diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..19c10e9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Ethan O'Brien + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 5183863..1c760c0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,189 @@ + +# EmulatorJS + +Self-hosted **Javascript** emulation for various system. + +
+ +*If something doesn't work, please consider opening an* ***[Issue]***
+*with as many details as possible, as well as the console log.* + +*The* ***Screen Recording*** *option currently doesn't support* ***Audio*** *.* + +--- + +**⸢ [Example Use] ⸥ ⸢ [Emulator Demo] ⸥ ⸢ [Beta] ⸥** + +--- + +## Supported Systems + +#### Nintendo + +**[Game Boy Advance][Nintendo Game Boy Advance]** | **[Famicom / NES][NES / Famicom]** | **[Virtual Boy][Virtual Boy]** | **[Game Boy][Nintendo Game Boy]** | **[SNES]** | **[DS][Nintendo DS]** | **[64][Nintendo 64]** + +#### Sega +**[Master System][Sega Master System]** | **[Mega Drive][Sega Mega Drive]** | **[Game Gear][Sega Game Gear]** | **[Saturn][Sega Saturn]** | **[32X][Sega 32X]** | **[CD][Sega CD]** + +#### Atari + +**[Jaguar][Atari Jaguar]** | **[Lynx][Atari Lynx]** | **[7800][Atari 7800]** | **[2600][Atari 2600]** + +#### Other + +**[TurboGrafs 16 PC Engine][TurboGrafs-16 / PC Engine]** | **[WanderSwan Color][WanderSwan / Color]** | **[Neo Geo Poket][Neo Geo Poket]** | **[PlayStation]** | **[Arcade]** | **[MSX]** | **[3DO]** + +--- + + +## Usage + +*For questions please use the* ***[Issue]*** *tab.* + +
+ +##### Setup + +1. Download this repository.
+ *`Code ➞ Download As Zip`* + +2. Use a **WebServer** to host the emulator. + +3. Use your **Browser** to navigate to `localhost` + +
+ +##### ROMs + +**ROMs** can be used as `zip` / `rar` / `7z` archives. + +
+ +##### Netplay + +By default **Netplay** is ***disabled***,
+to enable it, add the following: + +```js +// ID in your website, required for netplay. Each game in your site should have a different ID +EJS_gameID = 1; +``` + +
+ +*I have successfully rewrote the server side portion*
+*of netplay, which you can now use to self host!* + +1. Download the **[Server]**. + +2. Specify the servers address with: + +```js +EJS_netplayUrl = 'http://localhost:3000/'; // Absolute Url To Your Netplay Server +``` + +
+ +##### Custom Saves + +To customize the filename of save states
+simply add the following lines of code. + +```js +EJS_gameName = `Game Name`; +``` + +**➞ Save Filename:** `Game Name.state` + +
+ +##### AD + +To place an advertisement in front of the
+`play now` screen, include the following line: + +```js +EJS_AdUrl = `URL`; +``` + +
+ +##### Interface Color + +To use a different color for the emulator interface, use: + +```js +EJS_color = '#FF0000'; // Hex Color Code +``` + +
+ +##### Direct Start + +To start the emulator immediately, add this line: + +```js +EJS_startOnLoaded = true; +``` + +*For audio to play the user still*
+*needs to interact with the page.* + +
+ +##### Custom Paths + +Paths to emulator files can be customized with: + +```js +EJS_paths = { + 'fileName' : '/somepath', + 'emulator.js' : 'https://example.com/emulator.js', + 'n64-asmjs.data' : '/asdfds.data' +}; +``` + +*If a file is not defined, the default is used.* + +
+ +##### USING MAME SYSTEM + +you must add the line + +``` +EJS_core = 'mame'; +``` + +and the line + +``` +EJS_mameCore = '' // mame core options (example: '4|0') +``` +set the mame core value to the mame core number (`1` - `6`) + `|` + save states supported (`0` or `1`) + +
+ +# LICENSE + +Licenced under the Apache License 2.0 + +Read the whole license [here](LICENSE) + + + + +[Example Use]: https://coldcast.org/games/1/Super-Mario-Bros +[Emulator Demo]: https://ethanaobrien.github.io/emulatorjs/ +[Beta]: https://emulatorjs.netlify.app/ + +[Issue]: https://github.com/ethanaobrien/emulatorjs/issues +[This repository]: https://github.com/linuxserver/emulatorjs + +[EJS]: https://www.emulatorjs.com/ + +[Server]: https://github.com/ethanaobrien/emuserver/releases + [NES / Famicom]: docs/NES-Famicom.md [SNES]: docs/SNES.md [Nintendo 64]: docs/Nintendo%2064.md @@ -22,122 +208,3 @@ [TurboGrafs-16 / PC Engine]: docs/TurboGrafs%2016-PC%20Engine.md [Arcade]: docs/Arcade.md [Atari 2600]: docs/Atari%202600.md - - - -# emulatorjs - -A javascript emulator for nes, snes, and more! -The BEST emulator on the internet. No ads and self hosted! - -Example page: https://coldcast.org/games/1/Super-Mario-Bros - -

demo: https://ethanaobrien.github.io/emulatorjs/

- -BETA site: https://emulatorjs.netlify.app/ - -## Where did I get this? - -So I found this website called [emulatorjs](https://www.emulatorjs.com/) and I went into inspect and downloaded the resources. I removed the ad server, and made everything work within your own domain. -https://github.com/linuxserver/emulatorjs may soon make it possible to use all this open source - -The emulator is not illegal - the rom is - I am not responsible for what people decide to do with this software. - -NOTE: The screen recording option does not currently support audio! only video recording is supported at this time. - -## How To - -1. Download this repository (Code > Download as zip) then Extract the contents -2. Load into a web server and open localhost - -If you have questions, ask me and I will clarify (use the issues tab). Please search to make sure your isuue hasnt already been asked - -IF SOMETHING DOES NOT WORK - Please make an issue!! Include as many details as possible and please include a log of the console! - -All roms can be zipped into a `.zip`, `.rar`, or `.7z` archive - - -NETPLAY IS DISABLED BY DEFAULT. To enable, add this line to your code - -``` -EJS_gameID = 1; // ID in your website, required for netplay. -``` - - -## Supported systems! - -| Supported Systems | -|:------------------:| -| [NES / Famicom] | -| [SNES] | -| [Nintendo 64] | -| [Nintendo Game Boy] | -| [Nintendo Game Boy Advance] | -| [Nintendo DS] | -| [PlayStation] | -| [Virtual Boy] | -| [Sega Mega Drive] | -| [Sega Master System] | -| [Sega CD] | -| [Atari Lynx] | -| [MSX] | -| [3DO] | -| [Sega 32X] | -| [Atari Jaguar] | -| [Neo Geo Poket] | -| [Sega Game Gear] | -| [Sega Saturn] | -| [Atari 7800] | -| [WanderSwan / Color] | -| [TurboGrafs-16 / PC Engine] | -| [Arcade] | -| [Atari 2600] | - -## More Features - -To customize the filename of save states, add the line of code below - -``` -EJS_gameName = 'name of game'; -``` -When the user saves a state, the state will be saved with the name `name of game.state` - -
- -To add an ad to the play now screen, add the following line to your code - -``` -EJS_AdUrl = ''; //path to AD page -``` - -
- -To change the default color of the emulator interface, add the line below - -``` -EJS_color = ''; //hex color id -``` -You can set the color to a hex color code, for example `#FF0000` (red) - -
- -To start the emulator immediately, add this line to your code - -``` -EJS_startOnLoaded = true; -``` -This will start the emulator instantly -Please note, the Audio cannot start until the user interacts with the page - -
- -To specify an exact path for a file, add this line to your code - -``` -EJS_paths = { - "fileName": "/somepath", - "emulator.js": "https://example.com/emulator.js", - "n64-asmjs.data": "/asdfds.data" -} -``` -If a file is not defined, it be set to default diff --git a/data/32x-asmjs.data b/data/32x-asmjs.data deleted file mode 100644 index ec512c5..0000000 Binary files a/data/32x-asmjs.data and /dev/null differ diff --git a/data/32x-wasm.data b/data/32x-wasm.data deleted file mode 100644 index 34955b0..0000000 Binary files a/data/32x-wasm.data and /dev/null differ diff --git a/data/3do-asmjs.data b/data/3do-asmjs.data deleted file mode 100644 index 6f9f178..0000000 Binary files a/data/3do-asmjs.data and /dev/null differ diff --git a/data/a2600-asmjs.data b/data/a2600-asmjs.data deleted file mode 100644 index fbd90a2..0000000 Binary files a/data/a2600-asmjs.data and /dev/null differ diff --git a/data/a2600-wasm.data b/data/a2600-wasm.data deleted file mode 100644 index 912ddae..0000000 Binary files a/data/a2600-wasm.data and /dev/null differ diff --git a/data/a7800-asmjs.data b/data/a7800-asmjs.data deleted file mode 100644 index 8513e71..0000000 Binary files a/data/a7800-asmjs.data and /dev/null differ diff --git a/data/arcade-asmjs.data b/data/arcade-asmjs.data deleted file mode 100644 index 7001f2e..0000000 Binary files a/data/arcade-asmjs.data and /dev/null differ diff --git a/data/arcade-wasm.data b/data/arcade-wasm.data deleted file mode 100644 index eca7279..0000000 Binary files a/data/arcade-wasm.data and /dev/null differ diff --git a/data/bluemsx-asmjs.data b/data/bluemsx-asmjs.data deleted file mode 100644 index 82a7bb2..0000000 Binary files a/data/bluemsx-asmjs.data and /dev/null differ diff --git a/data/bluemsx-wasm.data b/data/bluemsx-wasm.data deleted file mode 100644 index 1f448ac..0000000 Binary files a/data/bluemsx-wasm.data and /dev/null differ diff --git a/data/emu-main.js b/data/emu-main.js new file mode 100644 index 0000000..debfb48 --- /dev/null +++ b/data/emu-main.js @@ -0,0 +1,6571 @@ +window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) { + 'use strict'; + window.EJS_RESET_VARS = []; + for (var k in window) { + window.EJS_RESET_VARS.push(k); + } + _0x2c1832.r(_0x17edbf); + _0x2c1832(0xa2), _0x2c1832(0x16c), _0x2c1832(0x16d); + var _0x39ca5e = { + 'volume': 0.5, + 'muted': false, + 'i18n': { + 'restart': 'Restart', + 'play': 'Play', + 'pause': 'Pause', + 'played': 'Played', + 'volume': 'Volume', + 'mute': 'Mute (F9)', + 'unmute': 'Unmute (F9)', + 'enterFullscreen': 'Enter fullscreen', + 'exitFullscreen': 'Exit fullscreen', + 'settings': 'Settings', + 'saveState': 'Save State (Shift + F2)', + 'loadState': 'Load State (Shift + F4)', + 'screenRecord': 'Start Screen Recording', + 'netplay': 'Netplay', + 'gamepad': 'Control Settings', + 'cheat': 'Cheats', + 'menuBack': 'Go back to previous menu', + 'normal': 'Normal', + 'all': 'All', + 'reset': 'Reset', + 'disabled': 'Disabled', + 'enabled': 'Enabled', + 'playNow': 'Play Now' + }, + 'listeners': { + 'play': null, + 'pause': null, + 'restart': null, + 'rewind': null, + 'mute': null, + 'volume': null, + 'fullscreen': null + }, + 'events': ['ready'], + 'selectors': { + 'editable': 'input, textarea, select, [contenteditable]', + 'container': '.ejs', + 'controls': { + 'container': null, + 'wrapper': '.jes__controls' + }, + 'buttons': { + 'play': '[data-btn="play"]', + 'pause': '[data-btn="pause"]', + 'mute': '[data-btn="mute"]', + 'fullscreen': '[data-btn="fullscreen"]', + 'settings': '[data-btn="settings"]', + 'saveState': '[data-btn="save-state"]', + 'loadState': '[data-btn="load-state"]', + 'screenRecord': '[data-btn="screen-record"]', + 'gamepad': '[data-btn="gamepad"]', + 'netplay': '[data-btn="netplay"]', + 'cheat': '[data-btn="cheat"]' + }, + 'inputs': { + 'volume': '[data-range="volume"]' + } + }, + 'classNames': { + 'type': 'ejs--video', + 'video': 'ejs__video-wrapper', + 'poster': 'ejs__poster', + 'posterEnabled': 'ejs__poster-enabled', + 'control': 'ejs__control', + 'controlPressed': 'ejs__control--pressed', + 'playing': 'ejs--playing', + 'paused': 'ejs--paused', + 'stopped': 'ejs--stopped', + 'loading': 'ejs--loading', + 'hover': 'ejs--hover', + 'tooltip': 'ejs__tooltip', + 'hidden': 'ejs__sr-only', + 'hideControls': 'ejs--hide-controls', + 'isIos': 'ejs--is-ios', + 'isTouch': 'ejs--is-touch', + 'uiSupported': 'ejs--full-ui', + 'noTransition': 'ejs--no-transition', + 'menu': { + 'value': 'ejs__menu__value', + 'badge': 'ejs__badge', + 'open': 'ejs--menu-open' + }, + 'fullscreen': { + 'enabled': 'ejs--fullscreen-enabled', + 'fallback': 'ejs--fullscreen-fallback' + }, + 'tabFocus': 'ejs__tab-focus' + } + }, + _0x3d61f9 = _0x2c1832(0x38), + _0x5127f4 = _0x2c1832(0x9d), + _0x48e5ff = _0x2c1832.n(_0x5127f4), + _0x406e79 = function(_0x2aa74f) { + return null != _0x2aa74f ? _0x2aa74f.constructor : null; + }, + _0x1b0c2c = function(_0x8ec039, _0x1cb5ff) { + return Boolean(_0x8ec039 && _0x1cb5ff && _0x8ec039 instanceof _0x1cb5ff); + }, + _0x19f739 = function(_0x3e8e1f) { + return null == _0x3e8e1f; + }, + _0x4fc5a1 = function(_0x37a418) { + return _0x406e79(_0x37a418) === Object; + }, + _0x34f3e8 = function(_0x2d2e5c) { + return _0x406e79(_0x2d2e5c) === String; + }, + _0x1ca546 = function(_0x4d698f) { + return Array.isArray(_0x4d698f); + }, + _0x37cc52 = function(_0x3a8b14) { + return _0x1b0c2c(_0x3a8b14, NodeList); + }, + _0x555ee8 = function(_0x1fde53) { + return _0x19f739(_0x1fde53) || (_0x34f3e8(_0x1fde53) || _0x1ca546(_0x1fde53) || _0x37cc52(_0x1fde53)) && !_0x1fde53.length || _0x4fc5a1(_0x1fde53) && !Object.keys(_0x1fde53).length; + }, + _0x1e2c68 = { + 'nullOrUndefined': _0x19f739, + 'object': _0x4fc5a1, + 'number': function(_0x1d08d4) { + return _0x406e79(_0x1d08d4) === Number && !Number.isNaN(_0x1d08d4); + }, + 'string': _0x34f3e8, + 'boolean': function(_0x340d71) { + return _0x406e79(_0x340d71) === Boolean; + }, + 'function': function(_0x10f562) { + return _0x406e79(_0x10f562) === Function; + }, + 'array': _0x1ca546, + 'weakMap': function(_0x70b79f) { + return _0x1b0c2c(_0x70b79f, WeakMap); + }, + 'nodeList': _0x37cc52, + 'element': function(_0xc21062) { + return _0x1b0c2c(_0xc21062, Element); + }, + 'textNode': function(_0x3e6b67) { + return _0x406e79(_0x3e6b67) === Text; + }, + 'event': function(_0x247601) { + return _0x1b0c2c(_0x247601, Event); + }, + 'keyboardEvent': function(_0x2b3224) { + return _0x1b0c2c(_0x2b3224, KeyboardEvent); + }, + 'cue': function(_0x57ee67) { + return _0x1b0c2c(_0x57ee67, window.TextTrackCue) || _0x1b0c2c(_0x57ee67, window.VTTCue); + }, + 'track': function(_0x23318b) { + return _0x1b0c2c(_0x23318b, TextTrack) || !_0x19f739(_0x23318b) && _0x34f3e8(_0x23318b.kind); + }, + 'url': function(_0xd61cf4) { + if (_0x1b0c2c(_0xd61cf4, window.URL)) return true; + var _0x17edbf = _0xd61cf4; + _0xd61cf4.startsWith('http://') && _0xd61cf4.startsWith('https://') || (_0x17edbf = 'http://' .concat(_0xd61cf4)); + try { + return !_0x555ee8(new URL(_0x17edbf).hostname); + } catch (_0x5e6cd2) { + return !0x1; + } + }, + 'empty': _0x555ee8 + }, + _0x168698 = function() { + var _0xa88a13 = !0x1; + try { + var _0x17edbf = Object.defineProperty({}, 'passive', { + 'get': function() { + return _0xa88a13 = true, null; + } + }); + window.addEventListener('test', null, _0x17edbf), window.removeEventListener('test', null, _0x17edbf); + } catch (_0x1db3b5) {} + return _0xa88a13; + }(); + + function _0x1ef215(_0xa482e6, _0x474854, _0xc30d6e) { + var _0x57056f = this, + _0x3f468e = arguments.length > 0x3 && void 0x0 !== arguments[0x3] && arguments[0x3], + _0x79ce58 = !(arguments.length > 0x4 && void 0x0 !== arguments[0x4]) || arguments[0x4], + _0x23848b = arguments.length > 0x5 && void 0x0 !== arguments[0x5] && arguments[0x5]; + if (_0xa482e6 && 'addEventListener' in _0xa482e6 && !_0x1e2c68.empty(_0x474854) && _0x1e2c68.function(_0xc30d6e)) { + var _0x4a2da0 = _0x474854.split(' '), + _0x40de8d = _0x23848b; + _0x168698 && (_0x40de8d = { + 'passive': _0x79ce58, + 'capture': _0x23848b + }), _0x4a2da0.forEach(function(_0x487d3c) { + _0x57056f && _0x57056f.eventListeners && _0x3f468e && _0x57056f.eventListeners.push({ + 'element': _0xa482e6, + 'type': _0x487d3c, + 'callback': _0xc30d6e, + 'options': _0x40de8d + }), _0xa482e6[_0x3f468e ? 'addEventListener' : 'removeEventListener'](_0x487d3c, _0xc30d6e, _0x40de8d); + }); + } + } + + function _0x1093f4(_0x4d8d94) { + var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', + _0x2c1832 = arguments.length > 0x2 ? arguments[0x2] : void 0x0, + _0x4adcdf = !(arguments.length > 0x3 && void 0x0 !== arguments[0x3]) || arguments[0x3], + _0x2f85bc = arguments.length > 0x4 && void 0x0 !== arguments[0x4] && arguments[0x4]; + _0x1ef215.call(this, _0x4d8d94, _0x17edbf, _0x2c1832, true, _0x4adcdf, _0x2f85bc); + } + + function _0x20109b(_0x550b1a) { + var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', + _0x2c1832 = arguments.length > 0x2 ? arguments[0x2] : void 0x0, + _0x5e10a2 = !(arguments.length > 0x3 && void 0x0 !== arguments[0x3]) || arguments[0x3], + _0x5c9512 = arguments.length > 0x4 && void 0x0 !== arguments[0x4] && arguments[0x4]; + _0x1ef215.call(this, _0x550b1a, _0x17edbf, _0x2c1832, !0x1, _0x5e10a2, _0x5c9512); + } + + function _0x455c85(_0x4e4b15) { + var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', + _0x2c1832 = arguments.length > 0x2 ? arguments[0x2] : void 0x0, + _0x2b8c91 = !(arguments.length > 0x3 && void 0x0 !== arguments[0x3]) || arguments[0x3], + _0x23e991 = arguments.length > 0x4 && void 0x0 !== arguments[0x4] && arguments[0x4]; + _0x1ef215.call(this, _0x4e4b15, _0x17edbf, function _0x5127f4() { + _0x20109b(_0x4e4b15, _0x17edbf, _0x5127f4, _0x2b8c91, _0x23e991); + for (var _0x1fe440 = arguments.length, _0x1d3219 = new Array(_0x1fe440), _0x54457c = 0x0; _0x54457c < _0x1fe440; _0x54457c++) _0x1d3219[_0x54457c] = arguments[_0x54457c]; + _0x2c1832.apply(this, _0x1d3219); + }, true, _0x2b8c91, _0x23e991); + } + + function _0xbae705(_0x975ccc) { + var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', + _0x2c1832 = arguments.length > 0x2 && void 0x0 !== arguments[0x2] && arguments[0x2], + _0x57297b = arguments.length > 0x3 && void 0x0 !== arguments[0x3] ? arguments[0x3] : {}; + if (_0x1e2c68.element(_0x975ccc) && !_0x1e2c68.empty(_0x17edbf)) { + var _0x4f631e = new CustomEvent(_0x17edbf, { + 'bubbles': _0x2c1832, + 'detail': Object.assign({}, _0x57297b, { + 'emulator': this + }) + }); + _0x975ccc.dispatchEvent(_0x4f631e); + } + } + var _0x55349e = _0x2c1832(0x9e), + _0x42870c = _0x2c1832.n(_0x55349e); + + function _0x30f85e(_0x3ed035, _0xd96db3) { + return function(_0x18bbf3) { + if (Array.isArray(_0x18bbf3)) return _0x18bbf3; + }(_0x3ed035) || function(_0x2bb2ab, _0x4993ee) { + var _0x2c1832 = [], + _0x629f39 = true, + _0xde5653 = !0x1, + _0x346a0d = void 0x0; + try { + for (var _0x57d79d, _0x557ef0 = _0x2bb2ab[Symbol.iterator](); !(_0x629f39 = (_0x57d79d = _0x557ef0.next()).done) && (_0x2c1832.push(_0x57d79d.value), !_0x4993ee || _0x2c1832.length !== _0x4993ee); _0x629f39 = true); + } catch (_0x54a546) { + _0xde5653 = true, _0x346a0d = _0x54a546; + } finally { + try { + _0x629f39 || null == _0x557ef0.return || _0x557ef0.return(); + } finally { + if (_0xde5653) throw _0x346a0d; + } + } + return _0x2c1832; + }(_0x3ed035, _0xd96db3) || function() { + throw new TypeError('Invalid attempt to destructure non-iterable instance'); + }(); + } + + function _0x580edd(_0x39eb34, _0x86c3db) { + var _0x2c1832 = _0x39eb34.length ? _0x39eb34 : [_0x39eb34]; + Array.from(_0x2c1832).reverse().forEach(function(_0x35fc48, _0x79e6bf) { + var _0x1510e4 = _0x79e6bf > 0x0 ? _0x86c3db.cloneNode(true) : _0x86c3db, + _0x247f26 = _0x35fc48.parentNode, + _0x3a5422 = _0x35fc48.nextSibling; + _0x1510e4.appendChild(_0x35fc48), _0x3a5422 ? _0x247f26.insertBefore(_0x1510e4, _0x3a5422) : _0x247f26.appendChild(_0x1510e4); + }); + } + + function _0x154f99(_0x5e4eb3, _0x1acdad) { + _0x1e2c68.element(_0x5e4eb3) && !_0x1e2c68.empty(_0x1acdad) && Object.entries(_0x1acdad).filter(function(_0x37e04b) { + var _0x1acdad = _0x30f85e(_0x37e04b, 0x2)[0x1]; + return !_0x1e2c68.nullOrUndefined(_0x1acdad); + }).forEach(function(_0x4993dd) { + var _0x2c1832 = _0x30f85e(_0x4993dd, 0x2), + _0x24704f = _0x2c1832[0x0], + _0x52ac21 = _0x2c1832[0x1]; + return _0x5e4eb3.setAttribute(_0x24704f, _0x52ac21); + }); + } + + function _0x428003(_0x1397c4, _0x1ec8c9, _0x1a02af) { + var _0xca6ad9 = document.createElement(_0x1397c4); + return _0x1e2c68.object(_0x1ec8c9) && _0x154f99(_0xca6ad9, _0x1ec8c9), _0x1e2c68.string(_0x1a02af) && (_0xca6ad9.innerText = _0x1a02af), _0xca6ad9; + } + + function _0x12a55d(_0x27d9d8) { + _0x1e2c68.nodeList(_0x27d9d8) || _0x1e2c68.array(_0x27d9d8) ? Array.from(_0x27d9d8).forEach(_0x12a55d) : _0x1e2c68.element(_0x27d9d8) && _0x1e2c68.element(_0x27d9d8.parentNode) && _0x27d9d8.parentNode.removeChild(_0x27d9d8); + } + + function _0xa949a8(_0x3bc809, _0x215e7f) { + if (!_0x1e2c68.string(_0x3bc809) || _0x1e2c68.empty(_0x3bc809)) return {}; + var _0x2c1832 = {}, + _0x3ab896 = _0x215e7f; + return _0x3bc809.split(',').forEach(function(_0x2b6c5b) { + var _0x215e7f = _0x2b6c5b.trim(), + _0x2b2f76 = _0x215e7f.replace('.', ''), + _0x499377 = _0x215e7f.replace(/[[\]]/g, '').split('='), + _0x1db3b8 = _0x499377[0x0], + _0x520bcf = _0x499377.length > 0x1 ? _0x499377[0x1].replace(/["']/g, '') : ''; + switch (_0x215e7f.charAt(0x0)) { + case '.': + _0x1e2c68.object(_0x3ab896) && _0x1e2c68.string(_0x3ab896.class) && (_0x3ab896.class += ' ' .concat(_0x2b2f76)), _0x2c1832.class = _0x2b2f76; + break; + case '#': + _0x2c1832.id = _0x215e7f.replace('#', ''); + break; + case '[': + _0x2c1832[_0x1db3b8] = _0x520bcf; + } + }), _0x2c1832; + } + + function _0x132da7(_0x275729, _0x511d6f) { + if (_0x1e2c68.element(_0x275729)) { + var _0x2c1832 = _0x511d6f; + _0x1e2c68.boolean(_0x2c1832) || (_0x2c1832 = !_0x275729.hidden), _0x2c1832 ? _0x275729.setAttribute('hidden', '') : _0x275729.removeAttribute('hidden'); + } + } + + function _0x3a8e2f(_0x2bf197, _0x46e2bb, _0x3b6b0b) { + if (_0x1e2c68.nodeList(_0x2bf197)) return Array.from(_0x2bf197).map(function(_0x543362) { + return _0x3a8e2f(_0x543362, _0x46e2bb, _0x3b6b0b); + }); + if (_0x1e2c68.element(_0x2bf197)) { + var _0x34f25e = 'toggle'; + return void 0x0 !== _0x3b6b0b && (_0x34f25e = _0x3b6b0b ? 'add' : 'remove'), _0x2bf197.classList[_0x34f25e](_0x46e2bb), _0x2bf197.classList.contains(_0x46e2bb); + } + return !0x1; + } + + function _0x350d73(_0x273517, _0x36ffc8) { + return _0x1e2c68.element(_0x273517) && _0x273517.classList.contains(_0x36ffc8); + } + + function _0x13f491(_0x11bf98, _0x674fa2) { + var _0x2c1832 = { + 'Element': Element + }; + return (_0x2c1832.matches || _0x2c1832.webkitMatchesSelector || _0x2c1832.mozMatchesSelector || _0x2c1832.msMatchesSelector || function() { + return Array.from(document.querySelectorAll(_0x674fa2)).includes(this); + }).call(_0x11bf98, _0x674fa2); + } + + function _0x23ffa1(_0x16eec8) { + return this.elements.container.querySelectorAll(_0x16eec8); + } + + function _0x530042(_0xbc0da2) { + return this.elements.container.querySelector(_0xbc0da2); + } + + function _0x5e0c7d() { + var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : null, + _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] && arguments[0x1]; + if (_0x1e2c68.element(_0xa88a13)) { + var _0x2c1832 = _0x23ffa1.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]'), + _0x1c6631 = _0x2c1832[0x0], + _0x52c9df = _0x2c1832[_0x2c1832.length - 0x1]; + _0x1ef215.call(this, this.elements.container, 'keydown', function(_0x1bba02) { + if ('Tab' === _0x1bba02.key && 0x9 === _0x1bba02.keyCode) { + var _0x17edbf = document.activeElement; + _0x17edbf !== _0x52c9df || _0x1bba02.shiftKey ? _0x17edbf === _0x1c6631 && _0x1bba02.shiftKey && (_0x52c9df.focus(), _0x1bba02.preventDefault()) : (_0x1c6631.focus(), _0x1bba02.preventDefault()); + } + }, _0x17edbf, !0x1); + } + } + + function _0x31cc23() { + var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : null, + _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] && arguments[0x1]; + _0x1e2c68.element(_0xa88a13) && (_0xa88a13.focus(), _0x17edbf && _0x3a8e2f(_0xa88a13, this.config.classNames.tabFocus)); + } + + function _0x449eac(_0x589e98) { + return _0x48e5ff.a.bind(_0x42870c.a)(_0x589e98); + } + var _0x32d193, _0x5f365a, _0x820caf, _0x5a2767 = (_0x32d193 = document.createElement('span'), _0x5f365a = { + 'WebkitTransition': 'webkitTransitionEnd', + 'MozTransition': 'transitionend', + 'OTransition': 'oTransitionEnd otransitionend', + 'transition': 'transitionend' + }, _0x820caf = Object.keys(_0x5f365a).find(function(_0x5bdb45) { + return void 0x0 !== _0x32d193.style[_0x5bdb45]; + }), !!_0x1e2c68.string(_0x820caf) && _0x5f365a[_0x820caf]); + + function _0x2b30e0(_0x1fb76b) { + setTimeout(function() { + try { + _0x132da7(_0x1fb76b, true), _0x1fb76b.offsetHeight, _0x132da7(_0x1fb76b, !0x1); + } catch (_0x517747) {} + }, 0x0); + } + var _0x296fa9, _0x59aa33 = { + 'isEdge': 'Netscape' === navigator.appName && navigator.appVersion.indexOf('Edge') > -0x1, + 'isIE': !!document.documentMode, + 'isWebkit': 'WebkitAppearance' in document.documentElement.style && !/Edge/ .test(navigator.userAgent), + 'isIPhone': /(iPhone|iPod)/gi .test(navigator.platform), + 'isIos': /(iPad|iPhone|iPod)/gi .test(navigator.platform), + 'info': function() { + var _0xa88a13 = /(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d\.apre]+)/ .exec(navigator.userAgent); + return { + 'name': _0xa88a13[0x1].toLowerCase(), + 'version': _0xa88a13[0x2] + }; + } + }, + _0x2d904a = { + 'rangeInput': (_0x296fa9 = document.createElement('input'), _0x296fa9.type = 'range', 'range' === _0x296fa9.type), + 'touch': 'ontouchstart' in document.documentElement, + 'transitions': !0x1 !== _0x5a2767, + 'reducedMotion': 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches, + 'webgl': function() { + var _0xa88a13 = { + 'DETECTED': !0x1 + }; + if (!_0xa88a13.DETECTED) { + var _0x17edbf = document.createElement('canvas'); + if (_0x17edbf && _0x17edbf.getContext) + for (var _0x2c1832 = ['webgl2', 'experimental-webgl2', 'webgl', 'experimental-webgl'], _0x44cd27 = 0x0, _0x12b7b8 = _0x2c1832.length; _0x44cd27 < _0x12b7b8; ++_0x44cd27) { + var _0x11cb40 = _0x2c1832[_0x44cd27], + _0x26b3b2 = _0x17edbf.getContext(_0x11cb40); + if (_0x26b3b2) { + _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); + var _0x40c8fc = _0x26b3b2.getExtension('WEBGL_debug_renderer_info'); + _0x40c8fc && (_0xa88a13.WEBGL_VENDOR = _0x26b3b2.getParameter(_0x40c8fc.UNMASKED_VENDOR_WEBGL), _0xa88a13.WEBGL_RENDERER = _0x26b3b2.getParameter(_0x40c8fc.UNMASKED_RENDERER_WEBGL)), _0xa88a13.DETECTED = true; + break; + } + } + } + return _0xa88a13; + }(), + 'wasm': 'undefined' != typeof WebAssembly && _0x1e2c68.object(WebAssembly), + 'audioContext': 'undefined' != typeof AudioContext + }; + + function _0x55cbbe(_0x43ca9d, _0x1fbf80, _0x332d13) { + return _0x1fbf80 in _0x43ca9d ? Object.defineProperty(_0x43ca9d, _0x1fbf80, { + 'value': _0x332d13, + 'enumerable': true, + 'configurable': true, + 'writable': true + }) : _0x43ca9d[_0x1fbf80] = _0x332d13, _0x43ca9d; + } + + function _0x344e81(_0xa095b0, _0x3d8795) { + return _0x3d8795.split('.').reduce(function(_0x1a1fcd, _0x5112cd) { + return _0x1a1fcd && _0x1a1fcd[_0x5112cd]; + }, _0xa095b0); + } + + function _0x5dc0c0() { + for (var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : {}, _0x17edbf = arguments.length, _0x2c1832 = new Array(_0x17edbf > 0x1 ? _0x17edbf - 0x1 : 0x0), _0x189546 = 0x1; _0x189546 < _0x17edbf; _0x189546++) _0x2c1832[_0x189546 - 0x1] = arguments[_0x189546]; + if (!_0x2c1832.length) return _0xa88a13; + var _0x279e54 = _0x2c1832.shift(); + return _0x1e2c68.object(_0x279e54) ? (Object.keys(_0x279e54).forEach(function(_0x53b45a) { + _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])); + }), _0x5dc0c0.apply(void 0x0, [_0xa88a13].concat(_0x2c1832))) : _0xa88a13; + } + + function _0x1a0e98() { + var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '', + _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', + _0x2c1832 = arguments.length > 0x2 && void 0x0 !== arguments[0x2] ? arguments[0x2] : ''; + return _0xa88a13.replace(new RegExp(_0x17edbf.toString().replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\x5c$1'), 'g'), _0x2c1832.toString()); + } + + function _0x9fdcea() { + var _0xa88a13 = (arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '').toString(); + return (_0xa88a13 = function() { + var _0xa88a13 = (arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '').toString(); + return _0xa88a13 = _0x1a0e98(_0xa88a13, '-', ' '), _0xa88a13 = _0x1a0e98(_0xa88a13, '_', ' '), _0x1a0e98(_0xa88a13 = function() { + return (arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '').toString().replace(/\w\S*/g, function(_0x5b5cba) { + return _0x5b5cba.charAt(0x0).toUpperCase() + _0x5b5cba.substr(0x1).toLowerCase(); + }); + }(_0xa88a13), ' ', ''); + }(_0xa88a13)).charAt(0x0).toLowerCase() + _0xa88a13.slice(0x1); + } + + function _0x419e30(_0x3614ce, _0x5196ee) { + return function(_0x38f65b) { + if (Array.isArray(_0x38f65b)) return _0x38f65b; + }(_0x3614ce) || function(_0x20a132, _0x481bd0) { + var _0x2c1832 = [], + _0x930e75 = true, + _0x40863e = !0x1, + _0xf7a5cf = void 0x0; + try { + for (var _0x9d4c5a, _0x2f59ed = _0x20a132[Symbol.iterator](); !(_0x930e75 = (_0x9d4c5a = _0x2f59ed.next()).done) && (_0x2c1832.push(_0x9d4c5a.value), !_0x481bd0 || _0x2c1832.length !== _0x481bd0); _0x930e75 = true); + } catch (_0x383181) { + _0x40863e = true, _0xf7a5cf = _0x383181; + } finally { + try { + _0x930e75 || null == _0x2f59ed.return || _0x2f59ed.return(); + } finally { + if (_0x40863e) throw _0xf7a5cf; + } + } + return _0x2c1832; + }(_0x3614ce, _0x5196ee) || function() { + throw new TypeError('Invalid attempt to destructure non-iterable instance'); + }(); + } + var _0xb9b2ff = { + 'get': function() { + var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '', + _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : {}; + if (_0x1e2c68.empty(_0xa88a13) || _0x1e2c68.empty(_0x17edbf)) return ''; + var _0x2c1832 = _0x344e81(_0x17edbf.i18n, _0xa88a13); + if (_0x1e2c68.empty(_0x2c1832)) return ''; + var _0x54bf45 = { + '{seektime}': _0x17edbf.seekTime, + '{title}': _0x17edbf.title + }; + return Object.entries(_0x54bf45).forEach(function(_0x34ee43) { + var _0x17edbf = _0x419e30(_0x34ee43, 0x2), + _0x473ebb = _0x17edbf[0x0], + _0x56ec0 = _0x17edbf[0x1]; + _0x2c1832 = _0x1a0e98(_0x2c1832, _0x473ebb, _0x56ec0); + }), _0x2c1832; + } + }; + + function _0x4c97b0(_0xb3d5fd, _0x2cda5d) { + for (var _0x2c1832 = 0x0; _0x2c1832 < _0x2cda5d.length; _0x2c1832++) { + var _0x3f3944 = _0x2cda5d[_0x2c1832]; + _0x3f3944.enumerable = _0x3f3944.enumerable || !0x1, _0x3f3944.configurable = true, 'value' in _0x3f3944 && (_0x3f3944.writable = true), Object.defineProperty(_0xb3d5fd, _0x3f3944.key, _0x3f3944); + } + } + var _0x2f61ba = function() { + function _0x566dbe(_0x3a7165, _0x3d2e3a) { + ! function(_0x48c5c0, _0x2b027d) { + if (!(_0x48c5c0 instanceof _0x2b027d)) throw new TypeError('Cannot call a class as a function'); + }(this, _0x566dbe), this.enabled = true, this.key = _0x3d2e3a; + } + var _0x17edbf, _0x2c1832, _0x4496fc; + return _0x17edbf = _0x566dbe, _0x4496fc = [{ + 'key': 'supported', + 'get': function() { + try { + return 'localStorage' in window && (window.localStorage.getItem('___test') || window.localStorage.setItem('___test', '___test'), true); + } catch (_0x42cafd) { + return !0x1; + } + } + }], (_0x2c1832 = [{ + 'key': 'get', + 'value': function(_0x4ed865) { + if (!_0x566dbe.supported || !this.enabled) return null; + var _0x2c1832 = window.localStorage.getItem(this.key); + if (_0x1e2c68.empty(_0x2c1832)) return null; + var _0x57ebf7 = JSON.parse(_0x2c1832); + return _0x1e2c68.string(_0x4ed865) && _0x4ed865.length ? _0x57ebf7[_0x4ed865] : _0x57ebf7; + } + }, { + 'key': 'set', + 'value': function(_0x443e7a) { + if (_0x566dbe.supported && this.enabled && _0x1e2c68.object(_0x443e7a)) { + var _0x2c1832 = this.get(); + _0x1e2c68.empty(_0x2c1832) && (_0x2c1832 = {}), _0x5dc0c0(_0x2c1832, _0x443e7a), window.localStorage.setItem(this.key, JSON.stringify(_0x2c1832)); + } + } + }]) && _0x4c97b0(_0x17edbf.prototype, _0x2c1832), _0x4496fc && _0x4c97b0(_0x17edbf, _0x4496fc), _0x566dbe; + }(); + var _0x13fb79, _0x569918 = _0x2c1832(0x6c), + _0x4e4ca6 = _0x2c1832.n(_0x569918), + _0x4ad1c6 = _0x2c1832(0x6), + _0x4704b1 = _0x2c1832(0x9f), + _0x3a58c8 = _0x2c1832.n(_0x4704b1), + _0x5032e6 = { + '2xScaleHQ.glslp': 'shaders = 1\n\nshader0 = "2xScaleHQ.glsl"\nfilter_linear0 = false\nscale_type_0 = source\n', + '4xScaleHQ.glslp': 'shaders = 1\n\nshader0 = "4xScaleHQ.glsl"\nfilter_linear0 = false\nscale_type_0 = source\n', + 'crt-easymode.glslp': 'shaders = 1\n\nshader0 = crt-easymode.glsl\nfilter_linear0 = false\nscale_type_0 = source\n', + 'crt-aperture.glslp': 'shaders = 1\n\nshader0 = crt-aperture.glsl\nfilter_linear0 = false\n', + 'crt-geom.glslp': 'shaders = 1\n\nshader0 = crt-geom.glsl\nfilter_linear0 = false\nscale_type_0 = source\n', + '2xScaleHQ.glsl': '/*\n2xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 dx = vec2(x, 0.0);\nvec2 dy = vec2(0.0, y);\nt1 = vec4(vTexCoord - dg1, vTexCoord - dy);\nt2 = vec4(vTexCoord - dg2, vTexCoord + dx);\nt3 = vec4(vTexCoord + dg1, vTexCoord + dy);\nt4 = vec4(vTexCoord + dg2, vTexCoord - dx);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 0.325; // start smoothing wt.\nfloat k = -0.250; // wt. decrease factor\nfloat max_w = 0.25; // max filter weight\nfloat min_w =-0.05; // min filter weight\nfloat lum_add = 0.25; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c00 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 c10 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 c20 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 c01 = COMPAT_TEXTURE(Source, t4.zw).xyz; \nvec3 c11 = COMPAT_TEXTURE(Source, vTexCoord).xyz; \nvec3 c21 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 c02 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 c12 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 c22 = COMPAT_TEXTURE(Source, t3.xy).xyz; \n\nfloat md1 = dot(abs(c00 - c22), dt);\nfloat md2 = dot(abs(c02 - c20), dt);\n\nfloat w1 = dot(abs(c22 - c11), dt) * md2;\nfloat w2 = dot(abs(c02 - c11), dt) * md1;\nfloat w3 = dot(abs(c00 - c11), dt) * md2;\nfloat w4 = dot(abs(c20 - c11), dt) * md1;\n\nfloat t1 = w1 + w3;\nfloat t2 = w2 + w4;\nfloat ww = max(t1, t2) + 0.0001;\n\nc11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww);\n\nfloat lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add);\nfloat lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add);\n\nw1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w);\nw2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w);\nw3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w);\nw4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w);\nFragColor = vec4(w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11, 1.0);\n} \n#endif\n', + '4xScaleHQ.glsl': '/*\n4xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 sd1 = dg1 * 0.5;\nvec2 sd2 = dg2 * 0.5;\nvec2 ddx = vec2(x, 0.0);\nvec2 ddy = vec2(0.0, y);\nt1 = vec4(vTexCoord - sd1, vTexCoord - ddy);\nt2 = vec4(vTexCoord - sd2, vTexCoord + ddx);\nt3 = vec4(vTexCoord + sd1, vTexCoord + ddy);\nt4 = vec4(vTexCoord + sd2, vTexCoord - ddx);\nt5 = vec4(vTexCoord - dg1, vTexCoord - dg2);\nt6 = vec4(vTexCoord + dg1, vTexCoord + dg2);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 1.0; // start smoothing wt.\nfloat k = -1.10; // wt. decrease factor\nfloat max_w = 0.75; // max filter weight\nfloat min_w = 0.03; // min filter weight\nfloat lum_add = 0.33; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c = COMPAT_TEXTURE(Source, vTexCoord).xyz;\nvec3 i1 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 i2 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 i3 = COMPAT_TEXTURE(Source, t3.xy).xyz; \nvec3 i4 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 o1 = COMPAT_TEXTURE(Source, t5.xy).xyz; \nvec3 o3 = COMPAT_TEXTURE(Source, t6.xy).xyz; \nvec3 o2 = COMPAT_TEXTURE(Source, t5.zw).xyz;\nvec3 o4 = COMPAT_TEXTURE(Source, t6.zw).xyz;\nvec3 s1 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 s2 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 s3 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 s4 = COMPAT_TEXTURE(Source, t4.zw).xyz; \n\nfloat ko1=dot(abs(o1-c),dt);\nfloat ko2=dot(abs(o2-c),dt);\nfloat ko3=dot(abs(o3-c),dt);\nfloat ko4=dot(abs(o4-c),dt);\n\nfloat k1=min(dot(abs(i1-i3),dt),max(ko1,ko3));\nfloat k2=min(dot(abs(i2-i4),dt),max(ko2,ko4));\n\nfloat w1 = k2; if(ko3= 130\n #define COMPAT_VARYING out\n #define COMPAT_ATTRIBUTE in\n #define COMPAT_TEXTURE texture\n #else\n #define COMPAT_VARYING varying\n #define COMPAT_ATTRIBUTE attribute\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _oPosition1;\n vec4 _r0005;\n COMPAT_ATTRIBUTE vec4 VertexCoord;\n COMPAT_ATTRIBUTE vec4 TexCoord;\n COMPAT_VARYING vec4 TEX0;\n \n uniform mat4 MVPMatrix;\n uniform int FrameDirection;\n uniform int FrameCount;\n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _oTex;\n _r0005 = VertexCoord.x*MVPMatrix[0];\n _r0005 = _r0005 + VertexCoord.y*MVPMatrix[1];\n _r0005 = _r0005 + VertexCoord.z*MVPMatrix[2];\n _r0005 = _r0005 + VertexCoord.w*MVPMatrix[3];\n _oPosition1 = _r0005;\n _oTex = TexCoord.xy;\n gl_Position = _r0005;\n TEX0.xy = TexCoord.xy;\n }\n #elif defined(FRAGMENT)\n \n #if __VERSION__ >= 130\n #define COMPAT_VARYING in\n #define COMPAT_TEXTURE texture\n out vec4 FragColor;\n #else\n #define COMPAT_VARYING varying\n #define FragColor gl_FragColor\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _ret_0;\n float _TMP30;\n float _TMP29;\n float _TMP28;\n float _TMP13;\n float _TMP32;\n float _TMP11;\n float _TMP10;\n float _TMP31;\n float _TMP9;\n float _TMP8;\n float _TMP15;\n float _TMP14;\n float _TMP33;\n vec4 _TMP34;\n vec4 _TMP27;\n vec4 _TMP25;\n vec4 _TMP23;\n vec4 _TMP21;\n vec4 _TMP26;\n vec4 _TMP24;\n vec4 _TMP22;\n vec4 _TMP20;\n float _TMP4;\n vec4 _TMP3;\n vec4 _TMP2;\n float _TMP19;\n float _TMP18;\n float _TMP17;\n float _TMP16;\n vec4 _TMP1;\n vec2 _TMP0;\n uniform sampler2D Texture;\n input_dummy _IN1;\n float _TMP43;\n float _x_step0044;\n float _curve0044;\n float _a0048;\n float _val0052;\n float _a0052;\n vec4 _TMP57;\n vec4 _x0072;\n vec2 _c0086;\n vec4 _x0088;\n vec4 _x0094;\n vec2 _c0098;\n vec4 _x0100;\n vec2 _c0104;\n vec4 _x0106;\n vec4 _sample_min0110;\n vec4 _sample_max0110;\n vec4 _r0112;\n vec4 _TMP117;\n vec2 _co0124;\n vec2 _c0126;\n vec4 _x0128;\n vec4 _x0134;\n vec2 _c0138;\n vec4 _x0140;\n vec2 _c0144;\n vec4 _x0146;\n vec4 _sample_min0150;\n vec4 _sample_max0150;\n vec4 _r0152;\n vec4 _TMP157;\n float _TMP163;\n float _x_step0164;\n float _curve0164;\n float _a0168;\n float _val0172;\n float _a0172;\n float _TMP183;\n float _TMP189;\n float _x0190;\n float _a0196;\n float _x0198;\n vec2 _x0200;\n float _x0208;\n COMPAT_VARYING vec4 TEX0;\n \n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _dx1;\n vec2 _dy;\n vec2 _pix_co;\n vec2 _tex_co;\n vec2 _dist;\n vec3 _col2;\n vec3 _col21;\n vec4 _coeffs1;\n float _luma;\n float _bright;\n float _scan_weight;\n vec2 _mod_fac;\n int _dot_no;\n vec3 _mask_weight;\n vec3 _TMP37;\n _dx1 = vec2(1.00000000E+00/TextureSize.x, 0.00000000E+00);\n _dy = vec2(0.00000000E+00, 1.00000000E+00/TextureSize.y);\n _pix_co = TEX0.xy*TextureSize - vec2( 5.00000000E-01, 5.00000000E-01);\n _TMP0 = floor(_pix_co);\n _tex_co = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/TextureSize;\n _dist = fract(_pix_co);\n _x_step0044 = float((_dist.x >= 5.00000000E-01));\n _a0048 = 2.50000000E-01 - (_dist.x - _x_step0044)*(_dist.x - _x_step0044);\n _TMP33 = inversesqrt(_a0048);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0052 = 5.00000000E-01 - _dist.x;\n _val0052 = float((_a0052 > 0.00000000E+00));\n _TMP15 = _val0052 - float((_a0052 < 0.00000000E+00));\n _curve0044 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP43 = _dist.x + 2.50000000E-01*(_curve0044 - _dist.x);\n _coeffs1 = 3.14159274E+00*vec4(1.00000000E+00 + _TMP43, _TMP43, 1.00000000E+00 - _TMP43, 2.00000000E+00 - _TMP43);\n _TMP1 = abs(_coeffs1);\n _TMP57 = max(_TMP1, vec4( 9.99999975E-06, 9.99999975E-06, 9.99999975E-06, 9.99999975E-06));\n _TMP16 = sin(_TMP57.x);\n _TMP17 = sin(_TMP57.y);\n _TMP18 = sin(_TMP57.z);\n _TMP19 = sin(_TMP57.w);\n _TMP2 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _x0072 = _TMP57/2.00000000E+00;\n _TMP16 = sin(_x0072.x);\n _TMP17 = sin(_x0072.y);\n _TMP18 = sin(_x0072.z);\n _TMP19 = sin(_x0072.w);\n _TMP3 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _coeffs1 = ((2.00000000E+00*_TMP2)*_TMP3)/(_TMP57*_TMP57);\n _TMP4 = dot(_coeffs1, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _coeffs1 = _coeffs1/_TMP4;\n _c0086 = _tex_co - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0086);\n _x0088 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0088;\n _TMP22 = COMPAT_TEXTURE(Texture, _tex_co);\n _x0094 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0094;\n _c0098 = _tex_co + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0098);\n _x0100 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0100;\n _c0104 = _tex_co + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0104);\n _x0106 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0106;\n _r0112 = _coeffs1.x*_TMP21;\n _r0112 = _r0112 + _coeffs1.y*_TMP23;\n _r0112 = _r0112 + _coeffs1.z*_TMP25;\n _r0112 = _r0112 + _coeffs1.w*_TMP27;\n _sample_min0110 = min(_TMP23, _TMP25);\n _sample_max0110 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0110, _r0112);\n _TMP117 = max(_sample_min0110, _TMP34);\n _co0124 = _tex_co + _dy;\n _c0126 = _co0124 - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0126);\n _x0128 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0128;\n _TMP22 = COMPAT_TEXTURE(Texture, _co0124);\n _x0134 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0134;\n _c0138 = _co0124 + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0138);\n _x0140 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0140;\n _c0144 = _co0124 + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0144);\n _x0146 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0146;\n _r0152 = _coeffs1.x*_TMP21;\n _r0152 = _r0152 + _coeffs1.y*_TMP23;\n _r0152 = _r0152 + _coeffs1.z*_TMP25;\n _r0152 = _r0152 + _coeffs1.w*_TMP27;\n _sample_min0150 = min(_TMP23, _TMP25);\n _sample_max0150 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0150, _r0152);\n _TMP157 = max(_sample_min0150, _TMP34);\n _x_step0164 = float((_dist.y >= 5.00000000E-01));\n _a0168 = 2.50000000E-01 - (_dist.y - _x_step0164)*(_dist.y - _x_step0164);\n _TMP33 = inversesqrt(_a0168);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0172 = 5.00000000E-01 - _dist.y;\n _val0172 = float((_a0172 > 0.00000000E+00));\n _TMP15 = _val0172 - float((_a0172 < 0.00000000E+00));\n _curve0164 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP163 = _dist.y + (_curve0164 - _dist.y);\n _col2 = _TMP117.xyz + _TMP163*(_TMP157.xyz - _TMP117.xyz);\n _luma = dot(vec3( 2.12599993E-01, 7.15200007E-01, 7.22000003E-02), _col2);\n _TMP8 = max(_col2.y, _col2.z);\n _TMP9 = max(_col2.x, _TMP8);\n _bright = (_TMP9 + _luma)/2.00000000E+00;\n _TMP31 = min(6.49999976E-01, _bright);\n _TMP183 = max(3.49999994E-01, _TMP31);\n _x0190 = _bright*1.50000000E+00;\n _TMP31 = min(1.50000000E+00, _x0190);\n _TMP189 = max(1.50000000E+00, _TMP31);\n _a0196 = TEX0.y*2.00000000E+00*3.14159274E+00*TextureSize.y;\n _TMP10 = cos(_a0196);\n _x0198 = _TMP10*5.00000000E-01 + 5.00000000E-01;\n _TMP11 = pow(_x0198, _TMP189);\n _scan_weight = 1.00000000E+00 - _TMP11;\n _x0200 = (TEX0.xy*OutputSize*TextureSize)/InputSize;\n _mod_fac = floor(_x0200);\n _x0208 = _mod_fac.x/3.00000000E+00;\n _TMP32 = floor(_x0208);\n _TMP13 = _mod_fac.x - 3.00000000E+00*_TMP32;\n _dot_no = int(_TMP13);\n if (_dot_no == 0) {\n _mask_weight = vec3( 1.00000000E+00, 6.99999988E-01, 6.99999988E-01);\n } else {\n if (_dot_no == 1) {\n _mask_weight = vec3( 6.99999988E-01, 1.00000000E+00, 6.99999988E-01);\n } else {\n _mask_weight = vec3( 6.99999988E-01, 6.99999988E-01, 1.00000000E+00);\n }\n }\n if (InputSize.y >= 4.00000000E+02) {\n _scan_weight = 1.00000000E+00;\n }\n _col21 = _col2.xyz;\n _col2 = _col2*vec3(_scan_weight, _scan_weight, _scan_weight);\n _col2 = _col2 + _TMP183*(_col21 - _col2);\n _col2 = _col2*_mask_weight;\n _TMP28 = pow(_col2.x, 5.55555582E-01);\n _TMP29 = pow(_col2.y, 5.55555582E-01);\n _TMP30 = pow(_col2.z, 5.55555582E-01);\n _col2 = vec3(_TMP28, _TMP29, _TMP30);\n _TMP37 = _col2*1.20000005E+00;\n _ret_0 = vec4(_TMP37.x, _TMP37.y, _TMP37.z, 1.00000000E+00);\n FragColor = _ret_0;\n return;\n }\n #endif\n', + 'crt-aperture.glsl': '\n/*\nCRT Shader by EasyMode\nLicense: GPL\n*/\n/*\n#pragma parameter SHARPNESS_IMAGE "Sharpness Image" 1.0 1.0 5.0 1.0\n#pragma parameter SHARPNESS_EDGES "Sharpness Edges" 3.0 1.0 5.0 1.0\n#pragma parameter GLOW_WIDTH "Glow Width" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HEIGHT "Glow Height" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HALATION "Glow Halation" 0.1 0.0 1.0 0.01\n#pragma parameter GLOW_DIFFUSION "Glow Diffusion" 0.05 0.0 1.0 0.01\n#pragma parameter MASK_COLORS "Mask Colors" 2.0 2.0 3.0 1.0\n#pragma parameter MASK_STRENGTH "Mask Strength" 0.3 0.0 1.0 0.05\n#pragma parameter MASK_SIZE "Mask Size" 1.0 1.0 9.0 1.0\n#pragma parameter SCANLINE_SIZE_MIN "Scanline Size Min." 0.5 0.5 1.5 0.05\n#pragma parameter SCANLINE_SIZE_MAX "Scanline Size Max." 1.5 0.5 1.5 0.05\n#pragma parameter GAMMA_INPUT "Gamma Input" 2.4 1.0 5.0 0.1\n#pragma parameter GAMMA_OUTPUT "Gamma Output" 2.4 1.0 5.0 0.1\n#pragma parameter BRIGHTNESS "Brightness" 1.5 0.0 2.0 0.05\n* */\n\n#define Coord TEX0\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define OUT out\n#define IN in\n#define tex2D texture\n#else\n#define OUT varying \n#define IN attribute \n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nIN vec4 VertexCoord;\nIN vec4 Color;\nIN vec2 TexCoord;\nOUT vec4 color;\nOUT vec2 Coord;\n\nuniform mat4 MVPMatrix;\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\ncolor = Color;\nCoord = TexCoord;\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define IN in\n#define tex2D texture\nout vec4 FragColor;\n#else\n#define IN varying\n#define FragColor gl_FragColor\n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nIN vec2 Coord;\n\n#ifdef PARAMETER_UNIFORM\nuniform PRECISION float SHARPNESS_IMAGE;\nuniform PRECISION float SHARPNESS_EDGES;\nuniform PRECISION float GLOW_WIDTH;\nuniform PRECISION float GLOW_HEIGHT;\nuniform PRECISION float GLOW_HALATION;\nuniform PRECISION float GLOW_DIFFUSION;\nuniform PRECISION float MASK_COLORS;\nuniform PRECISION float MASK_STRENGTH;\nuniform PRECISION float MASK_SIZE;\nuniform PRECISION float SCANLINE_SIZE_MIN;\nuniform PRECISION float SCANLINE_SIZE_MAX;\nuniform PRECISION float GAMMA_INPUT;\nuniform PRECISION float GAMMA_OUTPUT;\nuniform PRECISION float BRIGHTNESS;\n#else\n#define SHARPNESS_IMAGE 1.0\n#define SHARPNESS_EDGES 3.0\n#define GLOW_WIDTH 0.5\n#define GLOW_HEIGHT 0.5\n#define GLOW_HALATION 0.1\n#define GLOW_DIFFUSION 0.05\n#define MASK_COLORS 2.0\n#define MASK_STRENGTH 0.3\n#define MASK_SIZE 1.0\n#define SCANLINE_SIZE_MIN 0.5\n#define SCANLINE_SIZE_MAX 1.5\n#define GAMMA_INPUT 2.4\n#define GAMMA_OUTPUT 2.4\n#define BRIGHTNESS 1.5\n#endif\n\n#define FIX(c) max(abs(c), 1e-5)\n#define PI 3.141592653589\n#define saturate(c) clamp(c, 0.0, 1.0)\n#define TEX2D(c) pow(tex2D(tex, c).rgb, vec3(GAMMA_INPUT))\n\nmat3 get_color_matrix(sampler2D tex, vec2 co, vec2 dx)\n{\nreturn mat3(TEX2D(co - dx), TEX2D(co), TEX2D(co + dx));\n}\n\nvec3 blur(mat3 m, float dist, float rad)\n{\nvec3 x = vec3(dist - 1.0, dist, dist + 1.0) / rad;\nvec3 w = exp2(x * x * -1.0);\n\nreturn (m[0] * w.x + m[1] * w.y + m[2] * w.z) / (w.x + w.y + w.z);\n}\n\nvec3 filter_gaussian(sampler2D tex, vec2 co, vec2 tex_size)\n{\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 dy = vec2(0.0, 1.0 / tex_size.y);\nvec2 pix_co = co * tex_size;\nvec2 tex_co = (floor(pix_co) + 0.5) / tex_size;\nvec2 dist = (fract(pix_co) - 0.5) * -1.0;\n\nmat3 line0 = get_color_matrix(tex, tex_co - dy, dx);\nmat3 line1 = get_color_matrix(tex, tex_co, dx);\nmat3 line2 = get_color_matrix(tex, tex_co + dy, dx);\nmat3 column = mat3(blur(line0, dist.x, GLOW_WIDTH),\n blur(line1, dist.x, GLOW_WIDTH),\n blur(line2, dist.x, GLOW_WIDTH));\n\nreturn blur(column, dist.y, GLOW_HEIGHT);\n}\n\nvec3 filter_lanczos(sampler2D tex, vec2 co, vec2 tex_size, float sharp)\n{\ntex_size.x *= sharp;\n\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 pix_co = co * tex_size - vec2(0.5, 0.0);\nvec2 tex_co = (floor(pix_co) + vec2(0.5, 0.0)) / tex_size;\nvec2 dist = fract(pix_co);\nvec4 coef = PI * vec4(dist.x + 1.0, dist.x, dist.x - 1.0, dist.x - 2.0);\n\ncoef = FIX(coef);\ncoef = 2.0 * sin(coef) * sin(coef / 2.0) / (coef * coef);\ncoef /= dot(coef, vec4(1.0));\n\nvec4 col1 = vec4(TEX2D(tex_co), 1.0);\nvec4 col2 = vec4(TEX2D(tex_co + dx), 1.0);\n\nreturn (mat4(col1, col1, col2, col2) * coef).rgb;\n}\n\nvec3 get_scanline_weight(float x, vec3 col)\n{\nvec3 beam = mix(vec3(SCANLINE_SIZE_MIN), vec3(SCANLINE_SIZE_MAX), col);\nvec3 x_mul = 2.0 / beam;\nvec3 x_offset = x_mul * 0.5;\n\nreturn smoothstep(0.0, 1.0, 1.0 - abs(x * x_mul - x_offset)) * x_offset;\n}\n\nvec3 get_mask_weight(float x)\n{\nfloat i = mod(floor(x * OutputSize.x * TextureSize.x / (InputSize.x * MASK_SIZE)), MASK_COLORS);\n\nif (i == 0.0) return mix(vec3(1.0, 0.0, 1.0), vec3(1.0, 0.0, 0.0), MASK_COLORS - 2.0);\nelse if (i == 1.0) return vec3(0.0, 1.0, 0.0);\nelse return vec3(0.0, 0.0, 1.0);\n}\n\nvoid main()\n{\nvec3 col_glow = filter_gaussian(Texture, Coord, TextureSize);\nvec3 col_soft = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_IMAGE);\nvec3 col_sharp = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_EDGES);\nvec3 col = sqrt(col_sharp * col_soft);\n\ncol *= get_scanline_weight(fract(Coord.y * TextureSize.y), col_soft);\ncol_glow = saturate(col_glow - col);\ncol += col_glow * col_glow * GLOW_HALATION;\ncol = mix(col, col * get_mask_weight(Coord.x) * MASK_COLORS, MASK_STRENGTH);\ncol += col_glow * GLOW_DIFFUSION;\ncol = pow(col * BRIGHTNESS, vec3(1.0 / GAMMA_OUTPUT));\n\nFragColor = vec4(col, 1.0);\n}\n\n#endif\n', + 'crt-geom.glsl': '\n/*\nCRT-interlaced\n\nCopyright (C) 2010-2012 cgwg, Themaister and DOLLS\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2 of the License, or (at your option)\nany later version.\n\n(cgwg gave their consent to have the original version of this shader\ndistributed under the GPL in this message:\n\nhttp://board.byuu.org/viewtopic.php?p=26075#p26075\n\n"Feel free to distribute my shaders under the GPL. After all, the\nbarrel distortion code was taken from the Curvature shader, which is\nunder the GPL."\n)\nThis shader variant is pre-configured with screen curvature\n*/\n/*\n#pragma parameter CRTgamma "CRTGeom Target Gamma" 2.4 0.1 5.0 0.1\n#pragma parameter monitorgamma "CRTGeom Monitor Gamma" 2.2 0.1 5.0 0.1\n#pragma parameter d "CRTGeom Distance" 1.6 0.1 3.0 0.1\n#pragma parameter CURVATURE "CRTGeom Curvature Toggle" 1.0 0.0 1.0 1.0\n#pragma parameter R "CRTGeom Curvature Radius" 2.0 0.1 10.0 0.1\n#pragma parameter cornersize "CRTGeom Corner Size" 0.03 0.001 1.0 0.005\n#pragma parameter cornersmooth "CRTGeom Corner Smoothness" 1000.0 80.0 2000.0 100.0\n#pragma parameter x_tilt "CRTGeom Horizontal Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter y_tilt "CRTGeom Vertical Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter overscan_x "CRTGeom Horiz. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter overscan_y "CRTGeom Vert. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter DOTMASK "CRTGeom Dot Mask Toggle" 0.3 0.0 0.3 0.3\n#pragma parameter SHARPER "CRTGeom Sharpness" 1.0 1.0 3.0 1.0\n#pragma parameter scanline_weight "CRTGeom Scanline Weight" 0.3 0.1 0.5 0.05\n*/\n\n#ifndef PARAMETER_UNIFORM\n#define CRTgamma 2.4\n#define monitorgamma 2.2\n#define d 1.6\n#define CURVATURE 1.0\n#define R 2.0\n#define cornersize 0.03\n#define cornersmooth 1000.0\n#define x_tilt 0.0\n#define y_tilt 0.0\n#define overscan_x 100.0\n#define overscan_y 100.0\n#define DOTMASK 0.3\n#define SHARPER 1.0\n#define scanline_weight 0.3\n#endif\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\n#define FIX(c) max(abs(c), 1e-5);\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = R*acos(a);\nreturn uv*r/sin(r/R);\n}\n\nvec2 fwtrans(vec2 uv)\n{\nfloat r = FIX(sqrt(dot(uv,uv)));\nuv *= sin(r/R)/r;\nfloat x = 1.0-cos(r/R);\nfloat D = d/R + x*cosangle.x*cosangle.y+dot(uv,sinangle);\nreturn d*(uv*cosangle-x*sinangle)/D;\n}\n\nvec3 maxscale()\n{\nvec2 c = bkwtrans(-R * sinangle / (1.0 + R/d*cosangle.x*cosangle.y));\nvec2 a = vec2(0.5,0.5)*aspect;\nvec2 lo = vec2(fwtrans(vec2(-a.x,c.y)).x, fwtrans(vec2(c.x,-a.y)).y)/aspect;\nvec2 hi = vec2(fwtrans(vec2(+a.x,c.y)).x, fwtrans(vec2(c.x,+a.y)).y)/aspect;\nreturn vec3((hi+lo)*aspect*0.5,max(hi.x-lo.x,hi.y-lo.y));\n}\n\nvoid main()\n{\n// START of parameters\n\n// gamma of simulated CRT\n// CRTgamma = 1.8;\n// gamma of display monitor (typically 2.2 is correct)\n// monitorgamma = 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// d = 2.0;\n// radius of curvature\n// R = 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// cornersize = 0.03;\n// border smoothness parameter\n// decrease if borders are too aliased\n// cornersmooth = 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' + }, + _0x5bb4c9 = _0x2c1832(0x39), + _0x50f370 = _0x2c1832.n(_0x5bb4c9), + _0x246d02 = _0x2c1832(0xb), + _0x550f17 = _0x2c1832.n(_0x246d02), + _0x5ab74d = { + 'addStyleHook': function() { + _0x3a8e2f(this.elements.container, this.config.selectors.container.replace('.', ''), true), _0x3a8e2f(this.elements.container, this.config.classNames.uiSupported, true), _0x3a8e2f(this.elements.container, this.config.classNames.hideControls, true); + }, + 'build': function() { + 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; + }, + 'toggleControls': function(_0x4dbb7a) { + var _0x17edbf = this.elements.controls; + if (_0x17edbf) { + var _0x2c1832 = 0x0, + _0x4b4cd5 = _0x23ffa1.call(this, '.' .concat(_0x449eac({ + 'ejs__dialogs': true + }), ' > .').concat(_0x449eac({ + 'ejs__dialog': true + }))); + Array.from(_0x4b4cd5).forEach(function(_0x208a40, _0xd7fcf0) { + true !== _0x208a40.hidden && (_0x2c1832 += 0x1); + }), _0x2c1832 > 0x0 ? this.toggleControls(!0x1) : this.toggleControls(Boolean(_0x4dbb7a || this.paused || _0x17edbf.pressed || _0x17edbf.hover)); + } + } + }; + + function _0x5272a8(_0x4d422a) { + return (_0x5272a8 = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function(_0x241239) { + return typeof _0x241239; + } : function(_0x39f252) { + return _0x39f252 && 'function' == typeof Symbol && _0x39f252.constructor === Symbol && _0x39f252 !== Symbol.prototype ? 'symbol' : typeof _0x39f252; + })(_0x4d422a); + } + + function _0x3189ba(_0x4380c5, _0x3c0d58) { + if ('object' === _0x5272a8(_0x4380c5) && _0x4380c5.files && (_0x4380c5 = _0x4380c5.files[0x0]), this.littleEndian = !0x1, this.offset = 0x0, this._lastRead = null, 'object' === _0x5272a8(_0x4380c5) && _0x4380c5.name && _0x4380c5.size) { + if ('function' != typeof window.FileReader) throw new Error('Incompatible Browser'); + 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() { + this.marcFile._u8array = new Uint8Array(this.result), this.marcFile._dataView = new DataView(this.result), _0x3c0d58 && _0x3c0d58.call(); + }, !0x1), this._fileReader.readAsArrayBuffer(_0x4380c5); + } else if ('object' === _0x5272a8(_0x4380c5) && 'string' == typeof _0x4380c5.fileName && 'boolean' == typeof _0x4380c5.littleEndian) { + this.fileName = _0x4380c5.fileName, this.fileType = _0x4380c5.fileType, this.fileSize = _0x4380c5.fileSize; + var _0x2c1832 = new ArrayBuffer(_0x4380c5); + this._u8array = new Uint8Array(this.fileType), this._dataView = new DataView(this.fileType), _0x4380c5.copyToFile(this, 0x0), _0x3c0d58 && _0x3c0d58.call(); + } else if ('object' === _0x5272a8(_0x4380c5) && 'number' == typeof _0x4380c5.byteLength) this.fileName = 'file.bin', this.fileType = 'application/octet-stream', this.fileSize = _0x4380c5.byteLength, void 0x0 !== _0x4380c5.buffer && (_0x4380c5 = _0x4380c5.buffer), this._u8array = new Uint8Array(_0x4380c5), this._dataView = new DataView(_0x4380c5), _0x3c0d58 && _0x3c0d58.call(); + else { + if ('number' != typeof _0x4380c5) throw new Error('Invalid source'); + this.fileName = 'file.bin', this.fileType = 'application/octet-stream', this.fileSize = _0x4380c5; + _0x2c1832 = new ArrayBuffer(_0x4380c5); + this._u8array = new Uint8Array(_0x2c1832), this._dataView = new DataView(_0x2c1832), _0x3c0d58 && _0x3c0d58.call(); + } + } + _0x3189ba.IS_MACHINE_LITTLE_ENDIAN = (_0x13fb79 = new ArrayBuffer(0x2), new DataView(_0x13fb79).setInt16(0x0, 0x100, true), 0x100 === new Int16Array(_0x13fb79)[0x0]), _0x3189ba.prototype.seek = function(_0x13e235) { + this.offset = _0x13e235; + }, _0x3189ba.prototype.skip = function(_0xfa033c) { + this.offset += _0xfa033c; + }, _0x3189ba.prototype.isEOF = function() { + return !(this.offset < this.fileSize); + }, _0x3189ba.prototype.slice = function(_0x2bfcbb, _0x8026e) { + var _0x2c1832; + return _0x8026e = _0x8026e || this.fileSize - _0x2bfcbb, void 0x0 !== this._u8array.buffer.slice ? ((_0x2c1832 = new _0x3189ba(0x0)).fileSize = _0x8026e, _0x2c1832._u8array = new Uint8Array(this._u8array.buffer.slice(_0x2bfcbb, _0x2bfcbb + _0x8026e))) : (_0x2c1832 = new _0x3189ba(_0x8026e), this.copyToFile(_0x2c1832, _0x2bfcbb, _0x8026e, 0x0)), _0x2c1832.fileName = this.fileName, _0x2c1832.fileType = this.fileType, _0x2c1832.littleEndian = this.littleEndian, _0x2c1832; + }, _0x3189ba.prototype.copyToFile = function(_0x51f9b5, _0x1ada3e, _0x3997cd, _0x38ae1a) { + void 0x0 === _0x38ae1a && (_0x38ae1a = _0x1ada3e), _0x3997cd = _0x3997cd || this.fileSize - _0x1ada3e; + for (var _0x3bc3d8 = 0x0; _0x3bc3d8 < _0x3997cd; _0x3bc3d8++) _0x51f9b5._u8array[_0x38ae1a + _0x3bc3d8] = this._u8array[_0x1ada3e + _0x3bc3d8]; + }, _0x3189ba.prototype.save = function() { + var _0xa88a13; + try { + _0xa88a13 = new Blob([this._u8array], { + 'type': this.fileType + }); + } catch (_0x1dfb06) { + if (window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, 'InvalidStateError' !== _0x1dfb06.name || !window.BlobBuilder) throw new Error('Incompatible Browser'); + var _0x17edbf = new BlobBuilder(); + _0x17edbf.append(this._u8array.buffer), _0xa88a13 = _0x17edbf.getBlob(this.fileType); + } + saveAs(_0xa88a13, this.fileName); + }, _0x3189ba.prototype.readU8 = function() { + return this._lastRead = this._u8array[this.offset], this.offset++, this._lastRead; + }, _0x3189ba.prototype.readU16 = function() { + return this.littleEndian ? this._lastRead = this._u8array[this.offset] + (this._u8array[this.offset + 0x1] << 0x8) : this._lastRead = (this._u8array[this.offset] << 0x8) + this._u8array[this.offset + 0x1], this.offset += 0x2, this._lastRead >>> 0x0; + }, _0x3189ba.prototype.readU24 = function() { + return this.littleEndian ? this._lastRead = this._u8array[this.offset] + (this._u8array[this.offset + 0x1] << 0x8) + (this._u8array[this.offset + 0x2] << 0x10) : this._lastRead = (this._u8array[this.offset] << 0x10) + (this._u8array[this.offset + 0x1] << 0x8) + this._u8array[this.offset + 0x2], this.offset += 0x3, this._lastRead >>> 0x0; + }, _0x3189ba.prototype.readU32 = function() { + return this.littleEndian ? this._lastRead = this._u8array[this.offset] + (this._u8array[this.offset + 0x1] << 0x8) + (this._u8array[this.offset + 0x2] << 0x10) + (this._u8array[this.offset + 0x3] << 0x18) : this._lastRead = (this._u8array[this.offset] << 0x18) + (this._u8array[this.offset + 0x1] << 0x10) + (this._u8array[this.offset + 0x2] << 0x8) + this._u8array[this.offset + 0x3], this.offset += 0x4, this._lastRead >>> 0x0; + }, _0x3189ba.prototype.readBytes = function(_0x455cfd) { + this._lastRead = new Array(_0x455cfd); + for (var _0x17edbf = 0x0; _0x17edbf < _0x455cfd; _0x17edbf++) this._lastRead[_0x17edbf] = this._u8array[this.offset + _0x17edbf]; + return this.offset += _0x455cfd, this._lastRead; + }, _0x3189ba.prototype.readString = function(_0x4fe914) { + this._lastRead = ''; + for (var _0x17edbf = 0x0; _0x17edbf < _0x4fe914 && this.offset + _0x17edbf < this.fileSize && this._u8array[this.offset + _0x17edbf] > 0x0; _0x17edbf++) this._lastRead = this._lastRead + String.fromCharCode(this._u8array[this.offset + _0x17edbf]); + return this.offset += _0x4fe914, this._lastRead; + }, _0x3189ba.prototype.writeU8 = function(_0x276206) { + this._u8array[this.offset] = _0x276206, this.offset++; + }, _0x3189ba.prototype.writeU16 = function(_0x1bfd8f) { + this.littleEndian ? (this._u8array[this.offset] = 0xff & _0x1bfd8f, this._u8array[this.offset + 0x1] = _0x1bfd8f >> 0x8) : (this._u8array[this.offset] = _0x1bfd8f >> 0x8, this._u8array[this.offset + 0x1] = 0xff & _0x1bfd8f), this.offset += 0x2; + }, _0x3189ba.prototype.writeU24 = function(_0x3d6067) { + this.littleEndian ? (this._u8array[this.offset] = 0xff & _0x3d6067, this._u8array[this.offset + 0x1] = (0xff00 & _0x3d6067) >> 0x8, this._u8array[this.offset + 0x2] = (0xff0000 & _0x3d6067) >> 0x10) : (this._u8array[this.offset] = (0xff0000 & _0x3d6067) >> 0x10, this._u8array[this.offset + 0x1] = (0xff00 & _0x3d6067) >> 0x8, this._u8array[this.offset + 0x2] = 0xff & _0x3d6067), this.offset += 0x3; + }, _0x3189ba.prototype.writeU32 = function(_0xa4dd26) { + this.littleEndian ? (this._u8array[this.offset] = 0xff & _0xa4dd26, this._u8array[this.offset + 0x1] = (0xff00 & _0xa4dd26) >> 0x8, this._u8array[this.offset + 0x2] = (0xff0000 & _0xa4dd26) >> 0x10, this._u8array[this.offset + 0x3] = (0xff000000 & _0xa4dd26) >> 0x18) : (this._u8array[this.offset] = (0xff000000 & _0xa4dd26) >> 0x18, this._u8array[this.offset + 0x1] = (0xff0000 & _0xa4dd26) >> 0x10, this._u8array[this.offset + 0x2] = (0xff00 & _0xa4dd26) >> 0x8, this._u8array[this.offset + 0x3] = 0xff & _0xa4dd26), this.offset += 0x4; + }, _0x3189ba.prototype.writeBytes = function(_0x5ad6b9) { + for (var _0x17edbf = 0x0; _0x17edbf < _0x5ad6b9.length; _0x17edbf++) this._u8array[this.offset + _0x17edbf] = _0x5ad6b9[_0x17edbf]; + this.offset += _0x5ad6b9.length; + }, _0x3189ba.prototype.writeString = function(_0x58c146, _0x23e582) { + _0x23e582 = _0x23e582 || _0x58c146.length; + for (var _0x2c1832 = 0x0; _0x2c1832 < _0x58c146.length && _0x2c1832 < _0x23e582; _0x2c1832++) this._u8array[this.offset + _0x2c1832] = _0x58c146.charCodeAt(_0x2c1832); + for (; _0x2c1832 < _0x23e582; _0x2c1832++) this._u8array[this.offset + _0x2c1832] = 0x0; + this.offset += _0x23e582; + }; + var _0x863031 = _0x3189ba, + _0x34e7cf = 0x0; + + function _0x454881() { + this.records = [], this.truncate = !0x1; + } + + function _0x288092(_0x1ab789) { + var _0x17edbf = new _0x454881(); + _0x1ab789.seek(0x5); + for (var _0x2c1832 = 0x0, _0x195f00 = 0x0; !_0x1ab789.isEOF();) { + if (0x454f46 === (_0x2c1832 = _0x1ab789.readU24())) { + if (_0x1ab789.isEOF()) break; + if (_0x1ab789.offset + 0x3 === _0x1ab789.fileSize) { + _0x17edbf.truncate = _0x1ab789.readU24(); + break; + } + }(_0x195f00 = _0x1ab789.readU16()) === _0x34e7cf ? _0x17edbf.addRLERecord(_0x2c1832, _0x1ab789.readU16(), _0x1ab789.readU8()) : _0x17edbf.addSimpleRecord(_0x2c1832, _0x1ab789.readBytes(_0x195f00)); + } + return _0x17edbf; + } + _0x454881.prototype.addSimpleRecord = function(_0x37166f, _0x2e61e0) { + this.records.push({ + 'offset': _0x37166f, + 'type': 0x1, + 'length': _0x2e61e0.length, + 'data': _0x2e61e0 + }); + }, _0x454881.prototype.addRLERecord = function(_0x4ae2fb, _0x507845, _0x92bb02) { + this.records.push({ + 'offset': _0x4ae2fb, + 'type': _0x34e7cf, + 'length': _0x507845, + 'byte': _0x92bb02 + }); + }, _0x454881.prototype.toString = function() { + nSimpleRecords = 0x0, nRLERecords = 0x0; + for (var _0xa88a13 = 0x0; _0xa88a13 < this.records.length; _0xa88a13++) this.records[_0xa88a13].type === _0x34e7cf ? nRLERecords++ : nSimpleRecords++; + var _0x17edbf = 'Simple records: ' + nSimpleRecords; + return _0x17edbf += '\nRLE records: ' + nRLERecords, _0x17edbf += '\nTotal records: ' + this.records.length, this.truncate && (_0x17edbf += '\nTruncate at: 0x' + this.truncate.toString(0x10)), _0x17edbf; + }, _0x454881.prototype.export = function(_0x4d18dc) { + for (var _0x17edbf = 0x5, _0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) this.records[_0x2c1832].type === _0x34e7cf ? _0x17edbf += 0x8 : _0x17edbf += 0x5 + this.records[_0x2c1832].data.length; + _0x17edbf += 0x3, this.truncate && (_0x17edbf += 0x3), tempFile = new _0x863031(_0x17edbf), tempFile.fileName = _0x4d18dc + '.ips', tempFile.writeString('PATCH'); + for (_0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) { + var _0x512785 = this.records[_0x2c1832]; + tempFile.writeU24(_0x512785.offset), _0x512785.type === _0x34e7cf ? (tempFile.writeU16(0x0), tempFile.writeU16(_0x512785.length), tempFile.writeU8(_0x512785.byte)) : (tempFile.writeU16(_0x512785.data.length), tempFile.writeBytes(_0x512785.data)); + } + return tempFile.writeString('EOF'), _0x512785.truncate && tempFile.writeU24(_0x512785.truncate), tempFile; + }, _0x454881.prototype.apply = function(_0xefa71d) { + var _0x17edbf; + if (this.truncate) _0x17edbf = _0xefa71d.slice(0x0, this.truncate); + else { + for (var _0x2c1832 = _0xefa71d.fileSize, _0x5a0a71 = 0x0; _0x5a0a71 < this.records.length; _0x5a0a71++) { + var _0x105576 = this.records[_0x5a0a71]; + _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); + } + _0x2c1832 === _0xefa71d.fileSize ? _0x17edbf = _0xefa71d.slice(0x0, _0xefa71d.fileSize) : (_0x17edbf = new _0x863031(_0x2c1832), _0xefa71d.copyToFile(_0x17edbf, 0x0)); + } + _0xefa71d.seek(0x0); + for (_0x5a0a71 = 0x0; _0x5a0a71 < this.records.length; _0x5a0a71++) + if (_0x17edbf.seek(this.records[_0x5a0a71].offset), this.records[_0x5a0a71].type === _0x34e7cf) + for (var _0x729105 = 0x0; _0x729105 < this.records[_0x5a0a71].length; _0x729105++) _0x17edbf.writeU8(this.records[_0x5a0a71].byte); + else _0x17edbf.writeBytes(this.records[_0x5a0a71].data); + return _0x17edbf; + }; + '0123456789abcdef' .split(''); + var _0x1aa7ba = function() { + for (var _0xa88a13, _0x17edbf = [], _0x2c1832 = 0x0; _0x2c1832 < 0x100; _0x2c1832++) { + _0xa88a13 = _0x2c1832; + for (var _0x32bcf1 = 0x0; _0x32bcf1 < 0x8; _0x32bcf1++) _0xa88a13 = 0x1 & _0xa88a13 ? 0xedb88320 ^ _0xa88a13 >>> 0x1 : _0xa88a13 >>> 0x1; + _0x17edbf[_0x2c1832] = _0xa88a13; + } + return _0x17edbf; + }(); + + function _0x2d78e9(_0x509ecf, _0x4219e1, _0xd66d2b) { + for (var _0x185f93 = _0x4219e1 ? new Uint8Array(_0x509ecf._u8array.buffer, _0x4219e1) : _0x509ecf._u8array, _0x20e2c1 = -0x1, _0x3d100a = _0xd66d2b ? _0x185f93.length - 0x4 : _0x185f93.length, _0x56a6e6 = 0x0; _0x56a6e6 < _0x3d100a; _0x56a6e6++) _0x20e2c1 = _0x20e2c1 >>> 0x8 ^ _0x1aa7ba[0xff & (_0x20e2c1 ^ _0x185f93[_0x56a6e6])]; + return (-0x1 ^ _0x20e2c1) >>> 0x0; + } + var _0x37eff4 = 0x0, + _0x34d681 = 0x1, + _0x4c50e7 = 0x2, + _0xf9eeea = 0x3; + + function _0x5b02d3() { + this.sourceSize = 0x0, this.targetSize = 0x0, this.metaData = '', this.actions = [], this.sourceChecksum = 0x0, this.targetChecksum = 0x0, this.patchChecksum = 0x0; + } + + function _0x356089(_0x1bf770) { + _0x1bf770.readVLV = _0x45da2c, _0x1bf770.littleEndian = true; + var _0x17edbf = new _0x5b02d3(); + _0x1bf770.seek(0x4), _0x17edbf.sourceSize = _0x1bf770.readVLV(), _0x17edbf.targetSize = _0x1bf770.readVLV(); + var _0x2c1832 = _0x1bf770.readVLV(); + _0x2c1832 && (_0x17edbf.metaData = _0x1bf770.readString(_0x2c1832)); + for (var _0x157bba = _0x1bf770.fileSize - 0xc; _0x1bf770.offset < _0x157bba;) { + var _0x31dcc2 = _0x1bf770.readVLV(), + _0x21bafe = { + 'type': 0x3 & _0x31dcc2, + 'length': 0x1 + (_0x31dcc2 >> 0x2) + }; + if (_0x21bafe.type === _0x34d681) _0x21bafe.bytes = _0x1bf770.readBytes(_0x21bafe.length); + else if (_0x21bafe.type === _0x4c50e7 || _0x21bafe.type === _0xf9eeea) { + var _0x4c6327 = _0x1bf770.readVLV(); + _0x21bafe.relativeOffset = (0x1 & _0x4c6327 ? -0x1 : 0x1) * (_0x4c6327 >> 0x1); + } + _0x17edbf.actions.push(_0x21bafe); + } + if (_0x17edbf.sourceChecksum = _0x1bf770.readU32(), _0x17edbf.targetChecksum = _0x1bf770.readU32(), _0x17edbf.patchChecksum = _0x1bf770.readU32(), _0x17edbf.patchChecksum !== _0x2d78e9(_0x1bf770, 0x0, true)) throw new Error('error_crc_patch'); + return _0x17edbf; + } + + function _0x45da2c() { + for (var _0xa88a13 = 0x0, _0x17edbf = 0x1;;) { + var _0x2c1832 = this.readU8(); + if (_0xa88a13 += (0x7f & _0x2c1832) * _0x17edbf, 0x80 & _0x2c1832) break; + _0xa88a13 += _0x17edbf <<= 0x7; + } + return this._lastRead = _0xa88a13, _0xa88a13; + } + + function _0x152a53(_0x33f58d) { + for (;;) { + var _0x17edbf = 0x7f & _0x33f58d; + if (0x0 === (_0x33f58d >>= 0x7)) { + this.writeU8(0x80 | _0x17edbf); + break; + } + this.writeU8(_0x17edbf), _0x33f58d--; + } + } + + function _0x5a4975(_0x221175) { + for (var _0x17edbf = 0x0;;) { + if (0x0 === (_0x221175 >>= 0x7)) { + _0x17edbf++; + break; + } + _0x17edbf++, _0x221175--; + } + return _0x17edbf; + } + + function _0x562e68() { + this.offset = 0x0, this.next = null; + } + _0x5b02d3.prototype.toString = function() { + var _0xa88a13 = 'Source size: ' + this.sourceSize; + return _0xa88a13 += '\nTarget size: ' + this.targetSize, _0xa88a13 += '\nMetadata: ' + this.metaData, _0xa88a13 += '\n#Actions: ' + this.actions.length; + }, _0x5b02d3.prototype.validateSource = function(_0x48d2df, _0x3c15dd) { + return this.sourceChecksum === _0x2d78e9(_0x48d2df, _0x3c15dd); + }, _0x5b02d3.prototype.apply = function(_0x393f39, _0x76e509) { + if (_0x76e509 && !this.validateSource(_0x393f39)) throw new Error('error_crc_input'); + for (var _0x2c1832 = new _0x863031(this.targetSize), _0x4df6ae = 0x0, _0xad0fa9 = 0x0, _0x38240a = 0x0; _0x38240a < this.actions.length; _0x38240a++) { + var _0x4b1026 = this.actions[_0x38240a]; + if (_0x4b1026.type === _0x37eff4) _0x393f39.copyToFile(_0x2c1832, _0x2c1832.offset, _0x4b1026.length), _0x2c1832.skip(_0x4b1026.length); + else if (_0x4b1026.type === _0x34d681) _0x2c1832.writeBytes(_0x4b1026.bytes); + else if (_0x4b1026.type === _0x4c50e7) { + _0x4df6ae += _0x4b1026.relativeOffset; + for (var _0x5c2263 = _0x4b1026.length; _0x5c2263--;) _0x2c1832.writeU8(_0x393f39._u8array[_0x4df6ae]), _0x4df6ae++; + } else if (_0x4b1026.type === _0xf9eeea) { + _0xad0fa9 += _0x4b1026.relativeOffset; + for (_0x5c2263 = _0x4b1026.length; _0x5c2263--;) _0x2c1832.writeU8(_0x2c1832._u8array[_0xad0fa9]), _0xad0fa9++; + } + } + if (_0x76e509 && this.targetChecksum !== _0x2d78e9(_0x2c1832)) throw new Error('error_crc_output'); + return _0x2c1832; + }, _0x5b02d3.prototype.export = function(_0x3e1e58) { + var _0x17edbf = 'BPS1' .length; + _0x17edbf += _0x5a4975(this.sourceSize), _0x17edbf += _0x5a4975(this.targetSize), _0x17edbf += _0x5a4975(this.metaData.length), _0x17edbf += this.metaData.length; + for (var _0x2c1832 = 0x0; _0x2c1832 < this.actions.length; _0x2c1832++) { + _0x17edbf += _0x5a4975(((_0x38dad6 = this.actions[_0x2c1832]).length - 0x1 << 0x2) + _0x38dad6.type), _0x38dad6.type === _0x34d681 ? _0x17edbf += _0x38dad6.length : _0x38dad6.type !== _0x4c50e7 && _0x38dad6.type !== _0xf9eeea || (_0x17edbf += _0x5a4975((Math.abs(_0x38dad6.relativeOffset) << 0x1) + (_0x38dad6.relativeOffset < 0x0 ? 0x1 : 0x0))); + } + var _0x2d1555 = new _0x863031(_0x17edbf += 0xc); + _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); + for (_0x2c1832 = 0x0; _0x2c1832 < this.actions.length; _0x2c1832++) { + var _0x38dad6 = this.actions[_0x2c1832]; + _0x2d1555.writeVLV((_0x38dad6.length - 0x1 << 0x2) + _0x38dad6.type), _0x38dad6.type === _0x34d681 ? _0x2d1555.writeBytes(_0x38dad6.bytes) : _0x38dad6.type !== _0x4c50e7 && _0x38dad6.type !== _0xf9eeea || _0x2d1555.writeVLV((Math.abs(_0x38dad6.relativeOffset) << 0x1) + (_0x38dad6.relativeOffset < 0x0 ? 0x1 : 0x0)); + } + return _0x2d1555.writeU32(this.sourceChecksum), _0x2d1555.writeU32(this.targetChecksum), _0x2d1555.writeU32(this.patchChecksum), _0x2d1555; + }, _0x562e68.prototype.delete = function() { + this.next && delete this.next; + }; + var _0x7a6485 = 'UPS1'; + + function _0x42cd9e() { + this.records = [], this.sizeInput = 0x0, this.sizeOutput = 0x0, this.checksumInput = 0x0, this.checksumOutput = 0x0; + } + + function _0x10dc1d(_0x5d0c48) { + for (;;) { + var _0x17edbf = 0x7f & _0x5d0c48; + if (0x0 === (_0x5d0c48 >>= 0x7)) { + this.writeU8(0x80 | _0x17edbf); + break; + } + this.writeU8(_0x17edbf), _0x5d0c48 -= 0x1; + } + } + + function _0x454043() { + for (var _0xa88a13 = 0x0, _0x17edbf = 0x1;;) { + var _0x2c1832 = this.readU8(); + if (-0x1 == _0x2c1832) throw new Error('Can\'t read UPS VLV at 0x' + (this.offset - 0x1).toString(0x10)); + if (_0xa88a13 += (0x7f & _0x2c1832) * _0x17edbf, 0x0 != (0x80 & _0x2c1832)) break; + _0xa88a13 += _0x17edbf <<= 0x7; + } + return _0xa88a13; + } + + function _0xca245c(_0x459173) { + for (var _0x17edbf = 0x0;;) { + if (_0x17edbf++, 0x0 === (_0x459173 >>= 0x7)) break; + _0x459173 -= 0x1; + } + return _0x17edbf; + } + + function _0xd2202f(_0x5abb5e) { + var _0x17edbf = new _0x42cd9e(); + _0x5abb5e.readVLV = _0x454043, _0x5abb5e.seek(_0x7a6485.length), _0x17edbf.sizeInput = _0x5abb5e.readVLV(), _0x17edbf.sizeOutput = _0x5abb5e.readVLV(); + for (; _0x5abb5e.offset < _0x5abb5e.fileSize - 0xc;) { + for (var _0x2c1832 = _0x5abb5e.readVLV(), _0x3bca86 = []; _0x5abb5e.readU8();) _0x3bca86.push(_0x5abb5e._lastRead); + _0x17edbf.addRecord(_0x2c1832, _0x3bca86); + } + return _0x5abb5e.littleEndian = true, _0x17edbf.checksumInput = _0x5abb5e.readU32(), _0x17edbf.checksumOutput = _0x5abb5e.readU32(), _0x5abb5e.littleEndian = !0x1, _0x17edbf; + } + _0x42cd9e.prototype.addRecord = function(_0x162ca5, _0x39594d) { + this.records.push({ + 'offset': _0x162ca5, + 'XORdata': _0x39594d + }); + }, _0x42cd9e.prototype.toString = function() { + var _0xa88a13 = 'Records: ' + (void 0x0).records.length; + return _0xa88a13 += '\nInput file size: ' + (void 0x0).sizeInput, _0xa88a13 += '\nOutput file size: ' + (void 0x0).sizeOutput, _0xa88a13 += '\nInput file checksum: ' + padZeroes((void 0x0).checksumInput, 0x4), _0xa88a13 += '\nOutput file checksum: ' + padZeroes((void 0x0).checksumOutput, 0x4); + }, _0x42cd9e.prototype.export = function(_0x1a3e8b) { + var _0x17edbf = _0x7a6485.length; + _0x17edbf += _0xca245c(this.sizeInput), _0x17edbf += _0xca245c(this.sizeOutput); + for (var _0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) _0x17edbf += _0xca245c(this.records[_0x2c1832].offset), _0x17edbf += this.records[_0x2c1832].XORdata.length + 0x1; + _0x17edbf += 0xc, tempFile = new _0x863031(_0x17edbf), tempFile.writeVLV = _0x10dc1d, tempFile.fileName = _0x1a3e8b + '.ups', tempFile.writeString(_0x7a6485), tempFile.writeVLV(this.sizeInput), tempFile.writeVLV(this.sizeOutput); + for (_0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) tempFile.writeVLV(this.records[_0x2c1832].offset), tempFile.writeBytes(this.records[_0x2c1832].XORdata), tempFile.writeU8(0x0); + return tempFile.littleEndian = true, tempFile.writeU32(this.checksumInput), tempFile.writeU32(this.checksumOutput), tempFile.writeU32(_0x2d78e9(tempFile, 0x0, true)), tempFile; + }, _0x42cd9e.prototype.validateSource = function(_0x25cb26, _0xd0163c) { + return _0x2d78e9(_0x25cb26, _0xd0163c) === this.checksumInput; + }, _0x42cd9e.prototype.apply = function(_0x21d682, _0x41bbac) { + _0x41bbac && this.validateSource(_0x21d682), tempFile = new _0x863031(this.sizeOutput), _0x21d682.copyToFile(tempFile, 0x0, this.sizeInput), _0x21d682.seek(0x0); + for (var _0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) { + var _0x5ed6c9 = this.records[_0x2c1832]; + tempFile.skip(_0x5ed6c9.offset), _0x21d682.skip(_0x5ed6c9.offset); + for (var _0x3faf05 = 0x0; _0x3faf05 < _0x5ed6c9.XORdata.length; _0x3faf05++) tempFile.writeU8((_0x21d682.isEOF() ? 0x0 : _0x21d682.readU8()) ^ _0x5ed6c9.XORdata[_0x3faf05]); + tempFile.skip(0x1), _0x21d682.skip(0x1); + } + return _0x41bbac && (_0x2d78e9(tempFile), this.checksumOutput), tempFile; + }; + var _0xc778fa = _0x2c1832(0xa0), + _0x5a641d = _0x2c1832.n(_0xc778fa), + _0x4d7024 = { + '_FS': { + 'createPath': function(parent, path, canRead, canWrite) { + if (! _0x4d7024.FS) return; + if (typeof _0x4d7024.FS.createPath != 'function') { + _0x4d7024.FS.mkdir(path); + } else { + _0x4d7024.FS.createPath(parent, path, canRead, canWrite); + } + }, + 'createDataFile': function(parent, name, data, canRead, canWrite, canOwn) { + if (! _0x4d7024.FS) return; + if (typeof _0x4d7024.FS.createDataFile != 'function') { + var path = function(parent, name) { + if (parent.endsWith('/') || name.startsWith('/')) { + return parent + name; + } else { + return parent + '/' + name; + } + }(parent, name); + _0x4d7024.FS.writeFile(path, data); + } else { + _0x4d7024.FS.createDataFile(parent, name, data, canRead, canWrite, canOwn); + } + }, + 'createFolder': function(parent, name, a, b) { + if (! _0x4d7024.FS) return; + if (typeof _0x4d7024.FS.createFolder != 'function') { + var path = function(parent, name) { + if (parent.endsWith('/') || name.startsWith('/')) { + return parent + name; + } else { + return parent + '/' + name; + } + }(parent, name); + _0x4d7024.FS.mkdir(path); + } else { + _0x4d7024.FS.createFolder(parent, name, a, b); + } + } + }, + 'romdb': null, + 'supportBatterySave': !0x1, + 'hash': '2b35cacf70ae', + 'hash2': 'f5cbb3f38c0bb20e4', + 'hash3': '88cc8ad0c350400499a0', + 'loading': null, + 'gamePatch': null, + 'saveFilenames': [], + 'FS': null, + 'Module': null, + 'aspectRatio': 0x4 / 0x3, + 'memData': null, + 'wasmData': null, + 'coreFileData': {}, + 'coreFileName': '', + 'coreFileVersion': '', + 'isMobileDevice': !!/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i .test(navigator.userAgent || ''), + 'create': function() { + var _0xa88a13 = this; + window.URL = window.URL || window.webkitURL; + var _0x17edbf, _0x2c1832, _0x4ce206, _0x528f2b = !0x1, + _0x547484 = !0x1, + _0x5e24fa = !0x1, + _0x468801 = 0x0, + _0x31a5b3 = !0x1, + _0x1e0766 = { + 'psx': ['bin', 'iso', 'cue', 'img', 'mdf', 'pbp', 'toc', 'cbn', 'm3u'], + 'nds': ['nds', 'bin'], + 'nes': ['fds', 'nes', 'unif', 'unf'], + 'snes': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'], + 'snes2002': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'], + 'snes2005': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'], + 'snes2010': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'], + 'gb': ['gb', 'gbc', 'dmg'], + 'gba': ['gb', 'gbc', 'gba'], + 'vbanext': ['gba'], + 'vb': ['vb', 'vboy', 'bin'], + '3do': ['iso', 'bin', 'cue'], + 'lynx': ['lnx'], + 'jaguar': ['j64', 'jag', 'rom', 'abs', 'cof', 'bin', 'prg'], + 'a7800': ['a78', 'bin'], + 'a2600': ['a26', 'bin'], + 'ngp': ['ngp', 'ngc'], + 'n64': ['n64', 'v64', 'z64', 'bin', 'u1', 'ndd'], + 'pce': ['pce', 'bin', 'iso', 'cue', 'ccd', 'img', 'chd'], + 'sega': ['mdx', 'md', 'smd', 'gen', 'bin', 'iso', 'cue', 'sms', 'gg', 'sg', '68k', 'chd'], + 'segacd': ['mdx', 'md', 'smd', 'gen', 'bin', 'iso', 'cue', 'sms', 'gg', 'sg', '68k', 'chd'], + '32x': ['32x', 'bin', 'gen', 'smd', 'md', 'cue', 'iso', 'sms'], + 'saturn': ['bin', 'cue', 'iso'], + 'msx': ['rom', 'mx1', 'mx2', 'dsk', 'cas'], + 'bluemsx': ['rom', 'ri', 'mx1', 'mx2', 'col', 'dsk', 'cas', 'sg', 'sc', 'm3u'], + 'ws': ['ws', 'wsc'], + 'arcade': ['zip'], + 'fba0.2.97.29': ['zip'], + 'mame2003': ['zip'], + 'mame': ['zip'] + }, + _0x29078e = { + 'psx': 'psx', + 'nds': 'nds', + 'nes': 'nes', + 'snes': 'snes', + 'snes2002': 'snes2002', + 'snes2005': 'snes2005', + 'snes2010': 'snes2010', + 'gb': 'gb', + 'gbc': 'gb', + 'gba': 'gba', + 'vbanext': 'vbanext', + 'vb': 'vb', + 'n64': 'n64', + '3do': '3do', + 'segaMS': 'sega', + 'segaGG': 'sega', + 'segaMD': 'sega', + 'segaCD': 'segacd', + 'sega32x': '32x', + 'segaSaturn': 'saturn', + 'ngp': 'ngp', + 'pce': 'pce', + 'msx': 'bluemsx', + 'atari2600': 'a2600', + 'atari7800': 'a7800', + 'lynx': 'lynx', + 'ws': 'ws', + 'arcade': 'arcade', + 'fba0.2.97.29': 'fba0.2.97.29', + 'jaguar': 'jaguar', + 'mame2003': 'mame2003' + }, + _0xc6823 = this, + _0x1143c5 = _0xc6823.system; + _0x17edbf = (_0xc6823.customPaths && typeof _0xc6823.customPaths['extract7z.js'] == 'string') ? _0xc6823.customPaths['extract7z.js'] : (_0xc6823.dataPath + 'extract7z.js');; + _0x2c1832 = (_0xc6823.customPaths && typeof _0xc6823.customPaths['extractzip.js'] == 'string') ? _0xc6823.customPaths['extractzip.js'] : (_0xc6823.dataPath + 'extractzip.js?v=1'); + _0x4ce206 = (_0xc6823.customPaths && typeof _0xc6823.customPaths['libunrar.js'] == 'string') ? _0xc6823.customPaths['libunrar.js'] : (_0xc6823.dataPath + 'libunrar.js'); + var _0xb2be2a = _0x428003('canvas', {}); + this.game.appendChild(_0xb2be2a), _0x4d7024.loading = _0x428003('div', { + 'class': this.config.classNames.loading + }), this.elements.container.appendChild(_0x4d7024.loading); + var _0x4fce24 = { + 'loading-info': _0x449eac({ + 'loading-info': true + }), + 'ad': _0x449eac({ + 'ad': true + }), + 'close-ad': _0x449eac({ + 'close-ad': true + }), + 'start-game': _0x449eac({ + 'start-game': true + }), + 'on': _0x449eac({ + 'on': true + }), + 'p1': _0x449eac({ + 'p1': true + }), + 'p2': _0x449eac({ + 'p2': true + }), + 'p3': _0x449eac({ + 'p3': true + }), + 'p4': _0x449eac({ + 'p4': true + }) + }, + _0x4e198f = ''; + if (typeof _0xc6823.adUrl === 'string') { + _0x4d7024.loading.innerHTML = '\n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n '+(_0xb9b2ff.get('playNow', _0xc6823.config))+'\n
\n
'; + var _0x2e2264 = _0x428003('iframe', { + 'src': _0xc6823.adUrl, + 'scrolling': 'no', + 'frameborder': 'no', + 'style': 'width:300px !important;height:250px !important;display: block !important;' + }); + (_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 = 'Failed to initialize WebGL.'); + _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') + } else { + _0x4d7024.loading.innerHTML = '\n
\n
\n
\n
\n
\n
\n
\n ').concat(_0xb9b2ff.get('playNow', _0xc6823.config), '\n
\n
'); + if (! _0x2d904a.webgl.DETECTED) { + _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true), _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)).innerHTML = 'Failed to initialize WebGL.'; + } + } + var _0x18a437 = window.URL || window.webkitURL; + _0x550f17.a.interceptors.request.use(function(_0x1cd992) { + return _0x1cd992.headers['Content-Type'] = 'application/x-www-form-urlencoded', 'options' === _0x1cd992.method.toLowerCase() && (_0x1cd992.method = 'get'), _0x1cd992; + }, function(_0x5150c8) { + return Promise.reject(_0x5150c8); + }); + var _0x394c59 = function(_0x571737) { + var _0x17edbf; + return 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x3 === _0x571737[0x2] && 0x4 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x5 === _0x571737[0x2] && 0x6 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x7 === _0x571737[0x2] && 0x8 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x37 === _0x571737[0x0] && 0x7a === _0x571737[0x1] && 0xbc === _0x571737[0x2] && 0xaf === _0x571737[0x3] && 0x27 === _0x571737[0x4] && 0x1c === _0x571737[0x5] ? _0x17edbf = '7z' : 0x52 === _0x571737[0x0] && 0x61 === _0x571737[0x1] && 0x72 === _0x571737[0x2] && 0x21 === _0x571737[0x3] && 0x1a === _0x571737[0x4] && 0x7 === _0x571737[0x5] && 0x0 == _0x571737[0x6] && (_0x17edbf = 'rar'), _0x17edbf; + }, + _0xa24f60 = function(_0xbf2b8b) { + var _0x17edbf = 'importScripts("'+_0xbf2b8b+'");', + _0x2c1832 = new Blob([_0x17edbf], { + 'type': 'application/javascript' + }), + _0x501a8e = window.URL.createObjectURL(_0x2c1832); + return new Promise(function(_0x2d8147, _0x1b03b2) { + _0x2d8147(new Worker(_0x501a8e)); + }); + }, + _0x41d0bd = function(_0x3a41ff, _0x2b541e) { + var _0x2c1832 = ''; + if ('rar' == _0x2b541e) _0x2c1832 = '\nvar dataToPass = [];\nModule = {\n monitorRunDependencies: function(left) {\n if (left == 0) {\n setTimeout(function() {\n unrar(dataToPass, null);\n }, 100);\n }\n },\n onRuntimeInitialized: function() {\n },\n locateFile: function(file) {\n return \'' .concat(_0x3a41ff+'.mem', '\';\n }\n};\nimportScripts("').concat(_0x3a41ff, '");\nvar unrar = function(data, password) {\n var cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n var rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n var rec = function(entry) {\n if (entry.type === \'file\') {\n postMessage({"t":2,"file":entry.fullFileName,"size":entry.fileSize,"data":entry.fileContent});\n } else if (entry.type === \'dir\') {\n Object.keys(entry.ls).forEach(function(k) {\n rec(entry.ls[k]);\n })\n } else {\n throw "Unknown type";\n }\n }\n rec(rarContent);\n postMessage({"t":1});\n return rarContent;\n};\nonmessage = function(data) {\n dataToPass.push({name: \'test.rar\', content: data.data});\n};\n '); + var _0x22326b = new Blob([_0x2c1832], { + 'type': 'application/javascript' + }), + _0x3635b1 = window.URL.createObjectURL(_0x22326b); + return new Promise(function(_0x2d169f, _0x341b0d) { + _0x2d169f(new Worker(_0x3635b1)); + }); + }, + _0x24de8d = null, + _0x4e171c = null, + _0xa884ea = null, + _0x1ffb98 = null; + try { + _0x24de8d = new _0x50f370.a({ + 'dbVersion': 0x1, + 'storePrefix': 'ejs-', + 'storeName': 'system', + 'keyPath': null, + 'autoIncrement': !0x1, + 'onStoreReady': function() { + _0x528f2b = true; + }, + 'onError': function() { + _0x528f2b = true; + } + }), _0x4e171c = new _0x50f370.a({ + 'dbVersion': 0x1, + 'storePrefix': 'ejs-', + 'storeName': 'roms', + 'keyPath': null, + 'autoIncrement': !0x1, + 'onStoreReady': function() { + _0x547484 = true; + }, + 'onError': function() { + _0x547484 = true; + } + }), _0xa884ea = new _0x50f370.a({ + 'dbVersion': 0x1, + 'storePrefix': 'ejs-', + 'storeName': 'bios', + 'keyPath': null, + 'autoIncrement': !0x1, + 'onStoreReady': function() { + _0x5e24fa = true; + }, + 'onError': function() { + _0x5e24fa = true; + } + }), _0x1ffb98 = new _0x50f370.a({ + 'dbVersion': 0x1, + 'storePrefix': 'ejs-', + 'storeName': 'romsdata', + 'keyPath': null, + 'autoIncrement': !0x1, + 'onStoreReady': function() {}, + 'onError': function() {} + }); + } catch (_0x4fc9b6) { + _0x528f2b = true, _0x547484 = true, _0x5e24fa = true, console.log(_0x4fc9b6); + } + _0x1093f4.call(_0xc6823, _0xc6823.elements.container, 'start-game', function(_0x3d9f57) { + _0xc6823.started = true, _0xc6823.playing = true, _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['loading-info'])), true); + if (_0xdcec2a && (_0xdcec2a.virtualGamepadContainer == 'undefined' || _0xdcec2a.virtualGamepadContainer === null)) { + _0x5ab74d.toggleControls.call(_0xc6823, true); + } + var _0x2c1832 = _0x449eac({ + 'ejs__tooltip--visible': true + }), + _0x10efa5 = _0xc6823.elements.buttons.gamepad.querySelector('.' .concat(_0x449eac({ + 'ejs__tooltip': true + }))); + _0x3a8e2f(_0x10efa5, _0x2c1832, true), setTimeout(function() { + _0x3a8e2f(_0x10efa5, _0x2c1832, !0x1); + }, 0x1388) + if (typeof _0xc6823.adUrl === 'string') { + _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['close-ad'])), !0x1), setTimeout(function() { + _0xc6823.started && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)) && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).parentNode.removeChild(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad))); + }, 0x2710) + } + _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true); + var _0x30fd44 = _0x5dc0c0(_0x2593da.defaultCoreOptionsValues.call(_0xa88a13), _0x2593da.storage.get('core-options') || {}); + 'n64' === _0xc6823.system && _0x30fd44 && Object.keys(_0x30fd44).forEach(function(_0x3015d2) { + 'glupen64-aspect' === _0x3015d2 && '16:9' === _0x30fd44[_0x3015d2] && (_0xb2be2a.height = _0xb2be2a.width / 0x10 * 0x9, _0x4d7024.aspectRatio = 0x10 / 0x9); + }), 'arcade' !== _0xa88a13.system && 'fba0.2.97.29' !== _0xa88a13.system || _0x30fd44 && Object.keys(_0x30fd44).forEach(function(_0x490c06) { + 'fba-aspect' === _0x490c06 && 'PAR' === _0x30fd44[_0x490c06] && (_0xb2be2a.height = _0xb2be2a.width / 0x10 * 0x9, _0x4d7024.aspectRatio = 0x10 / 0x9); + }), 'gba' === _0xc6823.system && (_0xb2be2a.height = _0xb2be2a.width / 1.5, _0x4d7024.aspectRatio = 1.5), window.setTimeout(function() {}, 0x96), + function() { + var _0x3d9f57 = _0xa88a13; + if ('undefined' != typeof RI) { + document.removeEventListener('mousemove', RI.eventHandler, !0x1), _0xb2be2a.removeEventListener('mousedown', RI.canvasEventHandler, !0x1), _0xb2be2a.removeEventListener('mouseup', RI.canvasEventHandler, !0x1); + _0x3d9f57.elements.container.addEventListener('mousemove', function(_0x44f409) { + var _0x3d9f57 = 0x0, + _0x2c1832 = 0x0, + _0x2cc8a1 = _0x44f409.offsetX - _0x4d7024.Module.canvas.offsetLeft, + _0x5744ed = _0x44f409.offsetY - _0x4d7024.Module.canvas.offsetTop; + switch (_0x44f409.type) { + case 'mousemove': + _0x2cc8a1 < 0x0 ? (_0x2cc8a1 = 0x0, _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 < 0x0 ? (_0x5744ed = 0x0, _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; + for (var _0x3e03cb = 0x0; _0x3e03cb < RI.contexts.length; _0x3e03cb += 0x1) HEAP32[RI.contexts[_0x3e03cb].state + 0x20 >> 0x2] = _0x3d9f57, HEAP32[RI.contexts[_0x3e03cb].state + 0x24 >> 0x2] = _0x2c1832; + } + }, !0x1), _0x3d9f57.elements.container.addEventListener('mousedown', RI.canvasEventHandler, !0x1), _0x3d9f57.elements.container.addEventListener('mouseup', RI.canvasEventHandler, !0x1); + var _0x2c1832 = function(_0x5d0cbb) { + if (_0x5d0cbb.targetTouches[0x0]) { + var _0x3d9f57, _0x2c1832, _0x19a4e0 = 0x0, + _0x2b7b61 = 0x0, + _0x1e0f64 = _0x5d0cbb.target.getBoundingClientRect(), + _0x2c55b8 = _0x5d0cbb.targetTouches[0x0].clientX - _0x1e0f64.left, + _0x3a7025 = _0x5d0cbb.targetTouches[0x0].clientY - _0x1e0f64.top; + _0x2c55b8 < 0x0 ? (_0x2c55b8 = 0x0, _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 < 0x0 ? (_0x3a7025 = 0x0, _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; + for (var _0x43b670 = 0x0; _0x43b670 < RI.contexts.length; _0x43b670 += 0x1) HEAP32[RI.contexts[_0x43b670].state + 0x20 >> 0x2] = _0x19a4e0, HEAP32[RI.contexts[_0x43b670].state + 0x24 >> 0x2] = _0x2b7b61; + switch (_0x5d0cbb.type) { + case 'touchend': + case 'touchstart': + if (0x0 === _0x5d0cbb.button) _0x2c1832 = 0x28; + else { + if (0x2 !== _0x5d0cbb.button) break; + _0x2c1832 = 0x29; + } + _0x3d9f57 = 'touchend' === _0x5d0cbb.type ? 0x0 : 0x1; + for (var _0x443e8b = 0x0; _0x443e8b < RI.contexts.length; _0x443e8b += 0x1) HEAP8[RI.contexts[_0x443e8b].state + _0x2c1832 >> 0x0] = _0x3d9f57; + } + } + }; + _0x3d9f57.elements.container.addEventListener('touchstart', _0x2c1832, !0x1), _0x3d9f57.elements.container.addEventListener('touchend', _0x2c1832, !0x1); + } else { + var _0x518e5a = function(_0x45d640) { + var _0x3d9f57 = new MouseEvent(_0x45d640.type, _0x45d640); + _0x4d7024.Module.canvas.dispatchEvent(_0x3d9f57); + }; + _0x530042.call(_0xa88a13, '.' .concat(_0x449eac({ + 'ejs__dialogs': true + }))).addEventListener('mousemove', _0x518e5a, !0x1), _0x530042.call(_0xa88a13, '.' .concat(_0x449eac({ + 'ejs__dialogs': true + }))).addEventListener('mousedown', _0x518e5a, !0x1), _0x530042.call(_0xa88a13, '.' .concat(_0x449eac({ + 'ejs__dialogs': true + }))).addEventListener('mouseup', _0x518e5a, !0x1); + } + }(), 'msx' === _0xc6823.system && function(_0x3c016a) { + if ('undefined' != typeof RI) { + document.removeEventListener('keydown', RI.eventHandler, !0x1), document.removeEventListener('keyup', RI.eventHandler, !0x1); + var _0x3d9f57 = function(_0x97e67b) { + var _0x3d9f57 = _0x97e67b.keyCode, + _0x2c1832 = _0x3d9f57 >> 0x3, + _0x3340c0 = 0x1 << (0x7 & _0x3d9f57); + switch (_0x97e67b.type) { + case 'keyup': + case 'keydown': + if (_0x2c1832 >= 0x20) throw 'key code error! bad code: ' + _0x3d9f57; + for (var _0x126f58 = 0x0; _0x126f58 < RI.contexts.length; _0x126f58++) { + var _0x4ca77a = HEAP8[RI.contexts[_0x126f58].state + _0x2c1832 >> 0x0]; + 'keyup' === _0x97e67b.type ? _0x4ca77a &= ~_0x3340c0 : _0x4ca77a |= _0x3340c0, HEAP8[RI.contexts[_0x126f58].state + _0x2c1832 >> 0x0] = _0x4ca77a; + } + } + }; + document.addEventListener('keydown', _0x3d9f57, !0x1), document.addEventListener('keyup', _0x3d9f57, !0x1); + } + }(), setTimeout(function() { + var _0xa88a13; + _0xa88a13 = _0x59aa33.info(), null === _0xdcec2a.setVolume && 'undefined' != typeof RA ? (RA.queueAudio = function() { + var _0x3d9f57, _0x2c1832 = _0xc6823.volume, + _0x2cbc4 = RA.bufIndex; + _0x3d9f57 = RA.bufIndex ? RA.buffers[RA.bufIndex - 0x1].endTime : RA.context.currentTime, RA.buffers[_0x2cbc4].endTime = _0x3d9f57 + RA.buffers[_0x2cbc4].duration; + var _0x4e7320 = RA.context.createBufferSource(); + if (_0x4e7320.buffer = RA.buffers[_0x2cbc4], _0xc6823.muted && (_0x2c1832 = 0x0), 0x1 === _0x2c1832) _0x4e7320.connect(RA.context.destination); + else { + var _0x3da8fc = RA.context.createGain(); + _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, 0x0); + } + _0x4e7320.start(_0x3d9f57), RA.bufIndex += 0x1, RA.bufOffset = 0x0; + }, _0x59aa33.isIos && window.addEventListener('touchstart', function() { + if (RA.context) { + RA.context.resume(); + var _0xa88a13 = RA.context.createBufferSource(); + _0xa88a13.connect(RA.context.destination), _0xa88a13.start(); + } + }, !0x1)) : _0xdcec2a.setVolume(); + }, 0x1f4), setTimeout(function() { + _0xc6823.elements.container.focus(); + }, 0x1e), void 0x0 === window.addRunDependency && (window.Module = void 0x0); + var _0x36b9cc = _0x4d7024.FS.readFile(_0xc6823.startName); + if (_0x36b9cc.length <= 0x2000000 && '.cue' != _0xc6823.startName.substr(-0x4)) { + var _0x4fa964; + if ('snes' === _0xc6823.system || ['snes2002', 'snes2005', 'snes2010'].includes(_0xc6823.system)) { + var _0x4b2f70 = _0x36b9cc.length % 0x400; + _0x4fa964 = new _0x863031(_0x4b2f70 ? _0x36b9cc.slice ? _0x36b9cc.slice(_0x4b2f70) : _0x36b9cc.subarray(_0x4b2f70) : _0x36b9cc); + } else _0x4fa964 = new _0x863031(_0x36b9cc); + var _0x21e040 = _0x5a641d.a.create(), + _0x2b8478 = new FileReader(), + _0x15068c = 0x0, + _0x1646ca = _0x4fa964._u8array.length, + _0x4c84da = function() { + if (_0x15068c < _0x1646ca) { + var _0xa88a13 = Math.min(_0x15068c + 0x200000, _0x1646ca); + _0x2b8478.readAsArrayBuffer(new Blob([_0x4fa964._u8array.slice(_0x15068c, _0xa88a13)])), _0x15068c = _0xa88a13; + } else console.log(_0x21e040.hex()), _0xc6823.hash = _0x21e040.hex(), 'function' == typeof window.ejsromshash && window.ejsromshash(_0xc6823.hash); + }; + _0x2b8478.onload = function(_0x26a751) { + try { + _0x21e040.update(_0x26a751.target.result), _0x4c84da(); + } catch (_0x5c9e53) { + console.log(_0x5c9e53); + } + }, _0x4c84da(); + } + }) + if (typeof _0xc6823.adUrl === 'string') { + _0x1093f4.call(_0xc6823, _0x4d7024.loading.querySelector('.' .concat(_0x4fce24['close-ad'])), 'click', function(_0x96b13f) { + _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(); + }); + } + var _0x16cf3e = function() { + _0x4e171c.db && _0x4e171c.getAll(function(_0x1a4eaf) { + Array.isArray(_0x1a4eaf) && _0x1a4eaf.length > 0xa && _0x1a4eaf.sort(function(_0x155e15, _0x4a9e7f) { + return (_0x4a9e7f.lastaccess ? _0x4a9e7f.lastaccess : 0x0) - (_0x155e15.lastaccess ? _0x155e15.lastaccess : 0x0); + }).forEach(function(_0x43d1af, _0x2db4e2) { + _0x2db4e2 > 0xa && !_0x4d7024.saveFilenames.includes(_0x43d1af.key) ? (_0x4e171c.remove(_0x43d1af.key), _0x1ffb98.db && _0x1ffb98.remove(_0x43d1af.key)) : (delete _0x43d1af.data, _0x4e171c.put(_0x43d1af.key, _0x43d1af)); + }); + }, function() { + _0x4e171c.clear(), _0x1ffb98.db && _0x1ffb98.clear(); + }); + }, + _0x5f3757 = function(_0x2bd107) { + if (_0x4d7024.gamePatch) { + var _0x17edbf = _0x2bd107.startName.split('/'), + _0x2c1832 = _0x17edbf.pop().split('.').pop(), + _0x11dc72 = (_0x4d7024.gamePatch.split('.').pop(), _0x4d7024.gamePatch.split('/').pop().split('.').shift()), + _0x453ec0 = '' .concat(_0x17edbf.join('/'), '/').concat(_0x11dc72, '.').concat(_0x2c1832); + _0x453ec0 = _0x453ec0.replace(/\#/g, ''); + var _0x5438db = _0x4d7024.gamePatch; + if (_0x4d7024.FS.rename(_0x2bd107.startName, _0x453ec0), _0x2bd107.startName = _0x453ec0, 'snes' === _0x2bd107.system || ['snes2002', 'snes2005', 'snes2010'].includes(_0x2bd107.system)) { + var _0x4758bc, _0x4b4000, _0x4aa31e, _0x2d9175 = new _0x863031(_0x4d7024.FS.readFile(_0x2bd107.startName)), + _0x567355 = _0x2d78e9(_0x2d9175), + _0x3d2ad0 = new _0x863031(_0x4d7024.FS.readFile(_0x5438db)), + _0x4a229b = _0x3d2ad0.readString(0x6), + _0x20786d = _0x2d9175._u8array.length % 0x400; + _0x4a229b.startsWith('PATCH') ? (_0x4758bc = _0x288092(_0x3d2ad0), 0x0 === _0x20786d && 'B19ED489' === _0x567355.toString(0x10).toUpperCase() && ((_0x4b4000 = new Uint8Array(_0x2d9175._u8array.length + 0x200)).set(new Uint8Array(0x200), 0x0), _0x4b4000.set(_0x2d9175._u8array, 0x200), _0x2d9175 = new _0x863031(_0x4b4000))) : _0x4a229b.startsWith(_0x7a6485) ? _0x4758bc = _0xd2202f(_0x3d2ad0) : _0x4a229b.startsWith('BPS1') && (_0x4758bc = _0x356089(_0x3d2ad0), _0x20786d > 0x0 && 'A31BEAD4' === _0x567355.toString(0x10).toUpperCase() && (_0x4b4000 = _0x2d9175._u8array.slice ? _0x2d9175._u8array.slice(_0x20786d) : _0x2d9175._u8array.subarray(_0x20786d), _0x2d9175 = new _0x863031(_0x4b4000))); + try { + if (_0x4aa31e = _0x4758bc.apply(_0x2d9175, !0x1)) { + var _0x1ffde3 = _0x4aa31e._u8array.length % 0x400; + _0x1ffde3 > 0x0 && (_0x4b4000 = _0x4aa31e._u8array.slice ? _0x4aa31e._u8array.slice(_0x1ffde3) : _0x4aa31e._u8array.subarray(_0x1ffde3), _0x4aa31e = new _0x863031(_0x4b4000)), _0x4d7024.FS.unlink(_0x5438db), _0x4d7024.FS.unlink(_0x2bd107.startName), _0x4d7024.FS.writeFile(_0x2bd107.startName, _0x4aa31e._u8array); + } + } catch (_0x2ef20f) {} + } else { + var _0x4108d8, _0x5e086b, _0x454a20 = new _0x863031(_0x4d7024.FS.readFile(_0x2bd107.startName)), + _0x4991ea = new _0x863031(_0x4d7024.FS.readFile(_0x5438db)), + _0x130f1f = _0x4991ea.readString(0x6); + _0x130f1f.startsWith('PATCH') ? _0x4108d8 = _0x288092(_0x4991ea) : _0x130f1f.startsWith(_0x7a6485) ? _0x4108d8 = _0xd2202f(_0x4991ea) : _0x130f1f.startsWith('BPS1') && (_0x4108d8 = _0x356089(_0x4991ea)); + try { + (_0x5e086b = _0x4108d8.apply(_0x454a20, !0x1)) && (_0x4d7024.FS.unlink(_0x5438db), _0x4d7024.FS.unlink(_0x2bd107.startName), _0x4d7024.FS.writeFile(_0x2bd107.startName, _0x5e086b._u8array)); + } catch (_0x3ed519) {} + } + } + }, + _0x4bd781 = function() { + _0x31a5b3 ? (window.Module.TOTAL_MEMORY = 0x10000000, ['jaguar'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = 0x10000000), ['nds', 'nes', 'snes', 'arcade', 'mame'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = 0x0), ['snes2002', 'snes2005', 'snes2010'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = 0x0), 'gba' == _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x0), '3do' == _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x0), 'n64' == _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x0)) : ('nes' === _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x8000000), window.Module.TOTAL_MEMORY = _0x468801 + 0x4000000, ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = _0x468801 + 0x10000000, _0x4d7024.isMobileDevice && (window.Module.TOTAL_MEMORY = 0x12c00000)), ['n64', 'nds', 'jaguar'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = _0x468801 + 0x10000000, _0x4d7024.isMobileDevice && (window.Module.TOTAL_MEMORY = 0x12c00000)), 'gba' == _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x10000000)), 'undefined' != typeof EJS_MEMORY && (window.Module.TOTAL_MEMORY = EJS_MEMORY); + }, + _0x3512e9 = function(_0x1bc287, _0x1844e3) { + var _0x55627a = _0xa88a13, + _0x1cfda7 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), + _0x429d6b = (_0x1bc287.split('.').pop(), _0x29078e[_0x1143c5]), + _0xb0c5d8 = -0x1, + _0x567713 = '', + _0x567717 = function() { + if (typeof _0x55627a.loadStateOnStart == 'string') { + fetch(_0x55627a.loadStateOnStart).then(function(response) { + response.arrayBuffer().then(function(ab) { + var a = new Uint8Array(ab) + EJS_loadState(a) + }) + }) + } + }; + window.EJS_terminate = function() { + _0x4d7024.Module.pauseMainLoop(); + if (_0x55627a && _0x55627a.eventListeners) { + for (var k in _0x55627a) { + for (var i=0; i<_0x55627a.eventListeners.length; i++) { + var a = _0x55627a.eventListeners[i]; + a.element.removeEventListener(a.type, a.callback, a.capture); + } + } + } + if (window.EJS_RESET_VARS) { + var a = []; + var b = []; + for (var k in window) { + a.push(k); + } + for (var i=0; i= 0x0; _0x36bace -= 0x1) _0x1e0766[_0x429d6b][_0x36bace] === _0x1844e3.toLowerCase() && _0x36bace > _0xb0c5d8 && (_0xb0c5d8 = _0x36bace, _0x55627a.startName = ['', _0x25aae3.join('/'), _0x1bc287].join('/'), _0x55627a.startName = _0x55627a.startName.replace(/\/+/, '/')); + _0x1bc287 && (_0x4d7024._FS.createDataFile('/' .concat(_0x25aae3.join('/')), _0x1bc287, _0x52e6f3.data.data, true, !0x1), _0x468801 += _0x52e6f3.data.data.length), _0x567713 = '/' .concat(_0x25aae3.join('/'), '/').concat(_0x1bc287); + } + if (0x4 === _0x52e6f3.data.t && _0x52e6f3.data.total > 0x0) { + var _0x163fc4 = Math.floor(_0x52e6f3.data.current / _0x52e6f3.data.total * 0x64), + _0x5448a3 = _0x52e6f3.data.name || ''; + _0x163fc4 <= 0x64 && _0x163fc4 > 0x0 && (_0x1cfda7.innerHTML = _0xa88a13.localization('Decompress Game Data')+' ' .concat(_0x5448a3, ' ').concat(_0x163fc4, '%')); + } + } + }, + _0x1e67c4 = !0x1; + if (!['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x55627a.system)) { + var _0x20a78c = _0x1844e3.slice ? _0x1844e3.slice(0x0, 0xa) : _0x1844e3.subarray(0x0, 0xa), + _0x1761cf = _0x394c59(_0x20a78c); + '7z' === _0x1761cf ? (_0xa24f60(_0x17edbf).then(function(_0xea623e) { + _0xea623e.onmessage = _0x99321, _0xea623e.postMessage(_0x1844e3); + }), _0x1e67c4 = true) : 'zip' === _0x1761cf ? (_0xa24f60(_0x2c1832).then(function(_0x5a81e4) { + _0x5a81e4.onmessage = _0x99321, _0x5a81e4.postMessage(_0x1844e3); + }), _0x1e67c4 = true) : 'rar' == _0x1761cf && (_0x41d0bd(_0x4ce206, 'rar').then(function(_0x5f204f) { + _0x5f204f.onmessage = _0x99321, _0x5f204f.postMessage(_0x1844e3); + }), _0x1e67c4 = true); + } + if (!_0x1e67c4) { + var _0x1c661d = _0x1bc287.replace(/\#/g, ''); + try { + _0x468801 += _0x1844e3.length, _0x4d7024._FS.createDataFile('/', _0x1c661d, _0x1844e3, true, !0x1); + } catch (_0x210043) { + console.log(_0x210043); + } + _0x4bd781(), _0x55627a.startName = _0x1c661d, _0x5f3757(_0x55627a), _0x16cf3e(); + try { + var _0x4dd87f = [_0x55627a.startName, + [_0x4d7024.hash, _0x4d7024.hash2, _0x4d7024.hash3].join('') + ]; + 'undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX && _0x4dd87f.unshift('-v'); + _0x4d7024.Module.callMain(_0x4dd87f); + if (_0xc6823.coreVer === 2) { + _0x4d7024.Module.resumeMainLoop(); + _0x4d7024.Module.setCanvasSize(800, 600); + } + _0xbae705.call(_0x55627a, _0x55627a.elements.container, 'start-game'); + } catch (_0x42970c) { + console.log(_0x42970c), _0x1cfda7.innerHTML = 'Failed to start game'; + } + try{_0x567717();}catch(e){} + } + }, + _0x5048db = function() { + var _0x17edbf = _0xa88a13, + _0x2c1832 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), + _0x50eb85 = _0xa88a13.config, + _0x3cf3cf = (_0x50eb85.gameId, _0x50eb85.gameUrl), + _0x594488 = _0x50eb85.system; + 'vbanext' == _0x594488 && (_0x594488 = 'gba'); + var _0x154dc5 = _0x3cf3cf.split('/'), + _0x139f1c = _0x154dc5[_0x154dc5.length - 0x1]; + _0x139f1c.indexOf('?') > -0x1 && (_0x139f1c = _0x139f1c.substr(0x0, _0x139f1c.indexOf('?'))); + _0x139f1c.split('.').pop(); + _0x2c1832.innerHTML = _0xa88a13.localization('Download Game Data'), ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x17edbf.system) && _0x17edbf.config.gameParentUrl && (_0x2c1832.innerHTML += ' (2/2)'), _0x17edbf.config.gamePatchUrl && (_0x2c1832.innerHTML += ' (2/2)'); + new Promise(async function(resolve, reject) { + if (! _0x3cf3cf.startsWith('blob:')) { + resolve(await _0x550f17.a.head(_0x3cf3cf, {})) + } else { + var a = await fetch(_0x3cf3cf) + var a = await a.blob() + resolve({headers:{'content-length': a.size, 'content-type': 'text/plain'}}) + } + }).then(function(_0x3d703e) { + var _0x21b526 = _0x3d703e.headers['content-length'], + _0x7e8d4c = _0x3d703e.headers['content-type'], + _0x107e8a = (_0x3d703e.headers['last-modified'], '' .concat(_0x594488, '-').concat(_0x139f1c)), + _0x43a689 = function() { + _0x550f17.a.get(_0x3cf3cf, { + 'onDownloadProgress': function(_0x4e7133) { + var _0x13b999 = _0x4e7133.total ? '' .concat(Math.floor(_0x4e7133.loaded / _0x4e7133.total * 0x64), '%') : ''; + ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x17edbf.system) && _0x17edbf.config.gameParentUrl ? _0x2c1832.innerHTML = _0xa88a13.localization('Download Game Data')+' (2/2) ' .concat(_0x13b999) : _0x17edbf.config.gamePatchUrl ? _0x2c1832.innerHTML = _0xa88a13.localization('Download Game Data')+' (2/2) ' .concat(_0x13b999) : _0x2c1832.innerHTML = _0xa88a13.localization('Download Game Data')+' ' .concat(_0x13b999); + }, + 'responseType': 'arraybuffer' + }).then(function(_0x22a1f4) { + var _0x17edbf = new Uint8Array(_0x22a1f4.data); + if (_0xa88a13.config.gameUrl.startsWith('blob:') || _0xa88a13.config.gameUrl.startsWith('file:') || _0xa88a13.config.gameUrl.startsWith('chrome-extension:') || ((window.location.protocol == 'file:' || window.location.protocol == 'chrome-extension:') && _0xa88a13.config.gameUrl.split(':').length == 1)) {_0x3512e9(_0x139f1c, _0x17edbf);return;}; + if (_0x107e8a && _0x4e171c.db) + if (_0x17edbf.length > 0x6400000) + for (var _0x2c1832 = Math.ceil(_0x17edbf.length / 0x6400000), _0x257c4d = 0x0; _0x257c4d < _0x2c1832; _0x257c4d += 0x1) { + var _0x47d2ae = _0x17edbf.slice ? _0x17edbf.slice(0x6400000 * _0x257c4d, 0x6400000 * (_0x257c4d + 0x1)) : _0x17edbf.subarray(0x6400000 * _0x257c4d, 0x6400000 * (_0x257c4d + 0x1)), + _0x6ce9f3 = '' .concat(_0x107e8a); + _0x257c4d > 0x0 && (_0x6ce9f3 = '' .concat(_0x107e8a, '-part-').concat(_0x257c4d)), _0x4d7024.saveFilenames.push(_0x6ce9f3), _0x4e171c.put(_0x6ce9f3, { + 'filename': _0x139f1c, + 'filesize': _0x17edbf.length, + 'filetype': _0x7e8d4c, + 'key': _0x6ce9f3, + 'lastaccess': new Date().valueOf(), + 'next': '' .concat(_0x107e8a, '-part-').concat(_0x257c4d + 0x1) + }), _0x1ffb98.db && _0x1ffb98.put(_0x6ce9f3, { + 'filename': _0x139f1c, + 'filesize': _0x17edbf.length, + 'filetype': _0x7e8d4c, + 'key': _0x6ce9f3, + 'data': _0x47d2ae + }); + } else _0x4d7024.saveFilenames.push(_0x107e8a), _0x4e171c.put(_0x107e8a, { + 'filename': _0x139f1c, + 'filesize': _0x17edbf.length, + 'filetype': _0x7e8d4c, + 'key': _0x107e8a, + 'lastaccess': new Date().valueOf() + }), _0x1ffb98.db && _0x1ffb98.put(_0x107e8a, { + 'filename': _0x139f1c, + 'filesize': _0x17edbf.length, + 'filetype': _0x7e8d4c, + 'key': _0x107e8a, + 'data': _0x17edbf + }); + _0x3512e9(_0x139f1c, _0x17edbf); + }).catch(function(_0x2e4d62) { + console.log(_0x2e4d62), _0x2c1832.innerHTML = ''+_0xa88a13.localization('Network Error')+''; + }); + }; + _0x1ffb98.db ? _0x1ffb98.get(_0x107e8a, function(_0x5afc4a) { + if (_0x5afc4a && _0x5afc4a.filename === _0x139f1c && _0x5afc4a.filesize - _0x21b526 == 0x0 && _0x5afc4a.filetype === _0x7e8d4c && _0x5afc4a.key) + if (_0x4e171c.get(_0x107e8a, function(_0x2585bd) { + _0x2585bd.lastaccess = new Date().valueOf(), _0x4e171c.put(_0x2585bd.key, _0x2585bd); + }), _0x5afc4a.filesize > 0x6400000) { + var _0x17edbf = new Uint8Array(_0x5afc4a.filesize); + _0x17edbf.set(_0x5afc4a.data); + for (var _0x2c1832 = Math.ceil(_0x5afc4a.filesize / 0x6400000), _0x36180f = [], _0x3c1e3a = 0x1; _0x3c1e3a < _0x2c1832; _0x3c1e3a += 0x1) _0x36180f.push('' .concat(_0x107e8a, '-part-').concat(_0x3c1e3a)), _0x4e171c.get('' .concat(_0x107e8a, '-part-').concat(_0x3c1e3a), function(_0x4f1393) { + _0x4f1393.lastaccess = new Date().valueOf(), _0x4e171c.put(_0x4f1393.key, _0x4f1393); + }); + _0x1ffb98.getBatch(_0x36180f, function(_0x47ffae) { + _0x47ffae.filter(function(_0x3d76ae) { + return _0x3d76ae; + }).length !== _0x36180f.length ? _0x43a689() : (_0x47ffae.forEach(function(_0x15960c, _0x92d423) { + _0x17edbf.set(_0x15960c.data, 0x6400000 * (_0x92d423 + 0x1)); + }), _0x3512e9(_0x5afc4a.filename, _0x17edbf)); + }, function() {}, 'sparse'); + } else _0x3512e9(_0x5afc4a.filename, _0x5afc4a.data); + else _0x43a689(); + }) : _0x43a689(); + }).catch(function(_0x5ec6be) { + _0x2c1832.innerHTML = ''+_0xa88a13.localization('Network Error')+''; + }); + }, + _0x139f68 = function() { + var _0x2591d9 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), + _0x5c896f = _0xa88a13.config.gamePatchUrl; + if (_0x5c896f) { + var _0x227b23 = _0x5c896f.split('/'), + _0x179b43 = _0x227b23[_0x227b23.length - 0x1]; + _0x179b43.indexOf('?') > -0x1 && (_0x179b43 = _0x179b43.substr(0x0, _0x179b43.indexOf('?'))); + _0x179b43.split('.').pop(); + _0x2591d9.innerHTML = _0xa88a13.localization('Download Game Data')+' (1/2)', _0x550f17.a.get(_0x5c896f, { + 'onDownloadProgress': function(_0x3da9ab) { + _0x2591d9.innerHTML = _0xa88a13.localization('Download Game Data')+' (1/2) '; + var _0x17edbf = _0x3da9ab.total ? '' .concat(Math.floor(_0x3da9ab.loaded / _0x3da9ab.total * 0x64), '%') : ''; + _0x2591d9.innerHTML += _0x17edbf; + }, + 'responseType': 'arraybuffer' + }).then(function(_0x159ae9) { + var _0x39a81f = new Uint8Array(_0x159ae9.data); + ! function(_0xe531f0, _0x1097ca) { + var _0xf6806b = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), + _0x59c7c1 = (_0xe531f0.split('.').pop(), function(_0x36004e) { + if (_0x36004e.data) { + if (0x1 === _0x36004e.data.t && (_0x36004e.target.terminate(), _0x5048db()), 0x2 === _0x36004e.data.t) { + var _0x17edbf = _0x36004e.data.file.split('/'), + _0x2c1832 = _0x17edbf.pop(), + _0x2b320e = _0x2c1832.split('.').pop(); + _0x4d7024._FS.createPath('/', _0x17edbf.join('/'), true, true), _0x4d7024._FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x36004e.data.data, true, !0x1), _0x468801 += _0x36004e.data.data.length, ['ips', 'bps', 'ups'].includes(_0x2b320e) && !_0x4d7024.gamePatch && (_0x4d7024.gamePatch = '/' + _0x17edbf.join('/') + '/' + _0x2c1832); + } + if (0x4 === _0x36004e.data.t && _0x36004e.data.total > 0x0) { + var _0x1097ca = Math.floor(_0x36004e.data.current / _0x36004e.data.total * 0x64), + _0x95ac83 = _0x36004e.data.name || ''; + _0x1097ca <= 0x64 && _0x1097ca > 0x0 && (_0xf6806b.innerHTML = _0xa88a13.localization('Decompress Game Patch')+' ' .concat(_0x95ac83, ' ').concat(_0x1097ca, '%')); + } + } + }), + _0x4c332a = !0x1, + _0x3de3e4 = _0x1097ca.slice ? _0x1097ca.slice(0x0, 0xa) : _0x1097ca.subarray(0x0, 0xa), + _0x17f736 = _0x394c59(_0x3de3e4); + '7z' === _0x17f736 ? (_0xa24f60(_0x17edbf).then(function(_0x20601d) { + _0x20601d.onmessage = _0x59c7c1, _0x20601d.postMessage(_0x1097ca); + }), _0x4c332a = true) : 'zip' === _0x17f736 ? (_0xa24f60(_0x2c1832).then(function(_0x46622d) { + _0x46622d.onmessage = _0x59c7c1, _0x46622d.postMessage(_0x1097ca); + }), _0x4c332a = true) : 'rar' == _0x17f736 && (_0x41d0bd(_0x4ce206, 'rar').then(function(_0x2ecd24) { + _0x2ecd24.onmessage = messageCallBack, _0x2ecd24.postMessage(_0x1097ca); + }), _0x4c332a = true), _0x4c332a || (_0x468801 += _0x1097ca.length, _0x4d7024.gamePatch = '/' .concat(_0xe531f0), _0x4d7024._FS.createDataFile('/', _0xe531f0, _0x1097ca, true, !0x1), _0x5048db()); + }(_0x179b43, _0x39a81f); + }).catch(function(_0x314293) { + console.log(_0x314293), _0x2591d9.innerHTML = ''+_0xa88a13.localization('Network Error')+''; + }); + } else _0x5048db(); + }, + _0x452592 = function() { + var _0x17edbf = _0xa88a13, + _0x2c1832 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), + _0x5a21f7 = _0xa88a13.config.gameParentUrl; + if (_0x5a21f7 && ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x17edbf.system)) { + var _0x71bb4d = _0x5a21f7.split('/'), + _0xa1889f = _0x71bb4d[_0x71bb4d.length - 0x1]; + _0xa1889f.indexOf('?') > -0x1 && (_0xa1889f = _0xa1889f.substr(0x0, _0xa1889f.indexOf('?'))); + _0xa1889f.split('.').pop(); + _0x2c1832.innerHTML = _0xa88a13.localization('Download Game Data')+' (1/2)', _0x17edbf.config.gamePatchUrl && (_0x2c1832.innerHTML = _0xa88a13.localization('Download Game Data')+' (1/3)'), _0x550f17.a.head(_0x5a21f7, {}).then(function(_0x35c23a) { + var _0x17edbf = _0x35c23a.headers['content-length'], + _0x500ba1 = _0x35c23a.headers['content-type'], + _0x316472 = (_0x35c23a.headers['last-modified'], '' .concat(_0x1143c5, '-').concat(_0xa1889f)), + _0x31f098 = function() { + _0x550f17.a.get(_0x5a21f7, { + 'onDownloadProgress': function(_0x5e449f) { + var _0x17edbf = _0x5e449f.total ? '' .concat(Math.floor(_0x5e449f.loaded / _0x5e449f.total * 0x64), '%') : ''; + _0x2c1832.innerHTML = _0xa88a13.localization('Download Game Data')+' (1/2) ' .concat(_0x17edbf); + }, + 'responseType': 'arraybuffer' + }).then(function(_0x191007) { + var _0x17edbf = new Uint8Array(_0x191007.data); + if (_0x316472 && _0x4e171c.db) + if (_0x17edbf.length > 0x6400000) + for (var _0x2c1832 = Math.ceil(_0x17edbf.length / 0x6400000), _0x3f44d7 = 0x0; _0x3f44d7 < _0x2c1832; _0x3f44d7 += 0x1) { + var _0x15a529 = _0x17edbf.slice ? _0x17edbf.slice(0x6400000 * _0x3f44d7, 0x6400000 * (_0x3f44d7 + 0x1)) : _0x17edbf.subarray(0x6400000 * _0x3f44d7, 0x6400000 * (_0x3f44d7 + 0x1)), + _0x4a61f1 = '' .concat(_0x316472); + _0x3f44d7 > 0x0 && (_0x4a61f1 = '' .concat(_0x316472, '-part-').concat(_0x3f44d7)), _0x4d7024.saveFilenames.push(_0x4a61f1), _0x4e171c.put(_0x4a61f1, { + 'filename': _0xa1889f, + 'filesize': _0x17edbf.length, + 'filetype': _0x500ba1, + 'key': _0x4a61f1, + 'lastaccess': new Date().valueOf(), + 'next': '' .concat(_0x316472, '-part-').concat(_0x3f44d7 + 0x1) + }), _0x1ffb98.db && _0x1ffb98.put(_0x4a61f1, { + 'filename': _0xa1889f, + 'filesize': _0x17edbf.length, + 'filetype': _0x500ba1, + 'key': _0x4a61f1, + 'data': _0x15a529 + }); + } else _0x4d7024.saveFilenames.push(_0x316472), _0x4e171c.put(_0x316472, { + 'filename': _0xa1889f, + 'filesize': _0x17edbf.length, + 'filetype': _0x500ba1, + 'key': _0x316472, + 'lastaccess': new Date().valueOf() + }), _0x1ffb98.db && _0x1ffb98.put(_0x316472, { + 'filename': _0xa1889f, + 'filesize': _0x17edbf.length, + 'filetype': _0x500ba1, + 'key': _0x316472, + 'data': _0x17edbf + }); + var _0x54d79 = _0xa1889f.replace(/\#/g, ''); + try { + _0x468801 += _0x17edbf.length, _0x4d7024._FS.createDataFile('/', _0x54d79, _0x17edbf, true, !0x1), _0x139f68(); + } catch (_0x125736) { + console.log(_0x125736); + } + }).catch(function(_0x516cc3) { + console.log(_0x516cc3), _0x2c1832.innerHTML = ''+_0xa88a13.localization('Network Error')+''; + }); + }; + _0x1ffb98.db ? _0x1ffb98.get(_0x316472, function(_0x3e612b) { + if (_0x3e612b && _0x3e612b.filename === _0xa1889f && _0x3e612b.filesize - _0x17edbf == 0x0 && _0x3e612b.filetype === _0x500ba1 && _0x3e612b.key) + if (_0x3e612b.filesize > 0x6400000) { + var _0x2c1832 = new Uint8Array(_0x3e612b.filesize); + _0x2c1832.set(_0x3e612b.data); + for (var _0xa2197 = Math.ceil(_0x3e612b.filesize / 0x6400000), _0x6f30ae = [], _0x32aa3c = 0x1; _0x32aa3c < _0xa2197; _0x32aa3c += 0x1) _0x6f30ae.push('' .concat(_0x316472, '-part-').concat(_0x32aa3c)); + _0x1ffb98.getBatch(_0x6f30ae, function(_0x198a02) { + _0x198a02.filter(function(_0x1c8a88) { + return _0x1c8a88; + }).length !== _0x6f30ae ? _0x31f098() : (_0x198a02.forEach(function(_0x22b824, _0x16eecf) { + _0x2c1832.set(_0x22b824.data, 0x6400000 * (_0x16eecf + 0x1)); + }), _0x4d7024._FS.createDataFile('/', _0x3e612b.filename, _0x2c1832, true, !0x1), _0x139f68()); + }, function() {}, 'sparse'); + } else _0x4d7024._FS.createDataFile('/', _0x3e612b.filename, _0x3e612b.data, true, !0x1), _0x139f68(); + else _0x31f098(); + }) : _0x31f098(); + }).catch(function(_0x20f2e3) { + _0x2c1832.innerHTML = ''+_0xa88a13.localization('Network Error')+''; + }); + } else _0x139f68(); + }, + _0x57d85d = function(_0x5e7c8b, _0x3cff36) { + var _0x3ea97 = _0xa88a13, + _0x50119 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p2)), + _0x19a43e = (_0x5e7c8b.split('.').pop(), function(_0x1e8643) { + if (_0x1e8643.data) { + if (0x1 === _0x1e8643.data.t && (_0x50119.innerHTML = 'BIOS ready', _0x1e8643.target.terminate(), _0x452592()), 0x2 === _0x1e8643.data.t) { + var _0x17edbf = _0x1e8643.data.file.split('/'), + _0x2c1832 = _0x17edbf.pop(); + _0x2c1832.split('.').pop(); + _0x4d7024._FS.createPath('/', _0x17edbf.join('/'), true, true), _0x4d7024._FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x1e8643.data.data, true, !0x1), _0x468801 += _0x1e8643.data.data.length; + } + if (0x4 === _0x1e8643.data.t && _0x1e8643.data.total > 0x0) { + var _0x149f09 = Math.floor(_0x1e8643.data.current / _0x1e8643.data.total * 0x64), + _0x5e7c8b = _0x1e8643.data.name || ''; + _0x149f09 <= 0x64 && _0x149f09 > 0x0 && (_0x50119.innerHTML = 'Decompress BIOS ' .concat(_0x5e7c8b, ' ').concat(_0x149f09, '%')); + } + } + }), + _0x3a6560 = !0x1, + _0x12e229 = _0x3cff36.slice ? _0x3cff36.slice(0x0, 0xa) : _0x3cff36.subarray(0x0, 0xa), + _0x80852b = _0x394c59(_0x12e229); + '7z' === _0x80852b ? (_0xa24f60(_0x17edbf).then(function(_0x1b6a80) { + _0x1b6a80.onmessage = _0x19a43e, _0x1b6a80.postMessage(_0x3cff36); + }), _0x3a6560 = true) : 'zip' !== _0x80852b || ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x3ea97.system) ? 'rar' === _0x80852b && (_0x41d0bd(_0x4ce206, 'rar').then(function(_0x259be0) { + _0x259be0.onmessage = messageCallBack, _0x259be0.postMessage(_0x3cff36); + }), _0x3a6560 = true) : (_0xa24f60(_0x2c1832).then(function(_0x31c70d) { + _0x31c70d.onmessage = _0x19a43e, _0x31c70d.postMessage(_0x3cff36); + }), _0x3a6560 = true), _0x3a6560 || (_0x468801 += _0x3cff36.length, _0x50119.innerHTML = 'BIOS ready', _0x4d7024._FS.createDataFile('/', _0x5e7c8b, _0x3cff36, true, !0x1), _0x452592()); + }, + _0x10b71a = function() { + _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)).innerHTML = 'Game Core ready'; + var _0x17edbf = _0xa88a13.config.biosUrl, + _0x2c1832 = _0xa88a13; + _0xdcec2a.bindFunction.call(_0xa88a13), _0xdcec2a.setGamepadDialog.call(_0xa88a13), _0xdcec2a.setCacheDialog.call(_0xa88a13), _0xdcec2a.setLoadingDialog.call(_0xa88a13), _0xdcec2a.setNetplayDialog.call(_0xa88a13), _0xdcec2a.setCheatDialog.call(_0xa88a13), _0xdcec2a.initGamepad.call(_0xa88a13), _0xdcec2a.initKeyboard.call(_0xa88a13), _0xdcec2a.listeners.call(_0xa88a13), _0x4d7024._FS.createFolder('/', 'etc', true, true), _0x4d7024.FS.mkdir('/data'), _0x4d7024.FS.mkdir('/data/saves'), 'undefined' != typeof IDBFS ? _0x4d7024.FS.mount(IDBFS, {}, '/data/saves') : _0x4d7024.FS.mount(_0x4d7024.FS.filesystems.IDBFS, {}, '/data/saves'), _0x4d7024.FS.mkdir('/shader'), _0x4d7024.FS.syncfs(true, function(_0x1a8f12) {}), _0xdcec2a.initShaders(); + var _0x14d39f = ''; + _0x14d39f += 'savefile_directory = /data/saves\n', _0x14d39f += 'video_vsync = true\n', _0x14d39f += 'screenshot_directory = /\n', _0x14d39f += 'video_shader = /shader/shader.glslp\n', _0x14d39f += 'video_shader_enable = true\n', _0x14d39f += 'video_font_enable = false\n', _0x14d39f += 'video_scale = 1.0\n', _0x14d39f += 'video_gpu_screenshot = false\n', _0x14d39f += 'audio_latency = 96\n'; + var _0x36edb7 = _0x2593da.defaultCoreOptionsValues.call(_0xa88a13); + _0x2c1832.lightgun && ('nes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p2 = "258"\n'), 'segaMS' !== _0xa88a13.system && 'segaMD' !== _0xa88a13.system && 'segaCD' !== _0xa88a13.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' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p2 = "260"\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(_0xa88a13.system) && (_0x14d39f += 'input_libretro_device_p2 = "260"\n')), _0x2c1832.mouse && ('snes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p1 = 2\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(_0xa88a13.system) && (_0x14d39f += 'input_libretro_device_p1 = 2\n')), _0x2c1832.multitap && ('snes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p2 = 257\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(_0xa88a13.system) && (_0x14d39f += 'input_libretro_device_p2 = 257\n')), 'n64' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p1 = 5\n'), _0x2c1832.system, _0x14d39f += 'fastforward_ratio = 1.0\n', _0x14d39f += 'video_smooth = false\n'; + var _0x55117c = _0x5dc0c0(_0x36edb7, _0x2593da.storage.get('core-options') || {}), + _0x32dd27 = ''; + if (_0x2c1832.coreVer === 2) { + _0x4d7024._FS.createDataFile('/etc', 'retroarch.cfg', _0x14d39f, true, true); + _0x4d7024._FS.createFolder('/home/web_user', 'retroarch', true, true); + _0x4d7024._FS.createFolder('/home/web_user/retroarch', 'userdata', true, true); + _0x4d7024._FS.createDataFile('/home/web_user/retroarch/userdata', 'retroarch.cfg', _0x32dd27, true, true); + } else { + _0x4d7024._FS.createDataFile('/etc', 'retroarch.cfg', _0x14d39f, true, true); + _0x4d7024._FS.createFolder('/home/web_user', '.config', true, true); + _0x4d7024._FS.createFolder('/home/web_user/.config', 'retroarch', true, true); + _0x4d7024._FS.createDataFile('/home/web_user/.config/retroarch', 'retroarch-core-options.cfg', _0x32dd27, true, true); + } + if (_0x55117c && Object.keys(_0x55117c).forEach(function(_0x2950d3) { + if (_0x2c1832.lightgun && 'nes' === _0x2c1832.system && 'system_type' === _0x2950d3) return !0x1; + _0x32dd27 += '' .concat(_0x2950d3, ' = "').concat(_0x55117c[_0x2950d3], '"\n'), _0x1093f4.call(_0x2c1832, _0x2c1832.elements.container, 'start-game', function(_0x362c5c) { + _0xdcec2a.setVariable(_0x2950d3, _0x55117c[_0x2950d3]); + }); + }), _0x17edbf) { + var _0x12e137 = _0x17edbf.split('/'), + _0x103241 = _0x12e137[_0x12e137.length - 0x1]; + _0x103241.indexOf('?') > -0x1 && (_0x103241 = _0x103241.substr(0x0, _0x103241.indexOf('?'))); + _0x103241.split('.').pop(); + var _0x1f8424 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p2)); + _0x550f17.a.head(_0x17edbf, {}).then(function(_0x4bd3bd) { + var _0x8e30bf = _0x4bd3bd.headers['content-length'], + _0x14309b = _0x4bd3bd.headers['content-type'], + _0x51bfef = (_0x4bd3bd.headers['last-modified'], _0x2c1832.system), + _0x574747 = function() { + _0x550f17.a.get(_0x17edbf, { + 'onDownloadProgress': function(_0x107517) { + var _0x17edbf = _0x107517.total ? '' .concat(Math.floor(_0x107517.loaded / _0x107517.total * 0x64), '%') : ''; + _0x1f8424.innerHTML = 'Download BIOS ' .concat(_0x17edbf); + }, + 'responseType': 'arraybuffer' + }).then(function(_0x4b0c1d) { + var _0x17edbf = new Uint8Array(_0x4b0c1d.data); + _0xa884ea.db && _0xa884ea.put(_0x1143c5, { + 'filename': _0x103241, + 'filesize': _0x17edbf.length, + 'filetype': _0x14309b, + 'data': _0x17edbf + }), _0x57d85d(_0x103241, _0x17edbf); + }).catch(function(_0x58e374) { + _0x1f8424.innerHTML = ''+_0xa88a13.localization('Network Error')+''; + }); + }; + _0xa884ea.db ? _0xa884ea.get(_0x51bfef, function(_0x5cac21) { + _0x5cac21 && _0x5cac21.filename === _0x103241 && _0x5cac21.filesize - _0x8e30bf == 0x0 && _0x5cac21.filetype === _0x14309b ? _0x57d85d(_0x5cac21.filename, _0x5cac21.data) : _0x574747(); + }) : _0x574747(); + }).catch(function(_0x4f39c1) { + _0x1f8424.innerHTML = ''+_0xa88a13.localization('Network Error')+''; + }); + } else _0x452592(); + }, + _0x29b999 = function(_0x172278) { + var _0x17edbf; + _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); + }, + _0x4f0fcc = function(_0x18cb26) { + var _0x2c1832 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)), + _0x247459 = '', + _0x54d695 = function() { + null !== _0x4d7024.wasmData ? (window.Module.wasmBinary = _0x4d7024.wasmData, _0x4bd781(), window.Module.monitorRunDependencies = function(_0x59580a) { + 0x0 === _0x59580a && _0x10b71a(); + }, window.Module.onRuntimeInitialized = function() {}) : (_0x4bd781(), window.Module.monitorRunDependencies = function(_0x55a24a) { + console.log('monitorRunDependencies, ', _0x55a24a); + }, window.Module.onRuntimeInitialized = function() { + _0x4d7024.Module || (_0x4d7024.Module = window.Module), _0x4d7024.Module && _0x4d7024.Module.FS ? _0x4d7024.FS = _0x4d7024.Module.FS : _0x4d7024.FS = window.FS, console.log('onRuntimeInitialized'), _0x10b71a(); + }); + var _0x18cb26 = window.Module; + if (null !== _0x4d7024.wasmData && (_0x18cb26.wasmBinary = _0x4d7024.wasmData), _0x59aa33.isIos && null !== _0x4d7024.wasmData) { + var _0x17edbf = new Blob([_0x247459], { + 'type': 'text/javascript' + }), + _0x2c1832 = _0x428003('script', { + 'src': _0x18a437.createObjectURL(_0x17edbf) + }); + document.body.appendChild(_0x2c1832), _0x2c1832.onload = function() { + void 0x0 === window.addRunDependency && 'undefined' != typeof EmulatorJS && (_0x4d7024.Module = EmulatorJS(_0x18cb26), EmulatorJS = void 0x0), null !== _0x4d7024.memData && _0x29b999(_0x4d7024.memData), _0x4d7024.Module || (_0x4d7024.Module = window.Module), _0x4d7024.Module && _0x4d7024.Module.FS ? _0x4d7024.FS = _0x4d7024.Module.FS : _0x4d7024.FS = window.FS; + }; + } else _0x247459 = function(_0x3df03e) { + for (var _0x17edbf = [], _0x2c1832 = 0x0; _0x2c1832 < _0x3df03e.length; _0x2c1832 += 0x1) { + var _0xcf0289 = _0x3df03e[_0x2c1832]; + _0xcf0289 > 0xff && (_0xcf0289 &= 0xff), _0x17edbf.push(String.fromCharCode(_0xcf0289)); + } + return _0x17edbf.join(''); + }(_0x247459), window.eval(_0x247459), void 0x0 === window.addRunDependency && 'undefined' != typeof EmulatorJS && (_0x4d7024.Module = EmulatorJS(_0x18cb26), EmulatorJS = void 0x0), null !== _0x4d7024.memData && _0x29b999(_0x4d7024.memData), _0x4d7024.Module || (_0x4d7024.Module = window.Module), _0x4d7024.Module && _0x4d7024.Module.FS ? _0x4d7024.FS = _0x4d7024.Module.FS : _0x4d7024.FS = window.FS, window.EJS_MODULE = _0x4d7024.Module, window.ejs_loader = _0x4d7024, window.ejs_media = _0xdcec2a; + _0x247459 = null; + }; + _0x1093f4.call(_0xc6823, _0xc6823.elements.container, 'script-loaded', function(_0x467eee) { + _0x54d695(); + }); + var _0x21d6a1 = function(_0x3f49ec) { + if (_0x3f49ec.data) { + if (0x1 === _0x3f49ec.data.t && (_0xbae705.call(_0xc6823, _0xc6823.elements.container, 'script-loaded'), _0x3f49ec.target.terminate()), 0x2 === _0x3f49ec.data.t) { + var _0x17edbf = _0x3f49ec.data.file.split('/').pop(), + _0x58b5a7 = _0x17edbf.split('.').pop(); + _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); + } + 0x4 === _0x3f49ec.data.t && _0x3f49ec.data.total > 0x0 && (_0x2c1832.innerHTML = _0xa88a13.localization('Decompress Game Core')+' ' .concat(Math.floor(_0x3f49ec.data.current / _0x3f49ec.data.total * 0x64), '%')); + } + }; + _0xa24f60(_0x17edbf).then(function(_0x48c633) { + _0x48c633.onmessage = _0x21d6a1, _0x48c633.postMessage(_0x18cb26); + }); + }, + _0x26d6a1 = function(_0x3787ba) { + return _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true), + function() { + var _0x3787ba = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)), + _0x2c1832 = _0xa88a13; + _0x3787ba.innerHTML = _0x2c1832.localization('Loading')+'...'; + var _0x1c9c57 = setInterval(function() { + if (true === _0x528f2b && true === _0x547484 && true === _0x5e24fa) { + window.Module = { + 'TOTAL_MEMORY': 0x10000000, + 'noInitialRun': true, + 'arguments': [], + 'preRun': [], + 'postRun': [], + 'canvas': _0xb2be2a, + 'print': function(_0x4a8983) { + if (window.EJS_DEBUG_XX === true) { + console.log(_0x4a8983); + } + }, + 'printErr': function(_0x367bee) { + if (window.EJS_DEBUG_XX === true) { + console.log(_0x367bee); + } + }, + 'totalDependencies': 0x0, + 'monitorRunDependencies': function(_0x5d4b07) {}, + 'locateFile': function(_0x3fe7ca) { + var _0x3787ba = null; + if (_0x3fe7ca.includes('.worker.js')) { + Object.keys(_0x4d7024.coreFileData).includes(_0x3fe7ca) && (_0x3787ba = _0x4d7024.coreFileData[_0x3fe7ca]); + var _0x2c1832 = new Blob([''], { + 'type': 'application/javascript' + }); + return window.URL.createObjectURL(_0x2c1832); + } + return _0x3fe7ca.includes('.js.mem') && (Object.keys(_0x4d7024.coreFileData).includes(_0x3fe7ca) && (_0x3787ba = _0x4d7024.coreFileData[_0x3fe7ca]), _0x3787ba) ? (_0x4d7024.memData = null, _0x3787ba.buffer) : _0x3fe7ca; + }, + 'readAsync': function(_0x20d016, _0x9d2de4, _0x1425ee) { + if (_0x20d016 instanceof ArrayBuffer) setTimeout(function() { + _0x9d2de4(_0x20d016); + }, 0x1f4); + else { + var _0x164012 = new XMLHttpRequest(); + _0x164012.open('GET', _0x20d016, true), _0x164012.responseType = 'arraybuffer', _0x164012.onload = function() { + 0xc8 == _0x164012.status || 0x0 == _0x164012.status && _0x164012.response ? _0x9d2de4(_0x164012.response) : _0x1425ee(); + }, _0x164012.onerror = _0x1425ee, _0x164012.send(null); + } + } + }; + var _0xa88a13, _0x1dedcd = Math.ceil(new Date().valueOf() / 0x3e8); + var _0xa88a13 = (_0xc6823.customPaths && typeof _0xc6823.customPaths['v.json'] == 'string') ? _0xc6823.customPaths['v.json'] : (_0xc6823.dataPath + 'v.json?t='+_0x1dedcd); + var _0x3641d6 = function(_0x16049b, _0x55a075) { + var path = (_0xc6823.customPaths && typeof _0xc6823.customPaths[_0x16049b] == 'string') ? _0xc6823.customPaths[_0x16049b] : ((_0xc6823.coreVer === 2) ? (_0xc6823.dataPath+_0x16049b+'?v='+_0x55a075) : (_0xc6823.dataPath+'old/'+_0x16049b+'?v='+_0x55a075)); + _0x550f17.a.get(path, { + 'onDownloadProgress': function(_0x117e6b) { + var _0x55a075 = _0x117e6b.total ? '' .concat(Math.floor(_0x117e6b.loaded / _0x117e6b.total * 0x64), '%') : ''; + _0x3787ba.innerHTML = _0x2c1832.localization('Download Game Core')+' ' .concat(_0x55a075); + }, + 'responseType': 'arraybuffer' + }).then(function(_0x5eb80b) { + var _0x519406 = new Uint8Array(_0x5eb80b.data); + _0x24de8d.db && _0x24de8d.put(_0x16049b, { + 'version': _0x55a075, + 'data': _0x519406 + }); + if (_0xc6823.coreVer === 2) { + _0x4f0fcc(_0x519406); + } else { + var _0xea4c63 = _0x519406.slice ? _0x519406.slice(0xc) : _0x519406.subarray(0xc); + _0xea4c63.set([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c, 0x0, 0x3], 0x0); + _0x519406 = null; + _0x4f0fcc(_0xea4c63); + } + + }).catch(function(_0x2e06c8) { + _0x3787ba.innerHTML = ''+_0x2c1832.localization('Network Error')+''; + }); + }; + _0x550f17.a.get(_0xa88a13, {}).then(function(_0x578a2b) { + var _0x2458d5, _0x5d075f = _0x29078e[_0x2c1832.system], + _0x28ee7f = _0x578a2b.data[_0x2c1832.system], + _0x124167 = _0x28ee7f.version ? _0x28ee7f.version : 0x1, + _0x254bc2 = Boolean(_0x28ee7f.netplay), + _0x5b1dcd = Boolean(_0x28ee7f.state), + _0x9a1f1 = Boolean(_0x28ee7f.asmjs), + _0x3e4345 = Boolean(_0x28ee7f.wasm); + if ('nds' == _0x2c1832.system && ! _0x2d904a.wasm) { + _0x5b1dcd = !0x1; + }; + //alert(_0x5b1dcd) // is save/load state supported + if (_0xc6823.statesSupported === false) { + _0x5b1dcd = false; + }; + _0x4d7024.coreFileVersion = _0x124167; + _0x4d7024.coreFileName = _0x5d075f; + var _0x2eb141 = !0x1; + ['webgl2', 'experimental-webgl2'].includes(_0x2d904a.webgl.WEBGL_CONTEXT) && (_0x2eb141 = true); + 'undefined' != typeof EJS_N64_LEGACY && 0x1 == EJS_N64_LEGACY && (_0x2eb141 = !0x1); + if ('mame' == _0x2c1832.system) { + var data = _0x2c1832.mameCore; + if (! data || data === null || data.split('|').length !== 2) { + _0x3787ba.innerHTML = ''+_0x2c1832.localization('Missing mame config')+''; + return; + } + var _0x3787ba = data.split('|'); + _0x4d7024.coreFileName = ''.concat(_0x2c1832.system, '-').concat(_0x3787ba[0x0]); + _0x5b1dcd = '1' === _0x3787ba[0x1]; + _0x1e2c68.element(_0x2c1832.elements.buttons.saveState) && _0x132da7(_0x2c1832.elements.buttons.saveState, !_0x5b1dcd); + _0x1e2c68.element(_0x2c1832.elements.buttons.loadState) && _0x132da7(_0x2c1832.elements.buttons.loadState, !_0x5b1dcd); + _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), !_0x5b1dcd); + _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), !_0x5b1dcd); + if (_0x2c1832.coreVer === 2) { + _0x2458d5 = ''; + } else { + _0x2458d5 = _0x2c1832.system.concat('-old-').concat(_0x3787ba[0], '-wasm.data'); + } + _0x3787ba[0x0] ? (_0x2d904a.wasm && _0x3e4345 ? (_0x31a5b3 = true) : (_0x3787ba.innerHTML = ''+_0x2c1832.localization('Webassembly support is not detected in this browser')+'', _0x2458d5 = ''), _0x2458d5 && (_0x24de8d.db ? _0x24de8d.get(_0x2458d5, function(_0x655c87) { + if (_0x655c87 && _0x655c87.version === _0x124167) { + if (_0xc6823.coreVer === 2) { + _0x4f0fcc(_0x655c87.data); + } else { + var _0x3787ba = _0x655c87.data.slice ? _0x655c87.data.slice(0xc) : _0x655c87.data.subarray(0xc); + _0x3787ba.set([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c, 0x0, 0x3], 0x0); + _0x4f0fcc(_0x3787ba); + } + } else _0x3641d6(_0x2458d5, _0x124167); + }) : _0x3641d6(_0x2458d5, _0x124167))) : _0x3787ba.innerHTML = ''+_0x2c1832.localization('Unsupported Game')+''; + } else { + _0x2458d5 = false; + var type; + if (_0x2d904a.wasm && _0x3e4345) { + type = 'wasm'; + _0x2458d5 = true; + if ('n64' === _0x2c1832.system && !_0x2eb141) { + type = 'legacy-wasm'; + } + _0x31a5b3 = true; + } else if (_0x9a1f1) { + _0x2458d5 = true; + type = 'asmjs'; + if ('n64' === _0x2c1832.system && !_0x2eb141) { + type = 'legacy-asmjs'; + } + } + 'undefined' != typeof EJS_CUSTOM_COREFILE && (_0x2458d5 = EJS_CUSTOM_COREFILE); + if (_0x2458d5 !== true) { + _0x3787ba.innerHTML = ''+_0x2c1832.localization('Please upgrade your browser to the latest version')+''; + return; + } + if (_0x2c1832.coreVer === 2) { + _0x2458d5 = _0x5d075f + '-' + type + '.data'; + } else { + _0x2458d5 = _0x5d075f + '-old-' + type + '.data'; + } + 'undefined' != typeof EJS_CUSTOM_COREFILE && (_0x2458d5 = EJS_CUSTOM_COREFILE); + _0x24de8d.db ? _0x24de8d.get(_0x2458d5, function(_0x47a6fd) { + if (_0x47a6fd && _0x47a6fd.version === _0x124167 && false) { + if (_0xc6823.coreVer === 2) { + _0x4f0fcc(_0x47a6fd.data); + } else { + var _0x3787ba = _0x47a6fd.data.slice ? _0x47a6fd.data.slice(0xc) : _0x47a6fd.data.subarray(0xc); + _0x3787ba.set([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c, 0x0, 0x3], 0x0); + _0x4f0fcc(_0x3787ba); + } + } else _0x3641d6(_0x2458d5, _0x124167); + }) : _0x3641d6(_0x2458d5, _0x124167); + } + _0x254bc2 || _0x1e2c68.element(_0x2c1832.elements.buttons.netplay) && _0x132da7(_0x2c1832.elements.buttons.netplay, true), _0x1e2c68.element(_0x2c1832.elements.buttons.saveState) && _0x132da7(_0x2c1832.elements.buttons.saveState, !_0x5b1dcd), _0x1e2c68.element(_0x2c1832.elements.buttons.loadState) && _0x132da7(_0x2c1832.elements.buttons.loadState, !_0x5b1dcd), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), !_0x5b1dcd), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), !_0x5b1dcd); + _0xc6823.setStatesSupported(_0x5b1dcd); + }).catch(function(_0x2d06a9) { + _0x3787ba.innerHTML = ''+_0x2c1832.localization('Network Error')+''; + }), clearInterval(_0x1c9c57), _0x4d7024.romdb = _0x4e171c; + } + }, 0x1f4); + }(), !0x1; + }; + _0x455c85(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), 'click touchstart', _0x26d6a1); + if (_0xc6823.startOnLoad === true) { + _0x26d6a1() + } + } + }, + _0x27f4c4 = _0x4d7024, + _0x4a2390 = _0x2c1832(0xa1); + + function _0x3c0613(_0x3eef01) { + return function(_0x3d9b1e) { + if (Array.isArray(_0x3d9b1e)) { + for (var _0x17edbf = 0x0, _0x2c1832 = new Array(_0x3d9b1e.length); _0x17edbf < _0x3d9b1e.length; _0x17edbf++) _0x2c1832[_0x17edbf] = _0x3d9b1e[_0x17edbf]; + return _0x2c1832; + } + }(_0x3eef01) || function(_0x425c1a) { + if (Symbol.iterator in Object(_0x425c1a) || '[object Arguments]' === Object.prototype.toString.call(_0x425c1a)) return Array.from(_0x425c1a); + }(_0x3eef01) || function() { + throw new TypeError('Invalid attempt to spread non-iterable instance'); + }(); + } + + function _0xa08ac0(_0x514af5, _0x4089be) { + for (var _0x2c1832 = 0x0; _0x2c1832 < _0x4089be.length; _0x2c1832++) { + var _0x3347c8 = _0x4089be[_0x2c1832]; + _0x3347c8.enumerable = _0x3347c8.enumerable || !0x1, _0x3347c8.configurable = true, 'value' in _0x3347c8 && (_0x3347c8.writable = true), Object.defineProperty(_0x514af5, _0x3347c8.key, _0x3347c8); + } + } + var _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() { + function _0x5566a2(_0x1fcb21) { + var _0x2c1832 = _0x1fcb21.targetModal, + _0x29e6ab = _0x1fcb21.triggers, + _0x114128 = void 0x0 === _0x29e6ab ? [] : _0x29e6ab, + _0x5211ae = _0x1fcb21.onShow, + _0x402faa = void 0x0 === _0x5211ae ? function() {} : _0x5211ae, + _0x120cc3 = _0x1fcb21.onClose, + _0x48ad1c = void 0x0 === _0x120cc3 ? function() {} : _0x120cc3, + _0x6a1522 = _0x1fcb21.openTrigger, + _0x306932 = void 0x0 === _0x6a1522 ? 'data-micromodal-trigger' : _0x6a1522, + _0x446302 = _0x1fcb21.closeTrigger, + _0x2f0676 = void 0x0 === _0x446302 ? 'data-micromodal-close' : _0x446302, + _0x2a4c0e = _0x1fcb21.disableScroll, + _0x2297fa = void 0x0 !== _0x2a4c0e && _0x2a4c0e, + _0x5a3f47 = _0x1fcb21.disableFocus, + _0x4a8131 = void 0x0 !== _0x5a3f47 && _0x5a3f47, + _0x42179f = _0x1fcb21.awaitCloseAnimation, + _0x27da4d = void 0x0 !== _0x42179f && _0x42179f, + _0x1b535e = _0x1fcb21.debugMode, + _0x33d8ca = void 0x0 !== _0x1b535e && _0x1b535e, + _0xee6cb0 = _0x1fcb21.closeByEsckey, + _0x54de6a = void 0x0 === _0xee6cb0 || _0xee6cb0; + ! function(_0x27e736, _0x56010c) { + if (!(_0x27e736 instanceof _0x56010c)) throw new TypeError('Cannot call a class as a function'); + }(this, _0x5566a2), this.modal = document.getElementById(_0x2c1832), this.config = { + 'debugMode': _0x33d8ca, + 'disableScroll': _0x2297fa, + 'openTrigger': _0x306932, + 'closeTrigger': _0x2f0676, + 'onShow': _0x402faa, + 'onClose': _0x48ad1c, + 'awaitCloseAnimation': _0x27da4d, + 'disableFocus': _0x4a8131, + 'closeByEsckey': _0x54de6a + }, _0x114128.length > 0x0 && this.registerTriggers.apply(this, _0x3c0613(_0x114128)), this.onClick = this.onClick.bind(this), this.onKeydown = this.onKeydown.bind(this); + } + var _0x17edbf, _0x2c1832, _0x5021cc; + return _0x17edbf = _0x5566a2, (_0x2c1832 = [{ + 'key': 'registerTriggers', + 'value': function() { + for (var _0x5566a2 = this, _0x17edbf = arguments.length, _0x2c1832 = new Array(_0x17edbf), _0x4e24fa = 0x0; _0x4e24fa < _0x17edbf; _0x4e24fa++) _0x2c1832[_0x4e24fa] = arguments[_0x4e24fa]; + _0x2c1832.forEach(function(_0x511ded) { + _0x511ded.addEventListener('click', function() { + return _0x5566a2.showModal(); + }); + }); + } + }, { + 'key': 'showModal', + 'value': function() { + this.activeElement = document.activeElement, this.modal.setAttribute('aria-hidden', 'false'), this.modal.classList.add(_0x449eac({ + 'is-open': true + })), this.setFocusToFirstNode(), this.addEventListeners(), this.config.onShow(this.modal); + } + }, { + 'key': 'closeModal', + 'value': function() { + var _0x5566a2 = this.modal; + this.modal.setAttribute('aria-hidden', 'true'), this.removeEventListeners(), this.config.onClose(this.modal), this.config.awaitCloseAnimation ? this.modal.addEventListener('animationend', function _0x17edbf() { + _0x5566a2.classList.remove(_0x449eac({ + 'is-open': true + })), _0x5566a2.removeEventListener('animationend', _0x17edbf, !0x1); + }, !0x1) : _0x5566a2.classList.remove(_0x449eac({ + 'is-open': true + })); + } + }, { + 'key': 'addEventListeners', + 'value': function() { + this.modal.addEventListener('touchstart', this.onClick), this.modal.addEventListener('click', this.onClick), document.addEventListener('keydown', this.onKeydown); + } + }, { + 'key': 'removeEventListeners', + 'value': function() { + this.modal.removeEventListener('touchstart', this.onClick), this.modal.removeEventListener('click', this.onClick), document.removeEventListener('keydown', this.onKeydown); + } + }, { + 'key': 'onClick', + 'value': function(_0x6c9df3) { + _0x6c9df3.target.hasAttribute(this.config.closeTrigger) && (this.closeModal(), _0x6c9df3.preventDefault()); + } + }, { + 'key': 'onKeydown', + 'value': function(_0xe2d057) { + this.config.closeByEsckey && 0x1b === _0xe2d057.keyCode && this.closeModal(_0xe2d057), 0x9 === _0xe2d057.keyCode && this.maintainFocus(_0xe2d057); + } + }, { + 'key': 'getFocusableNodes', + 'value': function() { + var _0x5566a2 = this.modal.querySelectorAll(_0x1eda08); + return Object.keys(_0x5566a2).map(function(_0x1bd160) { + return _0x5566a2[_0x1bd160]; + }); + } + }, { + 'key': 'setFocusToFirstNode', + 'value': function() { + if (!this.config.disableFocus) { + var _0x5566a2 = this.getFocusableNodes(); + _0x5566a2.length && _0x5566a2[0x0].focus(); + } + } + }, { + 'key': 'maintainFocus', + 'value': function(_0x15092b) { + var _0x17edbf = this.getFocusableNodes(); + if (this.modal.contains(document.activeElement)) { + var _0x2c1832 = _0x17edbf.indexOf(document.activeElement); + _0x15092b.shiftKey && 0x0 === _0x2c1832 && (_0x17edbf[_0x17edbf.length - 0x1].focus(), _0x15092b.preventDefault()), _0x15092b.shiftKey || _0x2c1832 !== _0x17edbf.length - 0x1 || (_0x17edbf[0x0].focus(), _0x15092b.preventDefault()); + } else _0x17edbf[0x0].focus(); + } + }]) && _0xa08ac0(_0x17edbf.prototype, _0x2c1832), _0x5021cc && _0xa08ac0(_0x17edbf, _0x5021cc), _0x5566a2; + }(), _0xf43a92 = null, _0x214f42 = function(_0x31caa5) { + if (!document.getElementById(_0x31caa5)) return !0x1; + }, _0x3a9bfc = function(_0x48c135, _0x61240d) { + if (function(_0x28b4fb) { + _0x28b4fb.length <= 0x0 && (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;', '')); + }(_0x48c135), !_0x61240d) return true; + for (var _0x2c1832 in _0x61240d) _0x214f42(_0x2c1832); + return true; + }, { + 'init': function(_0x3f1b32) { + var _0x17edbf = Object.assign({}, { + 'openTrigger': 'data-micromodal-trigger' + }, _0x3f1b32), + _0x2c1832 = _0x3c0613(document.querySelectorAll('[' .concat(_0x17edbf.openTrigger, ']'))), + _0x537e55 = function(_0x5e363a, _0x9390ce) { + var _0x2c1832 = []; + return _0x5e363a.forEach(function(_0x305145) { + var _0x13d441 = _0x305145.attributes[_0x9390ce].value; + void 0x0 === _0x2c1832[_0x13d441] && (_0x2c1832[_0x13d441] = []), _0x2c1832[_0x13d441].push(_0x305145); + }), _0x2c1832; + }(_0x2c1832, _0x17edbf.openTrigger); + if (true !== _0x17edbf.debugMode || !0x1 !== _0x3a9bfc(_0x2c1832, _0x537e55)) + for (var _0x383dff in _0x537e55) { + var _0x34a8e0 = _0x537e55[_0x383dff]; + _0x17edbf.targetModal = _0x383dff, _0x17edbf.triggers = _0x3c0613(_0x34a8e0), new _0x4fc27f(_0x17edbf); + } + }, + 'show': function(_0x2a3fcf, _0x472cd6) { + var _0x2c1832 = _0x472cd6 || {}; + return _0x2c1832.targetModal = _0x2a3fcf, true === _0x2c1832.debugMode && !0x1 === _0x214f42(_0x2a3fcf) ? _0xf43a92 = null : (_0xf43a92 = new _0x4fc27f(_0x2c1832)).showModal(), _0xf43a92; + }, + 'close': function() { + _0xf43a92.closeModal(); + } + }), + _0x378b5c = { + 'defaultControllers': { + 0: { + 0: { + 'value': '88', + 'value2': '1' + }, + 1: { + 'value': '83', + 'value2': '3' + }, + 2: { + 'value': '16', + 'value2': '8' + }, + 3: { + 'value': '13', + 'value2': '9' + }, + 4: { + 'value': '38', + 'value2': '12' + }, + 5: { + 'value': '40', + 'value2': '13' + }, + 6: { + 'value': '37', + 'value2': '14' + }, + 7: { + 'value': '39', + 'value2': '15' + }, + 8: { + 'value': '90', + 'value2': '0' + }, + 9: { + 'value': '65', + 'value2': '2' + }, + 10: { + 'value': '81', + 'value2': '4' + }, + 11: { + 'value': '69', + 'value2': '5' + }, + 12: { + 'value': '82', + 'value2': '6' + }, + 13: { + 'value': '87', + 'value2': '7' + }, + 14: {}, + 15: {}, + 16: { + 'value': '72' + }, + 17: { + 'value': '70' + }, + 18: { + 'value': '71' + }, + 19: { + 'value': '84' + }, + 20: {'value': '76'}, + 21: {'value': '74'}, + 22: {'value': '75'}, + 23: {'value': '73'}, + 24: {}, + 25: {}, + 26: {} + }, + 1: {}, + 2: {}, + 3: {} + }, + 'controllers': {}, + 'virtualGamepadContainer': null, + 'keyMap': { + 8: 'backspace', + 9: 'tab', + 13: 'enter', + 16: 'shift', + 17: 'ctrl', + 18: 'alt', + 19: 'pause/break', + 20: 'caps lock', + 27: 'escape', + 32: 'space', + 33: 'page up', + 34: 'page down', + 35: 'end', + 36: 'home', + 37: 'left arrow', + 38: 'up arrow', + 39: 'right arrow', + 40: 'down arrow', + 45: 'insert', + 46: 'delete', + 48: '0', + 49: '1', + 50: '2', + 51: '3', + 52: '4', + 53: '5', + 54: '6', + 55: '7', + 56: '8', + 57: '9', + 65: 'a', + 66: 'b', + 67: 'c', + 68: 'd', + 69: 'e', + 70: 'f', + 71: 'g', + 72: 'h', + 73: 'i', + 74: 'j', + 75: 'k', + 76: 'l', + 77: 'm', + 78: 'n', + 79: 'o', + 80: 'p', + 81: 'q', + 82: 'r', + 83: 's', + 84: 't', + 85: 'u', + 86: 'v', + 87: 'w', + 88: 'x', + 89: 'y', + 90: 'z', + 91: 'left window key', + 92: 'right window key', + 93: 'select key', + 96: 'numpad 0', + 97: 'numpad 1', + 98: 'numpad 2', + 99: 'numpad 3', + 100: 'numpad 4', + 101: 'numpad 5', + 102: 'numpad 6', + 103: 'numpad 7', + 104: 'numpad 8', + 105: 'numpad 9', + 106: 'multiply', + 107: 'add', + 109: 'subtract', + 110: 'decimal point', + 111: 'divide', + 112: 'f1', + 113: 'f2', + 114: 'f3', + 115: 'f4', + 116: 'f5', + 117: 'f6', + 118: 'f7', + 119: 'f8', + 120: 'f9', + 121: 'f10', + 122: 'f11', + 123: 'f12', + 144: 'num lock', + 145: 'scroll lock', + 186: 'semi-colon', + 187: 'equal sign', + 188: 'comma', + 189: 'dash', + 190: 'period', + 191: 'forward slash', + 192: 'grave accent', + 219: 'open bracket', + 220: 'back slash', + 221: 'close braket', + 222: 'single quote' + }, + 'saveLoaddbDB': { + put: function(key, data) { + var openRequest = indexedDB.open("ejs-states", 1); + openRequest.onerror = function() {}; + openRequest.onsuccess = function() { + var db = openRequest.result; + var transaction = db.transaction(["states"], "readwrite"); + var objectStore = transaction.objectStore("states"); + var request = objectStore.put(data, key); + request.onerror = function() {}; + request.onsuccess = function() {}; + }; + openRequest.onupgradeneeded = function() { + var db = openRequest.result; + if (! db.objectStoreNames.contains('states')) { + db.createObjectStore('states'); + }; + }; + }, + get: function(key) { + return new Promise(function(resolve, reject) { + var openRequest = indexedDB.open("ejs-states", 1); + openRequest.onerror = function() {}; + openRequest.onsuccess = function() { + var db = openRequest.result; + var transaction = db.transaction(["states"], "readwrite"); + var objectStore = transaction.objectStore("states"); + var request = objectStore.get(key); + request.onsuccess = async function(e) { + var file = e.target.result; + if (file) { + resolve(file) + }; + }; + request.onerror = function() {}; + }; + openRequest.onupgradeneeded = function() { + var db = openRequest.result; + if (! db.objectStoreNames.contains('states')) { + db.createObjectStore('states'); + }; + }; + }); + }, + }, + 'saveLoadDB': function(type) { + try { + if (_0x2593da && typeof _0x2593da.getCoreOptionsValues == 'function') { + var location = _0x2593da.getCoreOptionsValues()['save-state-location']; + var slot = _0x2593da.getCoreOptionsValues()['save-state-slot']; + var game = this.config.gameUrl.split('/').pop(); + if (this.gameName) { + game = this.gameName; + }; + if ((!this.gameName && this.config.gameUrl.startsWith('blob:')) || !window.indexedDB) { + return false; + } + var key = game + '-' + slot; + if (!location || location === 'download') { + return false; + } + if (type === 'save') { + try { + if (this.coreVer === 2) { + _0x378b5c.saveState().then(function(data) { + _0x378b5c.saveLoaddbDB.put(key, data); + }) + } else { + var data = _0x378b5c.saveState(); + _0x378b5c.saveLoaddbDB.put(key, data); + } + } catch(e) {return false;}; + } else { + _0x378b5c.saveLoaddbDB.get(key).then(function(data) { + EJS_loadState(data); + }); + } + return true; + } else { + return false; + } + } catch(e) { + return false; + } + }, + 'gamepad': null, + 'allowCheat': true, + 'connection': null, + 'connected': !0x1, + 'playerName': '', + 'players': [], + 'waitingList': {}, + 'roomMaster': null, + 'inputsData': {}, + 'coreOptionData': {}, + 'currentFrame': 0x0, + 'wait': !0x1, + 'progressHelper': {}, + 'icons': { + 'lock': '' + }, + 'disableInput': !0x1, + 'disableControl': function(_0x5459be) { + if (_0x5459be) { + 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); + _0x378b5c.disableInput = true; + } else _0x378b5c.disableInput = !0x1; + }, + 'loadRoomsListTimer': null, + 'loadRoomsList': function() {}, + 'stopLoadRooms': function() { + _0x378b5c.loadRoomsListTimer && clearTimeout(_0x378b5c.loadRoomsListTimer); + }, + 'openRoom': function() {}, + 'isPaused': null, + 'setVolume': null, + 'setVariable': null, + 'simulateInput': null, + 'simulateInputFn': null, + 'toggleShader': null, + 'saveState': null, + 'screenRecord': null, + 'loadState': null, + 'quickSaveState': null, + 'quickLoadState': null, + 'changeStateSlot': null, + 'getScreenData': null, + 'getStateInfo': null, + 'setCheat': null, + 'resetCheat': null, + 'getGameCoreOptions': null, + 'classNames': { + 'dialog-container': _0x449eac({ + 'dialog-container': true + }), + 'tabs': _0x449eac({ + 'tabs': true + }), + 'dialog-title': _0x449eac({ + 'dialog-title': true + }), + 'dialog-content': _0x449eac({ + 'dialog-content': true + }), + 'dialog-buttons': _0x449eac({ + 'dialog-buttons': true + }), + 'overlay': _0x449eac({ + 'overlay': true + }), + 'key-setting-popup': _0x449eac({ + 'key-setting-popup': true + }), + 'tabs-panel': _0x449eac({ + 'tabs-panel': true + }), + 'tabs-content': _0x449eac({ + 'tabs-content': true + }), + 'button-container': _0x449eac({ + 'button-container': true + }), + 'set': _0x449eac({ + 'set': true + }), + 'active': _0x449eac({ + 'active': true + }), + 'btn-cancel': _0x449eac({ + 'btn-cancel': true + }), + 'btn-reset': _0x449eac({ + 'btn-reset': true + }), + 'btn-clear': _0x449eac({ + 'btn-clear': true + }), + 'btn-create': _0x449eac({ + 'btn-create': true + }), + 'btn-submit': _0x449eac({ + 'btn-submit': true + }), + 'btn-join-room': _0x449eac({ + 'btn-join-room': true + }), + 'btn-quit': _0x449eac({ + 'btn-quit': true + }), + 'btn-create-room': _0x449eac({ + 'btn-create-room': true + }), + 'netplay-player-name': _0x449eac({ + 'netplay-player-name': true + }), + 'netplay-roomlist': _0x449eac({ + 'netplay-roomlist': true + }), + 'netplay-room-name-input': _0x449eac({ + 'netplay-room-name-input': true + }), + 'netplay-room-password-input': _0x449eac({ + 'netplay-room-password-input': true + }), + 'netplay-create-room-set': _0x449eac({ + 'netplay-create-room-set': true + }), + 'netplay-room': _0x449eac({ + 'netplay-room': true + }), + 'modal': _0x449eac({ + 'modal': true + }), + 'modal__overlay': _0x449eac({ + 'modal__overlay': true + }), + 'modal__container': _0x449eac({ + 'modal__container': true + }), + 'modal__header': _0x449eac({ + 'modal__header': true + }), + 'modal__title': _0x449eac({ + 'modal__title': true + }), + 'modal__close': _0x449eac({ + 'modal__close': true + }), + 'modal__content': _0x449eac({ + 'modal__content': true + }), + 'modal__btn': _0x449eac({ + 'modal__btn': true + }), + 'modal__btn-primary': _0x449eac({ + 'modal__btn-primary': true + }), + 'micromodal-slide': _0x449eac({ + 'micromodal-slide': true + }), + 'modal__errmsg': _0x449eac({ + 'modal__errmsg': true + }), + 'modal__footer': _0x449eac({ + 'modal__footer': true + }), + 'cheats-add': _0x449eac({ + 'cheats-add': true + }), + 'cheats-list': _0x449eac({ + 'cheats-list': true + }), + 'cheat-code-input': _0x449eac({ + 'cheat-code-input': true + }), + 'cheat-name-input': _0x449eac({ + 'cheat-name-input': true + }), + 'ejs-switch': _0x449eac({ + 'ejs-switch': true + }), + 'ejs-delete-cheat': _0x449eac({ + 'ejs-delete-cheat': true + }) + }, + 'initShaders': function() { + for (var _0xa88a13 = _0x5032e6, _0x17edbf = Object.keys(_0xa88a13), _0x2c1832 = '', _0x26fb6a = 0x0; _0x26fb6a < _0x17edbf.length; _0x26fb6a += 0x1) _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); + }, + 'setGamepadDialog': function() { + var _0xa88a13 = this; + _0xa88a13.elements.dialogs.gamepad.innerHTML = '\n \n ' + + var _0x17edbf = '\n '), + _0x2c1832 = '\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n '+_0xa88a13.localization('Set')+'\n
\n
\n
') + if ('nes' === _0xa88a13.system) { + var _0x48ee51 = { + 0: 'B', + 2: 'SELECT', + 3: 'START', + 4: 'UP', + 5: 'DOWN', + 6: 'LEFT', + 7: 'RIGHT', + 8: 'A', + 24: _0xa88a13.localization('QUICK SAVE STATE'), + 25: _0xa88a13.localization('QUICK LOAD STATE'), + 26: _0xa88a13.localization('CHANGE STATE SLOT') + } + } else if ('snes' === _0xa88a13.system) { + var _0x48ee51 = { + 0: 'B', + 1: 'Y', + 2: 'SELECT', + 3: 'START', + 4: 'UP', + 5: 'DOWN', + 6: 'LEFT', + 7: 'RIGHT', + 8: 'A', + 9: 'X', + 10: 'L', + 11: 'R', + 24: _0xa88a13.localization('QUICK SAVE STATE'), + 25: _0xa88a13.localization('QUICK LOAD STATE'), + 26: _0xa88a13.localization('CHANGE STATE SLOT') + }; + } else if ('n64' === _0xa88a13.system) { + var _0x48ee51 = { + 0: 'B', + 3: 'START', + 4: 'UP', + 5: 'DOWN', + 6: 'LEFT', + 7: 'RIGHT', + 8: 'A', + 10: 'L', + 11: 'R', + 12: 'Z', + 19: 'L STICK UP', + 18: 'L STICK DOWN', + 17: 'L STICK LEFT', + 16: 'L STICK RIGHT', + 23: 'R STICK UP', + 22: 'R STICK DOWN', + 21: 'R STICK LEFT', + 20: 'R STICK RIGHT', + 24: _0xa88a13.localization('QUICK SAVE STATE'), + 25: _0xa88a13.localization('QUICK LOAD STATE'), + 26: _0xa88a13.localization('CHANGE STATE SLOT') + }; + } else if ('nds' === _0xa88a13.system) { + var _0x48ee51 = { + 0: 'B', + 1: 'Y', + 2: 'SELECT', + 3: 'START', + 4: 'UP', + 5: 'DOWN', + 6: 'LEFT', + 7: 'RIGHT', + 8: 'A', + 9: 'X', + 10: 'L', + 11: 'R', + 14: 'Microphone', + 24: _0xa88a13.localization('QUICK SAVE STATE'), + 25: _0xa88a13.localization('QUICK LOAD STATE'), + 26: _0xa88a13.localization('CHANGE STATE SLOT') + }; + } else { + var _0x48ee51 = { + 0: 'B', + 1: 'Y', + 2: 'SELECT', + 3: 'START', + 4: 'UP', + 5: 'DOWN', + 6: 'LEFT', + 7: 'RIGHT', + 8: 'A', + 9: 'X', + 10: 'L', + 11: 'R', + 12: 'L2', + 13: 'R2', + 14: 'L3', + 15: 'R3', + 19: 'L STICK UP', + 18: 'L STICK DOWN', + 17: 'L STICK LEFT', + 16: 'L STICK RIGHT', + 23: 'R STICK UP', + 22: 'R STICK DOWN', + 21: 'R STICK LEFT', + 20: 'R STICK RIGHT', + 24: _0xa88a13.localization('QUICK SAVE STATE'), + 25: _0xa88a13.localization('QUICK LOAD STATE'), + 26: _0xa88a13.localization('CHANGE STATE SLOT') + }; + } + if (['arcade', 'mame'].includes(_0xa88a13.system)) { + _0x48ee51[2] = _0xa88a13.localization('INSERT COIN'); + } + if (_0xa88a13.statesSupported === false) { + delete _0x48ee51[24]; + delete _0x48ee51[25]; + delete _0x48ee51[26]; + } + + for (var _0x501790 = [0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x0, 0x9, 0x1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x13, 0x12, 0x11, 0x10, 0x17, 0x16, 0x15, 0x14, 0x18, 0x19, 26], _0x50fd12 = function(_0x88827f) { + _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['tabs-content'])).innerHTML += _0x17edbf.replace(/{index}/g, _0x88827f), _0x501790.forEach(function(_0x1bf162) { + _0x48ee51[_0x1bf162] && (_0xa88a13.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x88827f)).innerHTML += _0x2c1832.replace(/{index}/g, _0x88827f).replace(/{id}/g, _0x1bf162).replace(/{label}/g, _0x48ee51[_0x1bf162])); + }), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'); + }, _0x3f0824 = 0x0; _0x3f0824 <= 0x3; _0x3f0824 += 0x1) _0x50fd12(_0x3f0824); + Object.keys(_0x378b5c.controllers).forEach(function(_0x23d419) { + _0x378b5c.controllers[_0x23d419] && Object.keys(_0x378b5c.controllers[_0x23d419]).forEach(function(_0x21e62d) { + var _0x294e35 = _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x21e62d, '"][data-index="').concat(_0x23d419, '"][data-type="1"]')), + _0x1849bc = _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x21e62d, '"][data-index="').concat(_0x23d419, '"][data-type="2"]')); + if (!_0x294e35 || !_0x1849bc) return !0x1; + var _0x19d43b = _0x378b5c.controllers[_0x23d419][_0x21e62d]; + _0x19d43b && (_0x19d43b.type && 0x1 !== 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) + 0x1)), _0x1849bc.setAttribute('data-value', _0x19d43b.value2))); + }); + }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-submit'])), 'click', function(_0x5f19bd) { + var _0x2c1832 = _0xa88a13.elements.dialogs.gamepad.querySelectorAll('input'), + _0x2844f7 = {}; + return Array.from(_0x2c1832).forEach(function(_0x33c024) { + var _0x5f19bd, _0x2c1832 = _0x33c024.getAttribute('data-index'), + _0x124d0a = _0x33c024.getAttribute('data-value'); + 0x2 === parseInt(_0x33c024.getAttribute('data-type'), 0xa) && (_0x5f19bd = _0x33c024.getAttribute('data-value')); + var _0x54b9af = _0x33c024.getAttribute('data-id'); + _0x2844f7[_0x2c1832] || (_0x2844f7[_0x2c1832] = {}), _0x2844f7[_0x2c1832][_0x54b9af] || (_0x2844f7[_0x2c1832][_0x54b9af] = {}), _0x124d0a && (_0x2844f7[_0x2c1832][_0x54b9af].value = _0x124d0a), _0x5f19bd && (_0x2844f7[_0x2c1832][_0x54b9af].value2 = _0x5f19bd); + }), _0x2593da.storage.set({ + 'controllers': _0x2844f7 + }), _0x378b5c.controllers = _0x2844f7, _0x132da7(_0xa88a13.elements.dialogs.gamepad, true), _0xa88a13.elements.container.focus(), _0x5f19bd.stopPropagation(), !0x1; + }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-reset'])), 'click', function(_0x5f19bd) { + _0x378b5c.controllers = JSON.parse(JSON.stringify(_0x378b5c.defaultControllers)) + localStorage.removeItem(_0x2593da.storage.key) + var _0x2c1832 = _0xa88a13.elements.dialogs.gamepad.querySelectorAll('input') + for (var i=0; i<_0x2c1832.length; i++) { + var player = _0x2c1832[i].getAttribute('data-index') + var controlOrGamepad = _0x2c1832[i].getAttribute('data-type') + var buttonId = _0x2c1832[i].getAttribute('data-id') + var a = (controlOrGamepad == 1) ? 'value' : 'value2' + if (_0x378b5c.defaultControllers[player] && _0x378b5c.defaultControllers[player][buttonId] && _0x378b5c.defaultControllers[player][buttonId][a]) { + if (controlOrGamepad == 1) { + _0x2c1832[i].value = _0x378b5c.keyMap[_0x378b5c.defaultControllers[player][buttonId][a]] + } else { + _0x2c1832[i].value = 'button ' + (parseInt(_0x378b5c.defaultControllers[player][buttonId][a])+1) + } + _0x2c1832[i].setAttribute('data-value', _0x378b5c.defaultControllers[player][buttonId][a]) + } else { + _0x2c1832[i].value = '' + _0x2c1832[i].setAttribute('data-value', '') + } + } + }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-clear'])), 'click', function(_0x5f19bd) { + var c = {0:{}, 1:{}, 2:{}, 3:{}}; + for (var k in _0x48ee51) { + c[0][k] = {}; + c[1][k] = {}; + c[2][k] = {}; + c[3][k] = {}; + } + _0x378b5c.controllers = c + localStorage.setItem(_0x2593da.storage.key, JSON.stringify({controllers: _0x378b5c.controllers})) + var _0x2c1832 = _0xa88a13.elements.dialogs.gamepad.querySelectorAll('input') + for (var i=0; i<_0x2c1832.length; i++) { + _0x2c1832[i].value = ''; + _0x2c1832[i].setAttribute('data-value', ''); + } + }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x16d598) { + return _0x132da7(_0xa88a13.elements.dialogs.gamepad, true), _0xa88a13.elements.container.focus(), _0x16d598.stopPropagation(), !0x1; + }), Array.from(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames.tabs, ' li'))).forEach(function(_0x523f7b) { + _0x1093f4.call(_0xa88a13, _0x523f7b, 'mousedown', function(_0xa99a78) { + _0x3a8e2f(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames.tabs, ' li')), _0x378b5c.classNames.active, !0x1), _0x3a8e2f(_0x523f7b, _0x378b5c.classNames.active, true); + var _0xb8a227 = _0x523f7b.querySelector('a').getAttribute('aria-controls'); + return Array.from(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames['tabs-content'], ' .').concat(_0x378b5c.classNames['tabs-panel']))).forEach(function(_0x1c29a4) { + _0x132da7(_0x1c29a4, true); + }), _0x132da7(_0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['tabs-content'], ' #').concat(_0xb8a227)), !0x1), _0xa99a78.stopPropagation(), !0x1; + }); + }), _0xbae705.call(_0xa88a13, _0xa88a13.elements.dialogs.gamepad.querySelector('[aria-controls="controls-0"]').parentNode, 'mousedown'); + var _0x11b11a = _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay)); + _0x1093f4.call(_0xa88a13, _0x11b11a, 'mousedown', function(_0x15c7de) { + _0x132da7(_0x11b11a, true), _0x15c7de.stopPropagation(); + }), Array.from(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames['button-container']))).forEach(function(_0x16f092) { + _0x1093f4.call(_0xa88a13, _0x16f092, 'mousedown', function(_0xdb1c93) { + _0xbae705.call(_0xa88a13, _0x16f092.querySelector('a.' .concat(_0x378b5c.classNames.set)), _0xdb1c93.type, true, {}); + }); + }), Array.from(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames['tabs-panel'], ' a.').concat(_0x378b5c.classNames.set))).forEach(function(_0x397818) { + _0x1093f4.call(_0xa88a13, _0x397818, 'mousedown', function(_0x1e1d79) { + var _0x2c1832 = _0x397818.parentNode.parentNode, + _0x4e649c = _0x2c1832.getAttribute('data-id'), + _0x431719 = _0x2c1832.getAttribute('data-index'), + _0x4a6f6f = _0x2c1832.getAttribute('data-label'); + _0x132da7(_0x11b11a, !0x1), _0x11b11a.setAttribute('data-id', _0x4e649c), _0x11b11a.setAttribute('data-index', _0x431719); + var _0x179623 = '[ ' .concat(_0x4a6f6f, ' ]'); + _0x378b5c.gamepad.gamepads[_0x431719] && _0x4e649c < 0x10 ? _0x179623 += '
Gamepad:' .concat(_0x378b5c.gamepad.gamepads[_0x431719].id, '
'+_0xa88a13.localization('Press keyboard or gamepad')+'
'+_0xa88a13.localization('Press escape (esc) to clear')) : _0x179623 += '
Press keyboard
'+_0xa88a13.localization('Press escape (esc) to clear'), _0x11b11a.querySelector('.' .concat(_0x378b5c.classNames['key-setting-popup'])).innerHTML = _0x179623, _0x1e1d79.stopPropagation(); + }); + }); + }, + 'setCacheDialog': function() { + var _0xa88a13 = this; + _0xa88a13.elements.dialogs.cache.innerHTML = '\n
\n
\n

'+_0xa88a13.localization('Cache Manager')+'

\n
\n
\n\n
\n \n
\n '), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x5d6721) { + return _0x132da7(_0xa88a13.elements.dialogs.cache, true), _0xa88a13.elements.container.focus(), _0x5d6721.stopPropagation(), !0x1; + }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-title'], ' a')), 'click', function(_0x46992d) { + return _0x27f4c4.romdb && (_0x27f4c4.romdb.clear(), _0xa88a13.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-content'])).innerHTML = '
'+_0xa88a13.localization('Empty')+'
'), _0x46992d.stopPropagation(), !0x1; + }); + }, + 'showLoading': function(_0x108b55) { + _0x4d8495.show('modal-6ed698f3d04061f5', { + 'closeByEsckey': !0x1 + }), _0x108b55 && console.log(''), _0x132da7(this.elements.dialogs.loading, !0x1); + }, + 'hideLoading': function() { + _0x4d8495.close(), _0x132da7(this.elements.dialogs.loading, true); + }, + 'setLoadingDialog': function() { + this.elements.dialogs.loading && (this.elements.dialogs.loading.innerHTML = '\n ')); + }, + 'setCheatDialog': function() { + var _0xa88a13 = this; + if (_0xa88a13.elements.dialogs.cheat) { + _0xa88a13.elements.dialogs.cheat.innerHTML = '\n \n\n \n\n \n '); + var _0x17edbf = _0xa88a13.elements.dialogs.cheat.querySelector('#modal-85cd7a1c543a484b'); + _0x1093f4.call(this, _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['cheats-add'])), 'click', function(_0x2a74b5) { + return _0x4d8495.show('modal-85cd7a1c543a484b', { + 'closeTrigger': 'data-modal-close' + }), !0x1; + }); + var _0x2c1832 = _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['cheats-list'])); + _0x1093f4.call(this, _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x1c01ce) { + var _0x184e2c = _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-name-input'])).value, + _0x15ccbb = _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-code-input'])).value; + if (_0x184e2c && _0x15ccbb) { + var _0x2c3108 = _0x2c1832.querySelectorAll('input:checked'); + _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-name-input'])).value = '', _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-code-input'])).value = '', _0x4d8495.close(); + var _0x5b2cff = _0xa88a13.cheats.length; + _0xa88a13.cheats.push([_0x184e2c, _0x15ccbb]), _0x2c1832.innerHTML += '
\n \n \n ×\n
'), _0x2c3108.forEach(function(_0x1fb248, _0x7bb84b) { + _0x2c1832.querySelector('#ejs-cheat-switch-' .concat(_0x7bb84b)).setAttribute('checked', 'checked'); + }); + } + return 'localStorage' in window && localStorage.setItem('' .concat(_0xa88a13.system, '-').concat(_0xa88a13.startName, '-cheats'), JSON.stringify(_0xa88a13.cheats)), _0x1c01ce.stopPropagation(), !0x1; + }); + var _0x257001 = function() { + if ('localStorage' in window) { + var _0x17edbf = localStorage.getItem('' .concat(_0xa88a13.system, '-').concat(_0xa88a13.startName, '-cheats')); + try { + _0x17edbf = JSON.parse(_0x17edbf); + } catch (_0x101b3e) {} + _0x17edbf && (_0xa88a13.cheats = _0x17edbf); + } + _0x2c1832.innerHTML = '', _0xa88a13.cheats && Array.isArray(_0xa88a13.cheats) && _0xa88a13.cheats.forEach(function(_0x245035, _0x116996) { + var _0x4ac35a = _0x245035[0x0]; + _0x245035[0x1]; + _0x2c1832.innerHTML += '
\n \n \n ×\n
'); + }); + }; + _0x1093f4.call(_0xa88a13, _0x2c1832, 'click', function(_0x576733) { + if (_0x576733.target && _0x576733.target.classList.contains(_0x378b5c.classNames['ejs-delete-cheat']) && _0x576733.target.getAttribute('data-idx')) { + var _0x5b10b7 = _0x576733.target.getAttribute('data-idx'); + _0xa88a13.cheats.splice(_0x5b10b7, 0x1), 'localStorage' in window && localStorage.setItem('' .concat(_0xa88a13.system, '-').concat(_0xa88a13.startName, '-cheats'), JSON.stringify(_0xa88a13.cheats)); + var _0x557895 = []; + _0x2c1832.querySelectorAll('input').forEach(function(_0xab0ba8, _0x1f3597) { + _0x557895[_0x1f3597] = !!_0x2c1832.querySelector('#ejs-cheat-switch-' .concat(_0x1f3597, ':checked')); + }), _0x557895.splice(_0x5b10b7, 0x1), _0x257001(), _0x557895.forEach(function(_0x2e22be, _0x2247c4) { + _0x2e22be && _0x2c1832.querySelector('#ejs-cheat-switch-' .concat(_0x2247c4)).setAttribute('checked', 'checked'); + }); + } + return _0x576733.stopPropagation(), !0x1; + }), _0x1093f4.call(_0xa88a13, _0xa88a13.elements.container, 'start-game', function(_0x4c266e) { + _0x257001(); + }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x4adb2c) { + return _0x132da7(_0xa88a13.elements.dialogs.cheat, true), _0x4adb2c.stopPropagation(), _0xa88a13.elements.container.focus(), !0x1; + }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-submit'])), 'click', function(_0x5785f6) { + return _0x378b5c.resetCheat(), _0x2c1832.querySelectorAll('input:checked').forEach(function(_0xeb7426, _0x45b02d) { + var _0x27e2c1 = _0xa88a13.cheats[_0xeb7426.value]; + _0x27e2c1 && _0x378b5c.setCheat(_0x45b02d, 0x1, _0x27e2c1[0x1]); + }), _0x132da7(_0xa88a13.elements.dialogs.cheat, true), _0xa88a13.elements.container.focus(), !0x1; + }), 'arcade' !== _0xa88a13.system && 'mame' !== _0xa88a13.system && 'mame2003' !== _0xa88a13.system && 'mame2010' !== _0xa88a13.system || (_0x1e2c68.element(_0xa88a13.elements.buttons.cheat) && _0x132da7(_0xa88a13.elements.buttons.cheat, true), _0x378b5c.allowCheat = !0x1), _0x378b5c.setCheat || (_0x132da7(_0xa88a13.elements.buttons.cheat, true), _0x378b5c.allowCheat = !0x1); + } + }, + 'setNetplayDialog': function() { + var _0xa88a13 = this, + _0x17edbf = this; + if (_0x17edbf.elements.dialogs.netplay) { + _0x17edbf.elements.dialogs.netplay.innerHTML = '\n
\n
\n

'+_0x17edbf.localization('Netplay')+'

\n
\n
\n \n\n \n
\n \n
\n\n \n \n \n \n \n \n \n \n \n \n '), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x3d4554) { + return _0x132da7(_0x17edbf.elements.dialogs.netplay, true), _0x378b5c.disableControl(!0x1), _0x378b5c.stopLoadRooms(), _0x3d4554.stopPropagation(), _0x17edbf.elements.container.focus(), !0x1; + }), window.setInterval(function() { + var _0xa88a13 = '', _0x17edbf.elements.widgets.netplay.innerHTML = _0xa88a13; + }, 0x1f4); + var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-9de6c4e9ce2b9361'), + _0x36bde0 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-85cd7a1c543a484a'), + _0x5289c1 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-7d8fd50ed642340b'), + _0x325651 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-5aa765d61d8327de'), + _0x3d0d28 = {}; + _0x378b5c.connection = new _0x4a2390.a(); + var _0x10d51e = _0xa88a13.socketUrl; + if (! _0x10d51e.endsWith('/')) { + _0x10d51e += '/'; + }; + _0x378b5c.connection.socketURL = '/', _0x378b5c.connection.socketURL = _0x10d51e, _0x378b5c.connection.socketMessageEvent = 'emulatorjs-message', _0x378b5c.connection.socketCustomEvent = 'emulatorjs-custom-message'; + var _0xda20e9 = _0x59aa33.info(); + _0x378b5c.connection.extra = { + 'name': _0x378b5c.playerName, + 'game_id': _0x17edbf.config.gameId, + 'browser_name': _0xda20e9.name, + 'room_name': ' ', + 'domain': document.domain + }, _0x378b5c.connection.socketMessageEvent = 'netplay', _0x378b5c.connection.enableFileSharing = true, _0x378b5c.connection.enableLogs = !0x1, _0x378b5c.connection.session = { + 'data': true + }, _0x378b5c.connection.sdpConstraints.mandatory = { + 'OfferToReceiveAudio': !0x1, + 'OfferToReceiveVideo': !0x1 + }, _0x378b5c.connection.onclose = function(_0x4fec07) {}, _0x378b5c.connection.iceServers = [{ + 'urls': 'turn:turn.emulatorjs.com:3478', + 'credential': 'dSnmrtehverella', + 'username': 'ejs' + }, { + 'urls': ['stun:stun.l.google.com:19302', 'stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302', 'stun:stun.l.google.com:19302?transport=udp'] + }], _0x378b5c.connection.maxParticipantsAllowed = 0x4, _0x378b5c.netPlayInitFrame = 0x0; + var _0x1eb137 = 0x0, + _0x52eb7d = !0x1; + Module.postMainLoop = function() { + var _0xa88a13; + if (_0x378b5c.currentFrame = parseInt(_0x378b5c.currentFrameNum(), 0xa), _0x378b5c.connected) + if (_0x1eb137 += 0x1, _0x378b5c.connection.isInitiator) _0x1eb137 >= 0x1 && function() { + for (var _0xa88a13 = [], _0x17edbf = _0x378b5c.currentFrame - 0x1; _0x17edbf < _0x378b5c.currentFrame; _0x17edbf += 0x1) _0x378b5c.inputsData[_0x17edbf] ? _0x378b5c.inputsData[_0x17edbf].forEach(function(_0x2a02da, _0x1b2066) { + _0xa88a13.push('' .concat(_0x2a02da.index, '|').concat(_0x2a02da.key, '|').concat(_0x2a02da.status, '|').concat(_0x2a02da.frame)); + }) : _0xa88a13.push('-1|||' .concat(_0x17edbf)); + _0x378b5c.connection.send(JSON.stringify({ + 'act': 'sync-control', + 'value': _0xa88a13 + })), _0x1eb137 = 0x0, _0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3125e4, _0x31ea67) { + _0x3125e4 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3125e4] = null, delete _0x378b5c.inputsData[_0x3125e4]); + }); + }(); + else { + if (_0x378b5c.coreOptionData[_0x378b5c.currentFrame]) { + var _0x2c1832 = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].key, + _0x4fd0cc = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].value; + _0x2593da.updateCoreOptions.call(_0x17edbf, _0x2c1832, _0x4fd0cc), delete _0x378b5c.coreOptionData[_0x378b5c.currentFrame]; + } + 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) { + _0x4bb42f.index >= 0x0 && _0x378b5c.simulateInputFn(_0x4bb42f.index, _0x4bb42f.key, _0x4bb42f.status); + }); + else { + _0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(); + var _0x3a10d1 = !0x1, + _0x42763c = Object.keys(_0x378b5c.inputsData); + 0x0 == _0x42763c.length && (_0x3a10d1 = true); + for (var _0x58af15 = 0x0; _0x58af15 < _0x42763c.length; _0x58af15 += 0x1) { + if (_0x42763c[_0x58af15] > _0x378b5c.currentFrame) { + console.log('lost', _0x378b5c.currentFrame), _0x3a10d1 = true; + break; + } + } + _0x3a10d1 ? _0x378b5c.wait || (!_0x52eb7d || _0x52eb7d < new Date().valueOf() - 0xbb8) && (_0x378b5c.inputsData = {}, _0x52eb7d = new Date().valueOf(), _0x378b5c.connection.send(JSON.stringify({ + 'act': 'sync-mem', + 'value': _0x378b5c.connection.userid + }), _0x378b5c.roomMaster)) : (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop()); + } + _0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3aa393, _0x3a7829) { + _0x3aa393 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3aa393] = null, delete _0x378b5c.inputsData[_0x3aa393]); + }); + } + }, _0x378b5c.connection.onopen = function(_0x4b10d6) { + _0x378b5c.connected = true, _0x378b5c.connection.isInitiator && (-0x1 === _0x378b5c.players.indexOf(_0x4b10d6.userid) && (_0x378b5c.players.filter(function(_0x3eafb3, _0xabd7b7) { + return null == _0x3eafb3; + }).length > 0x0 ? _0x378b5c.players.forEach(function(_0xbf0f19, _0xa9d540) { + null != _0xbf0f19 || _0x378b5c.players.includes(_0x4b10d6.userid) || (_0x378b5c.players[_0xa9d540] = _0x4b10d6.userid); + }) : _0x378b5c.players.push(_0x4b10d6.userid)), _0x378b5c.connection.send(JSON.stringify({ + 'act': 'get-players-result', + 'value': _0x378b5c.players, + 'coreOptions': _0x2593da.coreOptionsValues, + 'newuser': _0x4b10d6.userid, + 'master': _0x378b5c.connection.userid + }))), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf); + }, _0x378b5c.connection.onFileStart = function(_0x50eb3a) { + var _0x2c1832 = _0x50eb3a.name.split('-'); + '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 = {}; + }, _0x378b5c.connection.onFileProgress = function(_0x44a04b) { + var _0x17edbf = _0x378b5c.progressHelper[_0x44a04b.remoteUserId]; + _0x17edbf.current = _0x44a04b.currentPosition || _0x44a04b.maxChunks || _0x17edbf.max; + }, _0x378b5c.connection.onFileEnd = function(_0x45d454) { + _0x378b5c.hideLoading.call(_0x17edbf); + var _0x2c1832 = _0x45d454.name.split('-'), + _0x3795d9 = _0x2c1832[0x0] >> 0x0; + '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, { + 'responseType': 'arraybuffer' + }).then(function(_0x37db4c) { + _0x378b5c.inputsData = {}; + var _0x2c1832 = new Uint8Array(_0x37db4c.data); + _0x378b5c.loadState(_0x2c1832, _0x3795d9), _0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1, _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop(); + })) : '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, { + 'responseType': 'arraybuffer' + }).then(function(_0x4d241b) { + var _0x2c1832 = new Uint8Array(_0x4d241b.data); + _0x378b5c.loadState(_0x2c1832, _0x3795d9), _0x378b5c.wait = !0x1, _0x378b5c.disableInput = !0x1, _0x378b5c.connection.send(JSON.stringify({ + 'act': 'wait-end', + 'value': _0x378b5c.connection.userid + })), _0x378b5c.hideLoading.call(_0x17edbf), _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop(); + }))), _0x378b5c.connection.isInitiator || console.log('recv mem end', _0x378b5c.currentFrame, _0x45d454.name); + }; + var _0x3bdb35 = !0x1; + _0x378b5c.connection.onmessage = function(_0x32e81a) { + var _0x2c1832, _0x2dca58 = _0x32e81a.data || _0x32e81a; + try { + _0x2c1832 = JSON.parse(_0x2dca58); + } catch (_0x3fb9cc) { + _0x2c1832 = null; + } + if (_0x2c1832) { + 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() { + _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1; + }, 0x30))), 'sync-control' === _0x2c1832.act) { + var _0xb051c1 = _0x2c1832.value; + _0x17edbf.playing || _0x378b5c.wait; + var _0x2ef644 = _0x378b5c.connection.userid; + _0x378b5c.players.indexOf(_0x2ef644); + _0x378b5c.connection.isInitiator, _0xb051c1.forEach(function(_0x308105, _0x383237) { + var _0x2c1832 = _0x308105.split('|'), + _0x25a5c4 = _0x2c1832[0x0] >> 0x0, + _0x2b3afd = _0x2c1832[0x1] >> 0x0, + _0x4f5761 = _0x2c1832[0x2] >> 0x0, + _0x249303 = _0x2c1832[0x3] >> 0x0, + _0x54e0fd = _0x378b5c.currentFrame; + _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({ + 'index': _0x25a5c4, + 'key': _0x2b3afd, + 'status': _0x4f5761, + 'frame': _0x54e0fd + }), _0x378b5c.simulateInputFn(_0x25a5c4, _0x2b3afd, _0x4f5761)), _0x3bdb35 || _0x54e0fd - 0xa >= _0x249303 && (_0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x3bdb35 = true, _0x378b5c.wait = true, setTimeout(function() { + _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1; + }, 0x30))) : ('' !== _0x25a5c4 && _0x378b5c.inputsData[_0x249303].push({ + 'index': _0x25a5c4, + 'key': _0x2b3afd, + 'status': _0x4f5761, + 'frame': _0x249303 + }), _0x378b5c.inputsData[_0x378b5c.currentFrame] && _0x27f4c4.Module.resumeMainLoop(), _0x54e0fd + 0xa <= _0x249303 && _0x249303 > _0x378b5c.netPlayInitFrame + 0x64 && _0x378b5c.connection.send(JSON.stringify({ + 'act': 'short-pause', + 'value': _0x2ef644 + }), _0x378b5c.roomMaster)); + }); + } + if (_0x2c1832.act, _0x2c1832.act, 'update-core-option' === _0x2c1832.act && (_0x378b5c.connection.isInitiator || (_0x378b5c.coreOptionData[_0x2c1832.frame] = { + 'key': _0x2c1832.key, + 'value': _0x2c1832.value + })), 'restart-game' === _0x2c1832.act && (_0x378b5c.inputsData = {}, _0x378b5c.connection.send(JSON.stringify({ + 'act': 'sync-mem', + 'value': _0x378b5c.connection.userid + }), _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) { + _0x378b5c.wait = true, _0x378b5c.systemPause(0x1); + var _0x2a5bce = _0x2c1832.value; + _0x378b5c.disableControl(true), _0x378b5c.connection.send(JSON.stringify({ + 'act': 'wait', + 'value': _0x2a5bce + })); + for (var _0x8624ae = _0x378b5c.getStateInfo().split('|'), _0x99810a = _0x8624ae[0x0] >> 0x0, _0x96975a = new Uint8Array(_0x99810a), _0x4aea80 = _0x8624ae[0x1] >> 0x0, _0x2d2ba0 = 0x0; _0x2d2ba0 < _0x99810a; _0x2d2ba0 += 0x1) _0x96975a[_0x2d2ba0] = _0x27f4c4.Module.getValue(_0x4aea80 + _0x2d2ba0); + _0x27f4c4._FS.createDataFile('/', 'game.state', _0x96975a, true, true), _0x27f4c4.Module.cwrap('load_state', 'number', ['string', 'number'])('game.state', 0x0), _0x27f4c4.FS.unlink('game.state'), _0x378b5c.inputsData = {}; + var _0x49054f = new File([_0x96975a], '' .concat(0x0, '-game.state'), { + 'type': '', + 'lastModified': new Date() + }); + _0x378b5c.connection.shareFile(_0x49054f, _0x2a5bce); + } + if (_0x2c1832.act, 'get-players-result' === _0x2c1832.act && (_0x378b5c.players = _0x2c1832.value, _0x378b5c.roomMaster = _0x2c1832.master, _0x2c1832.newuser === _0x378b5c.connection.userid)) { + var _0x418ccb = _0x2593da.coreOptionsValues; + _0x2c1832.coreOptions && Object.keys(_0x2c1832.coreOptions).forEach(function(_0x3f4c8f) { + _0x418ccb[_0x3f4c8f] !== _0x2c1832.coreOptions[_0x3f4c8f] && _0x2593da.updateCoreOptions.call(_0x17edbf, _0x3f4c8f, _0x2c1832.coreOptions[_0x3f4c8f]); + }), _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.disableControl(true), setTimeout(function() { + _0x378b5c.connection.send(JSON.stringify({ + 'act': 'sync-mem', + 'value': _0x378b5c.connection.userid + }), _0x378b5c.roomMaster); + }, 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); + } + } + }, _0x378b5c.connection.onUserStatusChanged = function(_0x4188ba) { + if ('offline' === _0x4188ba.status) { + var _0x17edbf = _0x378b5c.players.indexOf(_0x4188ba.userid); + _0x17edbf >= 0x0 && (_0x378b5c.players[_0x17edbf] = null); + } + _0x4188ba.status; + }, _0x378b5c.connection.onExtraDataUpdated = function(_0x20ce61) { + _0x20ce61.userid === _0x378b5c.connection.userid && (_0x378b5c.connection.extra = _0x20ce61.extra); + }, _0x378b5c.connection.onleave = function(_0x30ebc6) { + if (_0x30ebc6.userid) { + var _0x2c1832 = _0x378b5c.players.indexOf(_0x30ebc6.userid); + _0x2c1832 >= 0x0 && (_0x378b5c.players[_0x2c1832] = null); + } + _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({ + 'act': 'wait-end', + 'value': _0x378b5c.connection.userid + }))), _0x378b5c.openRoom(_0x17edbf), _0x378b5c.inputsData = {}, _0x378b5c.hideLoading.call(_0x17edbf); + }; + var _0x2fba43 = function() { + try { + _0x378b5c.connection.onbeforeunload(); + } catch (_0xac619d) {} + _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) { + _0x132da7(_0x3d296d, !0x1); + }), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf); + }; + _0x378b5c.connection.close = _0x2fba43, _0x378b5c.connection.disconnect = _0x2fba43, _0x378b5c.connection.leave = _0x2fba43; + var _0x3f9c57, _0x10c0ad = function(_0x42ff74, _0x306f0b, _0x345d4d) { + _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) { + _0x132da7(_0x2911fb, true); + }), _0x378b5c.connection.socket && _0x378b5c.connection.socket.on('set-isInitiator-true', function(_0x31da46) { + _0x31da46 === _0x378b5c.connection.sessionid && (_0x378b5c.connection.socket.emit('extra-data-updated', _0x378b5c.connection.extra), _0x378b5c.connection.send(JSON.stringify({ + 'act': 'room-master', + 'value': _0x378b5c.connection.userid + })), _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) { + _0x132da7(_0x132034, !0x1); + })); + })) : (_0x4d8495.close(), _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = _0x345d4d, _0x4d8495.show('modal-7d8fd50ed642340b', { + 'closeTrigger': 'data-modal-close' + })); + }, + _0x1e0cdb = function(_0x5b3f13) { + var _0x2c1832 = _0x5b3f13.target.getAttribute('data-id'); + if ('Y' === _0x5b3f13.target.getAttribute('data-password')) _0x4d8495.show('modal-5aa765d61d8327de', { + 'closeTrigger': 'data-modal-close' + }), _0x325651.setAttribute('data-id', _0x2c1832); + else { + _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.userid = _0x378b5c.connection.token(); + try { + _0x378b5c.connection.join(_0x2c1832, _0x10c0ad); + } catch (_0x2767b9) { + _0x378b5c.hideLoading.call(_0x17edbf), _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = 'Error', _0x4d8495.show('modal-7d8fd50ed642340b', { + 'closeTrigger': 'data-modal-close' + }); + } + } + return _0x5b3f13.stopPropagation(), !0x1; + }; + _0x378b5c.loadRoomsList = function() { + _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), true), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), true); + var listUrl = _0x17edbf.listUrl + if (! listUrl.endsWith('/')) { + listUrl += '/'; + }; + var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])).querySelector('tbody'), + _0x5cf2be = [listUrl, 'list?game_id=', _0x17edbf.config.gameId, '&domain=', document.domain].join(''); + _0x550f17.a.get(_0x5cf2be, {}).then(function(_0x37c60b) { + if (_0x37c60b.data) { + var _0x4782da = [], + _0x28e87d = []; + _0x2c1832.querySelectorAll('tr').forEach(function(_0x1e5a22) { + _0x28e87d.push(_0x1e5a22.getAttribute('id')); + }), Object.keys(_0x37c60b.data).forEach(function(_0x47ae0e) { + var _0x4a8f4c = _0x37c60b.data[_0x47ae0e]; + if (_0x4782da.push(_0x47ae0e), _0x28e87d.includes(_0x47ae0e)) { + var _0x2d672f = _0x2c1832.querySelector('tr[id="' .concat(_0x47ae0e, '"]')); + _0x2c1832.removeChild(_0x2d672f); + } + var _0x295f41 = document.createElement('tr'); + _0x295f41.setAttribute('id', _0x47ae0e); + var _0xa2ea61 = _0x4a8f4c.password ? _0x378b5c.icons.lock : '', + _0x5452b6 = _0x4a8f4c.password ? 'Y' : 'N', + _0xb3121d = _0x4a8f4c.current < _0x4a8f4c.max ? 'Join') : '', + _0x5c8146 = _0x4a8f4c.country ? _0x4a8f4c.country : '?'; + _0x295f41.innerHTML = '[' .concat(_0x5c8146, '] ').concat(_0xa2ea61, ' ').concat(_0x4a8f4c.room_name, '').concat(_0x4a8f4c.current, '/').concat(_0x4a8f4c.max, '').concat(_0xb3121d, ''), _0x1093f4.call(_0xa88a13, _0x295f41.querySelector('.' .concat(_0x378b5c.classNames['btn-join-room'])), 'click', _0x1e0cdb), _0x2c1832.appendChild(_0x295f41); + }), _0x2c1832.querySelectorAll('tr').forEach(function(_0x24dcf7) { + _0x4782da.includes(_0x24dcf7.id) || _0x2c1832.removeChild(_0x24dcf7); + }); + } + _0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0); + }).catch(function(_0x227055) { + console.log('Network Error', _0x227055), _0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0); + }); + }, _0x378b5c.openRoom = function(_0x10625f) { + _0x378b5c.stopLoadRooms(), _0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), true), _0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), !0x1), _0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), true), _0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), !0x1), _0x378b5c.resetCheat(), _0x132da7(_0x10625f.elements.buttons.cheat, true); + var _0x17edbf = _0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), + _0x2c1832 = _0x17edbf.querySelector('[data-room-password]'); + null === _0x378b5c.connection.password ? _0x132da7(_0x2c1832, true) : (_0x132da7(_0x2c1832, !0x1), _0x2c1832.querySelector('span').innerText = _0x378b5c.connection.password); + var _0x18c1cb = _0x17edbf.querySelector('tbody'); + _0x18c1cb.innerHTML = '', _0x17edbf.querySelector('strong').innerText = _0x3d0d28.room_name, _0x378b5c.players.forEach(function(_0x938d55, _0xf3d39a) { + var _0x2c1832 = null; + if (_0x938d55 && (_0x378b5c.connection.peers[_0x938d55] ? _0x2c1832 = _0x378b5c.connection.peers[_0x938d55].extra : _0x378b5c.connection.userid === _0x938d55 && (_0x2c1832 = _0x378b5c.connection.extra), _0x2c1832 && _0x2c1832.name)) { + var _0x564064 = document.createElement('tr'); + _0x564064.innerHTML = '' .concat(_0xf3d39a + 0x1, '').concat(_0x2c1832.name, ''), _0x18c1cb.appendChild(_0x564064); + } + }); + }, _0x1093f4.call(this, _0x325651.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x9ac969) { + var _0x2c1832 = _0x325651.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value; + _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.password = _0x2c1832; + var _0xcf7207 = _0x325651.getAttribute('data-id'); + _0x378b5c.connection.join(_0xcf7207, function(_0x1a0deb, _0x1ef6c8, _0x1ad18e) { + _0x10c0ad(_0x1a0deb, 0x0, _0x1ad18e), _0x1a0deb && _0x325651.classList.remove(_0x449eac({ + 'is-open': true + })); + }), _0x9ac969.stopPropagation(); + }), _0x1093f4.call(this, _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x43f795) { + var _0x17edbf = _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['netplay-player-name'])).value; + _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(); + }), _0x1093f4.call(this, _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x202cf6) { + var _0x2c1832 = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-name-input'])).value; + _0x2c1832 = _0x2c1832.replace(/<|>/g, ''); + var _0x3510ed = _0x36bde0.querySelector('select[data-max-players] option:checked').value; + _0x3510ed < 0x2 && (_0x3510ed = 0x2), _0x3510ed > 0x4 && (_0x3510ed = 0x4); + for (var _0x1264b2 = 0x0; _0x1264b2 < _0x3510ed; _0x1264b2++) _0x378b5c.players[_0x1264b2] = null; + _0x378b5c.connection.maxParticipantsAllowed = _0x3510ed; + var _0x140bcf = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value; + _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) { + _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; + })) : _0x3f9c57.closeModal(), _0x202cf6.stopPropagation(); + }), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), 'click', function(_0x48cb26) { + return _0x3f9c57 = _0x4d8495.show('modal-85cd7a1c543a484a', { + 'closeTrigger': 'data-modal-close', + 'onClose': function() { + _0x17edbf.elements.container.focus(); + } + }), _0x48cb26.stopPropagation(), !0x1; + }), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), 'click', function(_0x68459d) { + return _0x378b5c.connection.close(), _0x378b5c.stopLoadRooms(), _0x378b5c.loadRoomsList(), _0x378b5c.inputsData = {}, _0x68459d.stopPropagation(), !0x1; + }); + } + window._0x378b5c = _0x378b5c + }, + 'initKeyboard': function() { + var _0xa88a13 = this, + _0x17edbf = this, + _0x2c1832 = this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay)); + _0x1093f4.call(this, document.body, 'keydown keyup', function(_0x459b32) { + if (_0x459b32.which >= 0x70 && _0x459b32.which <= 0x7b); + else { + var _0x335c01 = !_0xa88a13.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden, + _0x2eb03e = 'keydown' === _0x459b32.type; + if (_0x2eb03e && _0x335c01) { + var _0x1a3a47 = _0x2c1832.getAttribute('data-index'), + _0x1394cb = _0x2c1832.getAttribute('data-id'), + _0x2c8fd1 = null; + if (_0x459b32.key && _0x378b5c.keyMap[_0x459b32.keyCode] === 'escape') { + (_0x2c8fd1 = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1394cb, '"][data-index="').concat(_0x1a3a47, '"][data-type="1"]'))).setAttribute('data-value', '') + _0x2c8fd1.value = '' + (_0x2c8fd1 = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1394cb, '"][data-index="').concat(_0x1a3a47, '"][data-type="2"]'))).setAttribute('data-value', '') + _0x2c8fd1.value = '' + _0x132da7(_0x2c1832, true); + return; + }; + var _0x1a3a47 = _0x2c1832.getAttribute('data-index'), + _0x1394cb = _0x2c1832.getAttribute('data-id'), + _0x2c8fd1 = null; + _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); + } else Object.keys(_0x378b5c.controllers).forEach(function(_0x3863d2) { + Object.keys(_0x378b5c.controllers[_0x3863d2]).forEach(function(_0x509939) { + if (parseInt(_0x378b5c.controllers[_0x3863d2][_0x509939].value, 0xa) === _0x459b32.keyCode && ['24', '25', '26'].includes(_0x509939) && _0x459b32.type == 'keydown' && ! _0x459b32.repeat) { + if (_0x509939 == '24') {//save + _0x378b5c.quickSaveState() + } else if (_0x509939 == '25') {//load + _0x378b5c.quickLoadState() + } else if (_0x509939 == '26') {//load + _0x378b5c.changeStateSlot() + } + // quick save/load button + } + parseInt(_0x378b5c.controllers[_0x3863d2][_0x509939].value, 0xa) === _0x459b32.keyCode && (_0x2eb03e ? _0x509939 >= 0x10 && _0x509939 <= 0x17 ? _0x378b5c.simulateInput(_0x3863d2, _0x509939, 0x7fff) : _0x378b5c.simulateInput(_0x3863d2, _0x509939, 0x1) : _0x378b5c.simulateInput(_0x3863d2, _0x509939, 0x0)); + }); + }); + } + }), document.body.addEventListener('keydown', function(_0x14d612) { + var _0x2c1832 = _0x14d612.keyCode ? _0x14d612.keyCode : _0x14d612.which; + [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(); + }); + }, + 'initGamepad': function() { + var _0xa88a13 = this, + _0x17edbf = this, + _0x2c1832 = this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay)), + _0x181250 = new _0x4ad1c6[('Gamepad')](); + _0x378b5c.gamepad = _0x181250, _0x181250.init() && (_0x181250.bind(_0x4ad1c6.Gamepad.Event.TICK, function(_0x2fe35d) { + _0x2fe35d.forEach(function(_0x2b21f8) { + var _0x17edbf; + _0x2b21f8 && _0x2b21f8.axes && _0x2b21f8.axes[0x9] && ((_0x17edbf = _0x2b21f8.axes[0x9]) < 3.28571 ? 0x1 == _0x17edbf ? (_0x2b21f8.extra_buttons[0xc].pressed || (_0x2b21f8.extra_buttons[0xc] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xc, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })), _0x2b21f8.extra_buttons[0xe].pressed || (_0x2b21f8.extra_buttons[0xe] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xe, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + }))) : _0x17edbf <= -0.7142857 && _0x17edbf >= -0.714291 ? (_0x2b21f8.extra_buttons[0xc].pressed || (_0x2b21f8.extra_buttons[0xc] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xc, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })), _0x2b21f8.extra_buttons[0xf].pressed || (_0x2b21f8.extra_buttons[0xf] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xf, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + }))) : _0x17edbf >= 0.42856 && _0x17edbf <= 0.42858 ? (_0x2b21f8.extra_buttons[0xd].pressed || (_0x2b21f8.extra_buttons[0xd] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xd, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })), _0x2b21f8.extra_buttons[0xe].pressed || (_0x2b21f8.extra_buttons[0xe] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xe, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + }))) : _0x17edbf >= -0.14287 && _0x17edbf <= -0.14285 ? (_0x2b21f8.extra_buttons[0xd].pressed || (_0x2b21f8.extra_buttons[0xd] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xd, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })), _0x2b21f8.extra_buttons[0xf].pressed || (_0x2b21f8.extra_buttons[0xf] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xf, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + }))) : _0x17edbf <= -0x1 && _0x17edbf >= -1.01 ? _0x2b21f8.extra_buttons[0xc].pressed || (_0x2b21f8.extra_buttons[0xc] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xc, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })) : _0x17edbf >= 0.142857 && _0x17edbf <= 0.142858 ? _0x2b21f8.extra_buttons[0xd].pressed || (_0x2b21f8.extra_buttons[0xd] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xd, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })) : _0x17edbf >= 0.7142857 && _0x17edbf <= 0.7142858 ? _0x2b21f8.extra_buttons[0xe].pressed || (_0x2b21f8.extra_buttons[0xe] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xe, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })) : _0x17edbf <= -0.42857 && _0x17edbf >= -0.42858 && (_0x2b21f8.extra_buttons[0xf].pressed || (_0x2b21f8.extra_buttons[0xf] = { + 'pressed': true, + 'value': 0x1 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { + 'index': 0xf, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + }))) : (_0x2b21f8.extra_buttons[0xc].pressed && (_0x2b21f8.extra_buttons[0xc] = { + 'pressed': !0x1, + 'value': 0x0 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, { + 'index': 0xc, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })), _0x2b21f8.extra_buttons[0xd].pressed && (_0x2b21f8.extra_buttons[0xd] = { + 'pressed': !0x1, + 'value': 0x0 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, { + 'index': 0xd, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })), _0x2b21f8.extra_buttons[0xe].pressed && (_0x2b21f8.extra_buttons[0xe] = { + 'pressed': !0x1, + 'value': 0x0 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, { + 'index': 0xe, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })), _0x2b21f8.extra_buttons[0xf].pressed && (_0x2b21f8.extra_buttons[0xf] = { + 'pressed': !0x1, + 'value': 0x0 + }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, { + 'index': 0xf, + 'gamepad': _0x2b21f8, + 'gamepadIndex': _0x2b21f8.index + })))); + }); + }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, function(_0x15761a) { + if (!_0xa88a13.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden) { + var _0x387018, _0xdd4205 = parseInt(_0x2c1832.getAttribute('data-index'), 0xa), + _0x1f4ee2 = _0x2c1832.getAttribute('data-id'); + if (_0x15761a.gamepad.index === parseInt(_0xdd4205, 0xa)) { + for (var _0x211087 = 0x0; _0x211087 < 0x20 && ((_0x387018 = _0x15761a.gamepad.buttons[_0x211087]) || (_0x387018 = _0x15761a.gamepad.extra_buttons[_0x211087]), !_0x387018 || !('number' == typeof _0x387018 && 0x1 === _0x387018 || 'number' == typeof _0x387018.value && 0x1 === _0x387018.value)); _0x211087 += 0x1); + var _0x126d2d = null; + (_0x126d2d = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1f4ee2, '"][data-index="').concat(_0xdd4205, '"][data-type="2"]'))).setAttribute('data-value', _0x15761a.index), _0x126d2d.value = 'button ' .concat(_0x15761a.index + 0x1), _0x132da7(_0x2c1832, true); + } + } else Object.keys(_0x378b5c.controllers[_0x15761a.gamepad.index.toString()]).forEach(function(_0x3cf4d3) { + var _0x5cf388 = _0x15761a.gamepad.index.toString(); + if (parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(_0x15761a.index, 0xa) && ['24', '25', '26'].includes(_0x3cf4d3)) { + if (_0x3cf4d3 == '24') {//save + _0x378b5c.quickSaveState() + } else if (_0x3cf4d3 == '25') {//load + _0x378b5c.quickLoadState() + } else if (_0x3cf4d3 == '26') {//load + _0x378b5c.changeStateSlot() + } + } + parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(_0x15761a.index, 0xa) && parseInt(_0x5cf388, 0xa) === parseInt(_0x15761a.gamepad.index, 0xa) && _0x378b5c.simulateInput(_0x5cf388, _0x3cf4d3, 0x1); + }); + }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.BUTTON_UP, function(_0x3220b3) { + Object.keys(_0x378b5c.controllers).forEach(function(_0x302c3e) { + Object.keys(_0x378b5c.controllers[_0x302c3e]).forEach(function(_0x14eb8a) { + parseInt(_0x378b5c.controllers[_0x302c3e][_0x14eb8a].value2, 0xa) === parseInt(_0x3220b3.index, 0xa) && parseInt(_0x302c3e, 0xa) === parseInt(_0x3220b3.gamepad.index, 0xa) && _0x378b5c.simulateInput(_0x302c3e, _0x14eb8a, 0x0); + }); + }); + }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.AXIS_CHANGED, function(_0x31f017) { + var value = function(value) { + if (value > 0.5 || value < 0.5) { + return (value > 0) ? 1 : -1; + } else { + return 0; + } + }(parseFloat(_0x31f017.value)); + if (!_0xa88a13.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden) { + if (value !== 0) { + var _0x1f4ee2 = _0x2c1832.getAttribute('data-id'), + _0xdd4205 = parseInt(_0x2c1832.getAttribute('data-index'), 0xa); + var _0x126d2d = _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1f4ee2, '"][data-index="').concat(_0xdd4205, '"][data-type="2"]')) + _0x126d2d.setAttribute('data-value', _0x31f017.axis + ':' + value) + _0x126d2d.value = _0x31f017.axis + ':' + value + _0x132da7(_0x2c1832, true) + } + } else { + if (! _0x378b5c.prevButtons) { + _0x378b5c.prevButtons = {} + } + var quit = false + var _0x5cf388 = _0x31f017.gamepad.index.toString(); + if (! _0x378b5c.prevButtons[_0x5cf388]) { + _0x378b5c.prevButtons[_0x5cf388] = {} + } + if (! _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis]) { + _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis] = 0 + } + if (! _0x378b5c.prevButtons[_0x5cf388].buttonID) { + _0x378b5c.prevButtons[_0x5cf388].buttonID = 0 + } + for (var w=0; w 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x10, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x11, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x11, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x10, 0x0))), 'LEFT_STICK_Y' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x12, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x13, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x13, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x12, 0x0))), 'RIGHT_STICK_X' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x14, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x15, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x15, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x14, 0x0))), 'RIGHT_STICK_Y' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x16, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x17, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x17, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x16, 0x0))); + }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.DISCONNECTED, function(_0x1c996a) { + [0x0, 0x1, 0x2, 0x3].forEach(function(_0x429f30) { + var _0x2c1832 = _0x181250.gamepads[_0x429f30]; + _0x17edbf.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x429f30, ' .gamepad-name')).innerHTML = _0x2c1832 ? _0x2c1832.id : 'n/a'; + }); + }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.CONNECTED, function(_0x748f24) { + Object.keys(_0x181250.gamepads).forEach(function(_0x327c74) { + var _0x2c1832 = _0x181250.gamepads[_0x327c74]; + _0x17edbf.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x327c74, ' .gamepad-name')).innerHTML = _0x2c1832 ? _0x2c1832.id : 'n/a'; + }); + })); + }, + 'setShader': function(_0x4cbec3) { + if ('disabled' === _0x4cbec3) _0x27f4c4.FS.unlink('/shader/shader.glslp', ''), _0x378b5c.toggleShader && _0x378b5c.toggleShader(0x0); + else { + _0x378b5c.toggleShader && _0x378b5c.toggleShader(0x0); + var _0x17edbf = '/shader/' .concat(_0x4cbec3); + _0x27f4c4.FS.writeFile('/shader/shader.glslp', function(_0x52407e) { + if (!(_0x52407e instanceof Int32Array)) throw new Error('uintArrayToString: Only accepts Int32Array parameter'); + for (var _0x17edbf = '', _0x2c1832 = 0x0, _0x4d451e = _0x52407e.length; _0x2c1832 < _0x4d451e; _0x2c1832 += 0x1) { + var _0x37c7b6 = _0x52407e[_0x2c1832]; + if (_0x37c7b6 > 0xffff) throw new Error('Invalid value attempted to be serialised'); + _0x17edbf += String.fromCharCode(_0x37c7b6); + } + return _0x17edbf; + }(new Int32Array(_0x27f4c4.FS.readFile(_0x17edbf)))), _0x378b5c.toggleShader && _0x378b5c.toggleShader(0x1); + } + }, + 'toggleVirtualGamepad': function(_0x1ed80b) { + var _0xa88a13 = this; + if (null === _0x378b5c.virtualGamepadContainer) { + _0x378b5c.virtualGamepadContainer = _0x428003('div', { + 'class': _0x449eac({ + 'ejs-virtual-gamepad': true + }), + 'hidden': '' + }); + this.elements.container.appendChild(_0x378b5c.virtualGamepadContainer); + var blockCSS = 'height:31px;text-align:center;border:1px solid #ccc;border-radius:5px;line-height:31px;'; + var html = ''; + if (['snes', 'nds'].includes(_0xa88a13.system)) { + var elements = { + order: ['X','Y','A','B'], + orderCSS: ['left:40px;', 'top:40px;', 'left:81px;top:40px;', 'left:40px;top:80px;'], + LandR: true + } + } else if (['gba', 'gb', 'vb', 'nes'].includes(_0xa88a13.system)) { + var elements = { + order: ['B','A'], + orderCSS: ['left:-10px;top:70px;', 'left:60px;top:70px;'], + LandR: (_0xa88a13.system === 'gba') + } + } else if (['n64'].includes(_0xa88a13.system)) { + var elements = { + order: ['B','A'], + orderCSS: ['left:-10px;top:95px;', 'left:40px;top:150px;'], + LandR: true + } + } else { + var elements = { + order: ['Y','X','B','A'], + orderCSS: ['left:40px;', 'top:40px;', 'left:81px;top:40px;', 'left:40px;top:80px;'], + LandR: true + } + } + html += '
'; + + html += '
'; + if (elements.LandR === true) { + if (_0xa88a13.system === 'n64') { + html += '
L
'; + html += '
Z
'; + html += '
R
'; + } else { + html += '
L
'; + html += '
R
'; + } + } + html += '
'; + + html += '
'; + + html += '
'; + if (_0xa88a13.system === 'n64') { + html += '
'+_0xa88a13.localization('Menu')+'
'; + html += '
'+_0xa88a13.localization('Start')+'
'; + } else { + html += '
'+_0xa88a13.localization('Start')+'
'; + html += '
'+_0xa88a13.localization('Menu')+'
'; + html += '
'+_0xa88a13.localization('Select')+'
'; + } + html += '
'; + + html += '
'; + + if (_0xa88a13.system === 'n64') { + html += '
'; + html += '
'; + html += '
'; + html += '
'; + } + + for (var i=0; i'+elements.order[i]+'
'; + } + + html += '
'; + + _0x378b5c.virtualGamepadContainer.innerHTML = html; + _0x132da7(_0x378b5c.virtualGamepadContainer, !_0x1ed80b); + var _0x17edbf = _0x3a58c8.a.create({ + 'zone': _0x530042.call(this, '.' .concat(_0x449eac({ + 'ejs-virtual-gamepad': true + }), ' .').concat(_0x449eac({ + 'left': true + }))), + 'mode': 'static', + 'position': { + 'left': '50%', + 'top': '50%' + }, + 'color': 'red' + }); + function inputs() { + if (_0xa88a13.system === 'n64') { + var inputLocation; + if (_0x2593da && typeof _0x2593da.getCoreOptionsValues == 'function') { + inputLocation = _0x2593da.getCoreOptionsValues()['joystick-input']; + } + if (inputLocation === 'd-pad') { + return { + downVal: 1, + 4: 4, + 5: 5, + 6: 6, + 7: 7 + } + } else { + return { + downVal: 0x7fff, + 4: 19, + 5: 18, + 6: 17, + 7: 16 + } + } + } else { + return { + downVal: 1, + 4: 4, + 5: 5, + 6: 6, + 7: 7 + } + } + } + _0x17edbf.on('end', function(_0x27f006, _0x1fb527) { + _0x378b5c.syncInput(0, inputs[4], 0); + _0x378b5c.syncInput(0, inputs[5], 0); + _0x378b5c.syncInput(0, inputs[6], 0); + _0x378b5c.syncInput(0, inputs[7], 0); + }); + _0x17edbf.on('move', function(_0x1b060e, _0x4ae7d6) { + var _0x2c1832 = _0x4ae7d6.angle.degree; + _0x2c1832 >= 0x1e && _0x2c1832 < 0x96 ? _0x378b5c.syncInput(0, inputs()[4], inputs().downVal) : window.setTimeout(function() { + _0x378b5c.syncInput(0, inputs()[4], 0); + }, 0x1e); + _0x2c1832 >= 0xd2 && _0x2c1832 < 0x14a ? _0x378b5c.syncInput(0, inputs()[5], inputs().downVal) : window.setTimeout(function() { + _0x378b5c.syncInput(0, inputs()[5], 0); + }, 0x1e); + _0x2c1832 >= 0x78 && _0x2c1832 < 0xf0 ? _0x378b5c.syncInput(0, inputs()[6], inputs().downVal) : window.setTimeout(function() { + _0x378b5c.syncInput(0, inputs()[6], 0); + }, 0x1e); + _0x2c1832 >= 0x12c || _0x2c1832 >= 0x0 && _0x2c1832 < 0x3c ? _0x378b5c.syncInput(0, inputs()[7], inputs().downVal) : window.setTimeout(function() { + _0x378b5c.syncInput(0, inputs()[7], 0); + }, 0x1e); + }); + var _0x2c1832 = _0x449eac({ + 'virtual-gamepad': true + }), + _0x2ec721 = _0x449eac({ + 'touch': true + }); + if (! _0x59aa33.isIos) { + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832)), 'touchmove', function(_0x2ae626) { + _0x2ae626.stopPropagation(); + }); + } + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_a': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x185083) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x185083.type) ? (_0x3a8e2f(_0x185083.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0x0, 0x8, 0x0); + }, 0x1e)) : (_0x3a8e2f(_0x185083.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x8, 0x1)), _0x185083.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_b': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x213c3d) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x213c3d.type) ? (_0x3a8e2f(_0x213c3d.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0x0, 0x0, 0x0); + }, 0x1e)) : (_0x3a8e2f(_0x213c3d.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x0, 0x1)), _0x213c3d.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_x': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x5ce708) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x5ce708.type) ? (_0x3a8e2f(_0x5ce708.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0x0, 0x9, 0x0); + }, 0x1e)) : (_0x3a8e2f(_0x5ce708.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x9, 0x1)), _0x5ce708.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_y': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x1cfae6) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x1cfae6.type) ? (_0x3a8e2f(_0x1cfae6.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0x0, 0x1, 0x0); + }, 0x1e)) : (_0x3a8e2f(_0x1cfae6.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x1, 0x1)), _0x1cfae6.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_l': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x1a50ab) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x1a50ab.type) ? (_0x3a8e2f(_0x1a50ab.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0x0, 0xa, 0x0); + }, 0x1e)) : (_0x3a8e2f(_0x1a50ab.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0xa, 0x1)), _0x1a50ab.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_z': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x1a50ab) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x1a50ab.type) ? (_0x3a8e2f(_0x1a50ab.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0x0, 12, 0x0); + }, 0x1e)) : (_0x3a8e2f(_0x1a50ab.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 12, 0x1)), _0x1a50ab.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_r': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x3b8139) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x3b8139.type) ? (_0x3a8e2f(_0x3b8139.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0x0, 0xb, 0x0); + }, 0x1e)) : (_0x3a8e2f(_0x3b8139.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0xb, 0x1)), _0x3b8139.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_start': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x47af91) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x47af91.type) ? (_0x3a8e2f(_0x47af91.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0x0, 0x3, 0x0); + }, 0x1e)) : (_0x3a8e2f(_0x47af91.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x3, 0x1)), _0x47af91.stopPropagation(); + }); + + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_cu': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x47af91) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x47af91.type) ? (_0x3a8e2f(_0x47af91.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0, 23, 0); + }, 0x1e)) : (_0x3a8e2f(_0x47af91.target, _0x2ec721, true), _0x378b5c.syncInput(0, 23, 0x7fff)), _0x47af91.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_cd': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x47af91) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x47af91.type) ? (_0x3a8e2f(_0x47af91.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0, 22, 0); + }, 0x1e)) : (_0x3a8e2f(_0x47af91.target, _0x2ec721, true), _0x378b5c.syncInput(0, 22, 0x7fff)), _0x47af91.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_cl': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x47af91) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x47af91.type) ? (_0x3a8e2f(_0x47af91.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0, 21, 0); + }, 0x1e)) : (_0x3a8e2f(_0x47af91.target, _0x2ec721, true), _0x378b5c.syncInput(0, 21, 0x7fff)), _0x47af91.stopPropagation(); + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_cr': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x47af91) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x47af91.type) ? (_0x3a8e2f(_0x47af91.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0, 20, 0); + }, 0x1e)) : (_0x3a8e2f(_0x47af91.target, _0x2ec721, true), _0x378b5c.syncInput(0, 20, 0x7fff)), _0x47af91.stopPropagation(); + }); + + var hideTimeout; + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_c': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x47af91) { + if (['touchend', 'mouseup', 'mouseout'].includes(_0x47af91.type)) { + _0x3a8e2f(_0x47af91.target, _0x2ec721, false); + } else { + _0x3a8e2f(_0x47af91.target, _0x2ec721, true); + clearTimeout(hideTimeout); + _0x5ab74d.toggleControls.call(_0xa88a13, true); + hideTimeout = setTimeout(function() { + _0x5ab74d.toggleControls.call(_0xa88a13, false); + }, 5000) + } + }); + _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ + 'b_select': true + }))), 'touchstart touchend mousedown mouseup mouseout', function(_0x37f594) { + ['touchend', 'mouseup', 'mouseout'].includes(_0x37f594.type) ? (_0x3a8e2f(_0x37f594.target, _0x2ec721, !0x1), window.setTimeout(function() { + _0x378b5c.syncInput(0x0, 0x2, 0x0); + }, 0x1e)) : (_0x3a8e2f(_0x37f594.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x2, 0x1)), _0x37f594.stopPropagation(); + }); + } else _0x132da7(_0x378b5c.virtualGamepadContainer, !_0x1ed80b); + }, + 'setup': function() { + var _0xa88a13 = this; + if (this.game) { + if (_0x378b5c.playerName = _0xa88a13.config.playerName, _0x3a8e2f(this.elements.container, this.config.classNames.type, true), this.elements.container.setAttribute('tabindex', '0'), this.color) { + var _0x17edbf = function(_0x175d8e) { + var _0x17edbf = _0x175d8e.toLowerCase(); + if (_0x17edbf && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/ .test(_0x17edbf)) { + if (0x4 === _0x17edbf.length) { + for (var _0x2c1832 = '#', _0x4c881f = 0x1; _0x4c881f < 0x4; _0x4c881f += 0x1) _0x2c1832 += _0x17edbf.slice(_0x4c881f, _0x4c881f + 0x1).concat(_0x17edbf.slice(_0x4c881f, _0x4c881f + 0x1)); + _0x17edbf = _0x2c1832; + } + for (var _0x5ac4ff = [], _0x324169 = 0x1; _0x324169 < 0x7; _0x324169 += 0x2) _0x5ac4ff.push(parseInt('0x' .concat(_0x17edbf.slice(_0x324169, _0x324169 + 0x2)), 0x10)); + return _0x5ac4ff; + } + return null; + }(this.color); + _0x17edbf && this.elements.container.setAttribute('style', '--ejs-primary-color: ' .concat(_0x17edbf[0x0], ', ').concat(_0x17edbf[0x1], ', ').concat(_0x17edbf[0x2])); + } + if (this.elements.wrapper = _0x428003('div', { + 'class': this.config.classNames.video + }), _0x580edd(this.game, this.elements.wrapper), 'video' !== _0xa88a13.game.tagName.toLocaleLowerCase()) { + var _0x2c1832 = this.config.volume; + Object.defineProperty(_0xa88a13.game, 'volume', { + 'get': function() { + return _0x2c1832; + }, + 'set': function(_0x4cca18) { + _0x2c1832 = _0x4cca18, _0xbae705.call(_0xa88a13, _0xa88a13.game, 'volumechange'); + } + }); + var _0x541fe1 = _0xa88a13.storage.get('muted'); + Object.defineProperty(_0xa88a13.game, 'muted', { + 'get': function() { + return _0x541fe1; + }, + 'set': function(_0x54b6e0) { + var _0x2c1832 = !!_0x1e2c68.boolean(_0x54b6e0) && _0x54b6e0; + _0x541fe1 = _0x2c1832, _0xbae705.call(_0xa88a13, _0xa88a13.game, 'volumechange'); + } + }); + } + window.addEventListener('beforeunload', function(_0x34b11a) { + if (_0xa88a13.started) { + var _0x2c1832 = _0xa88a13.startName.split('/').pop().split('.'), + _0x478412 = _0x2c1832.slice(0x0, _0x2c1832.length - 0x1).join('.'); + _0x27f4c4.FS.syncfs(function(_0x1026f5) {}); + try { + var _0x40d46a = 'srm'; + 'nds' === _0xa88a13.system && (_0x40d46a = 'dsv'), _0x27f4c4.FS.unlink('/data/saves/' .concat(_0x478412, '.').concat(_0x40d46a)); + } catch (_0x2c3bc8) { + console.log('fail to save'); + } + _0x378b5c.saveSavFiles(), _0x27f4c4.FS.syncfs(function(_0x2c4b20) {}); + } + }, true); + } else console.warn('No game element found!'); + }, + 'listeners': function() { + var _0xa88a13 = this; + _0xa88a13.elements.buttons.restart && _0x1093f4.call(_0xa88a13, _0xa88a13.elements.buttons.restart, 'click', function(_0x5cfc51) { + if (_0x378b5c.restartGame(), _0x378b5c.inputsData = {}, _0x378b5c.connected && _0x378b5c.connection.isInitiator) { + for (var _0x17edbf = _0x378b5c.getStateInfo().split('|'), _0x2c1832 = _0x17edbf[0x0] >> 0x0, _0x1036de = (_0x17edbf[0x2], new Uint8Array(_0x2c1832)), _0x532138 = _0x17edbf[0x1] >> 0x0, _0x5a4c27 = 0x0; _0x5a4c27 < _0x2c1832; _0x5a4c27 += 0x1) _0x1036de[_0x5a4c27] = _0x27f4c4.Module.getValue(_0x532138 + _0x5a4c27); + var _0x5a3d1a = new File([_0x1036de], '0-game.state', { + 'type': '', + 'lastModified': new Date() + }); + _0x378b5c.connection.shareFile(_0x5a3d1a), _0x378b5c.inputsData = {}, _0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x378b5c.disableControl(true); + } + }), _0xa88a13.elements.buttons.screenRecord && _0x1093f4.call(_0xa88a13, _0xa88a13.elements.buttons.screenRecord, 'click', function(_0x5cfc51) { + + if (! _0xa88a13.recordData) { + _0xa88a13.recordData = {started:false, data:[], stopped: false} + } + if (! _0xa88a13.recordData.started) { //start recording + _0xa88a13.elements.buttons.screenRecord.getElementsByClassName('ejs--74c6d4176d27e37a19d2e9e61de8f4')[0].innerHTML = _0xa88a13.localization('Stop Screen Recording'); + if (MediaRecorder.isTypeSupported('video/webm; codecs=h264')) { + var options = {mimeType: 'video/webm; codecs=h264'}; // video/webm; codecs=h264,opus + } else if (MediaRecorder.isTypeSupported('video/webm; codecs=H264')) { + var options = {mimeType: 'video/webm; codecs=H264'}; + } else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp9')) { + var options = {mimeType: 'video/webm; codecs=vp9'}; + } else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp8')) { + var options = {mimeType: 'video/webm; codecs=vp8'}; + } else if (MediaRecorder.isTypeSupported('video/webm; codecs=avc1')) { + var options = {mimeType: 'video/webm; codecs=avc1'}; + } else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp9.0')) { + var options = {mimeType: 'video/webm; codecs=vp9.0'}; + } else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp8.0')) { + var options = {mimeType: 'video/webm; codecs=vp8.0'}; + } else { + var options = {}; + } + _0xa88a13.recordData.stream = _0x27f4c4.Module.canvas.captureStream(30); + _0xa88a13.recordData.recorder = new MediaRecorder(_0xa88a13.recordData.stream, options); + //_0xa88a13.recordData.recorder.addTrack() // TODO - find audio element + _0xa88a13.recordData.recorder.ondataavailable = function(e) { + if (e.data.size > 0) { + _0xa88a13.recordData.data.push(e.data) + } + if (_0xa88a13.recordData.stopped) { + var a = document.createElement("a") + a.href = window.URL.createObjectURL(new Blob(_0xa88a13.recordData.data, {type: "video/webm"})) + a.download = 'record.webm' + a.click() + window.URL.revokeObjectURL(a.href) + delete _0xa88a13.recordData + _0xa88a13.elements.buttons.screenRecord.getElementsByClassName('ejs--74c6d4176d27e37a19d2e9e61de8f4')[0].innerHTML = _0xa88a13.localization('Start Screen Recording'); + } + } + _0xa88a13.recordData.recorder.start() + _0xa88a13.recordData.started = true + } else if (_0xa88a13.recordData.started) { //stop recording + _0xa88a13.recordData.recorder.stop() + _0xa88a13.recordData.stopped = true + } + + }), _0xa88a13.elements.buttons.play && Array.from(_0xa88a13.elements.buttons.play).forEach(function(_0x24495b) { + _0x1093f4.call(_0xa88a13, _0x24495b, 'click', function(_0x966382) { + _0xa88a13.playing ? (_0xa88a13.playing = !0x1, _0x27f4c4.Module.pauseMainLoop(), _0x378b5c.connected && _0x378b5c.connection.isInitiator && _0x378b5c.connection.send(JSON.stringify({ + 'act': 'pause' + })), _0xbae705.call(_0xa88a13, _0xa88a13.elements.container, 'pause', !0x1, { + 'pause': true + })) : (_0xa88a13.playing = true, _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.connected && _0x378b5c.connection.isInitiator && _0x378b5c.connection.send(JSON.stringify({ + 'act': 'resume' + })), _0xbae705.call(_0xa88a13, _0xa88a13.elements.container, 'pause', !0x1, { + 'pause': !0x1 + })); + }); + }), _0xa88a13.elements.buttons.netplay && _0x1093f4.call(_0xa88a13, _0xa88a13.elements.buttons.netplay, 'click', function(_0x2317b9) { + _0x378b5c.disableControl(true), _0x132da7(_0xa88a13.elements.dialogs.netplay, !0x1), _0x378b5c.players.length > 0x0 ? _0x378b5c.openRoom(_0xa88a13) : (_0x378b5c.stopLoadRooms(), _0x378b5c.loadRoomsList()), _0x378b5c.playerName || _0x4d8495.show('modal-9de6c4e9ce2b9361', { + 'closeByEsckey': !0x1 + }); + }), _0xa88a13.elements.buttons.cheat && _0x1093f4.call(_0xa88a13, _0xa88a13.elements.buttons.cheat, 'click', function(_0x44b01a) { + _0x132da7(_0xa88a13.elements.dialogs.cheat, !0x1); + }); + _0x1093f4.call(_0xa88a13, _0xa88a13.elements.container, 'savestate', function(_0x25b541) { + if (_0x378b5c.saveLoadDB.call(_0xa88a13, 'save')) { + return + } + var _0x2c1832 = _0x25b541.detail.state; + if (_0x1e2c68.function(_0xa88a13.config.onsavestate)) _0xa88a13.config.onsavestate.call(null, { + 'screenshot': _0x25b541.detail.screenshot, + 'state': _0x2c1832 + }); + else { + var _0x2b5fc8 = new Blob([_0x2c1832]), + _0x152605 = _0xa88a13.startName.split('/').pop().split('.'), + _0x51d471 = _0x152605.slice(0x0, _0x152605.length - 0x1).join('.') + if (typeof _0xa88a13.gameName == 'string') { + var _0x51d471 = _0xa88a13.gameName + } + var _0x49f6b6 = _0x51d471 ? '' .concat(_0x51d471, '.state') : 'game.state'; + _0x4e4ca6()(_0x2b5fc8, _0x49f6b6); + } + _0xa88a13.elements.container.focus(); + }); + _0xa88a13.game.stateloadField = _0x428003('input'), _0xa88a13.game.stateloadField.type = 'file', _0xa88a13.game.stateloadField.onchange = function _0x17edbf(_0xcd4599) { + var _0xfd246e, _0x3fdd71 = _0xcd4599.target.files; + _0x3fdd71.length > 0x0 && ((_0xfd246e = new FileReader()).file_name = _0x3fdd71[0x0].name, _0xfd246e.onload = function() { + var _0xa88a13 = new Uint8Array(_0xfd246e.result); + EJS_loadState(_0xa88a13); + }, _0xfd246e.readAsArrayBuffer(_0x3fdd71[0x0])), _0xa88a13.game.stateloadField = _0x428003('input'), _0xa88a13.game.stateloadField.type = 'file', _0xa88a13.game.stateloadField.onchange = _0x17edbf; + }, _0x1093f4.call(_0xa88a13, _0xa88a13.elements.container, 'loadstate', function(_0x13504c) { + if (_0x378b5c.saveLoadDB.call(_0xa88a13, 'load')) { + return + } + _0x1e2c68.function(_0xa88a13.config.onloadstate) ? _0xa88a13.config.onloadstate.call(null, _0xa88a13.loadState) : _0xa88a13.game.stateloadField.click(), _0xa88a13.elements.container.focus(); + }), document.addEventListener('visibilitychange', function() { + 'hidden' === document.visibilityState ? console.log('hidden') : console.log('active'); + }); + }, + 'bindFunction': function() { + var _0xa88a13 = this, + _0x17edbf = _0xa88a13.system; + if (_0x27f4c4.Module && _0x27f4c4.Module._set_volume) { + var _0x2c1832 = _0x27f4c4.Module.cwrap('set_volume', 'null', ['number']); + _0x378b5c.setVolume = function() { + var _0x17edbf = 0x0; + _0xa88a13.volume < 0x1 && (_0x17edbf = 0x0 === _0xa88a13.volume ? -0x50 : 0x1e * _0xa88a13.volume - 0x1e, _0x2c1832(_0x17edbf)), _0xa88a13.muted && (_0x17edbf = -0x50), _0x2c1832(_0x17edbf); + }; + } + _0x378b5c.setVariable = _0x27f4c4.Module.cwrap('set_variable', 'null', ['string', 'string']), _0x378b5c.simulateInputFn = _0x27f4c4.Module.cwrap('simulate_input', 'null', ['number', 'number', 'number']); + var _0x2c63cc = { + 0: null, + 1: null, + 2: null, + 3: null, + 4: null, + 5: null, + 6: null, + 7: null, + 8: null, + 9: null, + 10: null, + 11: null, + 12: null, + 13: null, + 14: null, + 15: null, + 16: null, + 17: null, + 18: null, + 19: null, + 20: null, + 21: null, + 22: null, + 23: null, + 24: null, + 25: null, + 26: null, + 27: null, + 28: null, + 29: null, + 30: null, + 31: null + }; + _0x378b5c.simulateInput = function(_0x249751, _0x480d05, _0x50f784) { + if (_0x378b5c.connected) { + if (_0xa88a13.playing && !_0x378b5c.disableInput) { + var _0x35b9c1 = _0x378b5c.connection.userid, + _0x4d96ad = _0x378b5c.roomMaster === _0x35b9c1, + _0xf1bb97 = _0x378b5c.players.indexOf(_0x35b9c1), + _0x52e1f4 = _0x378b5c.currentFrameNum(); + _0x249751 >> 0x0 == 0x0 && (_0x2c63cc[_0x480d05] !== _0x50f784 && (_0x4d96ad ? (_0x378b5c.inputsData[_0x52e1f4] || (_0x378b5c.inputsData[_0x52e1f4] = []), _0x378b5c.inputsData[_0x52e1f4].push({ + 'index': _0xf1bb97, + 'key': _0x480d05, + 'status': _0x50f784, + 'frame': _0x52e1f4 + }),_0x378b5c.simulateInputFn(_0xf1bb97, _0x480d05, _0x50f784)) : _0x378b5c.connection.send(JSON.stringify({ + 'act': 'sync-control', + 'value': ['' .concat(_0xf1bb97, '|').concat(_0x480d05, '|').concat(_0x50f784, '|').concat(_0x52e1f4)] + }), _0x378b5c.roomMaster)), _0x2c63cc[_0x480d05] = _0x50f784); + } + } else _0x378b5c.disableInput || _0x378b5c.simulateInputFn(_0x249751, _0x480d05, _0x50f784); + }, _0x378b5c.syncInput = _0x378b5c.simulateInput; + window.simulateInput = _0x378b5c.simulateInput; + var _0x762355 = _0x27f4c4.Module.cwrap('shader_enable', 'null', ['number']); + _0x378b5c.toggleShader = function(_0x433182) { + return _0x762355(_0x433182); + } + _0x378b5c.getStateInfo = _0x27f4c4.Module.cwrap('get_state_info', 'string', []); + if (_0xa88a13.coreVer === 2) { + _0x378b5c.saveStateToFile = _0x27f4c4.Module.cwrap('cmd_save_state', 'null', []); + } + _0x378b5c.saveState = function() { + if (_0xa88a13.coreVer === 2) { + _0x378b5c.saveStateToFile(); + var length; + var asd = 50; + return new Promise(function(resolve, reject) { + var a = setInterval(function() { + try { + var data = _0x27f4c4.FS.readFile('save.state'); + } catch(e) {return;} + if (data.length === 0 || length === 0 || length !== data.length) { + length = data.length; + asd = 50; + return; + } + if (asd > 0) { + asd--; + return; + } + clearInterval(a); + _0x27f4c4.FS.unlink('save.state'); + resolve(data); + }, 100) + }) + } else { + var _0xa88a14, _0x17edbf = _0x378b5c.getStateInfo().split('|'), + _0x2c1832 = _0x17edbf[0x0] >> 0x0; + if (_0x2c1832 > 0x0) { + _0xa88a14 = new Uint8Array(_0x2c1832); + for (var _0x2ef6be = _0x17edbf[0x1] >> 0x0, _0x3cc34b = 0x0; _0x3cc34b < _0x2c1832; _0x3cc34b++) _0xa88a14[_0x3cc34b] = _0x27f4c4.Module.getValue(_0x2ef6be + _0x3cc34b); + } + return _0xa88a14; + } + }; + var _0x25a7a2 = _0x27f4c4.Module.cwrap('load_state', 'number', ['string', 'number']); + _0x378b5c.loadState = function(_0x4389ae, _0x1d4918) { + var _0x91cd69; + _0x91cd69 = _0x4389ae; + _0x27f4c4._FS.createDataFile('/', 'game.state', _0x91cd69, true, true); + null === _0x1d4918 && (_0x1d4918 = 0); + if ('arcade' === _0x17edbf && _0xa88a13.coreVer !== 2) { + setTimeout(function() { + _0x378b5c.getStateInfo(); + _0x25a7a2('game.state', _0x1d4918); + _0x27f4c4.FS.unlink('game.state'); + }, 0xa) + } else if (_0xa88a13.coreVer === 2) { + setTimeout(function() { + _0x25a7a2('game.state', _0x1d4918); + setTimeout(function() { + _0x27f4c4.FS.unlink('game.state'); + }, 100) + }, 10) + } else { + _0x25a7a2('game.state', _0x1d4918); + _0x27f4c4.FS.unlink('game.state'); + } + if (_0xa88a13.coreVer === 2) { + if (_0x378b5c.connected && _0x378b5c.connection.isInitiator) { + var _0x227419 = new File([_0x91cd69], '0-game.state', { + 'type': '', + 'lastModified': new Date() + }); + _0x378b5c.connection.shareFile(_0x227419); + _0x378b5c.inputsData = {}; + _0x378b5c.wait = true; + _0x378b5c.systemPause(0x1); + _0x27f4c4.Module.pauseMainLoop(); + _0x378b5c.disableControl(true); + } + } else { + if (_0x378b5c.connected && _0x378b5c.connection.isInitiator) { + for (var _0x54607c = _0x378b5c.getStateInfo().split('|'), _0x1ab9c9 = _0x54607c[0x0] >> 0x0, _0xce58ec = (_0x54607c[0x2], new Uint8Array(_0x1ab9c9)), _0x4aff4f = _0x54607c[0x1] >> 0x0, _0x3bfae0 = 0x0; _0x3bfae0 < _0x1ab9c9; _0x3bfae0 += 0x1) _0xce58ec[_0x3bfae0] = _0x27f4c4.Module.getValue(_0x4aff4f + _0x3bfae0); + var _0x227419 = new File([_0xce58ec], '0-game.state', { + 'type': '', + 'lastModified': new Date() + }); + _0x378b5c.connection.shareFile(_0x227419); + _0x378b5c.inputsData = {}; + _0x378b5c.wait = true; + _0x378b5c.systemPause(0x1); + _0x27f4c4.Module.pauseMainLoop(); + _0x378b5c.disableControl(true); + } + } + _0xa88a13.elements.container.focus(); + }; + _0x27f4c4.Module._set_cheat && (_0x378b5c.setCheat = _0x27f4c4.Module.cwrap('set_cheat', 'number', ['number', 'number', 'string'])); + _0x27f4c4.Module._reset_cheat && (_0x378b5c.resetCheat = _0x27f4c4.Module._reset_cheat); + _0x378b5c.quickSaveState = function() { + if (_0xa88a13.started && !_0x378b5c.connected) { + if (_0xa88a13.statesSupported === false) { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'CANNOT CURRENTLY SAVE STATE'; + clearTimeout(_0x378b5c.saveMsgTransitions); + _0x378b5c.saveMsgTransitions = setTimeout(function() { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; + }, 1500) + return; + } + if (_0x2593da && typeof _0x2593da.getCoreOptionsValues == 'function') { + var slot = _0x2593da.getCoreOptionsValues()['save-state-slot']; + if (! slot) { + slot = 1; + } + } else { + var slot = 1; + } + var name = slot + '-quick.state'; + try { + _0x27f4c4.FS.unlink(name); + } catch (_0x4b4d4c) {} + try { + if (_0xa88a13.coreVer === 2) { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'SAVING STATE TO SLOT ' + slot; + _0x378b5c.saveState().then(function(data) { + _0x27f4c4._FS.createDataFile('/', name, data, true, true); + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'STATE SAVED TO SLOT ' + slot; + clearTimeout(_0x378b5c.saveMsgTransitions); + _0x378b5c.saveMsgTransitions = setTimeout(function() { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; + }, 1500) + }); + } else { + var _0x17edbf = _0x378b5c.saveState(); + _0x27f4c4._FS.createDataFile('/', name, _0x17edbf, true, true); + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'STATE SAVED TO SLOT ' + slot; + clearTimeout(_0x378b5c.saveMsgTransitions); + _0x378b5c.saveMsgTransitions = setTimeout(function() { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; + }, 1500) + } + } catch(e) { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'FAILED TO SAVE STATE TO SLOT ' + slot; + clearTimeout(_0x378b5c.saveMsgTransitions); + _0x378b5c.saveMsgTransitions = setTimeout(function() { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; + }, 1500) + } + } + }; + _0x378b5c.saveMsgTransitions = null; + _0x378b5c.quickLoadState = function() { + if (_0xa88a13.started && !_0x378b5c.connected) { + if (_0xa88a13.statesSupported === false) { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'CANNOT CURRENTLY LOAD STATE'; + clearTimeout(_0x378b5c.saveMsgTransitions); + _0x378b5c.saveMsgTransitions = setTimeout(function() { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; + }, 1500) + return; + } + if (_0x2593da && typeof _0x2593da.getCoreOptionsValues == 'function') { + var slot = _0x2593da.getCoreOptionsValues()['save-state-slot']; + if (! slot) { + slot = 1; + } + } else { + var slot = 1; + } + var name = slot + '-quick.state'; + var success = true; + try { + if (_0xa88a13.coreVer === 2) { + var data = _0x27f4c4.FS.readFile(name); + _0x27f4c4.FS.writeFile('/game.state', data); + setTimeout(function() { + _0x25a7a2(name, 0); + setTimeout(function() { + _0x27f4c4.FS.unlink('game.state'); + }, 100) + }, 10) + } else { + _0x25a7a2(name, 0); + } + if ('arcade' === _0x17edbf && _0xa88a13.coreVer !== 2) { + setTimeout(function() { + _0x378b5c.getStateInfo(); + _0x25a7a2(name, 0x0); + }, 0xa); + } + } catch (_0x4ee386) { + success = false; + } + if (! success) { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'FAILED TO LOAD STATE FROM SLOT ' + slot; + } else { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'LOADED STATE FROM SLOT ' + slot; + } + clearTimeout(_0x378b5c.saveMsgTransitions); + _0x378b5c.saveMsgTransitions = setTimeout(function() { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; + }, 1500) + } + }, _0x378b5c.changeStateSlot = function(e) { + if (_0x2593da && typeof _0x2593da.getCoreOptionsValues == 'function') { + var slot = _0x2593da.getCoreOptionsValues()['save-state-slot']; + if (! slot) { + slot = 1; + } + } else { + var slot = 1; + } + var newSlot; + if (typeof e != 'number') { + newSlot = slot + 1; + } else { + newSlot = e; + } + if (newSlot > 9) { + newSlot = 1; + } + _0x7f9f36.updateCoreOptions.call(_0xa88a13, 'save-state-slot', newSlot) + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'SET SAVE STATE SLOT TO ' + newSlot; + clearTimeout(_0x378b5c.saveMsgTransitions); + _0x378b5c.saveMsgTransitions = setTimeout(function() { + _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; + }, 1500) + }, window.EJS_loadState = function(_0x4dd6a5) { + _0x378b5c.loadState(_0x4dd6a5, 0x0); + setTimeout(function() { + if (_0x378b5c.connected) { + var _0x17edbf = new File([_0x4dd6a5], '0-game.state', { + 'type': '', + 'lastModified': new Date() + }); + _0x378b5c.connection.shareFile(_0x17edbf), _0x378b5c.inputsData = {}, _0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x378b5c.disableControl(true); + } + }, 0x1e); + }; + var _0x840cf4 = _0x27f4c4.Module.cwrap('cmd_take_screenshot', '', []); + _0x378b5c.getScreenData = function() { + return _0x378b5c.toggleShader(0x0), _0x840cf4(), _0x378b5c.toggleShader(0x1), _0x27f4c4.FS.readFile('screenshot.png'); + }; + _0x378b5c.restartGame = _0x27f4c4.Module.cwrap('system_restart', '', []); + _0x378b5c.currentFrameNum = _0x27f4c4.Module.cwrap('get_current_frame_count', '', []); + _0x378b5c.saveSavFiles = _0x27f4c4.Module.cwrap('cmd_savefiles', '', []); + _0x27f4c4.Module._get_core_options && (_0x378b5c.getGameCoreOptions = _0x27f4c4.Module.cwrap('get_core_options', 'string', [])); + _0x378b5c.systemPause = function(_0x29d94a) { + return !0x1; + }; + _0x378b5c.controllers = _0x2593da.storage.get('controllers'); + _0x378b5c.controllers || (_0x378b5c.controllers = JSON.parse(JSON.stringify(_0x378b5c.defaultControllers))); + } + }, + _0xdcec2a = _0x378b5c; + + function _0x5005e6(_0x7f3270, _0x477158) { + return function(_0x20890f) { + if (Array.isArray(_0x20890f)) return _0x20890f; + }(_0x7f3270) || function(_0x557107, _0x409476) { + var _0x2c1832 = [], + _0x488a47 = true, + _0x34f76e = !0x1, + _0x19606f = void 0x0; + try { + for (var _0x328f4d, _0x4d9086 = _0x557107[Symbol.iterator](); !(_0x488a47 = (_0x328f4d = _0x4d9086.next()).done) && (_0x2c1832.push(_0x328f4d.value), !_0x409476 || _0x2c1832.length !== _0x409476); _0x488a47 = true); + } catch (_0x13c09a) { + _0x34f76e = true, _0x19606f = _0x13c09a; + } finally { + try { + _0x488a47 || null == _0x4d9086.return || _0x4d9086.return(); + } finally { + if (_0x34f76e) throw _0x19606f; + } + } + return _0x2c1832; + }(_0x7f3270, _0x477158) || function() { + throw new TypeError('Invalid attempt to destructure non-iterable instance'); + }(); + } + var _0x7f9f36 = { + 'storage': null, + 'coreOptionsValues': {}, + 'contextMenu': null, + 'normalOptions': { + 'shader': { + 'label': 'Shader', + 'options': { + 'disabled': 'Disabled', + '2xScaleHQ.glslp': '2xScaleHQ', + '4xScaleHQ.glslp': '4xScaleHQ', + 'crt-easymode.glslp': 'CRT easymode', + 'crt-aperture.glslp': 'CRT aperture', + 'crt-geom.glslp': 'CRT geom' + }, + 'default': 'disabled' + }, + 'virtual-gamepad': { + 'label': 'Virtual Gamepad', + 'options': { + 'disabled': 'Disabled', + 'enabled': 'Enabled' + }, + 'default': 'enabled' + } + }, + 'defaultCoreOptionsValues': function() { + var _0xa88a13 = {}; + switch (this.system) { + case 'pce': + _0xa88a13 = { + 'pce_nospritelimit': 'enabled' + }; + break; + case 'jaguar': + _0xa88a13 = { + 'virtualjaguar_doom_res_hack': 'enabled' + }; + break; + case 'psx': + _0xa88a13 = { + 'pcsx_rearmed_memcard2': 'enabled' + }; + break; + case 'nds': + _0xa88a13 = {}; + } + return _0xa88a13; + }, + 'getCoreOptionsValues': function() { + var _0xa88a13 = _0x7f9f36.storage.get('core-options'); + return _0x1e2c68.empty(_0xa88a13) && (_0xa88a13 = {}), _0xa88a13; + }, + 'getCoreOptions': function() { + var _0xa88a13 = {}; + switch (this.system) { + case 'nes': + _0xa88a13.fceumm_palette = { + 'label': this.localization('Color Palette'), + 'options': { + 'default': this.localization('Default'), + 'asqrealc': 'asqrealc', + 'nintendo-vc': 'nintendo-vc', + 'rgb': 'rgb', + 'yuv-v3': 'yuv-v3', + 'unsaturated-final': 'unsaturated-final', + 'sony-cxa2025as-us': 'sony-cxa2025as-us', + 'pal': 'pal', + 'bmf-final2': 'bmf-final2', + 'bmf-final3': 'bmf-final3', + 'smooth-fbx': 'smooth-fbx', + 'composite-direct-fbx': 'composite-direct-fbx', + 'pvm-style-d93-fbx': 'pvm-style-d93-fbx', + 'nescap': 'nescap', + 'ntsc-hardware-fbx': 'ntsc-hardware-fbx', + 'nes-classic-fbx-fs': 'nes-classic-fbx-fs', + 'wavebeam': 'wavebeam' + }, + 'default': 'default' + }, _0xa88a13.fceumm_nospritelimit = { + 'label': this.localization('No Sprite Limit'), + 'options': { + 'enabled': this.localization('Enabled'), + 'disabled': this.localization('Disabled') + }, + 'default': 'disabled' + }, _0xa88a13.fceumm_sndquality = { + 'label': this.localization('Sound Quality'), + 'options': { + 'Low': this.localization('Low'), + 'High': this.localization('High'), + 'Very High': this.localization('Very High') + }, + 'default': 'Low' + }, this.lightgun || (_0xa88a13.system_type = { + 'label': this.localization('4 Players Support'), + 'options': { + 'nes': 'NES', + 'famicom': 'Famicom' + }, + 'default': 'nes', + 'netplay': true + }), _0xa88a13.fceumm_turbo_enable = { + 'label': this.localization('Turbo Enable'), + 'options': { + 'None': this.localization('None'), + 'Player 1': this.localization('Player 1'), + 'Player 2': this.localization('Player 2'), + 'Both': this.localization('Both') + }, + 'default': 'None', + 'netplay': true + }, _0xa88a13.fceumm_region = { + 'label': this.localization('Region'), + 'options': { + 'Auto': this.localization('Auto'), + 'NTSC': 'NTSC', + 'PAL': 'PAL', + 'Dendy': 'Dendy'}, + 'default': 'Auto', + 'netplay': true + }; + break; + case 'snes': + _0xa88a13 = { + 'snes9x_next_overclock': { + 'label': this.localization('SuperFX Overclock'), + 'options': { + 'disabled': this.localization('Disabled')+'(10MHz)', + '40MHz': '40MHz', + '60MHz': '60MHz', + '80MHz': '80MHz', + '100MHz': '100MHz' + }, + 'default': 'disabled', + 'netplay': true + } + }; + break; + case 'snes2002': + case 'snes2005': + case 'snes2010': + _0xa88a13 = {}; + break; + case 'gb': + _0xa88a13 = { + 'gambatte_gb_colorization': { + 'label': this.localization('GB Colorization'), + 'options': { + 'disabled': this.localization('Disabled'), + 'auto': this.localization('auto'), + 'internal': this.localization('internal') + }, + 'default': 'disabled' + }, + 'gambatte_gb_internal_palette': { + 'label': this.localization('Internal Palette'), + 'options': { + 'GBC - Blue': this.localization('GBC - Blue'), + 'GBC - Brown': this.localization('GBC - Brown'), + 'GBC - Dark Blue': this.localization('GBC - Dark Blue'), + 'GBC - Dark Brown': this.localization('GBC - Dark Brown'), + 'GBC - Dark Green': this.localization('GBC - Dark Green'), + 'GBC - Grayscale': this.localization('GBC - Grayscale'), + 'GBC - Green': this.localization('GBC - Green'), + 'GBC - Inverted': this.localization('GBC - Inverted'), + 'GBC - Orange': this.localization('GBC - Orange'), + 'GBC - Pastel Mix': this.localization('GBC - Pastel Mix'), + 'GBC - Red': this.localization('GBC - Red'), + 'GBC - Yellow': this.localization('GBC - Yellow') + }, + 'default': 'GBC - Blue' + } + }; + break; + case 'gba': + _0xa88a13 = { + 'mgba_solar_sensor_level': { + 'label': this.localization('Solar sensor level'), + 'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'], + 'default': '0' + }, + 'mgba_frameskip': { + 'label': this.localization('Frameskip'), + 'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'], + 'default': '0' + } + }; + break; + case 'vbanext': + _0xa88a13 = { + 'vbanext_turboenable': { + 'label': this.localization('Enable Turbo Buttons'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'disabled' + }, + 'vbanext_turbodelay': { + 'label': this.localization('Turbo Delay in frames'), + 'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15'], + 'default': '2' + } + }; + break; + case 'n64': + _0xa88a13 = { + 'glupen64-aspect': { + 'label': this.localization('Aspect Ratio (Need to refresh page)'), + 'options': ['4:3', '16:9'], + 'default': '4:3' + }, + 'glupen64-43screensize': { + 'label': this.localization('4:3 Resolution'), + 'options': ['320x240', '640x480', '960x720', '1280x960'], + 'default': '320x240' + }, + 'glupen64-169screensize': { + 'label': this.localization('16:9 Resolution'), + 'options': ['640x360', '960x540', '1280x720'], + 'default': '640x360' + }, + 'glupen64-pak1': { + 'label': this.localization('Player 1 Pak'), + 'options': { + 'none': this.localization('none'), + 'memory': this.localization('memory'), + 'rumble': this.localization('rumble') + }, + 'default': 'none', + 'netplay': true + }, + 'glupen64-pak2': { + 'label': this.localization('Player 2 Pak'), + 'options': { + 'none': this.localization('none'), + 'memory': this.localization('memory'), + 'rumble': this.localization('rumble') + }, + 'default': 'none', + 'netplay': true + }, + 'glupen64-pak3': { + 'label': this.localization('Player 3 Pak'), + 'options': { + 'none': this.localization('none'), + 'memory': this.localization('memory'), + 'rumble': this.localization('rumble') + }, + 'default': 'none', + 'netplay': true + }, + 'glupen64-pak4': { + 'label': this.localization('Player 4 Pak'), + 'options': { + 'none': this.localization('none'), + 'memory': this.localization('memory'), + 'rumble': this.localization('rumble') + }, + 'default': 'none', + 'netplay': true + }, + }; + if (_0xdcec2a && (_0xdcec2a.virtualGamepadContainer != 'undefined' || _0xdcec2a.virtualGamepadContainer !== null)) { + + _0xa88a13['joystick-input'] = { + 'label': this.localization('Joystick input keys'), + 'options': { + 'd-pad': this.localization('d-pad'), + 'analog-stick': this.localization('Analog Stick') + }, + 'default': 'analog-stick', + 'netplay': true + } + } + break; + case 'nds': + _0xa88a13 = { + 'desmume_screens_layout': { + 'label': this.localization('Screen layout'), + 'options': { + 'top/bottom': this.localization('top/bottom'), + 'bottom/top': this.localization('bottom/top'), + 'left/right': this.localization('left/right'), + 'right/left': this.localization('right/left'), + 'top only': this.localization('top only'), + 'bottom only': this.localization('bottom only'), + 'quick switch': this.localization('quick switch'), + 'hybrid/top': this.localization('hybrid/top'), + 'hybrid/bottom': this.localization('hybrid/bottom') + }, + 'default': 'top/bottom' + }, + 'screen_rotation': { + 'label': this.localization('Screen Rotation'), + 'options': { + 0: '0°', + 90: '90°', + 180: '180°', + 270: '270°' + }, + 'default': 0 + }, + 'desmume_frameskip': { + 'label': this.localization('Frameskip'), + 'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], + 'default': '0' + } + }, _0x2d904a.wasm || delete _0xa88a13.screen_rotation; + break; + case 'vb': + case 'pce': + _0xa88a13 = {}; + break; + case 'segaMS': + case 'segaGG': + case 'segaMD': + case 'segaCD': + _0xa88a13 = { + 'genesis_plus_gx_no_sprite_limit': { + 'label': this.localization('No Sprite Limit'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'disabled' + }, + 'genesis_plus_gx_overclock': { + 'label': this.localization('CPU speed'), + 'options': ['100%', '125%', '150%', '175%', '200%'], + 'default': '100%', + 'netplay': true + }, + 'genesis_plus_gx_sound_output': { + 'label': this.localization('Sound output'), + 'options': { + 'stereo': this.localization('stereo'), + 'mono': this.localization('mono') + }, + 'default': 'stereo' + } + }; + break; + case 'sega32x': + _0xa88a13 = { + 'picodrive_sprlim': { + 'label': this.localization('No sprite limit'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'disabled' + } + }; + break; + case 'segaSaturn': + _0xa88a13 = { + 'yabause_frameskip': { + 'label': this.localization('Frameskip'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'disabled' + } + }; + break; + case 'msx': + _0xa88a13 = { + 'bluemsx_nospritelimits': { + 'label': this.localization('No Sprite Limit'), + 'options': { + 'OFF': this.localization('OFF'), + 'ON': this.localization('ON') + }, + 'default': 'OFF' + } + }; + break; + case 'ws': + case 'ngp': + _0xa88a13 = {}; + break; + case 'jaguar': + _0xa88a13 = { + 'virtualjaguar_usefastblitter': { + 'label': this.localization('Fast Blitter'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'disabled' + }, + 'virtualjaguar_bios': { + 'label': this.localization('Bios'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'disabled' + } + }; + break; + case 'psx': + _0xa88a13 = { + 'pcsx_rearmed_frameskip': { + 'label': this.localization('Frameskip'), + 'options': [0, 1, 2, 3], + 'default': 0, + 'netplay': true + }, + 'pcsx_rearmed_memcard2': { + 'label': this.localization('Enable second memory card'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'enabled', + 'netplay': true + }, + 'pcsx_rearmed_pad1type': { + 'label': this.localization('Pad 1 Type'), + 'options': { + 'default': this.localization('default'), + 'none': this.localization('none'), + 'standard': this.localization('standard'), + 'analog': this.localization('analog'), + 'negcon': this.localization('negcon') + }, + 'default': 'default', + 'netplay': true + }, + 'pcsx_rearmed_pad2type': { + 'label': this.localization('Pad 2 Type'), + 'options': { + 'default': this.localization('default'), + 'none': this.localization('none'), + 'standard': this.localization('standard'), + 'analog': this.localization('analog'), + 'negcon': this.localization('negcon') + }, + 'default': 'default', + 'netplay': true + }, + 'pcsx_rearmed_pad3type': { + 'label': this.localization('Pad 3 Type'), + 'options': { + 'default': this.localization('default'), + 'none': this.localization('none'), + 'standard': this.localization('standard'), + 'analog': this.localization('analog'), + 'negcon': this.localization('negcon') + }, + 'default': 'default', + 'netplay': true + }, + 'pcsx_rearmed_pad4type': { + 'label': this.localization('Pad 4 Type'), + 'options': { + 'default': this.localization('default'), + 'none': this.localization('none'), + 'standard': this.localization('standard'), + 'analog': this.localization('analog'), + 'negcon': this.localization('negcon') + }, + 'default': 'default', + 'netplay': true + }, + 'pcsx_rearmed_vibration': { + 'label': this.localization('Enable Vibration'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'enabled', + 'netplay': true + }, + 'pcsx_rearmed_neon_interlace_enable': { + 'label': this.localization('Enable interlacing mode(s)'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'disabled', + 'netplay': true + }, + 'pcsx_rearmed_neon_enhancement_enable': { + 'label': this.localization('Enhanced resolution (slow)'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'disabled', + 'netplay': true + }, + 'pcsx_rearmed_neon_enhancement_no_main': { + 'label': this.localization('Enhanced resolution speed hack'), + 'options': { + 'disabled': this.localization('disabled'), + 'enabled': this.localization('enabled') + }, + 'default': 'disabled', + 'netplay': true + } + }; + break; + case 'arcade': + case 'fba0.2.97.29': + _0xa88a13 = { + 'fba-aspect': { + 'label': this.localization('Aspect ratio'), + 'options': ['DAR', 'PAR'], + 'default': 'DAR' + }, + 'fba-frameskip': { + 'label': this.localization('Frameskip'), + 'options': ['0', '1', '2', '3', '4', '5'], + 'default': '0', + 'netplay': true + }, + 'fba-cpu-speed-adjust': { + 'label': this.localization('CPU overclock'), + 'options': ['100', '110', '120', '130', '140', '150', '160', '170', '180', '190', '200'], + 'default': '100', + 'netplay': true + }, + 'fba-diagnostic-input': { + 'label': this.localization('Diagnostic Input'), + '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'], + 'default': 'None', + 'netplay': true + }, + 'fba-neogeo-mode': { + 'label': this.localization('Force Neo Geo mode'), + 'options': ['MVS', 'AES', 'UNIBIOS', 'DIPSWITCH'], + 'default': 'MVS', + 'netplay': true + } + }; + break; + case 'mame2003': + case 'mame2010': + case 'mame': + _0xa88a13 = {}; + break; + default: + _0xa88a13 = {}, console.warn('Unsupported emulator'); + } + if (this.statesSupported === true) { + _0xa88a13['save-state-slot'] = { + 'label': this.localization('Save State Slot'), + 'options': [1, 2, 3, 4, 5, 6, 7, 8, 9], + 'default': 1 + } + } + if (this.statesSupported === true && window.indexedDB && + (typeof this.gameName == 'string' || !this.config.gameUrl.startsWith('blob:'))) { + _0xa88a13['save-state-location'] = { + 'label': this.localization('Save State Location'), + 'options': { + 'download': this.localization('download'), + 'keep in browser': this.localization('keep in browser') + }, + 'default': 'download' + } + } + _0xdcec2a.getGameCoreOptions && _0xdcec2a.getGameCoreOptions().split('\n').forEach(function(_0x2bef5a, _0x49b64b) { + var _0x5995db = _0x2bef5a.split('; '), + _0x16274c = _0x5995db[0x0]; + if (0x0 === _0x16274c.indexOf('fba-dipswitch-')) { + var _0x757776 = _0x5995db[0x1].split('|'), + _0x1f895e = _0x16274c.replace(/_/g, ' ').replace(/.+\-(.+)/, '$1'); + _0xa88a13[_0x16274c] = { + 'label': _0x1f895e, + 'options': _0x757776.slice(0x1, -0x1), + 'default': _0x757776[0x0].replace('(Default) ', ''), + 'netplay': true + }; + } + }); + return _0xa88a13; + }, + 'supportNetPlay': function() { + if (this.lightgun || this.mouse) return !0x1; + var _0xa88a13 = window.RTCPeerConnection || window.webkitPeerConnection00 || window.webkitRTCPeerConnection || window.mozRTCPeerConnection, + _0x17edbf = window.mozRTCIceCandidate || window.RTCIceCandidate, + _0x2c1832 = window.mozRTCSessionDescription || window.RTCSessionDescription; + return !!(_0xa88a13 && _0x17edbf && _0x2c1832) && !!(_0xa88a13 && 'createDataChannel' in _0xa88a13.prototype); + }, + 'isNetPlay': function() {}, + 'findElements': function() { + try { + return this.elements.controls = _0x530042.call(this, this.config.selectors.controls.wrapper), this.elements.buttons = { + 'play': _0x23ffa1.call(this, this.config.selectors.buttons.play), + 'pause': _0x530042.call(this, this.config.selectors.buttons.pause), + 'restart': _0x530042.call(this, this.config.selectors.buttons.restart), + 'mute': _0x530042.call(this, this.config.selectors.buttons.mute), + 'settings': _0x530042.call(this, this.config.selectors.buttons.settings), + 'fullscreen': _0x530042.call(this, this.config.selectors.buttons.fullscreen), + 'saveState': _0x530042.call(this, this.config.selectors.buttons.saveState), + 'screenRecord': _0x530042.call(this, this.config.selectors.buttons.screenRecord), + 'loadState': _0x530042.call(this, this.config.selectors.buttons.loadState), + 'gamepad': _0x530042.call(this, this.config.selectors.buttons.gamepad), + 'netplay': _0x530042.call(this, this.config.selectors.buttons.netplay), + 'cheat': _0x530042.call(this, this.config.selectors.buttons.cheat) + }, this.elements.inputs = { + 'volume': _0x530042.call(this, this.config.selectors.inputs.volume) + }, true; + } catch (_0x527381) { + return this.debug.warn('It looks like there is a problem with your custom controls HTML', _0x527381), !0x1; + } + }, + 'createIcon': function(_0x43d42f, _0x42a597) { + var _0x2c1832 = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + _0x154f99(_0x2c1832, _0x5dc0c0(_0x42a597, { + 'role': 'presentation', + 'focusable': 'false' + })); + var _0x50b7a7 = document.createElement('div'); + _0x50b7a7.innerHTML = '' .concat(this.icons[_0x43d42f], ''); + for (var _0x373099 = _0x50b7a7.childNodes[0x0].childNodes, _0x804f4d = 0x0; _0x804f4d < _0x373099.length; _0x804f4d += 0x1) _0x2c1832.appendChild(_0x373099[_0x804f4d]); + return _0x2c1832; + }, + 'createLabel': function(_0x185043) { + var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : {}, + _0x2c1832 = _0xb9b2ff.get(_0x185043, this.config), + _0x3d681f = {}; + _0x3d681f[_0x17edbf.class] = true, _0x3d681f[this.config.classNames.hidden] = true; + var _0x58a1d4 = Object.assign({}, _0x17edbf, { + 'class': [_0x17edbf.class, this.config.classNames.tooltip].filter(Boolean).join(' ') + }); + return _0x428003('span', _0x58a1d4, _0x2c1832); + }, + 'createBadge': function(_0x415aef) { + if (_0x1e2c68.empty(_0x415aef)) return null; + var _0x17edbf = _0x428003('span', { + 'class': this.config.classNames.menu.value + }); + return _0x17edbf.appendChild(_0x428003('span', { + 'class': this.config.classNames.menu.badge + }, _0x415aef)), _0x17edbf; + }, + 'createButton': function(_0x427a85, _0x493eb2) { + var _0x2c1832, _0x325832, _0xcb618b, _0x25c678, _0x58309d = _0x428003('button'), + _0x183584 = Object.assign({}, _0x493eb2), + _0x2345d2 = _0x9fdcea(_0x427a85), + _0x2ca20d = !0x1; + 'type' in _0x183584 || (_0x183584.type = 'button'); + var _0x34225b = _0x449eac({ + 'ejs__control': true + }); + switch ('class' in _0x183584 ? _0x183584.class.includes(_0x34225b) || (_0x183584.class += ' ' .concat(_0x34225b)) : _0x183584.class = _0x34225b, _0x427a85) { + case 'play': + _0x2ca20d = true, _0x2c1832 = 'play', _0xcb618b = 'pause', _0x325832 = 'play', _0x25c678 = 'pause'; + break; + case 'mute': + _0x2ca20d = true, _0x2c1832 = 'mute', _0xcb618b = 'unmute', _0x325832 = 'volume', _0x25c678 = 'muted'; + break; + case 'fullscreen': + _0x2ca20d = true, _0x2c1832 = 'enterFullscreen', _0xcb618b = 'exitFullscreen', _0x325832 = 'enter-fullscreen', _0x25c678 = 'exit-fullscreen'; + break; + default: + _0x2c1832 = _0x2345d2, _0x325832 = _0x427a85; + } + return _0x2ca20d ? (_0x58309d.appendChild(_0x7f9f36.createIcon.call(this, _0x25c678, { + 'class': _0x449eac({ + 'icon--pressed': true + }) + })), _0x58309d.appendChild(_0x7f9f36.createIcon.call(this, _0x325832, { + 'class': _0x449eac({ + 'icon--not-pressed': true + }) + })), _0x58309d.appendChild(_0x7f9f36.createLabel.call(this, _0xcb618b, { + 'class': _0x449eac({ + 'icon--pressed': true + }) + })), _0x58309d.appendChild(_0x7f9f36.createLabel.call(this, _0x2c1832, { + 'class': _0x449eac({ + 'icon--not-pressed': true + }) + }))) : (_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; + }, + 'createRange': function(_0x491b4a, _0x5f154a) { + var _0x2c1832 = _0x428003('input', _0x5dc0c0(_0xa949a8(this.config.selectors.inputs[_0x491b4a]), { + 'type': 'range', + 'min': 0x0, + 'max': 0x64, + 'step': 0.1, + 'value': 0x0, + 'autocomplete': 'off', + 'role': 'slider', + 'aria-label': _0xb9b2ff.get(_0x491b4a, this.config), + 'aria-valuemin': 0x0, + 'aria-valuemax': 0x64, + 'aria-valuenow': 0x0 + }, _0x5f154a)); + return this.elements.inputs[_0x491b4a] = _0x2c1832, _0x7f9f36.updateRangeFill.call(this, _0x2c1832), _0x2c1832; + }, + 'bindMenuItemShortcuts': function(_0x1830d1, _0x2770c2) { + var _0x2c1832 = this; + _0x1093f4(_0x1830d1, 'keydown keyup', function(_0x4bb9d6) { + if ([0x20, 0x26, 0x27, 0x28].includes(_0x4bb9d6.which) && (_0x4bb9d6.preventDefault(), _0x4bb9d6.stopPropagation(), 'keydown' !== _0x4bb9d6.type)) { + var _0x20ac7b, _0x51717d = _0x13f491(_0x1830d1, '[role="menuitemradio"]'); + if (!_0x51717d && [0x20, 0x27].includes(_0x4bb9d6.which)) _0x7f9f36.showMenuPanel.call(_0x2c1832, _0x2770c2, true); + 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)); + } + }, !0x1), _0x1093f4(_0x1830d1, 'keyup', function(_0x3844f5) { + 0xd === _0x3844f5.which && _0x7f9f36.focusFirstMenuItem.call(_0x2c1832, null, true); + }); + }, + 'createMenuItem': function(_0x52a95b) { + var _0x17edbf = this, + _0x2c1832 = _0x52a95b.value, + _0x231912 = _0x52a95b.list, + _0x57313b = _0x52a95b.type, + _0x19be70 = _0x52a95b.title, + _0x4ae558 = _0x52a95b.badge, + _0x34a012 = void 0x0 === _0x4ae558 ? null : _0x4ae558, + _0x7dbb2e = _0x52a95b.checked, + _0x200580 = void 0x0 !== _0x7dbb2e && _0x7dbb2e, + _0x4bb1a2 = _0xa949a8(this.config.selectors.inputs[_0x57313b]), + _0xb8fbbd = _0x428003('button', _0x5dc0c0(_0x4bb1a2, { + 'type': 'button', + 'role': 'menuitemradio', + 'class': '' .concat(this.config.classNames.control, ' ').concat(_0x4bb1a2.class ? _0x4bb1a2.class : '').trim(), + 'aria-checked': _0x200580, + 'value': _0x2c1832 + })), + _0x560073 = _0x428003('span'); + _0x560073.innerHTML = _0x19be70, _0x1e2c68.element(_0x34a012) && _0x560073.appendChild(_0x34a012), _0xb8fbbd.appendChild(_0x560073), Object.defineProperty(_0xb8fbbd, 'checked', { + 'enumerable': true, + 'get': function() { + return 'true' === _0xb8fbbd.getAttribute('aria-checked'); + }, + 'set': function(_0x2da7f0) { + _0x2da7f0 && Array.from(_0xb8fbbd.parentNode.children).filter(function(_0x480c16) { + return _0x13f491(_0x480c16, '[role="menuitemradio"]'); + }).forEach(function(_0x363b12) { + return _0x363b12.setAttribute('aria-checked', 'false'); + }), _0xb8fbbd.setAttribute('aria-checked', _0x2da7f0 ? 'true' : 'false'); + } + }); + var _0x449ec7 = _0x7f9f36.getCoreOptions.call(this); + this.listeners.bind(_0xb8fbbd, 'click keyup', function(_0x270d0d) { + _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({ + 'act': 'update-core-option', + 'key': _0x57313b, + 'value': _0x2c1832, + 'frame': _0xdcec2a.currentFrame + }))) : _0x7f9f36.updateCoreOptions.call(_0x17edbf, _0x57313b, _0x2c1832)), _0x7f9f36.showMenuPanel.call(_0x17edbf, 'home', _0x1e2c68.keyboardEvent(_0x270d0d))); + }, _0x57313b, !0x1), _0x7f9f36.bindMenuItemShortcuts.call(this, _0xb8fbbd, _0x57313b), _0x231912.appendChild(_0xb8fbbd); + }, + 'updateVolume': function() { + _0x1e2c68.element(this.elements.inputs.volume) && _0x7f9f36.setRange.call(this, this.elements.inputs.volume, this.muted ? 0x0 : this.volume), _0x1e2c68.element(this.elements.buttons.mute) && (this.elements.buttons.mute.pressed = this.muted || 0x0 === this.volume); + }, + 'setRange': function(_0x1c075b) { + var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : 0x0; + _0x1e2c68.element(_0x1c075b) && (_0x1c075b.value = _0x17edbf, _0x7f9f36.updateRangeFill.call(this, _0x1c075b)); + }, + 'updateRangeFill': function(_0x2dbde1) { + var _0x17edbf = _0x1e2c68.event(_0x2dbde1) ? _0x2dbde1.target : _0x2dbde1; + if (_0x1e2c68.element(_0x17edbf) && 'range' === _0x17edbf.getAttribute('type')) { + if (_0x13f491(_0x17edbf, this.config.selectors.inputs.volume)) { + var _0x2c1832 = 0x64 * _0x17edbf.value; + _0x17edbf.setAttribute('aria-valuenow', _0x2c1832), _0x17edbf.setAttribute('aria-valuetext', '' .concat(_0x2c1832.toFixed(0x1), '%')); + } else _0x17edbf.setAttribute('aria-valuenow', _0x17edbf.value); + _0x59aa33.isWebkit && _0x17edbf.style.setProperty('--value', '' .concat(_0x17edbf.value / _0x17edbf.max * 0x64, '%')); + } + }, + 'toggleMenuButton': function(_0x249814, _0x2948e9) { + _0x132da7(this.elements.settings.buttons[_0x249814], !_0x2948e9); + }, + 'updateNormalOptions': function(_0x255b79, _0x505484) { + this.elements.settings.buttons[_0x255b79].querySelector('.' .concat(this.config.classNames.menu.value)).innerHTML = _0x7f9f36.normalOptions[_0x255b79].options[_0x505484]; + var _0x2c1832 = {}; + _0x2c1832[_0x255b79] = _0x505484, _0x7f9f36.storage.set(_0x2c1832), 'shader' === _0x255b79 && _0xdcec2a.setShader(_0x505484), 'virtual-gamepad' === _0x255b79 && _0xdcec2a.toggleVirtualGamepad.call(this, 'enabled' === _0x505484); + }, + 'updateCoreOptions': function(_0x41c4ad, _0x15823e) { + if ('nds' == this.system && !_0x2d904a.wasm) return true; + if (_0x7f9f36.coreOptionsValues[_0x41c4ad] = _0x15823e, 'psx' === this.system && _0x27f4c4.Module.pauseMainLoop(), _0xdcec2a.setVariable(_0x41c4ad, _0x15823e), 'psx' === this.system && (setTimeout(function() { + _0x27f4c4.Module.resumeMainLoop(); + }, 0x64), setTimeout(function() { + _0x27f4c4.Module.resumeMainLoop(); + }, 0xc8)), 'nds' === this.system && _0x2d904a.wasm) { + var _0x2c1832 = this.elements.wrapper.querySelector('canvas'); + if ('screen_rotation' === _0x41c4ad) switch (_0x2c1832.style.transform = 'rotate(' + _0x15823e + 'deg)', _0x15823e) { + case '0': + _0xdcec2a.setVariable('desmume_input_rotation', '0'); + break; + case '90': + _0xdcec2a.setVariable('desmume_input_rotation', '270'); + break; + case '180': + _0xdcec2a.setVariable('desmume_input_rotation', '180'); + break; + case '270': + _0xdcec2a.setVariable('desmume_input_rotation', '90'); + } + } + if ('arcade' === this.system || 'fba0.2.97.29' === this.system) { + var _0x567ccc = this.elements.wrapper.querySelector('canvas'); + _0x567ccc.height = 'fba-aspect' === _0x41c4ad && 'PAR' === _0x15823e ? _0x567ccc.width / 0x10 * 0x9 : _0x567ccc.width / 0x4 * 0x3; + } + var _0x31bdec = _0x7f9f36.getCoreOptions.call(this), + _0x3efd0b = _0x7f9f36.storage.get('core-options'); + if (_0x1e2c68.empty(_0x3efd0b) && (_0x3efd0b = {}), _0x3efd0b[_0x41c4ad] = _0x15823e, _0x7f9f36.storage.set({ + 'core-options': _0x3efd0b + }), this.elements.settings.buttons[_0x41c4ad]) { + var _0xe95e6a = this.elements.settings.buttons[_0x41c4ad].querySelector('.' .concat(this.config.classNames.menu.value)); + _0x1e2c68.object(_0x31bdec[_0x41c4ad].options) ? _0xe95e6a.innerHTML = _0x31bdec[_0x41c4ad].options[_0x15823e] : _0xe95e6a.innerHTML = _0x15823e; + } + }, + 'setOptionMenuItem': function(_0x2f0e6a, _0x85969e) { + var _0x2c1832 = this, + _0x549dac = this.elements.settings.panels.home.querySelector('[role="menu"]'), + _0x43777f = this.elements.settings.popup.children[0x0]; + Object.keys(_0x2f0e6a).forEach(function(_0x4fcbcf) { + var _0x177975 = _0x4fcbcf, + _0x5f3e0f = _0x428003('button', _0x5dc0c0(_0xa949a8(_0x2c1832.config.selectors.buttons.settings), { + 'type': 'button', + 'class': _0x449eac({ + 'ejs__control': true, + 'ejs__control--forward': true + }), + 'role': 'menuitem', + 'item': _0x4fcbcf, + 'aria-haspopup': true + })); + _0x1093f4(_0x5f3e0f, 'click', function() { + _0x7f9f36.showMenuPanel.call(_0x2c1832, _0x177975, !0x1); + }); + var _0x1d5857, _0x1838f9 = _0x428003('span', null, _0x2f0e6a[_0x4fcbcf].label), + _0x455b20 = _0x428003('span', { + 'class': _0x2c1832.config.classNames.menu.value + }); + _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); + var _0x3f3775 = _0x428003('div', { + 'data-pane': escape(_0x177975), + 'hidden': '' + }), + _0x288440 = _0x428003('button', { + 'type': 'button', + 'class': _0x449eac({ + 'ejs__control': true, + 'ejs__control--back': true + }) + }); + _0x288440.appendChild(_0x428003('span', { + 'aria-hidden': true + }, _0x2f0e6a[_0x4fcbcf].label)), _0x288440.appendChild(_0x428003('span', { + 'class': _0x449eac({ + 'ejs__sr-only': true + }) + }, _0xb9b2ff.get('menuBack', _0x2c1832.config))), _0x1093f4(_0x3f3775, 'keydown', function(_0x462a4d) { + 0x25 === _0x462a4d.which && (_0x462a4d.preventDefault(), _0x462a4d.stopPropagation(), _0x7f9f36.showMenuPanel.call(_0x2c1832, 'home', true)); + }, !0x1), _0x1093f4(_0x288440, 'click', function() { + _0x7f9f36.showMenuPanel.call(_0x2c1832, 'home', !0x1); + }), _0x3f3775.appendChild(_0x288440), _0x3f3775.appendChild(_0x428003('div', { + 'role': 'menu' + })), _0x43777f.appendChild(_0x3f3775), _0x2c1832.elements.settings.buttons[_0x177975] = _0x5f3e0f, _0x2c1832.elements.settings.panels[_0x177975] = _0x3f3775; + var _0x2c172f = _0x3f3775.querySelector('[role="menu"]'); + ! function(_0x301c01) { + if (_0x1e2c68.element(_0x301c01)) + for (var _0x85969e = _0x301c01.childNodes.length; _0x85969e > 0x0;) _0x301c01.removeChild(_0x301c01.lastChild), _0x85969e -= 0x1; + }(_0x2c172f), _0x1e2c68.object(_0x2f0e6a[_0x4fcbcf].options) ? Object.keys(_0x2f0e6a[_0x4fcbcf].options).forEach(function(_0x281296) { + _0x7f9f36.createMenuItem.call(_0x2c1832, { + 'value': _0x281296, + 'list': _0x2c172f, + 'type': _0x177975, + 'title': _0x2f0e6a[_0x4fcbcf].options[_0x281296], + 'badge': null, + 'checked': Boolean(_0x1d5857 === _0x281296) + }); + }) : _0x1e2c68.array(_0x2f0e6a[_0x4fcbcf].options) && _0x2f0e6a[_0x4fcbcf].options.forEach(function(_0x28a341) { + _0x7f9f36.createMenuItem.call(_0x2c1832, { + 'value': _0x28a341, + 'list': _0x2c172f, + 'type': _0x177975, + 'title': _0x28a341, + 'badge': null, + 'checked': Boolean(_0x1d5857 === _0x28a341) + }); + }); + }); + }, + 'setNormalOptionsMenu': function() { + var _0xa88a13 = this, + _0x17edbf = this, + _0x2c1832 = {}; + _0x2c1832.orientation = _0x7f9f36.storage.get('orientation'), _0x2c1832.shader = _0x7f9f36.storage.get('shader'), _0x17edbf.touch ? (_0x2c1832['virtual-gamepad'] = _0x7f9f36.storage.get('virtual-gamepad'), _0x1093f4.call(_0x17edbf, _0x17edbf.elements.container, 'start-game', function() { + ('enabled' === _0x2c1832['virtual-gamepad'] || _0x1e2c68.empty(_0x2c1832['virtual-gamepad'])) && _0xdcec2a.toggleVirtualGamepad.call(_0x17edbf, true); + })) : delete _0x7f9f36.normalOptions['virtual-gamepad'], _0x7f9f36.setOptionMenuItem.call(this, _0x7f9f36.normalOptions, _0x2c1832), _0x1093f4.call(_0x17edbf, _0x17edbf.elements.container, 'start-game', function() { + var _0x2c1832 = _0xa88a13, + _0x42a7b1 = {}; + _0xdcec2a.getGameCoreOptions && _0xdcec2a.getGameCoreOptions().split('\n').forEach(function(_0x4a987e, _0x10bd7a) { + var _0x2c1832 = _0x4a987e.split('; '), + _0x1ddc5f = _0x2c1832[0x0]; + if (0x0 === _0x1ddc5f.indexOf('fba-dipswitch-')) { + var _0xbd808 = _0x2c1832[0x1].split('|'), + _0x3c4b1a = _0x1ddc5f.replace(/_/g, ' ').replace(/.+\-(.+)/, '$1'); + _0x42a7b1[_0x1ddc5f] = { + 'label': _0x3c4b1a, + 'options': _0xbd808.slice(0x1, -0x1), + 'default': _0xbd808[0x0].replace('(Default) ', ''), + 'netplay': true + }; + } + }); + var _0x27d859 = _0x7f9f36.storage.get('core-options'); + _0x7f9f36.coreOptionsValues = _0x27d859 || {}, _0x7f9f36.setOptionMenuItem.call(_0x17edbf, _0x42a7b1, _0x7f9f36.coreOptionsValues), Object.keys(_0x7f9f36.coreOptionsValues).forEach(function(_0x51fc4e, _0x4b3613) { + _0x7f9f36.updateCoreOptions.call(_0x2c1832, _0x51fc4e, _0x7f9f36.coreOptionsValues[_0x51fc4e]); + }), 'nds' == _0x17edbf.system && (_0x27f4c4.Module._fast_forward_2 ? _0x27f4c4.Module._fast_forward_2(0x1) : _0x27f4c4.Module._fast_forward && _0x27f4c4.Module._fast_forward(0x1)); + }); + }, + 'updateCoreOptionMenuItems': function() { + var _0xa88a13 = this.elements.settings.panels.home.querySelector('[role="menu"]'), + _0x17edbf = _0x7f9f36.getCoreOptions.call(this); + _0xdcec2a.connected && !_0xdcec2a.connection.isInitiator ? Object.keys(_0x17edbf).forEach(function(_0x480587) { + _0x17edbf[_0x480587].netplay && _0xa88a13.querySelector('[item="' .concat(_0x480587, '"]')).setAttribute('disabled', ''); + }) : Object.keys(_0x17edbf).forEach(function(_0x20e093) { + _0xa88a13.querySelector('[item="' .concat(_0x20e093, '"]')).removeAttribute('disabled'); + }); + }, + 'setCoreOptionsMenu': function() { + this.elements.settings.panels.home.querySelector('[role="menu"]'), this.elements.settings.popup.children[0x0]; + var _0xa88a13 = _0x7f9f36.getCoreOptions.call(this), + _0x17edbf = _0x7f9f36.storage.get('core-options'); + _0x7f9f36.coreOptionsValues = _0x17edbf || {}, _0x7f9f36.setOptionMenuItem.call(this, _0xa88a13, _0x17edbf); + }, + 'checkMenu': function() { + var _0xa88a13 = this.elements.settings.buttons; + !_0x1e2c68.empty(_0xa88a13) && Object.values(_0xa88a13).some(function(_0x200331) { + return !_0x200331.hidden; + }); + _0x132da7(this.elements.settings.menu, !0x1); + }, + 'focusFirstMenuItem': function(_0x303d68) { + var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] && arguments[0x1]; + if (!this.elements.settings.popup.hidden) { + var _0x2c1832 = _0x303d68; + _0x1e2c68.element(_0x2c1832) || (_0x2c1832 = Object.values(this.elements.settings.panels).find(function(_0xe94c5e) { + return !_0xe94c5e.hidden; + })); + var _0x2f3a13 = _0x2c1832.querySelector('[role^="menuitem"]'); + _0x31cc23.call(this, _0x2f3a13, _0x17edbf); + } + }, + 'toggleMenu': function(_0x28d6c6) { + var _0x17edbf = this.elements.settings.popup, + _0x2c1832 = this.elements.buttons.settings; + if (_0x1e2c68.element(_0x17edbf) && _0x1e2c68.element(_0x2c1832)) { + var _0x614270 = _0x17edbf.hidden, + _0x14f1b5 = _0x614270; + if (_0x1e2c68.boolean(_0x28d6c6)) _0x14f1b5 = _0x28d6c6; + else if (_0x1e2c68.keyboardEvent(_0x28d6c6) && 0x1b === _0x28d6c6.which) _0x14f1b5 = !0x1; + else if (_0x1e2c68.event(_0x28d6c6)) { + var _0xcf75ac = _0x17edbf.contains(_0x28d6c6.target); + if (_0xcf75ac || !_0xcf75ac && _0x28d6c6.target !== _0x2c1832 && _0x14f1b5) return; + } + _0x2c1832.setAttribute('aria-expanded', _0x14f1b5); + _0x132da7(_0x17edbf, !_0x14f1b5); + _0x3a8e2f(this.elements.container, this.config.classNames.menu.open, _0x14f1b5); + _0x14f1b5 && _0x1e2c68.keyboardEvent(_0x28d6c6) ? _0x7f9f36.focusFirstMenuItem.call(this, null, true) : _0x14f1b5 || _0x614270 || _0x31cc23.call(this, _0x2c1832, _0x1e2c68.keyboardEvent(_0x28d6c6)); + } + }, + 'getMenuSize': function(_0x55fe13) { + var _0x17edbf = _0x55fe13.cloneNode(true); + _0x17edbf.style.position = 'absolute'; + _0x17edbf.style.opacity = 0; + _0x17edbf.removeAttribute('hidden'); + _0x55fe13.parentNode.appendChild(_0x17edbf); + var _0x2c1832 = _0x17edbf.scrollWidth, + _0x5edd1b = _0x17edbf.scrollHeight; + return _0x12a55d(_0x17edbf), { + 'width': _0x2c1832, + 'height': _0x5edd1b + }; + }, + 'showLoadStatePanel': function() {}, + 'showMenuPanel': function() { + var _0xa88a13 = this, + _0x17edbf = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '', + _0x2c1832 = arguments.length > 0x1 && void 0x0 !== arguments[0x1] && arguments[0x1], + _0x7f4281 = _0x530042.call(this, '[data-pane="' .concat(escape(_0x17edbf), '"]')); + if (_0x1e2c68.element(_0x7f4281)) { + var _0x3d6729 = _0x7f4281.parentNode, + _0x381f57 = Array.from(_0x3d6729.children).find(function(_0x57c652) { + return !_0x57c652.hidden; + }); + if (_0x2d904a.transitions && !_0x2d904a.reducedMotion) { + _0x3d6729.style.width = '' .concat(_0x381f57.scrollWidth, 'px'); + _0x3d6729.style.height = '' .concat(_0x381f57.scrollHeight, 'px'); + var _0x29dd37 = _0x7f9f36.getMenuSize.call(this, _0x7f4281), + _0x37447f = function _0x17edbf(_0x40854f) { + _0x40854f.target === _0x3d6729 && ['width', 'height'].includes(_0x40854f.propertyName) && (_0x3d6729.style.width = '', _0x3d6729.style.height = '', _0x20109b.call(_0xa88a13, _0x3d6729, _0x5a2767, _0x17edbf)); + }; + _0x1093f4.call(this, _0x3d6729, _0x5a2767, _0x37447f), _0x3d6729.style.width = '' .concat(_0x29dd37.width, 'px'), _0x3d6729.style.height = '' .concat(_0x29dd37.height, 'px'); + } + _0x132da7(_0x381f57, true); + _0x132da7(_0x7f4281, false); + _0x7f9f36.focusFirstMenuItem.call(this, _0x7f4281, _0x2c1832); + } + }, + 'setLoadState': function(_0x526828, _0x2ce330) { + _0x526828.appendChild(_0x7f9f36.createButton.call(this, 'load-state', { + 'aria-haspopup': true, + 'aria-expanded': !0x1 + })); + var _0x2c1832 = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__dialog': true, + 'ejs__load-state__container': true + }), + 'hidden': '' + }), + _0x2e5e96 = _0x428003('div'); + _0x2c1832.appendChild(_0x2e5e96); + _0x530042.call(this, '.' .concat(_0x449eac({ + 'ejs__dialogs': true + }))).appendChild(_0x2c1832); + this.elements.dialogs.loadState = _0x2c1832; + }, + 'setScreenRecord': function(_0x4c3fdd, _0x289259) { + if (! window.MediaRecorder) { + return; + }; + var _0x2c1832 = _0x7f9f36.createButton.call(this, 'screen-record', { + 'aria-haspopup': true, + 'aria-expanded': !0x1, + 'style': 'margin-right:auto;' + }); + _0x4c3fdd.appendChild(_0x2c1832); + var _0x13c0e4 = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__dialog': true, + 'ejs__screenRecord__container': true + }), + 'hidden': '' + }), + _0xe2c02a = _0x428003('div'); + _0x13c0e4.appendChild(_0xe2c02a); + _0x530042.call(this, '.' .concat(_0x449eac({ + 'ejs__dialogs': true + }))).appendChild(_0x13c0e4); + this.elements.dialogs.screenRecord = _0x13c0e4; + }, + 'setGamepad': function(_0x4c3fdd, _0x289259) { + var _0x2c1832 = _0x7f9f36.createButton.call(this, 'gamepad', { + 'aria-haspopup': true, + 'aria-expanded': !0x1, + 'style': 'margin-right:auto;' + }); + _0x4c3fdd.appendChild(_0x2c1832); + var _0x13c0e4 = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__dialog': true, + 'ejs__gamepad__container': true + }), + 'hidden': '' + }), + _0xe2c02a = _0x428003('div'); + _0x13c0e4.appendChild(_0xe2c02a); + _0x530042.call(this, '.' .concat(_0x449eac({ + 'ejs__dialogs': true + }))).appendChild(_0x13c0e4); + this.elements.dialogs.gamepad = _0x13c0e4; + }, + 'setCheat': function(_0x328075, _0x21ca37) { + var _0x2c1832 = _0x7f9f36.createButton.call(this, 'cheat', { + 'aria-haspopup': true, + 'aria-expanded': !0x1, + 'style': 'margin-right:auto;' + }); + _0x328075.appendChild(_0x2c1832); + var _0x173db3 = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__dialog': true, + 'ejs__cheat__container': true + }), + 'hidden': '' + }), + _0x460961 = _0x428003('div'); + _0x173db3.appendChild(_0x460961); + _0x530042.call(this, '.' .concat(_0x449eac({ + 'ejs__dialogs': true + }))).appendChild(_0x173db3); + this.elements.dialogs.cheat = _0x173db3; + }, + 'setStateInfoBarWidget': function() { + var _0xa88a13 = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__widget': true + }) + }), + _0x17edbf = _0x428003('div'); + _0x17edbf.style = 'color: red;font-size: 17px;padding:10px;text-align:left;text-shadow:1px 1px 1px #000' + _0xa88a13.appendChild(_0x17edbf); + _0x530042.call(this, '.' .concat(_0x449eac({ + 'ejs__widgets': true + }))).appendChild(_0xa88a13); + this.elements.widgets.stateInfo = _0xa88a13; + this.elements.widgets.stateInfoDiv = _0x17edbf; + }, + 'setNetplayWidgets': function() { + var _0xa88a13 = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__widget': true, + 'ejs__widget_netplay': true + }) + }), + _0x17edbf = _0x428003('div'); + _0xa88a13.appendChild(_0x17edbf); + _0x530042.call(this, '.' .concat(_0x449eac({ + 'ejs__widgets': true + }))).appendChild(_0xa88a13); + this.elements.widgets.netplay = _0xa88a13; + }, + 'setNetplay': function(_0x1859f4, _0x50544d) { + _0x1859f4.appendChild(_0x7f9f36.createButton.call(this, 'netplay', { + 'aria-haspopup': true, + 'aria-expanded': !0x1 + })); + var _0x2c1832 = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__dialog': true, + 'ejs__netplay__container': true + }), + 'hidden': '' + }), + _0x4f63e0 = _0x428003('div'); + _0x2c1832.appendChild(_0x4f63e0); + _0x530042.call(this, '.' .concat(_0x449eac({ + 'ejs__dialogs': true + }))).appendChild(_0x2c1832); + this.elements.dialogs.netplay = _0x2c1832; + _0x7f9f36.setNetplayWidgets.call(this); + }, + 'toggleContextMenu': function(_0x24b1f3, _0x4b9d55) { + if (_0x350d73(_0x24b1f3.target, _0x449eac({ + 'ejs__dialogs': true + }))) { + var _0x2c1832 = _0x7f9f36.contextMenu.timer; + if (this.started) { + var _0x2a1dda = _0x530042.call(this, '.' .concat(_0x449eac({ + 'ejs__contextmenu': true + }), ' ul')); + if (_0x4b9d55) { + _0x7f9f36.contextMenu.style.display = 'block', _0x7f9f36.contextMenu.style.left = '' .concat(_0x24b1f3.layerX, 'px'), _0x7f9f36.contextMenu.style.top = '' .concat(_0x24b1f3.layerY, 'px'); + var _0x1b48e7 = _0x23ffa1.call(this, '.' .concat(_0x449eac({ + 'ejs__contextmenu': true + }), ' ul li')); + if (Array.from(_0x1b48e7).forEach(function(_0x228a1f, _0x123a07) {}), null === _0x2a1dda.getAttribute('menu')) { + var _0x14264d = _0x428003('li', {}); + _0x14264d.appendChild(_0x428003('a', { + 'target': '_blank', + 'href': 'https://github.com/ethanaobrien/emulatorjs' + }, 'EmulatorJS v' .concat(this.version))), _0x2a1dda.appendChild(_0x14264d), _0x2a1dda.setAttribute('menu', ''); + } + _0x2c1832 && clearTimeout(_0x2c1832), _0x2c1832 = setTimeout(function() {}, 0xfa0), _0x7f9f36.contextMenu.timer = _0x2c1832; + } else _0x7f9f36.contextMenu.style.display = 'none'; + } + } + }, + 'create': function(_0x42e40d) { + var _0xa88a13 = this; + _0x7f9f36.storage = new _0x2f61ba(this, 'ejs_' .concat(this.system, '_settings')); + var _0x17edbf = _0x428003('div', _0xa949a8(this.config.selectors.controls.wrapper)); + _0x7f9f36.contextMenu = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__contextmenu': true + }), + 'style': 'position: absolute; display:none;z-index:9' + }) + var contextHtml = ['
    ', '
'] + var contextFunctions = [] + function addContextHtml(title, hidden, functi0n) { + if (typeof functi0n == 'function') { + contextFunctions.push(functi0n) + } else { + contextFunctions.push(function(){}) + } + var i = contextHtml.length - 1 + if (hidden) { + contextHtml.splice(i, 0, '') + } else { + contextHtml.splice(i, 0, '
  • '+title+'
  • ') + } + } + addContextHtml(_0xa88a13.localization('Take Screenshot'), false, function(_0x20faaa) { + var _0x4e898a = _0x378b5c.getScreenData(); + _0x4e4ca6()(new Blob([_0x4e898a]), 'game.png'); + return false; + }) + addContextHtml(_0xa88a13.localization('Cache Manage'), true, function(_0x275730) { + if (_0x27f4c4.romdb) { + _0x132da7(_0xa88a13.elements.dialogs.cache, !0x1); + var _0x3360eb = _0xa88a13.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-content'])); + _0x3360eb.innerHTML = '
    '+_0xa88a13.localization('Loading')+'
    ', _0x27f4c4.romdb.getAll(function(_0x43586d) { + if (_0x43586d) { + var _0x275730 = _0x428003('table', { + 'style': 'width:100%;padding-left:10px;text-align:left' + }), + _0x1ab9e9 = _0x428003('tbody'); + _0x43586d.length > 0x0 ? (_0x3360eb.innerHTML = '', _0x43586d.forEach(function(_0x32b0b7, _0x2d0e11) { + if (_0x32b0b7.key && !/-part-\d+$/ .test(_0x32b0b7.key)) { + for (var _0x3360eb = Math.ceil(_0x32b0b7.filesize / 0x6400000), _0x277c67 = [_0x32b0b7.key], _0x3edb35 = 0x1; _0x3edb35 < _0x3360eb; _0x3edb35 += 0x1) _0x277c67.push('' .concat(_0x32b0b7.key, '-part-').concat(_0x3edb35)); + var _0x3e31f6 = _0x428003('tr'), + _0x5b75bd = _0x428003('td'), + _0x227405 = _0x428003('td'), + _0xac150b = _0x428003('td'); + _0x5b75bd.innerHTML = _0x32b0b7.filename, _0x227405.innerHTML = function(_0x1858c1) { + var _0x2d0e11 = -0x1; + do { + _0x1858c1 /= 0x400, _0x2d0e11++; + } while (_0x1858c1 > 0x400); + return Math.max(_0x1858c1, 0.1).toFixed(0x1) + [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'][_0x2d0e11]; + }(_0x32b0b7.filesize), _0xac150b.innerHTML = 'Remove', _0x3e31f6.appendChild(_0x5b75bd), _0x3e31f6.appendChild(_0x227405), _0x3e31f6.appendChild(_0xac150b), _0x1ab9e9.appendChild(_0x3e31f6), _0xac150b.querySelector('a').onclick = function(_0x16f22a) { + _0x27f4c4.romdb.removeBatch(_0x277c67); + try { + _0x1ab9e9.removeChild(_0x3e31f6); + } catch (_0x353628) {} + return _0x16f22a.stopPropagation(), !0x1; + }; + } + }), _0x275730.appendChild(_0x1ab9e9), _0x3360eb.appendChild(_0x275730)) : _0x3360eb.innerHTML = '
    '+_0xa88a13.localization('Empty')+'
    '; + } else _0x3360eb.innerHTML = '
    '+_0xa88a13.localization('Empty')+'
    '; + }, function() {}); + } + return false; + }) + addContextHtml(_0xa88a13.localization('Quick Save')+' (F2)', false, function(_0x395c73) { + _0x378b5c.quickSaveState(); + _0x2593da.contextMenu.style.display = 'none'; + }) + addContextHtml(_0xa88a13.localization('Quick Load')+' (F4)', false, function(_0x124f69) { + _0x378b5c.quickLoadState(); + _0x2593da.contextMenu.style.display = 'none'; + }) + + + _0x7f9f36.contextMenu.innerHTML = contextHtml.join('') + var a = _0x7f9f36.contextMenu.getElementsByTagName('li') + for (var i=0; i 0x0 && _0x7f9f36.setNetplay.call(this, _0x17edbf, _0x42e40d); + _0x7f9f36.setGamepad.call(this, _0x17edbf, _0x42e40d); + _0x7f9f36.setStateInfoBarWidget.call(this, _0x17edbf, _0x42e40d); + _0x7f9f36.setCheat.call(this, _0x17edbf, _0x42e40d); + _0x17edbf.appendChild(_0x428003('span', { + 'style': 'flex:1' + })); + var _0xd299b = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__volume': true + }) + }); + _0xd299b.appendChild(_0x7f9f36.createButton.call(this, 'mute')); + var _0x4bbcd0 = { + 'max': 0x1, + 'step': 0.01, + 'value': this.config.volume + }; + _0xd299b.appendChild(_0x7f9f36.createRange.call(this, 'volume', _0x5dc0c0(_0x4bbcd0, {}))), this.elements.volume = _0xd299b, _0x17edbf.appendChild(_0xd299b); + var _0x2746ab = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__menu': true + }) + }); + _0x2746ab.appendChild(_0x7f9f36.createButton.call(this, 'settings', { + 'aria-haspopup': true, + 'aria-expanded': !0x1 + })); + var _0x262fb8 = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__menu__container': true + }), + 'hidden': '' + }), + _0x3f3385 = _0x428003('div'), + _0x174c46 = _0x428003('div', { + 'data-pane': 'home' + }), + _0x17f3cb = _0x428003('div', { + 'role': 'menu' + }); + _0x174c46.appendChild(_0x17f3cb) + _0x3f3385.appendChild(_0x174c46) + this.elements.settings.panels.home = _0x174c46 + _0x262fb8.appendChild(_0x3f3385) + _0x2746ab.appendChild(_0x262fb8) + _0x17edbf.appendChild(_0x2746ab) + this.elements.settings.popup = _0x262fb8 + this.elements.settings.menu = _0x2746ab + _0x17edbf.appendChild(_0x7f9f36.createButton.call(this, 'fullscreen')) + var _0x19edbf = this; + _0x17edbf.addEventListener('mousedown', function() { + _0x19edbf.onButtonDiv = true; + }) + this.elements.controls = _0x17edbf + _0x7f9f36.setNormalOptionsMenu.call(this) + _0x7f9f36.setCoreOptionsMenu.call(this) + return _0x17edbf; + }, + 'inject': function() { + var _0xa88a13 = this; + this.icons = { + 'enter-fullscreen': '', + 'exit-fullscreen': '', + 'gamepad': '', + 'load-state': '', + 'muted': '', + 'netplay': '', + 'pause': '', + 'play': '', + 'restart': '', + 'save-state': '', + 'screen-record': '', + 'settings': '', + 'volume': '\n \n ', + 'cheat': '' + }, this.id = Math.floor(0x2710 * Math.random()); + var _0x17edbf = null; + this.elements.controls = null; + var _0x2c1832 = { + 'id': this.id + }, + _0x270a9e = true; + _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, { + 'id': this.id, + 'seektime': this.config.seekTime, + 'speed': this.speed, + 'quality': this.quality + }), _0x270a9e = !0x1); + var _0x1e6644, _0x3ec218 = function(_0x406126) { + var _0x17edbf = _0x406126; + return Object.entries(_0x2c1832).forEach(function(_0x3e992c) { + var _0x2c1832 = _0x5005e6(_0x3e992c, 0x2), + _0x47c2ec = _0x2c1832[0x0], + _0x547588 = _0x2c1832[0x1]; + _0x17edbf = _0x1a0e98(_0x17edbf, '{' .concat(_0x47c2ec, '}'), _0x547588); + }), _0x17edbf; + }; + 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)) { + var _0xe8272c = function(_0x176a3e) { + var _0x2c1832 = _0xa88a13.config.classNames.controlPressed; + Object.defineProperty(_0x176a3e, 'pressed', { + 'enumerable': true, + 'get': function() { + return _0x350d73(_0x176a3e, _0x2c1832); + }, + 'set': function() { + var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] && arguments[0x0]; + _0x3a8e2f(_0x176a3e, _0x2c1832, _0xa88a13); + } + }); + }; + Object.values(this.elements.buttons).filter(Boolean).forEach(function(_0x577b9b) { + _0x1e2c68.array(_0x577b9b) || _0x1e2c68.nodeList(_0x577b9b) ? Array.from(_0x577b9b).filter(Boolean).forEach(_0xe8272c) : _0xe8272c(_0x577b9b); + }); + } + window.navigator.userAgent.includes('Edge') && _0x2b30e0(_0x1e6644); + } + }, + _0x2593da = _0x7f9f36; + + function _0x28bdca(_0x5c50c3, _0x217698) { + for (var _0x2c1832 = 0x0; _0x2c1832 < _0x217698.length; _0x2c1832++) { + var _0x172cdb = _0x217698[_0x2c1832]; + _0x172cdb.enumerable = _0x172cdb.enumerable || !0x1, _0x172cdb.configurable = true, 'value' in _0x172cdb && (_0x172cdb.writable = true), Object.defineProperty(_0x5c50c3, _0x172cdb.key, _0x172cdb); + } + } + + function _0x238270() { + if (this.enabled) { + var _0xa88a13 = this.player.elements.buttons.fullscreen; + _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); + } + } + + function _0x3c983f() { + var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] && arguments[0x0]; + _0xa88a13 ? this.scrollPosition = { + 'x': window.scrollX || 0x0, + 'y': window.scrollY || 0x0 + } : 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); + } + var _0x335854 = function() { + function _0x1339df(_0x5f19c6) { + var _0x2c1832 = this; + ! function(_0x143a8a, _0x32a0a1) { + if (!(_0x143a8a instanceof _0x32a0a1)) throw new TypeError('Cannot call a class as a function'); + }(this, _0x1339df), this.player = _0x5f19c6, this.prefix = _0x1339df.prefix, this.property = _0x1339df.property, this.scrollPosition = { + 'x': 0x0, + 'y': 0x0 + }, _0x1093f4.call(this.player, document, 'ms' === this.prefix ? 'MSFullscreenChange' : '' .concat(this.prefix, 'fullscreenchange'), function() { + _0x238270.call(_0x2c1832); + }), this.update(); + } + + var _0x17edbf, _0x2c1832, _0x50d347; + + _0x17edbf = _0x1339df + + _0x50d347 = [{ + 'key': 'native', + 'get': function() { + return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled); + } + }, { + 'key': 'prefix', + 'get': function() { + if (_0x1e2c68.function(document.exitFullscreen)) return ''; + var _0x1339df = ''; + return ['webkit', 'moz', 'ms'].some(function(_0xc1e0c3) { + return !(!_0x1e2c68.function(document['' .concat(_0xc1e0c3, 'ExitFullscreen')]) && !_0x1e2c68.function(document['' .concat(_0xc1e0c3, 'CancelFullScreen')]) || (_0x1339df = _0xc1e0c3, 0x0)); + }), _0x1339df; + } + }, { + 'key': 'property', + 'get': function() { + return 'moz' === this.prefix ? 'FullScreen' : 'Fullscreen'; + } + }] + + _0x2c1832 = [{ + 'key': 'update', + 'value': function() { + this.enabled, _0x3a8e2f(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled); + } + }, { + 'key': 'enter', + 'value': function() { + 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)); + } + }, { + 'key': 'exit', + 'value': function() { + if (this.enabled) + if (_0x1339df.native) + if (this.prefix) { + if (!_0x1e2c68.empty(this.prefix)) { + var _0x17edbf = 'moz' === this.prefix ? 'Cancel' : 'Exit'; + document['' .concat(this.prefix).concat(_0x17edbf).concat(this.property)](); + } + } else(document.cancelFullScreen || document.exitFullscreen).call(document); + else _0x3c983f.call(this, !0x1); + } + }, { + 'key': 'toggle', + 'value': function() { + this.active ? this.exit() : this.enter(); + } + }, { + 'key': 'enabled', + 'get': function() { + return _0x1339df.native; + } + }, { + 'key': 'active', + 'get': function() { + 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)); + } + }, { + 'key': 'target', + 'get': function() { + return _0x59aa33.isEdge ? this.player.game : this.player.elements.container; + } + }] + + _0x28bdca(_0x17edbf.prototype, _0x2c1832) + _0x50d347 && _0x28bdca(_0x17edbf, _0x50d347) + return _0x1339df; + + }(); + + function _0x42b437(_0x458e02, _0x5729e1) { + if (Array.isArray(_0x458e02)) return _0x458e02; + var _0x2c1832 = [], + _0x2e7aa7 = true, + _0x393a5f = false, + _0x3b4eca = void 0x0; + try { + for (var _0x1aca09, _0x1bb8de = _0x458e02[Symbol.iterator](); !(_0x2e7aa7 = (_0x1aca09 = _0x1bb8de.next()).done) && (_0x2c1832.push(_0x1aca09.value), !_0x5729e1 || _0x2c1832.length !== _0x5729e1); _0x2e7aa7 = true); + } catch (_0x190997) { + _0x393a5f = true, _0x3b4eca = _0x190997; + } finally { + try { + _0x2e7aa7 || null == _0x1bb8de.return || _0x1bb8de.return(); + } finally { + if (_0x393a5f) throw _0x3b4eca; + } + } + return _0x2c1832; + throw new TypeError('Invalid attempt to destructure non-iterable instance'); + } + var _0x37093c = function() { + function _0x31e271(_0x948a97) { + ! function(_0x3adedc, _0x5952e9) { + if (!(_0x3adedc instanceof _0x5952e9)) throw new TypeError('Cannot call a class as a function'); + }(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); + } + _0x31e271.prototype = { + toggleMenu: function(_0x3156ad) { + _0x2593da.toggleMenu.call(this.emulator, _0x3156ad); + }, + firstTouch: function() { + var _0x31e271 = this.emulator, + _0x17edbf = _0x31e271.elements; + _0x31e271.touch = true, _0x3a8e2f(_0x17edbf.container, _0x31e271.config.classNames.isTouch, true); + }, + setTabFocus: function(_0x20bf1f) { + var _0x17edbf = this.emulator, + _0x2c1832 = _0x17edbf.elements, + _0x48d087 = _0x17edbf; + if (clearTimeout(this.focusTimer), 'keydown' !== _0x20bf1f.type || 0x9 === _0x20bf1f.which) { + 'keydown' === _0x20bf1f.type && (this.lastKeyDown = _0x20bf1f.timeStamp); + var _0x27d4ad, _0x967a30 = _0x20bf1f.timeStamp - this.lastKeyDown <= 0x14; + ('focus' !== _0x20bf1f.type || _0x967a30) && (_0x27d4ad = _0x48d087.config.classNames.tabFocus, _0x3a8e2f(_0x23ffa1.call(_0x48d087, '.' .concat(_0x27d4ad)), _0x27d4ad, !0x1), this.focusTimer = setTimeout(function() { + var _0x20bf1f = document.activeElement; + _0x2c1832.container.contains(_0x20bf1f) && _0x3a8e2f(document.activeElement, _0x48d087.config.classNames.tabFocus, true); + }, 0xa)); + } + }, + global: function() { + var _0x31e271 = !(arguments.length > 0x0 && void 0x0 !== arguments[0x0]) || arguments[0x0], + _0x17edbf = this.emulator, + _0x2c1832 = _0x17edbf; + _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, !0x1, true), _0x1093f4.call(_0x2c1832, document.body, 'keyup', function(_0x4e289a) { + _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')); + }); + }, + container: function() { + var _0x31e271, _0x17edbf = this.emulator, + _0x2c1832 = _0x17edbf.elements, + _0x45d275 = _0x17edbf, + setFullscreenInterval = null; + _0x1093f4.call(_0x45d275, _0x2c1832.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen start-game', function(_0x1ac81c) { + var _0x3953b5 = _0x2c1832.controls; + _0x3953b5 && 'enterfullscreen' === _0x1ac81c.type && (_0x3953b5.pressed = !0x1, _0x3953b5.hover = !0x1); + var _0x2c3de3 = 0x0; + if (['touchstart', 'touchmove', 'mousemove', 'start-game'].includes(_0x1ac81c.type)) { + if (_0x17edbf.system == 'nds' && _0x1ac81c.type == 'mousemove' && _0x27f4c4 && _0x27f4c4.Module && _0x27f4c4.Module.canvas && (document.pointerLockElement === _0x27f4c4.Module.canvas || document.mozPointerLockElement === _0x27f4c4.Module.canvas)) { + _0x5ab74d.toggleControls.call(_0x45d275, false); + return; + } + if (_0xdcec2a && (_0xdcec2a.virtualGamepadContainer == 'undefined' || _0xdcec2a.virtualGamepadContainer === null)) { + _0x5ab74d.toggleControls.call(_0x45d275, true); + _0x2c3de3 = _0x45d275.touch ? 0xbb8 : 0x7d0; + clearTimeout(_0x31e271); + _0x31e271 = setTimeout(function() { + return _0x5ab74d.toggleControls.call(_0x45d275, !0x1); + }, _0x2c3de3); + _0x2c1832.controls.setAttribute('data-timer', _0x31e271); + } + }; + }), _0x1093f4.call(_0x45d275, window, 'resize', function(_0x3e2cc5) { + var _0x17edbf = _0x45d275.elements.container.clientHeight, + _0x2c1832 = _0x23ffa1.call(_0x45d275, '.' .concat(_0x449eac({ + 'ejs__menu__container': true + }), ' [role="menu"]')); + Array.from(_0x2c1832).forEach(function(_0x43a16d) { + _0x43a16d.style.maxHeight = '' .concat(_0x17edbf - 0x5f, 'px'), _0x43a16d.style.overflow = 'auto'; + }), _0x27f4c4.Module && _0x27f4c4.Module.canvas, _0x45d275.elements.container.clientWidth / _0x45d275.elements.container.clientHeight < 1.3 ? _0x3a8e2f(_0x45d275.elements.container, _0x449eac({ + 'portrait': true + }), true) : _0x3a8e2f(_0x45d275.elements.container, _0x449eac({ + 'portrait': true + }), !0x1); + }), _0xbae705.call(_0x45d275, window, 'resize'), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'enterfullscreen', function(_0x586586) { + if (_0x45d275.coreVer === 2 && _0x27f4c4.Module) { + var repeat = 50; + clearInterval(setFullscreenInterval); + setFullscreenInterval = setInterval(function() { + _0x27f4c4.Module.setCanvasSize(window.innerWidth, window.innerHeight); + if (repeat < 0) { + clearInterval(setFullscreenInterval); + } + repeat--; + }, 100) + } + setTimeout(function() { + _0xbae705.call(_0x45d275, window, 'resize'); + }, 0x12c); + }), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'exitfullscreen', function(_0x4de2f3) { + if (_0x45d275.coreVer === 2 && _0x27f4c4.Module) { + clearInterval(setFullscreenInterval); + _0x27f4c4.Module.setCanvasSize(800, 600); + } + setTimeout(function() { + _0xbae705.call(_0x45d275, window, 'resize'); + }, 0x12c); + }), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'start-game', function(_0x5b0a00) { + var _0x17edbf = window.document.createEvent('UIEvents'); + _0x17edbf.initUIEvent('resize', true, !0x1, window, 0x0), window.dispatchEvent(_0x17edbf), _0x3a8e2f(_0x45d275.elements.container, _0x449eac({ + 'game-started': true + }), true); + }), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'blur', function(_0x893c7a) { + var _0x17edbf = _0x893c7a.currentTarget; + setTimeout(function() { + _0x17edbf.contains(document.activeElement) || _0xbae705.call(_0x45d275, _0x45d275.elements, 'blurgame'); + }, 0x0); + }), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'focus', function(_0xe0dee3) { + var _0x17edbf = _0xe0dee3.currentTarget; + setTimeout(function() { + _0x17edbf.contains(document.activeElement) && _0xbae705.call(_0x45d275, _0x45d275.elements, 'focusgame'); + }, 0x0); + }); + }, + media: function() { + var _0x31e271 = this.emulator, + _0x17edbf = _0x31e271.elements, + _0x2c1832 = _0x31e271; + _0x1093f4.call(_0x2c1832, _0x2c1832.game, 'volumechange', function(_0x3099fe) { + return _0x2593da.updateVolume.call(_0x2c1832, _0x3099fe); + }), _0x1093f4.call(_0x2c1832, _0x17edbf.container, 'contextmenu', function(_0x5c22bc) { + _0x2c1832.touch || _0x2c1832.lightgun || _0x2593da.toggleContextMenu.call(_0x2c1832, _0x5c22bc, true), _0x5c22bc.preventDefault(); + }, !0x1), _0x1093f4.call(_0x2c1832, _0x17edbf.container, 'mousewheel', function(_0x49c974) { + _0x49c974.stopPropagation(); + }, !0x1), _0x1093f4.call(_0x2c1832, _0x17edbf.container, 'mousedown', function(_0x53ee35) { + if (_0x31e271.system == 'nds' && _0x27f4c4 && _0x27f4c4.Module && _0x27f4c4.Module.canvas && ! _0x27f4c4.isMobileDevice && !(document.pointerLockElement === _0x27f4c4.Module.canvas || document.mozPointerLockElement === _0x27f4c4.Module.canvas) && _0x31e271.started && !_0x31e271.connected) { + setTimeout(function() { + if (_0x31e271.onButtonDiv !== true) { + _0x27f4c4.Module.canvas.requestPointerLock = _0x27f4c4.Module.canvas.requestPointerLock || _0x27f4c4.Module.canvas.mozRequestPointerLock; + _0x27f4c4.Module.canvas.requestPointerLock() + } + _0x31e271.onButtonDiv = false + }, 100) + } + _0x2c1832.touch || _0x2593da.toggleContextMenu.call(_0x2c1832, _0x53ee35, !0x1); + }, !0x1), _0x1093f4.call(_0x2c1832, _0x2c1832.game, 'volumechange', function() { + _0x2c1832.storage.set({ + 'volume': _0x2c1832.volume, + 'muted': _0x2c1832.muted + }), _0xdcec2a.setVolume && _0xdcec2a.setVolume(); + }); + var _0x38e17f = _0x2c1832.config.events.concat(['keyup', 'keydown']).join(' '); + _0x1093f4.call(_0x2c1832, _0x2c1832.game, _0x38e17f, function(_0x38e438) { + var _0x2b4804 = _0x38e438.detail, + _0x1bfeb2 = void 0x0 === _0x2b4804 ? {} : _0x2b4804; + 'error' === _0x38e438.type && (_0x1bfeb2 = _0x2c1832.game.error), _0xbae705.call(_0x2c1832, _0x17edbf.container, _0x38e438.type, true, _0x1bfeb2); + }); + }, + proxy: function(_0x52d0c2, _0x500f90, _0x175ce5) { + var _0x4bb44e = this.emulator, + _0x584a64 = _0x4bb44e.config.listeners[_0x175ce5], + _0x5269fd = true; + _0x1e2c68.function(_0x584a64) && (_0x5269fd = _0x584a64.call(_0x4bb44e, _0x52d0c2)), _0x5269fd && _0x1e2c68.function(_0x500f90) && _0x500f90.call(_0x4bb44e, _0x52d0c2); + }, + bind: function(_0x4a8d46, _0x8f91ad, _0x2affda, _0x41dfb1) { + var _0x1363b1 = this, + _0x53b9a1 = !(arguments.length > 0x4 && void 0x0 !== arguments[0x4]) || arguments[0x4], + _0x5209a5 = this.emulator, + _0x27b738 = _0x5209a5, + _0x5d89ff = _0x27b738.config.listeners[_0x41dfb1], + _0x100c9f = _0x1e2c68.function(_0x5d89ff); + _0x1093f4.call(_0x27b738, _0x4a8d46, _0x8f91ad, function(_0x5a03ac) { + return _0x1363b1.proxy(_0x5a03ac, _0x2affda, _0x41dfb1); + }, _0x53b9a1 && !_0x100c9f); + }, + controls: function() { + var _0x31e271 = this, + _0x17edbf = this.emulator, + _0x2c1832 = _0x17edbf.elements, + _0x127f22 = _0x59aa33.isIE ? 'change' : 'input'; + if (this.bind(_0x2c1832.buttons.mute, 'click', function() { + _0x17edbf.muted = !_0x17edbf.muted; + }, 'mute'), this.bind(_0x2c1832.buttons.fullscreen, 'click', function() { + _0x17edbf.fullscreen.toggle(); + }, 'fullscreen'), this.bind(_0x2c1832.buttons.gamepad, 'click', function() { + _0x5ab74d.toggleControls.call(_0x17edbf, !0x1), _0x132da7(_0x2c1832.dialogs.gamepad, !0x1); + }, 'mute'), this.bind(_0x2c1832.buttons.saveState, 'click', function() { + _0xbae705.call(_0x17edbf, _0x17edbf.elements.container, 'savestate-start', !0x1, {}); + _0xdcec2a.saveState().then(function(_0x31e271) { + var _0x2c1832 = _0xdcec2a.getScreenData(); + _0xbae705.call(_0x17edbf, _0x17edbf.elements.container, 'savestate', !0x1, { + 'state': _0x31e271, + 'screenshot': _0x2c1832 + }); + }); + }, 'mute'), this.bind(_0x2c1832.buttons.loadState, 'click', function() { + _0xbae705.call(_0x17edbf, _0x17edbf.elements.container, 'loadstate', !0x1, {}); + }, 'mute'), this.bind(_0x2c1832.buttons.settings, 'click', function(_0x1396ee) { + _0x1396ee.stopPropagation(), _0x2593da.toggleMenu.call(_0x17edbf, _0x1396ee); + }), this.bind(_0x2c1832.buttons.settings, 'keyup', function(_0x454936) { + var _0x2c1832 = _0x454936.which; + [0xd, 0x20].includes(_0x2c1832) && (0xd !== _0x2c1832 ? (_0x454936.preventDefault(), _0x454936.stopPropagation(), _0x2593da.toggleMenu.call(_0x17edbf, _0x454936)) : _0x2593da.focusFirstMenuItem.call(_0x17edbf, null, true)); + }, null, !0x1), this.bind(_0x2c1832.settings.menu, 'keydown', function(_0x40072c) { + 0x1b === _0x40072c.which && _0x2593da.toggleMenu.call(_0x17edbf, _0x40072c); + }), _0x59aa33.isIos) { + var _0x4bd188 = _0x23ffa1.call(_0x17edbf, 'input[type="range"]'); + Array.from(_0x4bd188).forEach(function(_0x345e4c) { + return _0x31e271.bind(_0x345e4c, _0x127f22, function(_0x58e6a9) { + return _0x2b30e0(_0x58e6a9.target); + }); + }); + } + _0x59aa33.isWebkit && Array.from(_0x23ffa1.call(_0x17edbf, 'input[type="range"]')).forEach(function(_0x45c503) { + _0x31e271.bind(_0x45c503, 'input', function(_0x436691) { + return _0x2593da.updateRangeFill.call(_0x17edbf, _0x436691.target); + }); + }), this.bind(_0x2c1832.inputs.volume, _0x127f22, function(_0x42307e) { + _0x17edbf.volume = _0x42307e.target.value; + }, 'volume'), this.bind(_0x2c1832.controls, 'mouseenter mouseleave', function(_0x10170b) { + 'mouseleave' === _0x10170b.type && null === _0x10170b.toElement ? _0x2c1832.controls.hover = true : _0x2c1832.controls.hover = !_0x17edbf.touch && 'mouseenter' === _0x10170b.type; + }), this.bind(_0x2c1832.controls, 'mousedown mouseup touchstart touchend touchcancel', function(_0x4bfb22) { + if (['mousedown', 'touchstart'].includes(_0x4bfb22.type)) { + _0x2c1832.controls.pressed = true; + var _0x17edbf = _0x2c1832.controls.getAttribute('data-timer2'); + clearTimeout(_0x17edbf); + } else { + var _0x29ba04 = setTimeout(function() { + _0x2c1832.controls.pressed = !0x1; + }, 0xfa0); + _0x2c1832.controls.setAttribute('data-timer2', _0x29ba04); + } + }), this.bind(_0x2c1832.controls, 'focusin focusout', function(_0x54e607) { + var _0x466a37 = _0x17edbf.config, + _0x2ab6f3 = _0x17edbf.elements, + _0x5f0669 = 'focusin' === _0x54e607.type, + _0x11de96 = _0x2ab6f3.controls.getAttribute('data-timer'); + if (_0x3a8e2f(_0x2ab6f3.controls, _0x466a37.classNames.noTransition, _0x5f0669), _0x5ab74d.toggleControls.call(_0x17edbf, _0x5f0669), _0x5f0669) { + setTimeout(function() { + _0x3a8e2f(_0x2ab6f3.controls, _0x466a37.classNames.noTransition, !0x1); + }, 0x0); + var _0x314d11 = _0x31e271.touch ? 0xbb8 : 0xfa0; + clearTimeout(_0x11de96), _0x11de96 = setTimeout(function() { + return _0x5ab74d.toggleControls.call(_0x17edbf, !0x1); + }, _0x314d11), _0x2ab6f3.controls.setAttribute('data-timer', _0x11de96); + } + }), this.bind(_0x2c1832.inputs.volume, 'wheel', function(_0x28b2d2) { + var _0x2c1832 = _0x28b2d2.webkitDirectionInvertedFromDevice, + _0x12883c = _0x42b437([_0x28b2d2.deltaX, -_0x28b2d2.deltaY].map(function(_0x1ce956) { + return _0x2c1832 ? -_0x1ce956 : _0x1ce956; + }), 0x2), + _0x247794 = _0x12883c[0x0], + _0x5dcee2 = _0x12883c[0x1], + _0x5691ae = Math.sign(Math.abs(_0x247794) > Math.abs(_0x5dcee2) ? _0x247794 : _0x5dcee2); + _0x17edbf.increaseVolume(_0x5691ae / 0x32); + var _0x47df17 = _0x17edbf.game.volume; + (0x1 === _0x5691ae && _0x47df17 < 0x1 || -0x1 === _0x5691ae && _0x47df17 > 0x0) && _0x28b2d2.preventDefault(); + }, 'volume', !0x1), this.bind(_0x2c1832.controls, 'contextmenu', function(_0x1db0c5) { + _0x1db0c5.stopPropagation(); + }), this.bind(_0x2c1832.contextMenu, 'contextmenu', function(_0x37851d) { + _0x37851d.stopPropagation(); + }); + } + + } + return _0x31e271; + }(); + + function _0x1a3a6c(_0x5a5a15, _0x4e2d69) { + for (var _0x2c1832 = 0x0; _0x2c1832 < _0x4e2d69.length; _0x2c1832++) { + var _0x2e1c57 = _0x4e2d69[_0x2c1832]; + _0x2e1c57.enumerable = _0x2e1c57.enumerable || false, _0x2e1c57.configurable = true, 'value' in _0x2e1c57 && (_0x2e1c57.writable = true), Object.defineProperty(_0x5a5a15, _0x2e1c57.key, _0x2e1c57); + } + } + var _0x3dbc76 = function() { + function _0x6954aa(_0x28cce1, _0x2ba0e6) { + var _0x5938bc = this; + var _0x2136bc = function(path, isDirectory) { + var finpath = window.location.pathname.split('/').pop(); + var finalpath = window.location.pathname.substring(0, window.location.pathname.length - finpath.length); + var split3 = finalpath.split('/') + var split2 = path.split('/') + var split1 = [ ] + for (var i=0; i 0) { + var split1 = function(origpath) { + var fullrequestpath = origpath + var finpath = fullrequestpath.split('/').pop() + var finalpath = fullrequestpath.substring(0, fullrequestpath.length - finpath.length) + if (origpath == '/') { + return '/' + } else { + return finalpath + } + }(split1.join('/')).split('/'); + } + } else { + split1.push(split2[w]); + } + } + var path = split1.join('/') + if (! path.startsWith('/')) { + var path = '/' + path; + } + path = window.location.protocol + '//' + window.location.host + path; + } + if (path.startsWith('/')) { + path = window.location.protocol + '//' + window.location.host + path; + } + if (! path.endsWith('/') && isDirectory) { + path = path + '/'; + } + return path + } + var a = function(_0x154660, _0x15626f) { + if (!(_0x154660 instanceof _0x15626f)) throw new TypeError('Cannot call a class as a function'); + }(this, _0x6954aa); + this.version = _0x3d61f9.a; + this.system = ''; + this.adUrl = null; + this.gameName = null; + this.loadStateOnStart = false; + this.statesSupported = true; + this.listUrl = 'https://ws.emulatorjs.com/'; + this.socketUrl = 'wss://ws.emulatorjs.com/'; + this.mameCore = null; + this.startOnLoad = false; + this.dataPath = ''; + this.customPaths = null; + this.hash = ''; + this.lightgun = false; + this.mouse = false; + this.multitap = false; + this.ready = false; + this.paused = true; + this.started = false; + this.touch = _0x2d904a.touch; + this.game = _0x28cce1; + _0x1e2c68.string(this.game) && (this.game = document.querySelectorAll(this.game)); + (window.jQuery && this.game instanceof jQuery || _0x1e2c68.nodeList(this.game) || _0x1e2c68.array(this.game)) && (this.game = this.game[0x0]); + this.game = this.game; + this.game.innerHTML = ''; + this.config = _0x5dc0c0({}, _0x39ca5e, _0x6954aa.defaults, _0x2ba0e6 || {}); + this.coreVer = function(core) { + if (false) { + return 2; + } + var supportedCores = ['nes', 'snes']; + return supportedCores.includes(core) ? 2 : 1; + }(this.config.system); // 2 = beta cores, 1 = old cores + this.lightgun = this.config.lightgun; + this.loadStateOnStart = this.config.loadStateOnStart || false; + this.adUrl = this.config.adUrl || null; + this.gameName = this.config.gameName || null; + this.mouse = this.config.mouse; + this.multitap = this.config.multitap; + this.cheats = this.config.cheats; + this.cheats || (this.cheats = []); + this.listUrl = this.config.netplayUrl || 'https://ws.emulatorjs.com/'; + this.socketUrl = this.config.netplayUrl || 'wss://ws.emulatorjs.com/'; + this.mameCore = this.config.mameCore || null; + this.color = this.config.color; + this.startOnLoad = this.config.startOnLoad || false; + this.statesSupported = this.config.statesSupported || true; + this.customPaths = function(paths) { + if (! paths) return {}; + var newPaths = {}; + for (var k in paths) { + if (typeof paths[k] == 'string') { + newPaths[k] = _0x2136bc(paths[k]); + } + } + return newPaths; + }(this.config.paths); + this.dataPath = function(path) { + if (typeof path != 'string') { + return function(origpath) { + var fullrequestpath = origpath + var finpath = fullrequestpath.split('/').pop() + var finalpath = fullrequestpath.substring(0, fullrequestpath.length - finpath.length) + if (origpath == '/') { + return window.location.protocol + '//' + window.location.host + '/'; + } else { + if (finalpath.startsWith('/')) { + finalpath = window.location.protocol + '//' + window.location.host + finalpath; + } + if (! finalpath.endsWith('/')) { + finalpath = finalpath + '/'; + } + return finalpath + } + }(window.location.href); + } + return _0x2136bc(path, true); + }(this.config.dataPath); + (async function(dataPath, customPath, lang) { + var localJson = {}; + if (lang && typeof lang == 'string' && lang !== 'en-US') { + var url = (customPath && typeof customPath[lang+'.json'] == 'string') ? customPath[lang+'.json'] : dataPath+'localization/'+lang+'.json'; + try { + var res = await fetch(url); + var text = await res.text(); + var localJson = JSON.parse(text); + _0x39ca5e.i18n = localJson.i18n; + _0x7f9f36.normalOptions = localJson.normalOptions; + } catch(e) { + console.error(e); + console.warn('error setting localization'); + } + } + return function(engText) { + return (typeof localJson[engText] == 'string') ? localJson[engText] : engText; + } + }(this.dataPath, this.customPaths, this.config.lang)).then(function(a) { + this.localization = a; + this.config = _0x5dc0c0({}, _0x39ca5e, _0x6954aa.defaults, _0x2ba0e6 || {}); + Object.keys(this.config.classNames).forEach(function(_0x1d6b41) { + var _0x28cce1 = _0x5938bc; + if (_0x1e2c68.object(_0x28cce1.config.classNames[_0x1d6b41])) Object.keys(_0x28cce1.config.classNames[_0x1d6b41]).forEach(function(_0x42f7f2) { + var _0x2ba0e6 = {}; + _0x2ba0e6[_0x5938bc.config.classNames[_0x1d6b41][_0x42f7f2]] = true, _0x5938bc.config.classNames[_0x1d6b41][_0x42f7f2] = _0x449eac(_0x2ba0e6); + }); + else { + var _0x2ba0e6 = {}; + _0x2ba0e6[_0x5938bc.config.classNames[_0x1d6b41]] = true, _0x5938bc.config.classNames[_0x1d6b41] = _0x449eac(_0x2ba0e6); + } + }); + this.config.selectors.controls.wrapper = '.' .concat(_0x449eac({ + 'ejs__controls': true + })); + this.config.selectors.container = '.' .concat(_0x449eac({ + 'ejs': true + })); + this.system = this.config.system; + this.elements = { + 'container': null, + 'buttons': {}, + 'display': {}, + 'inputs': {}, + 'settings': { + 'popup': null, + 'menu': null, + 'panels': {}, + 'buttons': {} + }, + 'dialogs': { + 'gamepad': null, + 'loading': null, + 'netplay': null + }, + 'widgets': {} + }; + this.fullscreen = { + 'active': false + } + if (this.game.emulator) console.warn('Target already setup'); + else { + this.config.mute = true; + this.eventListeners = []; + this.listeners = new _0x37093c(this); + this.storage = new _0x2f61ba(this, 'ejs_settings'); + this.game.emulator = this; + _0x1e2c68.element(this.elements.container) || (this.elements.container = _0x428003('div'), _0x580edd(this.game, this.elements.container)); + var _0x5e63f0 = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__widgets': true + }) + }); + this.elements.container.appendChild(_0x5e63f0); + var _0x32c8af = _0x428003('div', { + 'class': _0x449eac({ + 'ejs__dialogs': true + }) + }); + this.elements.container.appendChild(_0x32c8af); + _0x5ab74d.addStyleHook.call(this); + _0xdcec2a.setup.call(this); + _0x5ab74d.build.call(this); + this.listeners.container(); + this.listeners.global(); + this.fullscreen = new _0x335854(this); + _0x27f4c4.create.call(this); + var _0x446e06 = document.createElement('script'); + _0x446e06.src = (this.customPaths && typeof this.customPaths['webrtc-adapter.js'] == 'string') ? this.customPaths['webrtc-adapter.js'] : (this.dataPath + 'webrtc-adapter.js'); + document.body.appendChild(_0x446e06); + } + }.bind(this)) + } + var _0x17edbf, _0x2c1832, _0x423c42; + _0x17edbf = _0x6954aa, _0x423c42 = [{ + 'key': 'setup', + 'value': function(_0x3bb461) { + var _0x2c1832 = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : {}, + _0x3eda14 = null; + 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) { + return new _0x6954aa(_0x176f95, _0x2c1832); + }); + } + }], (_0x2c1832 = [{ + 'key': 'restart', + 'value': function() { + this.currentTime = 0x0; + } + }, { + 'key': 'increaseVolume', + 'value': function(_0x2881c7) { + var _0x17edbf = this.game.muted ? 0x0 : this.volume; + this.volume = _0x17edbf + (_0x1e2c68.number(_0x2881c7) ? _0x2881c7 : 0x0); + } + }, { + 'key': 'decreaseVolume', + 'value': function(_0x492b2e) { + this.increaseVolume(-_0x492b2e); + } + }, { + 'key': 'toggleControls', + 'value': function(_0x1c82b4) { + if (this.started) { + var _0x17edbf = void 0x0 === _0x1c82b4 ? void 0x0 : !_0x1c82b4, + _0x2c1832 = _0x3a8e2f(this.elements.container, this.config.classNames.hideControls, _0x17edbf); + return _0x2c1832 && _0x2593da.toggleMenu.call(this, !0x1), !_0x2c1832; + } + return !0x1; + } + }, { + 'key': 'setStatesSupported', + 'value': function(newValue) { + this.statesSupported = newValue; + } + }, { + 'key': 'loadState', + 'value': function(_0x3c6414) { + _0xdcec2a.loadState(_0x3c6414, 0x0); + } + }, { + 'key': 'on', + 'value': function(_0x44ca1b, _0x2e6552) { + _0x1093f4.call(this, this.elements.container, _0x44ca1b, _0x2e6552); + } + }, { + 'key': 'once', + 'value': function(_0x9f0e03, _0x44b98a) { + _0x455c85.call(this, this.elements.container, _0x9f0e03, _0x44b98a); + } + }, { + 'key': 'off', + 'value': function(_0x343615, _0x2023ff) { + _0x20109b(this.elements.container, _0x343615, _0x2023ff); + } + }, { + 'key': 'playing', + 'set': function() { + var _0x6954aa = !(arguments.length > 0x0 && void 0x0 !== arguments[0x0]) || arguments[0x0]; + Array.from(this.elements.buttons.play || []).forEach(function(_0x4a27d3) { + _0x4a27d3.pressed = _0x6954aa; + }), this.paused = !_0x6954aa; + }, + 'get': function() { + return Boolean(this.ready && !this.paused); + } + }, { + 'key': 'volume', + 'set': function(_0x52441c) { + var _0x17edbf = _0x52441c; + _0x1e2c68.string(_0x17edbf) && (_0x17edbf = Number(_0x17edbf)), _0x1e2c68.number(_0x17edbf) || (_0x17edbf = this.storage.get('volume')), _0x1e2c68.number(_0x17edbf) || (_0x17edbf = this.config.volume), _0x17edbf > 0x1 && (_0x17edbf = 0x1), _0x17edbf < 0x0 && (_0x17edbf = 0x0), this.config.volume = _0x17edbf, this.game.volume = _0x17edbf, !_0x1e2c68.empty(_0x52441c) && this.muted && _0x17edbf > 0x0 && (this.muted = !0x1); + }, + 'get': function() { + return Number(this.game.volume); + } + }, { + 'key': 'muted', + 'set': function(_0x218306) { + var _0x17edbf = _0x218306; + _0x1e2c68.boolean(_0x17edbf) || (_0x17edbf = this.storage.get('muted')), _0x1e2c68.boolean(_0x17edbf) || (_0x17edbf = this.config.muted), this.config.muted = _0x17edbf, this.game.muted = _0x17edbf; + }, + 'get': function() { + return Boolean(this.game.muted); + } + }]) + _0x1a3a6c(_0x17edbf.prototype, _0x2c1832) + _0x423c42 && _0x1a3a6c(_0x17edbf, _0x423c42) + return _0x6954aa; + }(); + _0x3dbc76.defaults = {}; + _0x17edbf.default = _0x3dbc76; +} + diff --git a/data/emulator.js b/data/emulator.js index 707f14c..5ad4017 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -202,7 +202,7 @@ var EJS = function(_0x574f5e) { _0x5633cb.StandardMapping = { 'env': {}, 'buttons': { - 'byButton': [0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10] + 'byButton': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] }, 'axes': { 'byAxis': [0x0, 0x1, 0x2, 0x3] @@ -2165,7 +2165,7 @@ var EJS = function(_0x574f5e) { }; }, function(_0x2406a9, _0x548f51, _0x324eb4) { 'use strict'; - _0x548f51.a = '0.4.25'; + _0x548f51.a = '0.4.26'; }, function(_0x2e240f, _0x5b82af, _0x39b24a) { var _0xafdfe, _0x133983; ! function(_0xcb4965, _0x3924c5, _0x2b6d6d) { @@ -12230,15 +12230,6 @@ var EJS = function(_0x574f5e) { 'center': 'ejs--49fa47c86a131e4ca8fb268bfdde89', 'right': 'ejs--7d2b19f77fd0ccabf94dc1ca39ae18', 'touch': 'ejs--d708d9d486f1eca73a593d5c09f8ad', - 'b_start': 'ejs--76fa7567879f97f5991c50ac600735', - 'b_select': 'ejs--82fa3531556f97f5991c50ac600735', - 'b_y': 'ejs--fbd499578ebef494fbcd1c9114cd1d', - 'b_c': 'ejs--fbd492618ebsd464fbcd1c9185cd14', - 'b_a': 'ejs--b4c6d9bdbbd3dcfc8fa82689ecf448', - 'b_x': 'ejs--87c940c15830daa967b08e67e9b87e', - 'b_b': 'ejs--b7c456c7dd7a616a55965bb134323b', - 'b_l': 'ejs--7930ee9bb7ae2fa6e2f7b5568f1e98', - 'b_r': 'ejs--2226100d4c5408c2699e942aabb31c', 'modal': 'ejs--eefec939452eb92fad035932d0f47c', 'modal__overlay': 'ejs--f1f43b27384834c8c22c6f81d0c5ae', 'modal__container': 'ejs--c4ee33766a01ed0356c3ec07898e96', @@ -12824,7 +12815,7 @@ var EJS = function(_0x574f5e) { for (var _0x55216d in _0x45595f) _0x45595f.hasOwnProperty(_0x55216d) && (_0x3efa0b[_0x55216d] = _0x45595f[_0x55216d]); return _0x3efa0b; }(this.query); - _0x3efa0b.EIO = _0x423ddf.protocol, _0x3efa0b.transport = _0x148af1; + _0x3efa0b.EIO = 4, _0x3efa0b.transport = _0x148af1; var _0x55216d = this.transportOptions[_0x148af1] || {}; return this.id && (_0x3efa0b.sid = this.id), new _0x1fdb83[_0x148af1]({ 'query': _0x3efa0b, @@ -13560,5928 +13551,4 @@ var EJS = function(_0x574f5e) { }, _0x17a9ac.prototype.setJitter = function(_0x2d4fd2) { this.jitter = _0x2d4fd2; }; -}, , function(_0xa88a13, _0x17edbf, _0x2c1832) { - 'use strict'; - _0x2c1832.r(_0x17edbf); - _0x2c1832(0xa2), _0x2c1832(0x16c), _0x2c1832(0x16d); - var _0x39ca5e = { - 'volume': 0.5, - 'muted': !0x1, - 'i18n': { - 'restart': 'Restart', - 'play': 'Play', - 'pause': 'Pause', - 'played': 'Played', - 'volume': 'Volume', - 'mute': 'Mute (F9)', - 'unmute': 'Unmute (F9)', - 'enterFullscreen': 'Enter fullscreen', - 'exitFullscreen': 'Exit fullscreen', - 'settings': 'Settings', - 'saveState': 'Save State (Shift + F2)', - 'loadState': 'Load State (Shift + F4)', - 'screenRecord': 'Start Screen Recording', - 'netplay': 'Netplay', - 'gamepad': 'Control Settings', - 'cheat': 'Cheats', - 'menuBack': 'Go back to previous menu', - 'normal': 'Normal', - 'all': 'All', - 'reset': 'Reset', - 'disabled': 'Disabled', - 'enabled': 'Enabled', - 'playNow': 'Play Now' - }, - 'listeners': { - 'play': null, - 'pause': null, - 'restart': null, - 'rewind': null, - 'mute': null, - 'volume': null, - 'fullscreen': null - }, - 'events': ['ready'], - 'selectors': { - 'editable': 'input, textarea, select, [contenteditable]', - 'container': '.ejs', - 'controls': { - 'container': null, - 'wrapper': '.jes__controls' - }, - 'buttons': { - 'play': '[data-btn="play"]', - 'pause': '[data-btn="pause"]', - 'mute': '[data-btn="mute"]', - 'fullscreen': '[data-btn="fullscreen"]', - 'settings': '[data-btn="settings"]', - 'saveState': '[data-btn="save-state"]', - 'loadState': '[data-btn="load-state"]', - 'screenRecord': '[data-btn="screen-record"]', - 'gamepad': '[data-btn="gamepad"]', - 'netplay': '[data-btn="netplay"]', - 'cheat': '[data-btn="cheat"]' - }, - 'inputs': { - 'volume': '[data-range="volume"]' - } - }, - 'classNames': { - 'type': 'ejs--video', - 'video': 'ejs__video-wrapper', - 'poster': 'ejs__poster', - 'posterEnabled': 'ejs__poster-enabled', - 'control': 'ejs__control', - 'controlPressed': 'ejs__control--pressed', - 'playing': 'ejs--playing', - 'paused': 'ejs--paused', - 'stopped': 'ejs--stopped', - 'loading': 'ejs--loading', - 'hover': 'ejs--hover', - 'tooltip': 'ejs__tooltip', - 'hidden': 'ejs__sr-only', - 'hideControls': 'ejs--hide-controls', - 'isIos': 'ejs--is-ios', - 'isTouch': 'ejs--is-touch', - 'uiSupported': 'ejs--full-ui', - 'noTransition': 'ejs--no-transition', - 'menu': { - 'value': 'ejs__menu__value', - 'badge': 'ejs__badge', - 'open': 'ejs--menu-open' - }, - 'fullscreen': { - 'enabled': 'ejs--fullscreen-enabled', - 'fallback': 'ejs--fullscreen-fallback' - }, - 'tabFocus': 'ejs__tab-focus' - } - }, - _0x3d61f9 = _0x2c1832(0x38), - _0x5127f4 = _0x2c1832(0x9d), - _0x48e5ff = _0x2c1832.n(_0x5127f4), - _0x406e79 = function(_0x2aa74f) { - return null != _0x2aa74f ? _0x2aa74f.constructor : null; - }, - _0x1b0c2c = function(_0x8ec039, _0x1cb5ff) { - return Boolean(_0x8ec039 && _0x1cb5ff && _0x8ec039 instanceof _0x1cb5ff); - }, - _0x19f739 = function(_0x3e8e1f) { - return null == _0x3e8e1f; - }, - _0x4fc5a1 = function(_0x37a418) { - return _0x406e79(_0x37a418) === Object; - }, - _0x34f3e8 = function(_0x2d2e5c) { - return _0x406e79(_0x2d2e5c) === String; - }, - _0x1ca546 = function(_0x4d698f) { - return Array.isArray(_0x4d698f); - }, - _0x37cc52 = function(_0x3a8b14) { - return _0x1b0c2c(_0x3a8b14, NodeList); - }, - _0x555ee8 = function(_0x1fde53) { - return _0x19f739(_0x1fde53) || (_0x34f3e8(_0x1fde53) || _0x1ca546(_0x1fde53) || _0x37cc52(_0x1fde53)) && !_0x1fde53.length || _0x4fc5a1(_0x1fde53) && !Object.keys(_0x1fde53).length; - }, - _0x1e2c68 = { - 'nullOrUndefined': _0x19f739, - 'object': _0x4fc5a1, - 'number': function(_0x1d08d4) { - return _0x406e79(_0x1d08d4) === Number && !Number.isNaN(_0x1d08d4); - }, - 'string': _0x34f3e8, - 'boolean': function(_0x340d71) { - return _0x406e79(_0x340d71) === Boolean; - }, - 'function': function(_0x10f562) { - return _0x406e79(_0x10f562) === Function; - }, - 'array': _0x1ca546, - 'weakMap': function(_0x70b79f) { - return _0x1b0c2c(_0x70b79f, WeakMap); - }, - 'nodeList': _0x37cc52, - 'element': function(_0xc21062) { - return _0x1b0c2c(_0xc21062, Element); - }, - 'textNode': function(_0x3e6b67) { - return _0x406e79(_0x3e6b67) === Text; - }, - 'event': function(_0x247601) { - return _0x1b0c2c(_0x247601, Event); - }, - 'keyboardEvent': function(_0x2b3224) { - return _0x1b0c2c(_0x2b3224, KeyboardEvent); - }, - 'cue': function(_0x57ee67) { - return _0x1b0c2c(_0x57ee67, window.TextTrackCue) || _0x1b0c2c(_0x57ee67, window.VTTCue); - }, - 'track': function(_0x23318b) { - return _0x1b0c2c(_0x23318b, TextTrack) || !_0x19f739(_0x23318b) && _0x34f3e8(_0x23318b.kind); - }, - 'url': function(_0xd61cf4) { - if (_0x1b0c2c(_0xd61cf4, window.URL)) return true; - var _0x17edbf = _0xd61cf4; - _0xd61cf4.startsWith('http://') && _0xd61cf4.startsWith('https://') || (_0x17edbf = 'http://' .concat(_0xd61cf4)); - try { - return !_0x555ee8(new URL(_0x17edbf).hostname); - } catch (_0x5e6cd2) { - return !0x1; - } - }, - 'empty': _0x555ee8 - }, - _0x168698 = function() { - var _0xa88a13 = !0x1; - try { - var _0x17edbf = Object.defineProperty({}, 'passive', { - 'get': function() { - return _0xa88a13 = true, null; - } - }); - window.addEventListener('test', null, _0x17edbf), window.removeEventListener('test', null, _0x17edbf); - } catch (_0x1db3b5) {} - return _0xa88a13; - }(); - - function _0x1ef215(_0xa482e6, _0x474854, _0xc30d6e) { - var _0x57056f = this, - _0x3f468e = arguments.length > 0x3 && void 0x0 !== arguments[0x3] && arguments[0x3], - _0x79ce58 = !(arguments.length > 0x4 && void 0x0 !== arguments[0x4]) || arguments[0x4], - _0x23848b = arguments.length > 0x5 && void 0x0 !== arguments[0x5] && arguments[0x5]; - if (_0xa482e6 && 'addEventListener' in _0xa482e6 && !_0x1e2c68.empty(_0x474854) && _0x1e2c68.function(_0xc30d6e)) { - var _0x4a2da0 = _0x474854.split(' '), - _0x40de8d = _0x23848b; - _0x168698 && (_0x40de8d = { - 'passive': _0x79ce58, - 'capture': _0x23848b - }), _0x4a2da0.forEach(function(_0x487d3c) { - _0x57056f && _0x57056f.eventListeners && _0x3f468e && _0x57056f.eventListeners.push({ - 'element': _0xa482e6, - 'type': _0x487d3c, - 'callback': _0xc30d6e, - 'options': _0x40de8d - }), _0xa482e6[_0x3f468e ? 'addEventListener' : 'removeEventListener'](_0x487d3c, _0xc30d6e, _0x40de8d); - }); - } - } - - function _0x1093f4(_0x4d8d94) { - var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', - _0x2c1832 = arguments.length > 0x2 ? arguments[0x2] : void 0x0, - _0x4adcdf = !(arguments.length > 0x3 && void 0x0 !== arguments[0x3]) || arguments[0x3], - _0x2f85bc = arguments.length > 0x4 && void 0x0 !== arguments[0x4] && arguments[0x4]; - _0x1ef215.call(this, _0x4d8d94, _0x17edbf, _0x2c1832, true, _0x4adcdf, _0x2f85bc); - } - - function _0x20109b(_0x550b1a) { - var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', - _0x2c1832 = arguments.length > 0x2 ? arguments[0x2] : void 0x0, - _0x5e10a2 = !(arguments.length > 0x3 && void 0x0 !== arguments[0x3]) || arguments[0x3], - _0x5c9512 = arguments.length > 0x4 && void 0x0 !== arguments[0x4] && arguments[0x4]; - _0x1ef215.call(this, _0x550b1a, _0x17edbf, _0x2c1832, !0x1, _0x5e10a2, _0x5c9512); - } - - function _0x455c85(_0x4e4b15) { - var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', - _0x2c1832 = arguments.length > 0x2 ? arguments[0x2] : void 0x0, - _0x2b8c91 = !(arguments.length > 0x3 && void 0x0 !== arguments[0x3]) || arguments[0x3], - _0x23e991 = arguments.length > 0x4 && void 0x0 !== arguments[0x4] && arguments[0x4]; - _0x1ef215.call(this, _0x4e4b15, _0x17edbf, function _0x5127f4() { - _0x20109b(_0x4e4b15, _0x17edbf, _0x5127f4, _0x2b8c91, _0x23e991); - for (var _0x1fe440 = arguments.length, _0x1d3219 = new Array(_0x1fe440), _0x54457c = 0x0; _0x54457c < _0x1fe440; _0x54457c++) _0x1d3219[_0x54457c] = arguments[_0x54457c]; - _0x2c1832.apply(this, _0x1d3219); - }, true, _0x2b8c91, _0x23e991); - } - - function _0xbae705(_0x975ccc) { - var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', - _0x2c1832 = arguments.length > 0x2 && void 0x0 !== arguments[0x2] && arguments[0x2], - _0x57297b = arguments.length > 0x3 && void 0x0 !== arguments[0x3] ? arguments[0x3] : {}; - if (_0x1e2c68.element(_0x975ccc) && !_0x1e2c68.empty(_0x17edbf)) { - var _0x4f631e = new CustomEvent(_0x17edbf, { - 'bubbles': _0x2c1832, - 'detail': Object.assign({}, _0x57297b, { - 'emulator': this - }) - }); - _0x975ccc.dispatchEvent(_0x4f631e); - } - } - var _0x55349e = _0x2c1832(0x9e), - _0x42870c = _0x2c1832.n(_0x55349e); - - function _0x30f85e(_0x3ed035, _0xd96db3) { - return function(_0x18bbf3) { - if (Array.isArray(_0x18bbf3)) return _0x18bbf3; - }(_0x3ed035) || function(_0x2bb2ab, _0x4993ee) { - var _0x2c1832 = [], - _0x629f39 = true, - _0xde5653 = !0x1, - _0x346a0d = void 0x0; - try { - for (var _0x57d79d, _0x557ef0 = _0x2bb2ab[Symbol.iterator](); !(_0x629f39 = (_0x57d79d = _0x557ef0.next()).done) && (_0x2c1832.push(_0x57d79d.value), !_0x4993ee || _0x2c1832.length !== _0x4993ee); _0x629f39 = true); - } catch (_0x54a546) { - _0xde5653 = true, _0x346a0d = _0x54a546; - } finally { - try { - _0x629f39 || null == _0x557ef0.return || _0x557ef0.return(); - } finally { - if (_0xde5653) throw _0x346a0d; - } - } - return _0x2c1832; - }(_0x3ed035, _0xd96db3) || function() { - throw new TypeError('Invalid attempt to destructure non-iterable instance'); - }(); - } - - function _0x580edd(_0x39eb34, _0x86c3db) { - var _0x2c1832 = _0x39eb34.length ? _0x39eb34 : [_0x39eb34]; - Array.from(_0x2c1832).reverse().forEach(function(_0x35fc48, _0x79e6bf) { - var _0x1510e4 = _0x79e6bf > 0x0 ? _0x86c3db.cloneNode(true) : _0x86c3db, - _0x247f26 = _0x35fc48.parentNode, - _0x3a5422 = _0x35fc48.nextSibling; - _0x1510e4.appendChild(_0x35fc48), _0x3a5422 ? _0x247f26.insertBefore(_0x1510e4, _0x3a5422) : _0x247f26.appendChild(_0x1510e4); - }); - } - - function _0x154f99(_0x5e4eb3, _0x1acdad) { - _0x1e2c68.element(_0x5e4eb3) && !_0x1e2c68.empty(_0x1acdad) && Object.entries(_0x1acdad).filter(function(_0x37e04b) { - var _0x1acdad = _0x30f85e(_0x37e04b, 0x2)[0x1]; - return !_0x1e2c68.nullOrUndefined(_0x1acdad); - }).forEach(function(_0x4993dd) { - var _0x2c1832 = _0x30f85e(_0x4993dd, 0x2), - _0x24704f = _0x2c1832[0x0], - _0x52ac21 = _0x2c1832[0x1]; - return _0x5e4eb3.setAttribute(_0x24704f, _0x52ac21); - }); - } - - function _0x428003(_0x1397c4, _0x1ec8c9, _0x1a02af) { - var _0xca6ad9 = document.createElement(_0x1397c4); - return _0x1e2c68.object(_0x1ec8c9) && _0x154f99(_0xca6ad9, _0x1ec8c9), _0x1e2c68.string(_0x1a02af) && (_0xca6ad9.innerText = _0x1a02af), _0xca6ad9; - } - - function _0x12a55d(_0x27d9d8) { - _0x1e2c68.nodeList(_0x27d9d8) || _0x1e2c68.array(_0x27d9d8) ? Array.from(_0x27d9d8).forEach(_0x12a55d) : _0x1e2c68.element(_0x27d9d8) && _0x1e2c68.element(_0x27d9d8.parentNode) && _0x27d9d8.parentNode.removeChild(_0x27d9d8); - } - - function _0xa949a8(_0x3bc809, _0x215e7f) { - if (!_0x1e2c68.string(_0x3bc809) || _0x1e2c68.empty(_0x3bc809)) return {}; - var _0x2c1832 = {}, - _0x3ab896 = _0x215e7f; - return _0x3bc809.split(',').forEach(function(_0x2b6c5b) { - var _0x215e7f = _0x2b6c5b.trim(), - _0x2b2f76 = _0x215e7f.replace('.', ''), - _0x499377 = _0x215e7f.replace(/[[\]]/g, '').split('='), - _0x1db3b8 = _0x499377[0x0], - _0x520bcf = _0x499377.length > 0x1 ? _0x499377[0x1].replace(/["']/g, '') : ''; - switch (_0x215e7f.charAt(0x0)) { - case '.': - _0x1e2c68.object(_0x3ab896) && _0x1e2c68.string(_0x3ab896.class) && (_0x3ab896.class += ' ' .concat(_0x2b2f76)), _0x2c1832.class = _0x2b2f76; - break; - case '#': - _0x2c1832.id = _0x215e7f.replace('#', ''); - break; - case '[': - _0x2c1832[_0x1db3b8] = _0x520bcf; - } - }), _0x2c1832; - } - - function _0x132da7(_0x275729, _0x511d6f) { - if (_0x1e2c68.element(_0x275729)) { - var _0x2c1832 = _0x511d6f; - _0x1e2c68.boolean(_0x2c1832) || (_0x2c1832 = !_0x275729.hidden), _0x2c1832 ? _0x275729.setAttribute('hidden', '') : _0x275729.removeAttribute('hidden'); - } - } - - function _0x3a8e2f(_0x2bf197, _0x46e2bb, _0x3b6b0b) { - if (_0x1e2c68.nodeList(_0x2bf197)) return Array.from(_0x2bf197).map(function(_0x543362) { - return _0x3a8e2f(_0x543362, _0x46e2bb, _0x3b6b0b); - }); - if (_0x1e2c68.element(_0x2bf197)) { - var _0x34f25e = 'toggle'; - return void 0x0 !== _0x3b6b0b && (_0x34f25e = _0x3b6b0b ? 'add' : 'remove'), _0x2bf197.classList[_0x34f25e](_0x46e2bb), _0x2bf197.classList.contains(_0x46e2bb); - } - return !0x1; - } - - function _0x350d73(_0x273517, _0x36ffc8) { - return _0x1e2c68.element(_0x273517) && _0x273517.classList.contains(_0x36ffc8); - } - - function _0x13f491(_0x11bf98, _0x674fa2) { - var _0x2c1832 = { - 'Element': Element - }; - return (_0x2c1832.matches || _0x2c1832.webkitMatchesSelector || _0x2c1832.mozMatchesSelector || _0x2c1832.msMatchesSelector || function() { - return Array.from(document.querySelectorAll(_0x674fa2)).includes(this); - }).call(_0x11bf98, _0x674fa2); - } - - function _0x23ffa1(_0x16eec8) { - return this.elements.container.querySelectorAll(_0x16eec8); - } - - function _0x530042(_0xbc0da2) { - return this.elements.container.querySelector(_0xbc0da2); - } - - function _0x5e0c7d() { - var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : null, - _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] && arguments[0x1]; - if (_0x1e2c68.element(_0xa88a13)) { - var _0x2c1832 = _0x23ffa1.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]'), - _0x1c6631 = _0x2c1832[0x0], - _0x52c9df = _0x2c1832[_0x2c1832.length - 0x1]; - _0x1ef215.call(this, this.elements.container, 'keydown', function(_0x1bba02) { - if ('Tab' === _0x1bba02.key && 0x9 === _0x1bba02.keyCode) { - var _0x17edbf = document.activeElement; - _0x17edbf !== _0x52c9df || _0x1bba02.shiftKey ? _0x17edbf === _0x1c6631 && _0x1bba02.shiftKey && (_0x52c9df.focus(), _0x1bba02.preventDefault()) : (_0x1c6631.focus(), _0x1bba02.preventDefault()); - } - }, _0x17edbf, !0x1); - } - } - - function _0x31cc23() { - var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : null, - _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] && arguments[0x1]; - _0x1e2c68.element(_0xa88a13) && (_0xa88a13.focus(), _0x17edbf && _0x3a8e2f(_0xa88a13, this.config.classNames.tabFocus)); - } - - function _0x449eac(_0x589e98) { - return _0x48e5ff.a.bind(_0x42870c.a)(_0x589e98); - } - var _0x32d193, _0x5f365a, _0x820caf, _0x5a2767 = (_0x32d193 = document.createElement('span'), _0x5f365a = { - 'WebkitTransition': 'webkitTransitionEnd', - 'MozTransition': 'transitionend', - 'OTransition': 'oTransitionEnd otransitionend', - 'transition': 'transitionend' - }, _0x820caf = Object.keys(_0x5f365a).find(function(_0x5bdb45) { - return void 0x0 !== _0x32d193.style[_0x5bdb45]; - }), !!_0x1e2c68.string(_0x820caf) && _0x5f365a[_0x820caf]); - - function _0x2b30e0(_0x1fb76b) { - setTimeout(function() { - try { - _0x132da7(_0x1fb76b, true), _0x1fb76b.offsetHeight, _0x132da7(_0x1fb76b, !0x1); - } catch (_0x517747) {} - }, 0x0); - } - var _0x296fa9, _0x59aa33 = { - 'isEdge': 'Netscape' === navigator.appName && navigator.appVersion.indexOf('Edge') > -0x1, - 'isIE': !!document.documentMode, - 'isWebkit': 'WebkitAppearance' in document.documentElement.style && !/Edge/ .test(navigator.userAgent), - 'isIPhone': /(iPhone|iPod)/gi .test(navigator.platform), - 'isIos': /(iPad|iPhone|iPod)/gi .test(navigator.platform), - 'info': function() { - var _0xa88a13 = /(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d\.apre]+)/ .exec(navigator.userAgent); - return { - 'name': _0xa88a13[0x1].toLowerCase(), - 'version': _0xa88a13[0x2] - }; - } - }, - _0x2d904a = { - 'rangeInput': (_0x296fa9 = document.createElement('input'), _0x296fa9.type = 'range', 'range' === _0x296fa9.type), - 'touch': 'ontouchstart' in document.documentElement, - 'transitions': !0x1 !== _0x5a2767, - 'reducedMotion': 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches, - 'webgl': function() { - var _0xa88a13 = { - 'DETECTED': !0x1 - }; - if (!_0xa88a13.DETECTED) { - var _0x17edbf = document.createElement('canvas'); - if (_0x17edbf && _0x17edbf.getContext) - for (var _0x2c1832 = ['webgl2', 'experimental-webgl2', 'webgl', 'experimental-webgl'], _0x44cd27 = 0x0, _0x12b7b8 = _0x2c1832.length; _0x44cd27 < _0x12b7b8; ++_0x44cd27) { - var _0x11cb40 = _0x2c1832[_0x44cd27], - _0x26b3b2 = _0x17edbf.getContext(_0x11cb40); - if (_0x26b3b2) { - _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); - var _0x40c8fc = _0x26b3b2.getExtension('WEBGL_debug_renderer_info'); - _0x40c8fc && (_0xa88a13.WEBGL_VENDOR = _0x26b3b2.getParameter(_0x40c8fc.UNMASKED_VENDOR_WEBGL), _0xa88a13.WEBGL_RENDERER = _0x26b3b2.getParameter(_0x40c8fc.UNMASKED_RENDERER_WEBGL)), _0xa88a13.DETECTED = true; - break; - } - } - } - return _0xa88a13; - }(), - 'wasm': 'undefined' != typeof WebAssembly && _0x1e2c68.object(WebAssembly), - 'audioContext': 'undefined' != typeof AudioContext - }; - - function _0x55cbbe(_0x43ca9d, _0x1fbf80, _0x332d13) { - return _0x1fbf80 in _0x43ca9d ? Object.defineProperty(_0x43ca9d, _0x1fbf80, { - 'value': _0x332d13, - 'enumerable': true, - 'configurable': true, - 'writable': true - }) : _0x43ca9d[_0x1fbf80] = _0x332d13, _0x43ca9d; - } - - function _0x344e81(_0xa095b0, _0x3d8795) { - return _0x3d8795.split('.').reduce(function(_0x1a1fcd, _0x5112cd) { - return _0x1a1fcd && _0x1a1fcd[_0x5112cd]; - }, _0xa095b0); - } - - function _0x5dc0c0() { - for (var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : {}, _0x17edbf = arguments.length, _0x2c1832 = new Array(_0x17edbf > 0x1 ? _0x17edbf - 0x1 : 0x0), _0x189546 = 0x1; _0x189546 < _0x17edbf; _0x189546++) _0x2c1832[_0x189546 - 0x1] = arguments[_0x189546]; - if (!_0x2c1832.length) return _0xa88a13; - var _0x279e54 = _0x2c1832.shift(); - return _0x1e2c68.object(_0x279e54) ? (Object.keys(_0x279e54).forEach(function(_0x53b45a) { - _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])); - }), _0x5dc0c0.apply(void 0x0, [_0xa88a13].concat(_0x2c1832))) : _0xa88a13; - } - - function _0x1a0e98() { - var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '', - _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '', - _0x2c1832 = arguments.length > 0x2 && void 0x0 !== arguments[0x2] ? arguments[0x2] : ''; - return _0xa88a13.replace(new RegExp(_0x17edbf.toString().replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\x5c$1'), 'g'), _0x2c1832.toString()); - } - - function _0x9fdcea() { - var _0xa88a13 = (arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '').toString(); - return (_0xa88a13 = function() { - var _0xa88a13 = (arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '').toString(); - return _0xa88a13 = _0x1a0e98(_0xa88a13, '-', ' '), _0xa88a13 = _0x1a0e98(_0xa88a13, '_', ' '), _0x1a0e98(_0xa88a13 = function() { - return (arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '').toString().replace(/\w\S*/g, function(_0x5b5cba) { - return _0x5b5cba.charAt(0x0).toUpperCase() + _0x5b5cba.substr(0x1).toLowerCase(); - }); - }(_0xa88a13), ' ', ''); - }(_0xa88a13)).charAt(0x0).toLowerCase() + _0xa88a13.slice(0x1); - } - - function _0x419e30(_0x3614ce, _0x5196ee) { - return function(_0x38f65b) { - if (Array.isArray(_0x38f65b)) return _0x38f65b; - }(_0x3614ce) || function(_0x20a132, _0x481bd0) { - var _0x2c1832 = [], - _0x930e75 = true, - _0x40863e = !0x1, - _0xf7a5cf = void 0x0; - try { - for (var _0x9d4c5a, _0x2f59ed = _0x20a132[Symbol.iterator](); !(_0x930e75 = (_0x9d4c5a = _0x2f59ed.next()).done) && (_0x2c1832.push(_0x9d4c5a.value), !_0x481bd0 || _0x2c1832.length !== _0x481bd0); _0x930e75 = true); - } catch (_0x383181) { - _0x40863e = true, _0xf7a5cf = _0x383181; - } finally { - try { - _0x930e75 || null == _0x2f59ed.return || _0x2f59ed.return(); - } finally { - if (_0x40863e) throw _0xf7a5cf; - } - } - return _0x2c1832; - }(_0x3614ce, _0x5196ee) || function() { - throw new TypeError('Invalid attempt to destructure non-iterable instance'); - }(); - } - var _0xb9b2ff = { - 'get': function() { - var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '', - _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : {}; - if (_0x1e2c68.empty(_0xa88a13) || _0x1e2c68.empty(_0x17edbf)) return ''; - var _0x2c1832 = _0x344e81(_0x17edbf.i18n, _0xa88a13); - if (_0x1e2c68.empty(_0x2c1832)) return ''; - var _0x54bf45 = { - '{seektime}': _0x17edbf.seekTime, - '{title}': _0x17edbf.title - }; - return Object.entries(_0x54bf45).forEach(function(_0x34ee43) { - var _0x17edbf = _0x419e30(_0x34ee43, 0x2), - _0x473ebb = _0x17edbf[0x0], - _0x56ec0 = _0x17edbf[0x1]; - _0x2c1832 = _0x1a0e98(_0x2c1832, _0x473ebb, _0x56ec0); - }), _0x2c1832; - } - }; - - function _0x4c97b0(_0xb3d5fd, _0x2cda5d) { - for (var _0x2c1832 = 0x0; _0x2c1832 < _0x2cda5d.length; _0x2c1832++) { - var _0x3f3944 = _0x2cda5d[_0x2c1832]; - _0x3f3944.enumerable = _0x3f3944.enumerable || !0x1, _0x3f3944.configurable = true, 'value' in _0x3f3944 && (_0x3f3944.writable = true), Object.defineProperty(_0xb3d5fd, _0x3f3944.key, _0x3f3944); - } - } - var _0x2f61ba = function() { - function _0x566dbe(_0x3a7165, _0x3d2e3a) { - ! function(_0x48c5c0, _0x2b027d) { - if (!(_0x48c5c0 instanceof _0x2b027d)) throw new TypeError('Cannot call a class as a function'); - }(this, _0x566dbe), this.enabled = true, this.key = _0x3d2e3a; - } - var _0x17edbf, _0x2c1832, _0x4496fc; - return _0x17edbf = _0x566dbe, _0x4496fc = [{ - 'key': 'supported', - 'get': function() { - try { - return 'localStorage' in window && (window.localStorage.getItem('___test') || window.localStorage.setItem('___test', '___test'), true); - } catch (_0x42cafd) { - return !0x1; - } - } - }], (_0x2c1832 = [{ - 'key': 'get', - 'value': function(_0x4ed865) { - if (!_0x566dbe.supported || !this.enabled) return null; - var _0x2c1832 = window.localStorage.getItem(this.key); - if (_0x1e2c68.empty(_0x2c1832)) return null; - var _0x57ebf7 = JSON.parse(_0x2c1832); - return _0x1e2c68.string(_0x4ed865) && _0x4ed865.length ? _0x57ebf7[_0x4ed865] : _0x57ebf7; - } - }, { - 'key': 'set', - 'value': function(_0x443e7a) { - if (_0x566dbe.supported && this.enabled && _0x1e2c68.object(_0x443e7a)) { - var _0x2c1832 = this.get(); - _0x1e2c68.empty(_0x2c1832) && (_0x2c1832 = {}), _0x5dc0c0(_0x2c1832, _0x443e7a), window.localStorage.setItem(this.key, JSON.stringify(_0x2c1832)); - } - } - }]) && _0x4c97b0(_0x17edbf.prototype, _0x2c1832), _0x4496fc && _0x4c97b0(_0x17edbf, _0x4496fc), _0x566dbe; - }(); - var _0x13fb79, _0x569918 = _0x2c1832(0x6c), - _0x4e4ca6 = _0x2c1832.n(_0x569918), - _0x4ad1c6 = _0x2c1832(0x6), - _0x4704b1 = _0x2c1832(0x9f), - _0x3a58c8 = _0x2c1832.n(_0x4704b1), - _0x5032e6 = { - '2xScaleHQ.glslp': 'shaders = 1\n\nshader0 = "2xScaleHQ.glsl"\nfilter_linear0 = false\nscale_type_0 = source\n', - '4xScaleHQ.glslp': 'shaders = 1\n\nshader0 = "4xScaleHQ.glsl"\nfilter_linear0 = false\nscale_type_0 = source\n', - 'crt-easymode.glslp': 'shaders = 1\n\nshader0 = crt-easymode.glsl\nfilter_linear0 = false\nscale_type_0 = source\n', - 'crt-aperture.glslp': 'shaders = 1\n\nshader0 = crt-aperture.glsl\nfilter_linear0 = false\n', - 'crt-geom.glslp': 'shaders = 1\n\nshader0 = crt-geom.glsl\nfilter_linear0 = false\nscale_type_0 = source\n', - '2xScaleHQ.glsl': '/*\n2xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 dx = vec2(x, 0.0);\nvec2 dy = vec2(0.0, y);\nt1 = vec4(vTexCoord - dg1, vTexCoord - dy);\nt2 = vec4(vTexCoord - dg2, vTexCoord + dx);\nt3 = vec4(vTexCoord + dg1, vTexCoord + dy);\nt4 = vec4(vTexCoord + dg2, vTexCoord - dx);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 0.325; // start smoothing wt.\nfloat k = -0.250; // wt. decrease factor\nfloat max_w = 0.25; // max filter weight\nfloat min_w =-0.05; // min filter weight\nfloat lum_add = 0.25; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c00 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 c10 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 c20 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 c01 = COMPAT_TEXTURE(Source, t4.zw).xyz; \nvec3 c11 = COMPAT_TEXTURE(Source, vTexCoord).xyz; \nvec3 c21 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 c02 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 c12 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 c22 = COMPAT_TEXTURE(Source, t3.xy).xyz; \n\nfloat md1 = dot(abs(c00 - c22), dt);\nfloat md2 = dot(abs(c02 - c20), dt);\n\nfloat w1 = dot(abs(c22 - c11), dt) * md2;\nfloat w2 = dot(abs(c02 - c11), dt) * md1;\nfloat w3 = dot(abs(c00 - c11), dt) * md2;\nfloat w4 = dot(abs(c20 - c11), dt) * md1;\n\nfloat t1 = w1 + w3;\nfloat t2 = w2 + w4;\nfloat ww = max(t1, t2) + 0.0001;\n\nc11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww);\n\nfloat lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add);\nfloat lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add);\n\nw1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w);\nw2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w);\nw3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w);\nw4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w);\nFragColor = vec4(w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11, 1.0);\n} \n#endif\n', - '4xScaleHQ.glsl': '/*\n4xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 sd1 = dg1 * 0.5;\nvec2 sd2 = dg2 * 0.5;\nvec2 ddx = vec2(x, 0.0);\nvec2 ddy = vec2(0.0, y);\nt1 = vec4(vTexCoord - sd1, vTexCoord - ddy);\nt2 = vec4(vTexCoord - sd2, vTexCoord + ddx);\nt3 = vec4(vTexCoord + sd1, vTexCoord + ddy);\nt4 = vec4(vTexCoord + sd2, vTexCoord - ddx);\nt5 = vec4(vTexCoord - dg1, vTexCoord - dg2);\nt6 = vec4(vTexCoord + dg1, vTexCoord + dg2);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 1.0; // start smoothing wt.\nfloat k = -1.10; // wt. decrease factor\nfloat max_w = 0.75; // max filter weight\nfloat min_w = 0.03; // min filter weight\nfloat lum_add = 0.33; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c = COMPAT_TEXTURE(Source, vTexCoord).xyz;\nvec3 i1 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 i2 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 i3 = COMPAT_TEXTURE(Source, t3.xy).xyz; \nvec3 i4 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 o1 = COMPAT_TEXTURE(Source, t5.xy).xyz; \nvec3 o3 = COMPAT_TEXTURE(Source, t6.xy).xyz; \nvec3 o2 = COMPAT_TEXTURE(Source, t5.zw).xyz;\nvec3 o4 = COMPAT_TEXTURE(Source, t6.zw).xyz;\nvec3 s1 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 s2 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 s3 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 s4 = COMPAT_TEXTURE(Source, t4.zw).xyz; \n\nfloat ko1=dot(abs(o1-c),dt);\nfloat ko2=dot(abs(o2-c),dt);\nfloat ko3=dot(abs(o3-c),dt);\nfloat ko4=dot(abs(o4-c),dt);\n\nfloat k1=min(dot(abs(i1-i3),dt),max(ko1,ko3));\nfloat k2=min(dot(abs(i2-i4),dt),max(ko2,ko4));\n\nfloat w1 = k2; if(ko3= 130\n #define COMPAT_VARYING out\n #define COMPAT_ATTRIBUTE in\n #define COMPAT_TEXTURE texture\n #else\n #define COMPAT_VARYING varying\n #define COMPAT_ATTRIBUTE attribute\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _oPosition1;\n vec4 _r0005;\n COMPAT_ATTRIBUTE vec4 VertexCoord;\n COMPAT_ATTRIBUTE vec4 TexCoord;\n COMPAT_VARYING vec4 TEX0;\n \n uniform mat4 MVPMatrix;\n uniform int FrameDirection;\n uniform int FrameCount;\n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _oTex;\n _r0005 = VertexCoord.x*MVPMatrix[0];\n _r0005 = _r0005 + VertexCoord.y*MVPMatrix[1];\n _r0005 = _r0005 + VertexCoord.z*MVPMatrix[2];\n _r0005 = _r0005 + VertexCoord.w*MVPMatrix[3];\n _oPosition1 = _r0005;\n _oTex = TexCoord.xy;\n gl_Position = _r0005;\n TEX0.xy = TexCoord.xy;\n }\n #elif defined(FRAGMENT)\n \n #if __VERSION__ >= 130\n #define COMPAT_VARYING in\n #define COMPAT_TEXTURE texture\n out vec4 FragColor;\n #else\n #define COMPAT_VARYING varying\n #define FragColor gl_FragColor\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _ret_0;\n float _TMP30;\n float _TMP29;\n float _TMP28;\n float _TMP13;\n float _TMP32;\n float _TMP11;\n float _TMP10;\n float _TMP31;\n float _TMP9;\n float _TMP8;\n float _TMP15;\n float _TMP14;\n float _TMP33;\n vec4 _TMP34;\n vec4 _TMP27;\n vec4 _TMP25;\n vec4 _TMP23;\n vec4 _TMP21;\n vec4 _TMP26;\n vec4 _TMP24;\n vec4 _TMP22;\n vec4 _TMP20;\n float _TMP4;\n vec4 _TMP3;\n vec4 _TMP2;\n float _TMP19;\n float _TMP18;\n float _TMP17;\n float _TMP16;\n vec4 _TMP1;\n vec2 _TMP0;\n uniform sampler2D Texture;\n input_dummy _IN1;\n float _TMP43;\n float _x_step0044;\n float _curve0044;\n float _a0048;\n float _val0052;\n float _a0052;\n vec4 _TMP57;\n vec4 _x0072;\n vec2 _c0086;\n vec4 _x0088;\n vec4 _x0094;\n vec2 _c0098;\n vec4 _x0100;\n vec2 _c0104;\n vec4 _x0106;\n vec4 _sample_min0110;\n vec4 _sample_max0110;\n vec4 _r0112;\n vec4 _TMP117;\n vec2 _co0124;\n vec2 _c0126;\n vec4 _x0128;\n vec4 _x0134;\n vec2 _c0138;\n vec4 _x0140;\n vec2 _c0144;\n vec4 _x0146;\n vec4 _sample_min0150;\n vec4 _sample_max0150;\n vec4 _r0152;\n vec4 _TMP157;\n float _TMP163;\n float _x_step0164;\n float _curve0164;\n float _a0168;\n float _val0172;\n float _a0172;\n float _TMP183;\n float _TMP189;\n float _x0190;\n float _a0196;\n float _x0198;\n vec2 _x0200;\n float _x0208;\n COMPAT_VARYING vec4 TEX0;\n \n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _dx1;\n vec2 _dy;\n vec2 _pix_co;\n vec2 _tex_co;\n vec2 _dist;\n vec3 _col2;\n vec3 _col21;\n vec4 _coeffs1;\n float _luma;\n float _bright;\n float _scan_weight;\n vec2 _mod_fac;\n int _dot_no;\n vec3 _mask_weight;\n vec3 _TMP37;\n _dx1 = vec2(1.00000000E+00/TextureSize.x, 0.00000000E+00);\n _dy = vec2(0.00000000E+00, 1.00000000E+00/TextureSize.y);\n _pix_co = TEX0.xy*TextureSize - vec2( 5.00000000E-01, 5.00000000E-01);\n _TMP0 = floor(_pix_co);\n _tex_co = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/TextureSize;\n _dist = fract(_pix_co);\n _x_step0044 = float((_dist.x >= 5.00000000E-01));\n _a0048 = 2.50000000E-01 - (_dist.x - _x_step0044)*(_dist.x - _x_step0044);\n _TMP33 = inversesqrt(_a0048);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0052 = 5.00000000E-01 - _dist.x;\n _val0052 = float((_a0052 > 0.00000000E+00));\n _TMP15 = _val0052 - float((_a0052 < 0.00000000E+00));\n _curve0044 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP43 = _dist.x + 2.50000000E-01*(_curve0044 - _dist.x);\n _coeffs1 = 3.14159274E+00*vec4(1.00000000E+00 + _TMP43, _TMP43, 1.00000000E+00 - _TMP43, 2.00000000E+00 - _TMP43);\n _TMP1 = abs(_coeffs1);\n _TMP57 = max(_TMP1, vec4( 9.99999975E-06, 9.99999975E-06, 9.99999975E-06, 9.99999975E-06));\n _TMP16 = sin(_TMP57.x);\n _TMP17 = sin(_TMP57.y);\n _TMP18 = sin(_TMP57.z);\n _TMP19 = sin(_TMP57.w);\n _TMP2 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _x0072 = _TMP57/2.00000000E+00;\n _TMP16 = sin(_x0072.x);\n _TMP17 = sin(_x0072.y);\n _TMP18 = sin(_x0072.z);\n _TMP19 = sin(_x0072.w);\n _TMP3 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _coeffs1 = ((2.00000000E+00*_TMP2)*_TMP3)/(_TMP57*_TMP57);\n _TMP4 = dot(_coeffs1, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _coeffs1 = _coeffs1/_TMP4;\n _c0086 = _tex_co - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0086);\n _x0088 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0088;\n _TMP22 = COMPAT_TEXTURE(Texture, _tex_co);\n _x0094 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0094;\n _c0098 = _tex_co + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0098);\n _x0100 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0100;\n _c0104 = _tex_co + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0104);\n _x0106 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0106;\n _r0112 = _coeffs1.x*_TMP21;\n _r0112 = _r0112 + _coeffs1.y*_TMP23;\n _r0112 = _r0112 + _coeffs1.z*_TMP25;\n _r0112 = _r0112 + _coeffs1.w*_TMP27;\n _sample_min0110 = min(_TMP23, _TMP25);\n _sample_max0110 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0110, _r0112);\n _TMP117 = max(_sample_min0110, _TMP34);\n _co0124 = _tex_co + _dy;\n _c0126 = _co0124 - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0126);\n _x0128 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0128;\n _TMP22 = COMPAT_TEXTURE(Texture, _co0124);\n _x0134 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0134;\n _c0138 = _co0124 + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0138);\n _x0140 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0140;\n _c0144 = _co0124 + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0144);\n _x0146 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0146;\n _r0152 = _coeffs1.x*_TMP21;\n _r0152 = _r0152 + _coeffs1.y*_TMP23;\n _r0152 = _r0152 + _coeffs1.z*_TMP25;\n _r0152 = _r0152 + _coeffs1.w*_TMP27;\n _sample_min0150 = min(_TMP23, _TMP25);\n _sample_max0150 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0150, _r0152);\n _TMP157 = max(_sample_min0150, _TMP34);\n _x_step0164 = float((_dist.y >= 5.00000000E-01));\n _a0168 = 2.50000000E-01 - (_dist.y - _x_step0164)*(_dist.y - _x_step0164);\n _TMP33 = inversesqrt(_a0168);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0172 = 5.00000000E-01 - _dist.y;\n _val0172 = float((_a0172 > 0.00000000E+00));\n _TMP15 = _val0172 - float((_a0172 < 0.00000000E+00));\n _curve0164 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP163 = _dist.y + (_curve0164 - _dist.y);\n _col2 = _TMP117.xyz + _TMP163*(_TMP157.xyz - _TMP117.xyz);\n _luma = dot(vec3( 2.12599993E-01, 7.15200007E-01, 7.22000003E-02), _col2);\n _TMP8 = max(_col2.y, _col2.z);\n _TMP9 = max(_col2.x, _TMP8);\n _bright = (_TMP9 + _luma)/2.00000000E+00;\n _TMP31 = min(6.49999976E-01, _bright);\n _TMP183 = max(3.49999994E-01, _TMP31);\n _x0190 = _bright*1.50000000E+00;\n _TMP31 = min(1.50000000E+00, _x0190);\n _TMP189 = max(1.50000000E+00, _TMP31);\n _a0196 = TEX0.y*2.00000000E+00*3.14159274E+00*TextureSize.y;\n _TMP10 = cos(_a0196);\n _x0198 = _TMP10*5.00000000E-01 + 5.00000000E-01;\n _TMP11 = pow(_x0198, _TMP189);\n _scan_weight = 1.00000000E+00 - _TMP11;\n _x0200 = (TEX0.xy*OutputSize*TextureSize)/InputSize;\n _mod_fac = floor(_x0200);\n _x0208 = _mod_fac.x/3.00000000E+00;\n _TMP32 = floor(_x0208);\n _TMP13 = _mod_fac.x - 3.00000000E+00*_TMP32;\n _dot_no = int(_TMP13);\n if (_dot_no == 0) {\n _mask_weight = vec3( 1.00000000E+00, 6.99999988E-01, 6.99999988E-01);\n } else {\n if (_dot_no == 1) {\n _mask_weight = vec3( 6.99999988E-01, 1.00000000E+00, 6.99999988E-01);\n } else {\n _mask_weight = vec3( 6.99999988E-01, 6.99999988E-01, 1.00000000E+00);\n }\n }\n if (InputSize.y >= 4.00000000E+02) {\n _scan_weight = 1.00000000E+00;\n }\n _col21 = _col2.xyz;\n _col2 = _col2*vec3(_scan_weight, _scan_weight, _scan_weight);\n _col2 = _col2 + _TMP183*(_col21 - _col2);\n _col2 = _col2*_mask_weight;\n _TMP28 = pow(_col2.x, 5.55555582E-01);\n _TMP29 = pow(_col2.y, 5.55555582E-01);\n _TMP30 = pow(_col2.z, 5.55555582E-01);\n _col2 = vec3(_TMP28, _TMP29, _TMP30);\n _TMP37 = _col2*1.20000005E+00;\n _ret_0 = vec4(_TMP37.x, _TMP37.y, _TMP37.z, 1.00000000E+00);\n FragColor = _ret_0;\n return;\n }\n #endif\n', - 'crt-aperture.glsl': '\n/*\nCRT Shader by EasyMode\nLicense: GPL\n*/\n/*\n#pragma parameter SHARPNESS_IMAGE "Sharpness Image" 1.0 1.0 5.0 1.0\n#pragma parameter SHARPNESS_EDGES "Sharpness Edges" 3.0 1.0 5.0 1.0\n#pragma parameter GLOW_WIDTH "Glow Width" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HEIGHT "Glow Height" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HALATION "Glow Halation" 0.1 0.0 1.0 0.01\n#pragma parameter GLOW_DIFFUSION "Glow Diffusion" 0.05 0.0 1.0 0.01\n#pragma parameter MASK_COLORS "Mask Colors" 2.0 2.0 3.0 1.0\n#pragma parameter MASK_STRENGTH "Mask Strength" 0.3 0.0 1.0 0.05\n#pragma parameter MASK_SIZE "Mask Size" 1.0 1.0 9.0 1.0\n#pragma parameter SCANLINE_SIZE_MIN "Scanline Size Min." 0.5 0.5 1.5 0.05\n#pragma parameter SCANLINE_SIZE_MAX "Scanline Size Max." 1.5 0.5 1.5 0.05\n#pragma parameter GAMMA_INPUT "Gamma Input" 2.4 1.0 5.0 0.1\n#pragma parameter GAMMA_OUTPUT "Gamma Output" 2.4 1.0 5.0 0.1\n#pragma parameter BRIGHTNESS "Brightness" 1.5 0.0 2.0 0.05\n* */\n\n#define Coord TEX0\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define OUT out\n#define IN in\n#define tex2D texture\n#else\n#define OUT varying \n#define IN attribute \n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nIN vec4 VertexCoord;\nIN vec4 Color;\nIN vec2 TexCoord;\nOUT vec4 color;\nOUT vec2 Coord;\n\nuniform mat4 MVPMatrix;\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\ncolor = Color;\nCoord = TexCoord;\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define IN in\n#define tex2D texture\nout vec4 FragColor;\n#else\n#define IN varying\n#define FragColor gl_FragColor\n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nIN vec2 Coord;\n\n#ifdef PARAMETER_UNIFORM\nuniform PRECISION float SHARPNESS_IMAGE;\nuniform PRECISION float SHARPNESS_EDGES;\nuniform PRECISION float GLOW_WIDTH;\nuniform PRECISION float GLOW_HEIGHT;\nuniform PRECISION float GLOW_HALATION;\nuniform PRECISION float GLOW_DIFFUSION;\nuniform PRECISION float MASK_COLORS;\nuniform PRECISION float MASK_STRENGTH;\nuniform PRECISION float MASK_SIZE;\nuniform PRECISION float SCANLINE_SIZE_MIN;\nuniform PRECISION float SCANLINE_SIZE_MAX;\nuniform PRECISION float GAMMA_INPUT;\nuniform PRECISION float GAMMA_OUTPUT;\nuniform PRECISION float BRIGHTNESS;\n#else\n#define SHARPNESS_IMAGE 1.0\n#define SHARPNESS_EDGES 3.0\n#define GLOW_WIDTH 0.5\n#define GLOW_HEIGHT 0.5\n#define GLOW_HALATION 0.1\n#define GLOW_DIFFUSION 0.05\n#define MASK_COLORS 2.0\n#define MASK_STRENGTH 0.3\n#define MASK_SIZE 1.0\n#define SCANLINE_SIZE_MIN 0.5\n#define SCANLINE_SIZE_MAX 1.5\n#define GAMMA_INPUT 2.4\n#define GAMMA_OUTPUT 2.4\n#define BRIGHTNESS 1.5\n#endif\n\n#define FIX(c) max(abs(c), 1e-5)\n#define PI 3.141592653589\n#define saturate(c) clamp(c, 0.0, 1.0)\n#define TEX2D(c) pow(tex2D(tex, c).rgb, vec3(GAMMA_INPUT))\n\nmat3 get_color_matrix(sampler2D tex, vec2 co, vec2 dx)\n{\nreturn mat3(TEX2D(co - dx), TEX2D(co), TEX2D(co + dx));\n}\n\nvec3 blur(mat3 m, float dist, float rad)\n{\nvec3 x = vec3(dist - 1.0, dist, dist + 1.0) / rad;\nvec3 w = exp2(x * x * -1.0);\n\nreturn (m[0] * w.x + m[1] * w.y + m[2] * w.z) / (w.x + w.y + w.z);\n}\n\nvec3 filter_gaussian(sampler2D tex, vec2 co, vec2 tex_size)\n{\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 dy = vec2(0.0, 1.0 / tex_size.y);\nvec2 pix_co = co * tex_size;\nvec2 tex_co = (floor(pix_co) + 0.5) / tex_size;\nvec2 dist = (fract(pix_co) - 0.5) * -1.0;\n\nmat3 line0 = get_color_matrix(tex, tex_co - dy, dx);\nmat3 line1 = get_color_matrix(tex, tex_co, dx);\nmat3 line2 = get_color_matrix(tex, tex_co + dy, dx);\nmat3 column = mat3(blur(line0, dist.x, GLOW_WIDTH),\n blur(line1, dist.x, GLOW_WIDTH),\n blur(line2, dist.x, GLOW_WIDTH));\n\nreturn blur(column, dist.y, GLOW_HEIGHT);\n}\n\nvec3 filter_lanczos(sampler2D tex, vec2 co, vec2 tex_size, float sharp)\n{\ntex_size.x *= sharp;\n\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 pix_co = co * tex_size - vec2(0.5, 0.0);\nvec2 tex_co = (floor(pix_co) + vec2(0.5, 0.0)) / tex_size;\nvec2 dist = fract(pix_co);\nvec4 coef = PI * vec4(dist.x + 1.0, dist.x, dist.x - 1.0, dist.x - 2.0);\n\ncoef = FIX(coef);\ncoef = 2.0 * sin(coef) * sin(coef / 2.0) / (coef * coef);\ncoef /= dot(coef, vec4(1.0));\n\nvec4 col1 = vec4(TEX2D(tex_co), 1.0);\nvec4 col2 = vec4(TEX2D(tex_co + dx), 1.0);\n\nreturn (mat4(col1, col1, col2, col2) * coef).rgb;\n}\n\nvec3 get_scanline_weight(float x, vec3 col)\n{\nvec3 beam = mix(vec3(SCANLINE_SIZE_MIN), vec3(SCANLINE_SIZE_MAX), col);\nvec3 x_mul = 2.0 / beam;\nvec3 x_offset = x_mul * 0.5;\n\nreturn smoothstep(0.0, 1.0, 1.0 - abs(x * x_mul - x_offset)) * x_offset;\n}\n\nvec3 get_mask_weight(float x)\n{\nfloat i = mod(floor(x * OutputSize.x * TextureSize.x / (InputSize.x * MASK_SIZE)), MASK_COLORS);\n\nif (i == 0.0) return mix(vec3(1.0, 0.0, 1.0), vec3(1.0, 0.0, 0.0), MASK_COLORS - 2.0);\nelse if (i == 1.0) return vec3(0.0, 1.0, 0.0);\nelse return vec3(0.0, 0.0, 1.0);\n}\n\nvoid main()\n{\nvec3 col_glow = filter_gaussian(Texture, Coord, TextureSize);\nvec3 col_soft = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_IMAGE);\nvec3 col_sharp = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_EDGES);\nvec3 col = sqrt(col_sharp * col_soft);\n\ncol *= get_scanline_weight(fract(Coord.y * TextureSize.y), col_soft);\ncol_glow = saturate(col_glow - col);\ncol += col_glow * col_glow * GLOW_HALATION;\ncol = mix(col, col * get_mask_weight(Coord.x) * MASK_COLORS, MASK_STRENGTH);\ncol += col_glow * GLOW_DIFFUSION;\ncol = pow(col * BRIGHTNESS, vec3(1.0 / GAMMA_OUTPUT));\n\nFragColor = vec4(col, 1.0);\n}\n\n#endif\n', - 'crt-geom.glsl': '\n/*\nCRT-interlaced\n\nCopyright (C) 2010-2012 cgwg, Themaister and DOLLS\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2 of the License, or (at your option)\nany later version.\n\n(cgwg gave their consent to have the original version of this shader\ndistributed under the GPL in this message:\n\nhttp://board.byuu.org/viewtopic.php?p=26075#p26075\n\n"Feel free to distribute my shaders under the GPL. After all, the\nbarrel distortion code was taken from the Curvature shader, which is\nunder the GPL."\n)\nThis shader variant is pre-configured with screen curvature\n*/\n/*\n#pragma parameter CRTgamma "CRTGeom Target Gamma" 2.4 0.1 5.0 0.1\n#pragma parameter monitorgamma "CRTGeom Monitor Gamma" 2.2 0.1 5.0 0.1\n#pragma parameter d "CRTGeom Distance" 1.6 0.1 3.0 0.1\n#pragma parameter CURVATURE "CRTGeom Curvature Toggle" 1.0 0.0 1.0 1.0\n#pragma parameter R "CRTGeom Curvature Radius" 2.0 0.1 10.0 0.1\n#pragma parameter cornersize "CRTGeom Corner Size" 0.03 0.001 1.0 0.005\n#pragma parameter cornersmooth "CRTGeom Corner Smoothness" 1000.0 80.0 2000.0 100.0\n#pragma parameter x_tilt "CRTGeom Horizontal Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter y_tilt "CRTGeom Vertical Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter overscan_x "CRTGeom Horiz. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter overscan_y "CRTGeom Vert. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter DOTMASK "CRTGeom Dot Mask Toggle" 0.3 0.0 0.3 0.3\n#pragma parameter SHARPER "CRTGeom Sharpness" 1.0 1.0 3.0 1.0\n#pragma parameter scanline_weight "CRTGeom Scanline Weight" 0.3 0.1 0.5 0.05\n*/\n\n#ifndef PARAMETER_UNIFORM\n#define CRTgamma 2.4\n#define monitorgamma 2.2\n#define d 1.6\n#define CURVATURE 1.0\n#define R 2.0\n#define cornersize 0.03\n#define cornersmooth 1000.0\n#define x_tilt 0.0\n#define y_tilt 0.0\n#define overscan_x 100.0\n#define overscan_y 100.0\n#define DOTMASK 0.3\n#define SHARPER 1.0\n#define scanline_weight 0.3\n#endif\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\n#define FIX(c) max(abs(c), 1e-5);\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = R*acos(a);\nreturn uv*r/sin(r/R);\n}\n\nvec2 fwtrans(vec2 uv)\n{\nfloat r = FIX(sqrt(dot(uv,uv)));\nuv *= sin(r/R)/r;\nfloat x = 1.0-cos(r/R);\nfloat D = d/R + x*cosangle.x*cosangle.y+dot(uv,sinangle);\nreturn d*(uv*cosangle-x*sinangle)/D;\n}\n\nvec3 maxscale()\n{\nvec2 c = bkwtrans(-R * sinangle / (1.0 + R/d*cosangle.x*cosangle.y));\nvec2 a = vec2(0.5,0.5)*aspect;\nvec2 lo = vec2(fwtrans(vec2(-a.x,c.y)).x, fwtrans(vec2(c.x,-a.y)).y)/aspect;\nvec2 hi = vec2(fwtrans(vec2(+a.x,c.y)).x, fwtrans(vec2(c.x,+a.y)).y)/aspect;\nreturn vec3((hi+lo)*aspect*0.5,max(hi.x-lo.x,hi.y-lo.y));\n}\n\nvoid main()\n{\n// START of parameters\n\n// gamma of simulated CRT\n// CRTgamma = 1.8;\n// gamma of display monitor (typically 2.2 is correct)\n// monitorgamma = 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// d = 2.0;\n// radius of curvature\n// R = 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// cornersize = 0.03;\n// border smoothness parameter\n// decrease if borders are too aliased\n// cornersmooth = 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' - }, - _0x5bb4c9 = _0x2c1832(0x39), - _0x50f370 = _0x2c1832.n(_0x5bb4c9), - _0x246d02 = _0x2c1832(0xb), - _0x550f17 = _0x2c1832.n(_0x246d02), - _0x5ab74d = { - 'addStyleHook': function() { - _0x3a8e2f(this.elements.container, this.config.selectors.container.replace('.', ''), true), _0x3a8e2f(this.elements.container, this.config.classNames.uiSupported, true), _0x3a8e2f(this.elements.container, this.config.classNames.hideControls, true); - }, - 'build': function() { - 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; - }, - 'toggleControls': function(_0x4dbb7a) { - var _0x17edbf = this.elements.controls; - if (_0x17edbf) { - var _0x2c1832 = 0x0, - _0x4b4cd5 = _0x23ffa1.call(this, '.' .concat(_0x449eac({ - 'ejs__dialogs': true - }), ' > .').concat(_0x449eac({ - 'ejs__dialog': true - }))); - Array.from(_0x4b4cd5).forEach(function(_0x208a40, _0xd7fcf0) { - true !== _0x208a40.hidden && (_0x2c1832 += 0x1); - }), _0x2c1832 > 0x0 ? this.toggleControls(!0x1) : this.toggleControls(Boolean(_0x4dbb7a || this.paused || _0x17edbf.pressed || _0x17edbf.hover)); - } - } - }; - - function _0x5272a8(_0x4d422a) { - return (_0x5272a8 = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function(_0x241239) { - return typeof _0x241239; - } : function(_0x39f252) { - return _0x39f252 && 'function' == typeof Symbol && _0x39f252.constructor === Symbol && _0x39f252 !== Symbol.prototype ? 'symbol' : typeof _0x39f252; - })(_0x4d422a); - } - - function _0x3189ba(_0x4380c5, _0x3c0d58) { - if ('object' === _0x5272a8(_0x4380c5) && _0x4380c5.files && (_0x4380c5 = _0x4380c5.files[0x0]), this.littleEndian = !0x1, this.offset = 0x0, this._lastRead = null, 'object' === _0x5272a8(_0x4380c5) && _0x4380c5.name && _0x4380c5.size) { - if ('function' != typeof window.FileReader) throw new Error('Incompatible Browser'); - 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() { - this.marcFile._u8array = new Uint8Array(this.result), this.marcFile._dataView = new DataView(this.result), _0x3c0d58 && _0x3c0d58.call(); - }, !0x1), this._fileReader.readAsArrayBuffer(_0x4380c5); - } else if ('object' === _0x5272a8(_0x4380c5) && 'string' == typeof _0x4380c5.fileName && 'boolean' == typeof _0x4380c5.littleEndian) { - this.fileName = _0x4380c5.fileName, this.fileType = _0x4380c5.fileType, this.fileSize = _0x4380c5.fileSize; - var _0x2c1832 = new ArrayBuffer(_0x4380c5); - this._u8array = new Uint8Array(this.fileType), this._dataView = new DataView(this.fileType), _0x4380c5.copyToFile(this, 0x0), _0x3c0d58 && _0x3c0d58.call(); - } else if ('object' === _0x5272a8(_0x4380c5) && 'number' == typeof _0x4380c5.byteLength) this.fileName = 'file.bin', this.fileType = 'application/octet-stream', this.fileSize = _0x4380c5.byteLength, void 0x0 !== _0x4380c5.buffer && (_0x4380c5 = _0x4380c5.buffer), this._u8array = new Uint8Array(_0x4380c5), this._dataView = new DataView(_0x4380c5), _0x3c0d58 && _0x3c0d58.call(); - else { - if ('number' != typeof _0x4380c5) throw new Error('Invalid source'); - this.fileName = 'file.bin', this.fileType = 'application/octet-stream', this.fileSize = _0x4380c5; - _0x2c1832 = new ArrayBuffer(_0x4380c5); - this._u8array = new Uint8Array(_0x2c1832), this._dataView = new DataView(_0x2c1832), _0x3c0d58 && _0x3c0d58.call(); - } - } - _0x3189ba.IS_MACHINE_LITTLE_ENDIAN = (_0x13fb79 = new ArrayBuffer(0x2), new DataView(_0x13fb79).setInt16(0x0, 0x100, true), 0x100 === new Int16Array(_0x13fb79)[0x0]), _0x3189ba.prototype.seek = function(_0x13e235) { - this.offset = _0x13e235; - }, _0x3189ba.prototype.skip = function(_0xfa033c) { - this.offset += _0xfa033c; - }, _0x3189ba.prototype.isEOF = function() { - return !(this.offset < this.fileSize); - }, _0x3189ba.prototype.slice = function(_0x2bfcbb, _0x8026e) { - var _0x2c1832; - return _0x8026e = _0x8026e || this.fileSize - _0x2bfcbb, void 0x0 !== this._u8array.buffer.slice ? ((_0x2c1832 = new _0x3189ba(0x0)).fileSize = _0x8026e, _0x2c1832._u8array = new Uint8Array(this._u8array.buffer.slice(_0x2bfcbb, _0x2bfcbb + _0x8026e))) : (_0x2c1832 = new _0x3189ba(_0x8026e), this.copyToFile(_0x2c1832, _0x2bfcbb, _0x8026e, 0x0)), _0x2c1832.fileName = this.fileName, _0x2c1832.fileType = this.fileType, _0x2c1832.littleEndian = this.littleEndian, _0x2c1832; - }, _0x3189ba.prototype.copyToFile = function(_0x51f9b5, _0x1ada3e, _0x3997cd, _0x38ae1a) { - void 0x0 === _0x38ae1a && (_0x38ae1a = _0x1ada3e), _0x3997cd = _0x3997cd || this.fileSize - _0x1ada3e; - for (var _0x3bc3d8 = 0x0; _0x3bc3d8 < _0x3997cd; _0x3bc3d8++) _0x51f9b5._u8array[_0x38ae1a + _0x3bc3d8] = this._u8array[_0x1ada3e + _0x3bc3d8]; - }, _0x3189ba.prototype.save = function() { - var _0xa88a13; - try { - _0xa88a13 = new Blob([this._u8array], { - 'type': this.fileType - }); - } catch (_0x1dfb06) { - if (window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, 'InvalidStateError' !== _0x1dfb06.name || !window.BlobBuilder) throw new Error('Incompatible Browser'); - var _0x17edbf = new BlobBuilder(); - _0x17edbf.append(this._u8array.buffer), _0xa88a13 = _0x17edbf.getBlob(this.fileType); - } - saveAs(_0xa88a13, this.fileName); - }, _0x3189ba.prototype.readU8 = function() { - return this._lastRead = this._u8array[this.offset], this.offset++, this._lastRead; - }, _0x3189ba.prototype.readU16 = function() { - return this.littleEndian ? this._lastRead = this._u8array[this.offset] + (this._u8array[this.offset + 0x1] << 0x8) : this._lastRead = (this._u8array[this.offset] << 0x8) + this._u8array[this.offset + 0x1], this.offset += 0x2, this._lastRead >>> 0x0; - }, _0x3189ba.prototype.readU24 = function() { - return this.littleEndian ? this._lastRead = this._u8array[this.offset] + (this._u8array[this.offset + 0x1] << 0x8) + (this._u8array[this.offset + 0x2] << 0x10) : this._lastRead = (this._u8array[this.offset] << 0x10) + (this._u8array[this.offset + 0x1] << 0x8) + this._u8array[this.offset + 0x2], this.offset += 0x3, this._lastRead >>> 0x0; - }, _0x3189ba.prototype.readU32 = function() { - return this.littleEndian ? this._lastRead = this._u8array[this.offset] + (this._u8array[this.offset + 0x1] << 0x8) + (this._u8array[this.offset + 0x2] << 0x10) + (this._u8array[this.offset + 0x3] << 0x18) : this._lastRead = (this._u8array[this.offset] << 0x18) + (this._u8array[this.offset + 0x1] << 0x10) + (this._u8array[this.offset + 0x2] << 0x8) + this._u8array[this.offset + 0x3], this.offset += 0x4, this._lastRead >>> 0x0; - }, _0x3189ba.prototype.readBytes = function(_0x455cfd) { - this._lastRead = new Array(_0x455cfd); - for (var _0x17edbf = 0x0; _0x17edbf < _0x455cfd; _0x17edbf++) this._lastRead[_0x17edbf] = this._u8array[this.offset + _0x17edbf]; - return this.offset += _0x455cfd, this._lastRead; - }, _0x3189ba.prototype.readString = function(_0x4fe914) { - this._lastRead = ''; - for (var _0x17edbf = 0x0; _0x17edbf < _0x4fe914 && this.offset + _0x17edbf < this.fileSize && this._u8array[this.offset + _0x17edbf] > 0x0; _0x17edbf++) this._lastRead = this._lastRead + String.fromCharCode(this._u8array[this.offset + _0x17edbf]); - return this.offset += _0x4fe914, this._lastRead; - }, _0x3189ba.prototype.writeU8 = function(_0x276206) { - this._u8array[this.offset] = _0x276206, this.offset++; - }, _0x3189ba.prototype.writeU16 = function(_0x1bfd8f) { - this.littleEndian ? (this._u8array[this.offset] = 0xff & _0x1bfd8f, this._u8array[this.offset + 0x1] = _0x1bfd8f >> 0x8) : (this._u8array[this.offset] = _0x1bfd8f >> 0x8, this._u8array[this.offset + 0x1] = 0xff & _0x1bfd8f), this.offset += 0x2; - }, _0x3189ba.prototype.writeU24 = function(_0x3d6067) { - this.littleEndian ? (this._u8array[this.offset] = 0xff & _0x3d6067, this._u8array[this.offset + 0x1] = (0xff00 & _0x3d6067) >> 0x8, this._u8array[this.offset + 0x2] = (0xff0000 & _0x3d6067) >> 0x10) : (this._u8array[this.offset] = (0xff0000 & _0x3d6067) >> 0x10, this._u8array[this.offset + 0x1] = (0xff00 & _0x3d6067) >> 0x8, this._u8array[this.offset + 0x2] = 0xff & _0x3d6067), this.offset += 0x3; - }, _0x3189ba.prototype.writeU32 = function(_0xa4dd26) { - this.littleEndian ? (this._u8array[this.offset] = 0xff & _0xa4dd26, this._u8array[this.offset + 0x1] = (0xff00 & _0xa4dd26) >> 0x8, this._u8array[this.offset + 0x2] = (0xff0000 & _0xa4dd26) >> 0x10, this._u8array[this.offset + 0x3] = (0xff000000 & _0xa4dd26) >> 0x18) : (this._u8array[this.offset] = (0xff000000 & _0xa4dd26) >> 0x18, this._u8array[this.offset + 0x1] = (0xff0000 & _0xa4dd26) >> 0x10, this._u8array[this.offset + 0x2] = (0xff00 & _0xa4dd26) >> 0x8, this._u8array[this.offset + 0x3] = 0xff & _0xa4dd26), this.offset += 0x4; - }, _0x3189ba.prototype.writeBytes = function(_0x5ad6b9) { - for (var _0x17edbf = 0x0; _0x17edbf < _0x5ad6b9.length; _0x17edbf++) this._u8array[this.offset + _0x17edbf] = _0x5ad6b9[_0x17edbf]; - this.offset += _0x5ad6b9.length; - }, _0x3189ba.prototype.writeString = function(_0x58c146, _0x23e582) { - _0x23e582 = _0x23e582 || _0x58c146.length; - for (var _0x2c1832 = 0x0; _0x2c1832 < _0x58c146.length && _0x2c1832 < _0x23e582; _0x2c1832++) this._u8array[this.offset + _0x2c1832] = _0x58c146.charCodeAt(_0x2c1832); - for (; _0x2c1832 < _0x23e582; _0x2c1832++) this._u8array[this.offset + _0x2c1832] = 0x0; - this.offset += _0x23e582; - }; - var _0x863031 = _0x3189ba, - _0x34e7cf = 0x0; - - function _0x454881() { - this.records = [], this.truncate = !0x1; - } - - function _0x288092(_0x1ab789) { - var _0x17edbf = new _0x454881(); - _0x1ab789.seek(0x5); - for (var _0x2c1832 = 0x0, _0x195f00 = 0x0; !_0x1ab789.isEOF();) { - if (0x454f46 === (_0x2c1832 = _0x1ab789.readU24())) { - if (_0x1ab789.isEOF()) break; - if (_0x1ab789.offset + 0x3 === _0x1ab789.fileSize) { - _0x17edbf.truncate = _0x1ab789.readU24(); - break; - } - }(_0x195f00 = _0x1ab789.readU16()) === _0x34e7cf ? _0x17edbf.addRLERecord(_0x2c1832, _0x1ab789.readU16(), _0x1ab789.readU8()) : _0x17edbf.addSimpleRecord(_0x2c1832, _0x1ab789.readBytes(_0x195f00)); - } - return _0x17edbf; - } - _0x454881.prototype.addSimpleRecord = function(_0x37166f, _0x2e61e0) { - this.records.push({ - 'offset': _0x37166f, - 'type': 0x1, - 'length': _0x2e61e0.length, - 'data': _0x2e61e0 - }); - }, _0x454881.prototype.addRLERecord = function(_0x4ae2fb, _0x507845, _0x92bb02) { - this.records.push({ - 'offset': _0x4ae2fb, - 'type': _0x34e7cf, - 'length': _0x507845, - 'byte': _0x92bb02 - }); - }, _0x454881.prototype.toString = function() { - nSimpleRecords = 0x0, nRLERecords = 0x0; - for (var _0xa88a13 = 0x0; _0xa88a13 < this.records.length; _0xa88a13++) this.records[_0xa88a13].type === _0x34e7cf ? nRLERecords++ : nSimpleRecords++; - var _0x17edbf = 'Simple records: ' + nSimpleRecords; - return _0x17edbf += '\nRLE records: ' + nRLERecords, _0x17edbf += '\nTotal records: ' + this.records.length, this.truncate && (_0x17edbf += '\nTruncate at: 0x' + this.truncate.toString(0x10)), _0x17edbf; - }, _0x454881.prototype.export = function(_0x4d18dc) { - for (var _0x17edbf = 0x5, _0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) this.records[_0x2c1832].type === _0x34e7cf ? _0x17edbf += 0x8 : _0x17edbf += 0x5 + this.records[_0x2c1832].data.length; - _0x17edbf += 0x3, this.truncate && (_0x17edbf += 0x3), tempFile = new _0x863031(_0x17edbf), tempFile.fileName = _0x4d18dc + '.ips', tempFile.writeString('PATCH'); - for (_0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) { - var _0x512785 = this.records[_0x2c1832]; - tempFile.writeU24(_0x512785.offset), _0x512785.type === _0x34e7cf ? (tempFile.writeU16(0x0), tempFile.writeU16(_0x512785.length), tempFile.writeU8(_0x512785.byte)) : (tempFile.writeU16(_0x512785.data.length), tempFile.writeBytes(_0x512785.data)); - } - return tempFile.writeString('EOF'), _0x512785.truncate && tempFile.writeU24(_0x512785.truncate), tempFile; - }, _0x454881.prototype.apply = function(_0xefa71d) { - var _0x17edbf; - if (this.truncate) _0x17edbf = _0xefa71d.slice(0x0, this.truncate); - else { - for (var _0x2c1832 = _0xefa71d.fileSize, _0x5a0a71 = 0x0; _0x5a0a71 < this.records.length; _0x5a0a71++) { - var _0x105576 = this.records[_0x5a0a71]; - _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); - } - _0x2c1832 === _0xefa71d.fileSize ? _0x17edbf = _0xefa71d.slice(0x0, _0xefa71d.fileSize) : (_0x17edbf = new _0x863031(_0x2c1832), _0xefa71d.copyToFile(_0x17edbf, 0x0)); - } - _0xefa71d.seek(0x0); - for (_0x5a0a71 = 0x0; _0x5a0a71 < this.records.length; _0x5a0a71++) - if (_0x17edbf.seek(this.records[_0x5a0a71].offset), this.records[_0x5a0a71].type === _0x34e7cf) - for (var _0x729105 = 0x0; _0x729105 < this.records[_0x5a0a71].length; _0x729105++) _0x17edbf.writeU8(this.records[_0x5a0a71].byte); - else _0x17edbf.writeBytes(this.records[_0x5a0a71].data); - return _0x17edbf; - }; - '0123456789abcdef' .split(''); - var _0x1aa7ba = function() { - for (var _0xa88a13, _0x17edbf = [], _0x2c1832 = 0x0; _0x2c1832 < 0x100; _0x2c1832++) { - _0xa88a13 = _0x2c1832; - for (var _0x32bcf1 = 0x0; _0x32bcf1 < 0x8; _0x32bcf1++) _0xa88a13 = 0x1 & _0xa88a13 ? 0xedb88320 ^ _0xa88a13 >>> 0x1 : _0xa88a13 >>> 0x1; - _0x17edbf[_0x2c1832] = _0xa88a13; - } - return _0x17edbf; - }(); - - function _0x2d78e9(_0x509ecf, _0x4219e1, _0xd66d2b) { - for (var _0x185f93 = _0x4219e1 ? new Uint8Array(_0x509ecf._u8array.buffer, _0x4219e1) : _0x509ecf._u8array, _0x20e2c1 = -0x1, _0x3d100a = _0xd66d2b ? _0x185f93.length - 0x4 : _0x185f93.length, _0x56a6e6 = 0x0; _0x56a6e6 < _0x3d100a; _0x56a6e6++) _0x20e2c1 = _0x20e2c1 >>> 0x8 ^ _0x1aa7ba[0xff & (_0x20e2c1 ^ _0x185f93[_0x56a6e6])]; - return (-0x1 ^ _0x20e2c1) >>> 0x0; - } - var _0x37eff4 = 0x0, - _0x34d681 = 0x1, - _0x4c50e7 = 0x2, - _0xf9eeea = 0x3; - - function _0x5b02d3() { - this.sourceSize = 0x0, this.targetSize = 0x0, this.metaData = '', this.actions = [], this.sourceChecksum = 0x0, this.targetChecksum = 0x0, this.patchChecksum = 0x0; - } - - function _0x356089(_0x1bf770) { - _0x1bf770.readVLV = _0x45da2c, _0x1bf770.littleEndian = true; - var _0x17edbf = new _0x5b02d3(); - _0x1bf770.seek(0x4), _0x17edbf.sourceSize = _0x1bf770.readVLV(), _0x17edbf.targetSize = _0x1bf770.readVLV(); - var _0x2c1832 = _0x1bf770.readVLV(); - _0x2c1832 && (_0x17edbf.metaData = _0x1bf770.readString(_0x2c1832)); - for (var _0x157bba = _0x1bf770.fileSize - 0xc; _0x1bf770.offset < _0x157bba;) { - var _0x31dcc2 = _0x1bf770.readVLV(), - _0x21bafe = { - 'type': 0x3 & _0x31dcc2, - 'length': 0x1 + (_0x31dcc2 >> 0x2) - }; - if (_0x21bafe.type === _0x34d681) _0x21bafe.bytes = _0x1bf770.readBytes(_0x21bafe.length); - else if (_0x21bafe.type === _0x4c50e7 || _0x21bafe.type === _0xf9eeea) { - var _0x4c6327 = _0x1bf770.readVLV(); - _0x21bafe.relativeOffset = (0x1 & _0x4c6327 ? -0x1 : 0x1) * (_0x4c6327 >> 0x1); - } - _0x17edbf.actions.push(_0x21bafe); - } - if (_0x17edbf.sourceChecksum = _0x1bf770.readU32(), _0x17edbf.targetChecksum = _0x1bf770.readU32(), _0x17edbf.patchChecksum = _0x1bf770.readU32(), _0x17edbf.patchChecksum !== _0x2d78e9(_0x1bf770, 0x0, true)) throw new Error('error_crc_patch'); - return _0x17edbf; - } - - function _0x45da2c() { - for (var _0xa88a13 = 0x0, _0x17edbf = 0x1;;) { - var _0x2c1832 = this.readU8(); - if (_0xa88a13 += (0x7f & _0x2c1832) * _0x17edbf, 0x80 & _0x2c1832) break; - _0xa88a13 += _0x17edbf <<= 0x7; - } - return this._lastRead = _0xa88a13, _0xa88a13; - } - - function _0x152a53(_0x33f58d) { - for (;;) { - var _0x17edbf = 0x7f & _0x33f58d; - if (0x0 === (_0x33f58d >>= 0x7)) { - this.writeU8(0x80 | _0x17edbf); - break; - } - this.writeU8(_0x17edbf), _0x33f58d--; - } - } - - function _0x5a4975(_0x221175) { - for (var _0x17edbf = 0x0;;) { - if (0x0 === (_0x221175 >>= 0x7)) { - _0x17edbf++; - break; - } - _0x17edbf++, _0x221175--; - } - return _0x17edbf; - } - - function _0x562e68() { - this.offset = 0x0, this.next = null; - } - _0x5b02d3.prototype.toString = function() { - var _0xa88a13 = 'Source size: ' + this.sourceSize; - return _0xa88a13 += '\nTarget size: ' + this.targetSize, _0xa88a13 += '\nMetadata: ' + this.metaData, _0xa88a13 += '\n#Actions: ' + this.actions.length; - }, _0x5b02d3.prototype.validateSource = function(_0x48d2df, _0x3c15dd) { - return this.sourceChecksum === _0x2d78e9(_0x48d2df, _0x3c15dd); - }, _0x5b02d3.prototype.apply = function(_0x393f39, _0x76e509) { - if (_0x76e509 && !this.validateSource(_0x393f39)) throw new Error('error_crc_input'); - for (var _0x2c1832 = new _0x863031(this.targetSize), _0x4df6ae = 0x0, _0xad0fa9 = 0x0, _0x38240a = 0x0; _0x38240a < this.actions.length; _0x38240a++) { - var _0x4b1026 = this.actions[_0x38240a]; - if (_0x4b1026.type === _0x37eff4) _0x393f39.copyToFile(_0x2c1832, _0x2c1832.offset, _0x4b1026.length), _0x2c1832.skip(_0x4b1026.length); - else if (_0x4b1026.type === _0x34d681) _0x2c1832.writeBytes(_0x4b1026.bytes); - else if (_0x4b1026.type === _0x4c50e7) { - _0x4df6ae += _0x4b1026.relativeOffset; - for (var _0x5c2263 = _0x4b1026.length; _0x5c2263--;) _0x2c1832.writeU8(_0x393f39._u8array[_0x4df6ae]), _0x4df6ae++; - } else if (_0x4b1026.type === _0xf9eeea) { - _0xad0fa9 += _0x4b1026.relativeOffset; - for (_0x5c2263 = _0x4b1026.length; _0x5c2263--;) _0x2c1832.writeU8(_0x2c1832._u8array[_0xad0fa9]), _0xad0fa9++; - } - } - if (_0x76e509 && this.targetChecksum !== _0x2d78e9(_0x2c1832)) throw new Error('error_crc_output'); - return _0x2c1832; - }, _0x5b02d3.prototype.export = function(_0x3e1e58) { - var _0x17edbf = 'BPS1' .length; - _0x17edbf += _0x5a4975(this.sourceSize), _0x17edbf += _0x5a4975(this.targetSize), _0x17edbf += _0x5a4975(this.metaData.length), _0x17edbf += this.metaData.length; - for (var _0x2c1832 = 0x0; _0x2c1832 < this.actions.length; _0x2c1832++) { - _0x17edbf += _0x5a4975(((_0x38dad6 = this.actions[_0x2c1832]).length - 0x1 << 0x2) + _0x38dad6.type), _0x38dad6.type === _0x34d681 ? _0x17edbf += _0x38dad6.length : _0x38dad6.type !== _0x4c50e7 && _0x38dad6.type !== _0xf9eeea || (_0x17edbf += _0x5a4975((Math.abs(_0x38dad6.relativeOffset) << 0x1) + (_0x38dad6.relativeOffset < 0x0 ? 0x1 : 0x0))); - } - var _0x2d1555 = new _0x863031(_0x17edbf += 0xc); - _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); - for (_0x2c1832 = 0x0; _0x2c1832 < this.actions.length; _0x2c1832++) { - var _0x38dad6 = this.actions[_0x2c1832]; - _0x2d1555.writeVLV((_0x38dad6.length - 0x1 << 0x2) + _0x38dad6.type), _0x38dad6.type === _0x34d681 ? _0x2d1555.writeBytes(_0x38dad6.bytes) : _0x38dad6.type !== _0x4c50e7 && _0x38dad6.type !== _0xf9eeea || _0x2d1555.writeVLV((Math.abs(_0x38dad6.relativeOffset) << 0x1) + (_0x38dad6.relativeOffset < 0x0 ? 0x1 : 0x0)); - } - return _0x2d1555.writeU32(this.sourceChecksum), _0x2d1555.writeU32(this.targetChecksum), _0x2d1555.writeU32(this.patchChecksum), _0x2d1555; - }, _0x562e68.prototype.delete = function() { - this.next && delete this.next; - }; - var _0x7a6485 = 'UPS1'; - - function _0x42cd9e() { - this.records = [], this.sizeInput = 0x0, this.sizeOutput = 0x0, this.checksumInput = 0x0, this.checksumOutput = 0x0; - } - - function _0x10dc1d(_0x5d0c48) { - for (;;) { - var _0x17edbf = 0x7f & _0x5d0c48; - if (0x0 === (_0x5d0c48 >>= 0x7)) { - this.writeU8(0x80 | _0x17edbf); - break; - } - this.writeU8(_0x17edbf), _0x5d0c48 -= 0x1; - } - } - - function _0x454043() { - for (var _0xa88a13 = 0x0, _0x17edbf = 0x1;;) { - var _0x2c1832 = this.readU8(); - if (-0x1 == _0x2c1832) throw new Error('Can\'t read UPS VLV at 0x' + (this.offset - 0x1).toString(0x10)); - if (_0xa88a13 += (0x7f & _0x2c1832) * _0x17edbf, 0x0 != (0x80 & _0x2c1832)) break; - _0xa88a13 += _0x17edbf <<= 0x7; - } - return _0xa88a13; - } - - function _0xca245c(_0x459173) { - for (var _0x17edbf = 0x0;;) { - if (_0x17edbf++, 0x0 === (_0x459173 >>= 0x7)) break; - _0x459173 -= 0x1; - } - return _0x17edbf; - } - - function _0xd2202f(_0x5abb5e) { - var _0x17edbf = new _0x42cd9e(); - _0x5abb5e.readVLV = _0x454043, _0x5abb5e.seek(_0x7a6485.length), _0x17edbf.sizeInput = _0x5abb5e.readVLV(), _0x17edbf.sizeOutput = _0x5abb5e.readVLV(); - for (; _0x5abb5e.offset < _0x5abb5e.fileSize - 0xc;) { - for (var _0x2c1832 = _0x5abb5e.readVLV(), _0x3bca86 = []; _0x5abb5e.readU8();) _0x3bca86.push(_0x5abb5e._lastRead); - _0x17edbf.addRecord(_0x2c1832, _0x3bca86); - } - return _0x5abb5e.littleEndian = true, _0x17edbf.checksumInput = _0x5abb5e.readU32(), _0x17edbf.checksumOutput = _0x5abb5e.readU32(), _0x5abb5e.littleEndian = !0x1, _0x17edbf; - } - _0x42cd9e.prototype.addRecord = function(_0x162ca5, _0x39594d) { - this.records.push({ - 'offset': _0x162ca5, - 'XORdata': _0x39594d - }); - }, _0x42cd9e.prototype.toString = function() { - var _0xa88a13 = 'Records: ' + (void 0x0).records.length; - return _0xa88a13 += '\nInput file size: ' + (void 0x0).sizeInput, _0xa88a13 += '\nOutput file size: ' + (void 0x0).sizeOutput, _0xa88a13 += '\nInput file checksum: ' + padZeroes((void 0x0).checksumInput, 0x4), _0xa88a13 += '\nOutput file checksum: ' + padZeroes((void 0x0).checksumOutput, 0x4); - }, _0x42cd9e.prototype.export = function(_0x1a3e8b) { - var _0x17edbf = _0x7a6485.length; - _0x17edbf += _0xca245c(this.sizeInput), _0x17edbf += _0xca245c(this.sizeOutput); - for (var _0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) _0x17edbf += _0xca245c(this.records[_0x2c1832].offset), _0x17edbf += this.records[_0x2c1832].XORdata.length + 0x1; - _0x17edbf += 0xc, tempFile = new _0x863031(_0x17edbf), tempFile.writeVLV = _0x10dc1d, tempFile.fileName = _0x1a3e8b + '.ups', tempFile.writeString(_0x7a6485), tempFile.writeVLV(this.sizeInput), tempFile.writeVLV(this.sizeOutput); - for (_0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) tempFile.writeVLV(this.records[_0x2c1832].offset), tempFile.writeBytes(this.records[_0x2c1832].XORdata), tempFile.writeU8(0x0); - return tempFile.littleEndian = true, tempFile.writeU32(this.checksumInput), tempFile.writeU32(this.checksumOutput), tempFile.writeU32(_0x2d78e9(tempFile, 0x0, true)), tempFile; - }, _0x42cd9e.prototype.validateSource = function(_0x25cb26, _0xd0163c) { - return _0x2d78e9(_0x25cb26, _0xd0163c) === this.checksumInput; - }, _0x42cd9e.prototype.apply = function(_0x21d682, _0x41bbac) { - _0x41bbac && this.validateSource(_0x21d682), tempFile = new _0x863031(this.sizeOutput), _0x21d682.copyToFile(tempFile, 0x0, this.sizeInput), _0x21d682.seek(0x0); - for (var _0x2c1832 = 0x0; _0x2c1832 < this.records.length; _0x2c1832++) { - var _0x5ed6c9 = this.records[_0x2c1832]; - tempFile.skip(_0x5ed6c9.offset), _0x21d682.skip(_0x5ed6c9.offset); - for (var _0x3faf05 = 0x0; _0x3faf05 < _0x5ed6c9.XORdata.length; _0x3faf05++) tempFile.writeU8((_0x21d682.isEOF() ? 0x0 : _0x21d682.readU8()) ^ _0x5ed6c9.XORdata[_0x3faf05]); - tempFile.skip(0x1), _0x21d682.skip(0x1); - } - return _0x41bbac && (_0x2d78e9(tempFile), this.checksumOutput), tempFile; - }; - var _0xc778fa = _0x2c1832(0xa0), - _0x5a641d = _0x2c1832.n(_0xc778fa), - _0x4d7024 = { - 'romdb': null, - 'supportBatterySave': !0x1, - 'hash': '2b35cacf70ae', - 'hash2': 'f5cbb3f38c0bb20e4', - 'hash3': '88cc8ad0c350400499a0', - 'loading': null, - 'gamePatch': null, - 'saveFilenames': [], - 'FS': null, - 'Module': null, - 'aspectRatio': 0x4 / 0x3, - 'memData': null, - 'wasmData': null, - 'coreFileData': {}, - 'coreFileName': '', - 'coreFileVersion': '', - 'isMobileDevice': !!/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i .test(navigator.userAgent || ''), - 'create': function() { - var _0xa88a13 = this; - window.URL = window.URL || window.webkitURL; - var _0x17edbf, _0x2c1832, _0x4ce206, _0x528f2b = !0x1, - _0x547484 = !0x1, - _0x5e24fa = !0x1, - _0x468801 = 0x0, - _0x31a5b3 = !0x1, - _0x1e0766 = { - 'psx': ['bin', 'iso', 'cue', 'img', 'mdf', 'pbp', 'toc', 'cbn', 'm3u'], - 'nds': ['nds', 'bin'], - 'nes': ['fds', 'nes', 'unif', 'unf'], - 'snes': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'], - 'snes2002': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'], - 'snes2005': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'], - 'snes2010': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'], - 'gb': ['gb', 'gbc', 'dmg'], - 'gba': ['gb', 'gbc', 'gba'], - 'vbanext': ['gba'], - 'vb': ['vb', 'vboy', 'bin'], - '3do': ['iso', 'bin', 'cue'], - 'lynx': ['lnx'], - 'jaguar': ['j64', 'jag', 'rom', 'abs', 'cof', 'bin', 'prg'], - 'a7800': ['a78', 'bin'], - 'a2600': ['a26', 'bin'], - 'ngp': ['ngp', 'ngc'], - 'n64': ['n64', 'v64', 'z64', 'bin', 'u1', 'ndd'], - 'pce': ['pce', 'bin', 'iso', 'cue', 'ccd', 'img', 'chd'], - 'sega': ['mdx', 'md', 'smd', 'gen', 'bin', 'iso', 'cue', 'sms', 'gg', 'sg', '68k', 'chd'], - 'segacd': ['mdx', 'md', 'smd', 'gen', 'bin', 'iso', 'cue', 'sms', 'gg', 'sg', '68k', 'chd'], - '32x': ['32x', 'bin', 'gen', 'smd', 'md', 'cue', 'iso', 'sms'], - 'saturn': ['bin', 'cue', 'iso'], - 'msx': ['rom', 'mx1', 'mx2', 'dsk', 'cas'], - 'bluemsx': ['rom', 'ri', 'mx1', 'mx2', 'col', 'dsk', 'cas', 'sg', 'sc', 'm3u'], - 'ws': ['ws', 'wsc'], - 'arcade': ['zip'], - 'fba0.2.97.29': ['zip'], - 'mame2003': ['zip'], - 'mame': ['zip'] - }, - _0x29078e = { - 'psx': 'psx', - 'nds': 'nds', - 'nes': 'nes', - 'snes': 'snes', - 'snes2002': 'snes2002', - 'snes2005': 'snes2005', - 'snes2010': 'snes2010', - 'gb': 'gb', - 'gbc': 'gb', - 'gba': 'gba', - 'vbanext': 'vbanext', - 'vb': 'vb', - 'n64': 'n64', - '3do': '3do', - 'segaMS': 'sega', - 'segaGG': 'sega', - 'segaMD': 'sega', - 'segaCD': 'segacd', - 'sega32x': '32x', - 'segaSaturn': 'saturn', - 'ngp': 'ngp', - 'pce': 'pce', - 'msx': 'bluemsx', - 'atari2600': 'a2600', - 'atari7800': 'a7800', - 'lynx': 'lynx', - 'ws': 'ws', - 'arcade': 'arcade', - 'fba0.2.97.29': 'fba0.2.97.29', - 'jaguar': 'jaguar', - 'mame2003': 'mame2003' - }, - _0xc6823 = this, - _0x1143c5 = _0xc6823.system; - _0x17edbf = (_0xc6823.customPaths && typeof _0xc6823.customPaths['extract7z.js'] == 'string') ? _0xc6823.customPaths['extract7z.js'] : (_0xc6823.dataPath + 'extract7z.js');; - _0x2c1832 = (_0xc6823.customPaths && typeof _0xc6823.customPaths['extractzip.js'] == 'string') ? _0xc6823.customPaths['extractzip.js'] : (_0xc6823.dataPath + 'extractzip.js?v=1'); - _0x4ce206 = (_0xc6823.customPaths && typeof _0xc6823.customPaths['libunrar.js'] == 'string') ? _0xc6823.customPaths['libunrar.js'] : (_0xc6823.dataPath + 'libunrar.js'); - var _0xb2be2a = _0x428003('canvas', {}); - this.game.appendChild(_0xb2be2a), _0x4d7024.loading = _0x428003('div', { - 'class': this.config.classNames.loading - }), this.elements.container.appendChild(_0x4d7024.loading); - var _0x4fce24 = { - 'loading-info': _0x449eac({ - 'loading-info': true - }), - 'ad': _0x449eac({ - 'ad': true - }), - 'close-ad': _0x449eac({ - 'close-ad': true - }), - 'start-game': _0x449eac({ - 'start-game': true - }), - 'on': _0x449eac({ - 'on': true - }), - 'p1': _0x449eac({ - 'p1': true - }), - 'p2': _0x449eac({ - 'p2': true - }), - 'p3': _0x449eac({ - 'p3': true - }), - 'p4': _0x449eac({ - 'p4': true - }) - }, - _0x4e198f = ''; - if (typeof _0xc6823.adUrl === 'string') { - _0x4d7024.loading.innerHTML = '\n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    '; - var _0x2e2264 = _0x428003('iframe', { - 'src': _0xc6823.adUrl, - 'scrolling': 'no', - 'frameborder': 'no', - 'style': 'width:300px !important;height:250px !important;display: block !important;' - }); - (_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 = 'Failed to initialize WebGL.'); - _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') - } else { - _0x4d7024.loading.innerHTML = '\n '); - if (! _0x2d904a.webgl.DETECTED) { - _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true), _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)).innerHTML = 'Failed to initialize WebGL.'; - } - } - var _0x18a437 = window.URL || window.webkitURL; - _0x550f17.a.interceptors.request.use(function(_0x1cd992) { - return _0x1cd992.headers['Content-Type'] = 'application/x-www-form-urlencoded', 'options' === _0x1cd992.method.toLowerCase() && (_0x1cd992.method = 'get'), _0x1cd992; - }, function(_0x5150c8) { - return Promise.reject(_0x5150c8); - }); - var _0x394c59 = function(_0x571737) { - var _0x17edbf; - return 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x3 === _0x571737[0x2] && 0x4 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x5 === _0x571737[0x2] && 0x6 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x7 === _0x571737[0x2] && 0x8 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x37 === _0x571737[0x0] && 0x7a === _0x571737[0x1] && 0xbc === _0x571737[0x2] && 0xaf === _0x571737[0x3] && 0x27 === _0x571737[0x4] && 0x1c === _0x571737[0x5] ? _0x17edbf = '7z' : 0x52 === _0x571737[0x0] && 0x61 === _0x571737[0x1] && 0x72 === _0x571737[0x2] && 0x21 === _0x571737[0x3] && 0x1a === _0x571737[0x4] && 0x7 === _0x571737[0x5] && 0x0 == _0x571737[0x6] && (_0x17edbf = 'rar'), _0x17edbf; - }, - _0xa24f60 = function(_0xbf2b8b) { - var _0x17edbf = 'importScripts("'+_0xbf2b8b+'");', - _0x2c1832 = new Blob([_0x17edbf], { - 'type': 'application/javascript' - }), - _0x501a8e = window.URL.createObjectURL(_0x2c1832); - return new Promise(function(_0x2d8147, _0x1b03b2) { - _0x2d8147(new Worker(_0x501a8e)); - }); - }, - _0x41d0bd = function(_0x3a41ff, _0x2b541e) { - var _0x2c1832 = ''; - if ('rar' == _0x2b541e) _0x2c1832 = '\nvar dataToPass = [];\nModule = {\n monitorRunDependencies: function(left) {\n if (left == 0) {\n setTimeout(function() {\n unrar(dataToPass, null);\n }, 100);\n }\n },\n onRuntimeInitialized: function() {\n },\n locateFile: function(file) {\n return \'' .concat(_0x3a41ff+'.mem', '\';\n }\n};\nimportScripts("').concat(_0x3a41ff, '");\nvar unrar = function(data, password) {\n var cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n var rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n var rec = function(entry) {\n if (entry.type === \'file\') {\n postMessage({"t":2,"file":entry.fullFileName,"size":entry.fileSize,"data":entry.fileContent});\n } else if (entry.type === \'dir\') {\n Object.keys(entry.ls).forEach(function(k) {\n rec(entry.ls[k]);\n })\n } else {\n throw "Unknown type";\n }\n }\n rec(rarContent);\n postMessage({"t":1});\n return rarContent;\n};\nonmessage = function(data) {\n dataToPass.push({name: \'test.rar\', content: data.data});\n};\n '); - var _0x22326b = new Blob([_0x2c1832], { - 'type': 'application/javascript' - }), - _0x3635b1 = window.URL.createObjectURL(_0x22326b); - return new Promise(function(_0x2d169f, _0x341b0d) { - _0x2d169f(new Worker(_0x3635b1)); - }); - }, - _0x24de8d = null, - _0x4e171c = null, - _0xa884ea = null, - _0x1ffb98 = null; - try { - _0x24de8d = new _0x50f370.a({ - 'dbVersion': 0x1, - 'storePrefix': 'ejs-', - 'storeName': 'system', - 'keyPath': null, - 'autoIncrement': !0x1, - 'onStoreReady': function() { - _0x528f2b = true; - }, - 'onError': function() { - _0x528f2b = true; - } - }), _0x4e171c = new _0x50f370.a({ - 'dbVersion': 0x1, - 'storePrefix': 'ejs-', - 'storeName': 'roms', - 'keyPath': null, - 'autoIncrement': !0x1, - 'onStoreReady': function() { - _0x547484 = true; - }, - 'onError': function() { - _0x547484 = true; - } - }), _0xa884ea = new _0x50f370.a({ - 'dbVersion': 0x1, - 'storePrefix': 'ejs-', - 'storeName': 'bios', - 'keyPath': null, - 'autoIncrement': !0x1, - 'onStoreReady': function() { - _0x5e24fa = true; - }, - 'onError': function() { - _0x5e24fa = true; - } - }), _0x1ffb98 = new _0x50f370.a({ - 'dbVersion': 0x1, - 'storePrefix': 'ejs-', - 'storeName': 'romsdata', - 'keyPath': null, - 'autoIncrement': !0x1, - 'onStoreReady': function() {}, - 'onError': function() {} - }); - } catch (_0x4fc9b6) { - _0x528f2b = true, _0x547484 = true, _0x5e24fa = true, console.log(_0x4fc9b6); - } - _0x1093f4.call(_0xc6823, _0xc6823.elements.container, 'start-game', function(_0x3d9f57) { - _0xc6823.started = true, _0xc6823.playing = true, _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['loading-info'])), true); - if (_0xdcec2a && (_0xdcec2a.virtualGamepadContainer == 'undefined' || _0xdcec2a.virtualGamepadContainer === null)) { - _0x5ab74d.toggleControls.call(_0xc6823, true); - } - var _0x2c1832 = _0x449eac({ - 'ejs__tooltip--visible': true - }), - _0x10efa5 = _0xc6823.elements.buttons.gamepad.querySelector('.' .concat(_0x449eac({ - 'ejs__tooltip': true - }))); - _0x3a8e2f(_0x10efa5, _0x2c1832, true), setTimeout(function() { - _0x3a8e2f(_0x10efa5, _0x2c1832, !0x1); - }, 0x1388) - if (typeof _0xc6823.adUrl === 'string') { - _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['close-ad'])), !0x1), setTimeout(function() { - _0xc6823.started && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)) && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).parentNode.removeChild(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad))); - }, 0x2710) - } - _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true); - var _0x30fd44 = _0x5dc0c0(_0x2593da.defaultCoreOptionsValues.call(_0xa88a13), _0x2593da.storage.get('core-options') || {}); - 'n64' === _0xc6823.system && _0x30fd44 && Object.keys(_0x30fd44).forEach(function(_0x3015d2) { - 'glupen64-aspect' === _0x3015d2 && '16:9' === _0x30fd44[_0x3015d2] && (_0xb2be2a.height = _0xb2be2a.width / 0x10 * 0x9, _0x4d7024.aspectRatio = 0x10 / 0x9); - }), 'arcade' !== _0xa88a13.system && 'fba0.2.97.29' !== _0xa88a13.system || _0x30fd44 && Object.keys(_0x30fd44).forEach(function(_0x490c06) { - 'fba-aspect' === _0x490c06 && 'PAR' === _0x30fd44[_0x490c06] && (_0xb2be2a.height = _0xb2be2a.width / 0x10 * 0x9, _0x4d7024.aspectRatio = 0x10 / 0x9); - }), 'gba' === _0xc6823.system && (_0xb2be2a.height = _0xb2be2a.width / 1.5, _0x4d7024.aspectRatio = 1.5), window.setTimeout(function() {}, 0x96), - function() { - var _0x3d9f57 = _0xa88a13; - if ('undefined' != typeof RI) { - document.removeEventListener('mousemove', RI.eventHandler, !0x1), _0xb2be2a.removeEventListener('mousedown', RI.canvasEventHandler, !0x1), _0xb2be2a.removeEventListener('mouseup', RI.canvasEventHandler, !0x1); - _0x3d9f57.elements.container.addEventListener('mousemove', function(_0x44f409) { - var _0x3d9f57 = 0x0, - _0x2c1832 = 0x0, - _0x2cc8a1 = _0x44f409.offsetX - _0x4d7024.Module.canvas.offsetLeft, - _0x5744ed = _0x44f409.offsetY - _0x4d7024.Module.canvas.offsetTop; - switch (_0x44f409.type) { - case 'mousemove': - _0x2cc8a1 < 0x0 ? (_0x2cc8a1 = 0x0, _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 < 0x0 ? (_0x5744ed = 0x0, _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; - for (var _0x3e03cb = 0x0; _0x3e03cb < RI.contexts.length; _0x3e03cb += 0x1) HEAP32[RI.contexts[_0x3e03cb].state + 0x20 >> 0x2] = _0x3d9f57, HEAP32[RI.contexts[_0x3e03cb].state + 0x24 >> 0x2] = _0x2c1832; - } - }, !0x1), _0x3d9f57.elements.container.addEventListener('mousedown', RI.canvasEventHandler, !0x1), _0x3d9f57.elements.container.addEventListener('mouseup', RI.canvasEventHandler, !0x1); - var _0x2c1832 = function(_0x5d0cbb) { - if (_0x5d0cbb.targetTouches[0x0]) { - var _0x3d9f57, _0x2c1832, _0x19a4e0 = 0x0, - _0x2b7b61 = 0x0, - _0x1e0f64 = _0x5d0cbb.target.getBoundingClientRect(), - _0x2c55b8 = _0x5d0cbb.targetTouches[0x0].clientX - _0x1e0f64.left, - _0x3a7025 = _0x5d0cbb.targetTouches[0x0].clientY - _0x1e0f64.top; - _0x2c55b8 < 0x0 ? (_0x2c55b8 = 0x0, _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 < 0x0 ? (_0x3a7025 = 0x0, _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; - for (var _0x43b670 = 0x0; _0x43b670 < RI.contexts.length; _0x43b670 += 0x1) HEAP32[RI.contexts[_0x43b670].state + 0x20 >> 0x2] = _0x19a4e0, HEAP32[RI.contexts[_0x43b670].state + 0x24 >> 0x2] = _0x2b7b61; - switch (_0x5d0cbb.type) { - case 'touchend': - case 'touchstart': - if (0x0 === _0x5d0cbb.button) _0x2c1832 = 0x28; - else { - if (0x2 !== _0x5d0cbb.button) break; - _0x2c1832 = 0x29; - } - _0x3d9f57 = 'touchend' === _0x5d0cbb.type ? 0x0 : 0x1; - for (var _0x443e8b = 0x0; _0x443e8b < RI.contexts.length; _0x443e8b += 0x1) HEAP8[RI.contexts[_0x443e8b].state + _0x2c1832 >> 0x0] = _0x3d9f57; - } - } - }; - _0x3d9f57.elements.container.addEventListener('touchstart', _0x2c1832, !0x1), _0x3d9f57.elements.container.addEventListener('touchend', _0x2c1832, !0x1); - } else { - var _0x518e5a = function(_0x45d640) { - var _0x3d9f57 = new MouseEvent(_0x45d640.type, _0x45d640); - _0x4d7024.Module.canvas.dispatchEvent(_0x3d9f57); - }; - _0x530042.call(_0xa88a13, '.' .concat(_0x449eac({ - 'ejs__dialogs': true - }))).addEventListener('mousemove', _0x518e5a, !0x1), _0x530042.call(_0xa88a13, '.' .concat(_0x449eac({ - 'ejs__dialogs': true - }))).addEventListener('mousedown', _0x518e5a, !0x1), _0x530042.call(_0xa88a13, '.' .concat(_0x449eac({ - 'ejs__dialogs': true - }))).addEventListener('mouseup', _0x518e5a, !0x1); - } - }(), 'msx' === _0xc6823.system && function(_0x3c016a) { - if ('undefined' != typeof RI) { - document.removeEventListener('keydown', RI.eventHandler, !0x1), document.removeEventListener('keyup', RI.eventHandler, !0x1); - var _0x3d9f57 = function(_0x97e67b) { - var _0x3d9f57 = _0x97e67b.keyCode, - _0x2c1832 = _0x3d9f57 >> 0x3, - _0x3340c0 = 0x1 << (0x7 & _0x3d9f57); - switch (_0x97e67b.type) { - case 'keyup': - case 'keydown': - if (_0x2c1832 >= 0x20) throw 'key code error! bad code: ' + _0x3d9f57; - for (var _0x126f58 = 0x0; _0x126f58 < RI.contexts.length; _0x126f58++) { - var _0x4ca77a = HEAP8[RI.contexts[_0x126f58].state + _0x2c1832 >> 0x0]; - 'keyup' === _0x97e67b.type ? _0x4ca77a &= ~_0x3340c0 : _0x4ca77a |= _0x3340c0, HEAP8[RI.contexts[_0x126f58].state + _0x2c1832 >> 0x0] = _0x4ca77a; - } - } - }; - document.addEventListener('keydown', _0x3d9f57, !0x1), document.addEventListener('keyup', _0x3d9f57, !0x1); - } - }(), setTimeout(function() { - var _0xa88a13; - _0xa88a13 = _0x59aa33.info(), null === _0xdcec2a.setVolume && 'undefined' != typeof RA ? (RA.queueAudio = function() { - var _0x3d9f57, _0x2c1832 = _0xc6823.volume, - _0x2cbc4 = RA.bufIndex; - _0x3d9f57 = RA.bufIndex ? RA.buffers[RA.bufIndex - 0x1].endTime : RA.context.currentTime, RA.buffers[_0x2cbc4].endTime = _0x3d9f57 + RA.buffers[_0x2cbc4].duration; - var _0x4e7320 = RA.context.createBufferSource(); - if (_0x4e7320.buffer = RA.buffers[_0x2cbc4], _0xc6823.muted && (_0x2c1832 = 0x0), 0x1 === _0x2c1832) _0x4e7320.connect(RA.context.destination); - else { - var _0x3da8fc = RA.context.createGain(); - _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, 0x0); - } - _0x4e7320.start(_0x3d9f57), RA.bufIndex += 0x1, RA.bufOffset = 0x0; - }, _0x59aa33.isIos && window.addEventListener('touchstart', function() { - if (RA.context) { - RA.context.resume(); - var _0xa88a13 = RA.context.createBufferSource(); - _0xa88a13.connect(RA.context.destination), _0xa88a13.start(); - } - }, !0x1)) : _0xdcec2a.setVolume(); - }, 0x1f4), setTimeout(function() { - _0xc6823.elements.container.focus(); - }, 0x1e), void 0x0 === window.addRunDependency && (window.Module = void 0x0); - var _0x36b9cc = _0x4d7024.FS.readFile(_0xc6823.startName); - if (_0x36b9cc.length <= 0x2000000 && '.cue' != _0xc6823.startName.substr(-0x4)) { - var _0x4fa964; - if ('snes' === _0xc6823.system || ['snes2002', 'snes2005', 'snes2010'].includes(_0xc6823.system)) { - var _0x4b2f70 = _0x36b9cc.length % 0x400; - _0x4fa964 = new _0x863031(_0x4b2f70 ? _0x36b9cc.slice ? _0x36b9cc.slice(_0x4b2f70) : _0x36b9cc.subarray(_0x4b2f70) : _0x36b9cc); - } else _0x4fa964 = new _0x863031(_0x36b9cc); - var _0x21e040 = _0x5a641d.a.create(), - _0x2b8478 = new FileReader(), - _0x15068c = 0x0, - _0x1646ca = _0x4fa964._u8array.length, - _0x4c84da = function() { - if (_0x15068c < _0x1646ca) { - var _0xa88a13 = Math.min(_0x15068c + 0x200000, _0x1646ca); - _0x2b8478.readAsArrayBuffer(new Blob([_0x4fa964._u8array.slice(_0x15068c, _0xa88a13)])), _0x15068c = _0xa88a13; - } else console.log(_0x21e040.hex()), _0xc6823.hash = _0x21e040.hex(), 'function' == typeof window.ejsromshash && window.ejsromshash(_0xc6823.hash); - }; - _0x2b8478.onload = function(_0x26a751) { - try { - _0x21e040.update(_0x26a751.target.result), _0x4c84da(); - } catch (_0x5c9e53) { - console.log(_0x5c9e53); - } - }, _0x4c84da(); - } - }) - if (typeof _0xc6823.adUrl === 'string') { - _0x1093f4.call(_0xc6823, _0x4d7024.loading.querySelector('.' .concat(_0x4fce24['close-ad'])), 'click', function(_0x96b13f) { - _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(); - }); - } - var _0x16cf3e = function() { - _0x4e171c.db && _0x4e171c.getAll(function(_0x1a4eaf) { - Array.isArray(_0x1a4eaf) && _0x1a4eaf.length > 0xa && _0x1a4eaf.sort(function(_0x155e15, _0x4a9e7f) { - return (_0x4a9e7f.lastaccess ? _0x4a9e7f.lastaccess : 0x0) - (_0x155e15.lastaccess ? _0x155e15.lastaccess : 0x0); - }).forEach(function(_0x43d1af, _0x2db4e2) { - _0x2db4e2 > 0xa && !_0x4d7024.saveFilenames.includes(_0x43d1af.key) ? (_0x4e171c.remove(_0x43d1af.key), _0x1ffb98.db && _0x1ffb98.remove(_0x43d1af.key)) : (delete _0x43d1af.data, _0x4e171c.put(_0x43d1af.key, _0x43d1af)); - }); - }, function() { - _0x4e171c.clear(), _0x1ffb98.db && _0x1ffb98.clear(); - }); - }, - _0x5f3757 = function(_0x2bd107) { - if (_0x4d7024.gamePatch) { - var _0x17edbf = _0x2bd107.startName.split('/'), - _0x2c1832 = _0x17edbf.pop().split('.').pop(), - _0x11dc72 = (_0x4d7024.gamePatch.split('.').pop(), _0x4d7024.gamePatch.split('/').pop().split('.').shift()), - _0x453ec0 = '' .concat(_0x17edbf.join('/'), '/').concat(_0x11dc72, '.').concat(_0x2c1832); - _0x453ec0 = _0x453ec0.replace(/\#/g, ''); - var _0x5438db = _0x4d7024.gamePatch; - if (_0x4d7024.FS.rename(_0x2bd107.startName, _0x453ec0), _0x2bd107.startName = _0x453ec0, 'snes' === _0x2bd107.system || ['snes2002', 'snes2005', 'snes2010'].includes(_0x2bd107.system)) { - var _0x4758bc, _0x4b4000, _0x4aa31e, _0x2d9175 = new _0x863031(_0x4d7024.FS.readFile(_0x2bd107.startName)), - _0x567355 = _0x2d78e9(_0x2d9175), - _0x3d2ad0 = new _0x863031(_0x4d7024.FS.readFile(_0x5438db)), - _0x4a229b = _0x3d2ad0.readString(0x6), - _0x20786d = _0x2d9175._u8array.length % 0x400; - _0x4a229b.startsWith('PATCH') ? (_0x4758bc = _0x288092(_0x3d2ad0), 0x0 === _0x20786d && 'B19ED489' === _0x567355.toString(0x10).toUpperCase() && ((_0x4b4000 = new Uint8Array(_0x2d9175._u8array.length + 0x200)).set(new Uint8Array(0x200), 0x0), _0x4b4000.set(_0x2d9175._u8array, 0x200), _0x2d9175 = new _0x863031(_0x4b4000))) : _0x4a229b.startsWith(_0x7a6485) ? _0x4758bc = _0xd2202f(_0x3d2ad0) : _0x4a229b.startsWith('BPS1') && (_0x4758bc = _0x356089(_0x3d2ad0), _0x20786d > 0x0 && 'A31BEAD4' === _0x567355.toString(0x10).toUpperCase() && (_0x4b4000 = _0x2d9175._u8array.slice ? _0x2d9175._u8array.slice(_0x20786d) : _0x2d9175._u8array.subarray(_0x20786d), _0x2d9175 = new _0x863031(_0x4b4000))); - try { - if (_0x4aa31e = _0x4758bc.apply(_0x2d9175, !0x1)) { - var _0x1ffde3 = _0x4aa31e._u8array.length % 0x400; - _0x1ffde3 > 0x0 && (_0x4b4000 = _0x4aa31e._u8array.slice ? _0x4aa31e._u8array.slice(_0x1ffde3) : _0x4aa31e._u8array.subarray(_0x1ffde3), _0x4aa31e = new _0x863031(_0x4b4000)), _0x4d7024.FS.unlink(_0x5438db), _0x4d7024.FS.unlink(_0x2bd107.startName), _0x4d7024.FS.writeFile(_0x2bd107.startName, _0x4aa31e._u8array); - } - } catch (_0x2ef20f) {} - } else { - var _0x4108d8, _0x5e086b, _0x454a20 = new _0x863031(_0x4d7024.FS.readFile(_0x2bd107.startName)), - _0x4991ea = new _0x863031(_0x4d7024.FS.readFile(_0x5438db)), - _0x130f1f = _0x4991ea.readString(0x6); - _0x130f1f.startsWith('PATCH') ? _0x4108d8 = _0x288092(_0x4991ea) : _0x130f1f.startsWith(_0x7a6485) ? _0x4108d8 = _0xd2202f(_0x4991ea) : _0x130f1f.startsWith('BPS1') && (_0x4108d8 = _0x356089(_0x4991ea)); - try { - (_0x5e086b = _0x4108d8.apply(_0x454a20, !0x1)) && (_0x4d7024.FS.unlink(_0x5438db), _0x4d7024.FS.unlink(_0x2bd107.startName), _0x4d7024.FS.writeFile(_0x2bd107.startName, _0x5e086b._u8array)); - } catch (_0x3ed519) {} - } - } - }, - _0x4bd781 = function() { - _0x31a5b3 ? (window.Module.TOTAL_MEMORY = 0x10000000, ['jaguar'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = 0x10000000), ['nds', 'nes', 'snes', 'arcade', 'mame'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = 0x0), ['snes2002', 'snes2005', 'snes2010'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = 0x0), 'gba' == _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x0), '3do' == _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x0), 'n64' == _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x0)) : ('nes' === _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x8000000), window.Module.TOTAL_MEMORY = _0x468801 + 0x4000000, ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = _0x468801 + 0x10000000, _0x4d7024.isMobileDevice && (window.Module.TOTAL_MEMORY = 0x12c00000)), ['n64', 'nds', 'jaguar'].includes(_0xa88a13.system) && (window.Module.TOTAL_MEMORY = _0x468801 + 0x10000000, _0x4d7024.isMobileDevice && (window.Module.TOTAL_MEMORY = 0x12c00000)), 'gba' == _0xa88a13.system && (window.Module.TOTAL_MEMORY = 0x10000000)), 'undefined' != typeof EJS_MEMORY && (window.Module.TOTAL_MEMORY = EJS_MEMORY); - }, - _0x3512e9 = function(_0x1bc287, _0x1844e3) { - var _0x55627a = _0xa88a13, - _0x1cfda7 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), - _0x429d6b = (_0x1bc287.split('.').pop(), _0x29078e[_0x1143c5]), - _0xb0c5d8 = -0x1, - _0x567713 = '', - _0x567717 = function() { - if (typeof _0x55627a.loadStateOnStart == 'string') { - fetch(_0x55627a.loadStateOnStart).then(function(response) { - response.arrayBuffer().then(function(ab) { - var a = new Uint8Array(ab) - EJS_loadState(a) - }) - }) - } - }, - _0x99321 = function(_0x52e6f3) { - if (_0x52e6f3.data) { - if (0x1 === _0x52e6f3.data.t) { - _0x1cfda7.innerHTML = 'Game Data ready', _0x52e6f3.target.terminate(); - try { - _0x4bd781(), _0x5f3757(_0x55627a), _0x16cf3e(); - var _0x17edbf = 'callMain'; - !_0x55627a.startName && _0x567713 && (_0x55627a.startName = _0x567713); - var _0x2c1832 = [_0x55627a.startName, - [_0x4d7024.hash, _0x4d7024.hash2, _0x4d7024.hash3].join('') - ]; - 'undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX && _0x2c1832.unshift('-v'), _0x4d7024.Module[_0x17edbf](_0x2c1832), _0xbae705.call(_0x55627a, _0x55627a.elements.container, 'start-game'); - _0x567717(); - } catch (_0x4a1471) { - console.log(_0x4a1471), _0x1cfda7.innerHTML = 'Failed to start game'; - } - } - if (0x2 === _0x52e6f3.data.t) { - var _0x25aae3 = _0x52e6f3.data.file.split('/'), - _0x1bc287 = _0x25aae3.pop(), - _0x1844e3 = _0x1bc287.split('.').pop(); - _0x1bc287 = _0x1bc287.replace(/\#/g, ''), _0x4d7024.FS.createPath('/', _0x25aae3.join('/'), true, true); - for (var _0x36bace = _0x1e0766[_0x429d6b].length - 0x1; _0x36bace >= 0x0; _0x36bace -= 0x1) _0x1e0766[_0x429d6b][_0x36bace] === _0x1844e3.toLowerCase() && _0x36bace > _0xb0c5d8 && (_0xb0c5d8 = _0x36bace, _0x55627a.startName = ['', _0x25aae3.join('/'), _0x1bc287].join('/'), _0x55627a.startName = _0x55627a.startName.replace(/\/+/, '/')); - _0x1bc287 && (_0x4d7024.FS.createDataFile('/' .concat(_0x25aae3.join('/')), _0x1bc287, _0x52e6f3.data.data, true, !0x1), _0x468801 += _0x52e6f3.data.data.length), _0x567713 = '/' .concat(_0x25aae3.join('/'), '/').concat(_0x1bc287); - } - if (0x4 === _0x52e6f3.data.t && _0x52e6f3.data.total > 0x0) { - var _0x163fc4 = Math.floor(_0x52e6f3.data.current / _0x52e6f3.data.total * 0x64), - _0x5448a3 = _0x52e6f3.data.name || ''; - _0x163fc4 <= 0x64 && _0x163fc4 > 0x0 && (_0x1cfda7.innerHTML = 'Decompress Game Data ' .concat(_0x5448a3, ' ').concat(_0x163fc4, '%')); - } - } - }, - _0x1e67c4 = !0x1; - if (!['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x55627a.system)) { - var _0x20a78c = _0x1844e3.slice ? _0x1844e3.slice(0x0, 0xa) : _0x1844e3.subarray(0x0, 0xa), - _0x1761cf = _0x394c59(_0x20a78c); - '7z' === _0x1761cf ? (_0xa24f60(_0x17edbf).then(function(_0xea623e) { - _0xea623e.onmessage = _0x99321, _0xea623e.postMessage(_0x1844e3); - }), _0x1e67c4 = true) : 'zip' === _0x1761cf ? (_0xa24f60(_0x2c1832).then(function(_0x5a81e4) { - _0x5a81e4.onmessage = _0x99321, _0x5a81e4.postMessage(_0x1844e3); - }), _0x1e67c4 = true) : 'rar' == _0x1761cf && (_0x41d0bd(_0x4ce206, 'rar').then(function(_0x5f204f) { - _0x5f204f.onmessage = _0x99321, _0x5f204f.postMessage(_0x1844e3); - }), _0x1e67c4 = true); - } - if (!_0x1e67c4) { - var _0x1c661d = _0x1bc287.replace(/\#/g, ''); - try { - _0x468801 += _0x1844e3.length, _0x4d7024.FS.createDataFile('/', _0x1c661d, _0x1844e3, true, !0x1); - } catch (_0x210043) { - console.log(_0x210043); - } - _0x4bd781(), _0x55627a.startName = _0x1c661d, _0x5f3757(_0x55627a), _0x16cf3e(); - try { - var _0x165f73 = 'callMain', - _0x4dd87f = [_0x55627a.startName, - [_0x4d7024.hash, _0x4d7024.hash2, _0x4d7024.hash3].join('') - ]; - 'undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX && _0x4dd87f.unshift('-v'), _0x4d7024.Module[_0x165f73](_0x4dd87f), _0xbae705.call(_0x55627a, _0x55627a.elements.container, 'start-game'); - _0x567717(); - } catch (_0x42970c) { - console.log(_0x42970c), _0x1cfda7.innerHTML = 'Failed to start game'; - } - } - }, - _0x5048db = function() { - var _0x17edbf = _0xa88a13, - _0x2c1832 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), - _0x50eb85 = _0xa88a13.config, - _0x3cf3cf = (_0x50eb85.gameId, _0x50eb85.gameUrl), - _0x594488 = _0x50eb85.system; - 'vbanext' == _0x594488 && (_0x594488 = 'gba'); - var _0x154dc5 = _0x3cf3cf.split('/'), - _0x139f1c = _0x154dc5[_0x154dc5.length - 0x1]; - _0x139f1c.indexOf('?') > -0x1 && (_0x139f1c = _0x139f1c.substr(0x0, _0x139f1c.indexOf('?'))); - _0x139f1c.split('.').pop(); - _0x2c1832.innerHTML = 'Download Game Data', ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x17edbf.system) && _0x17edbf.config.gameParentUrl && (_0x2c1832.innerHTML += ' (2/2)'), _0x17edbf.config.gamePatchUrl && (_0x2c1832.innerHTML += ' (2/2)'); - new Promise(async function(resolve, reject) { - if (! _0x3cf3cf.startsWith('blob:')) { - resolve(await _0x550f17.a.head(_0x3cf3cf, {})) - } else { - var a = await fetch(_0x3cf3cf) - var a = await a.blob() - resolve({headers:{'content-length': a.size, 'content-type': 'text/plain'}}) - } - }).then(function(_0x3d703e) { - var _0x21b526 = _0x3d703e.headers['content-length'], - _0x7e8d4c = _0x3d703e.headers['content-type'], - _0x107e8a = (_0x3d703e.headers['last-modified'], '' .concat(_0x594488, '-').concat(_0x139f1c)), - _0x43a689 = function() { - _0x550f17.a.get(_0x3cf3cf, { - 'onDownloadProgress': function(_0x4e7133) { - var _0x13b999 = _0x4e7133.total ? '' .concat(Math.floor(_0x4e7133.loaded / _0x4e7133.total * 0x64), '%') : ''; - ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x17edbf.system) && _0x17edbf.config.gameParentUrl ? _0x2c1832.innerHTML = 'Download Game Data (2/2) ' .concat(_0x13b999) : _0x17edbf.config.gamePatchUrl ? _0x2c1832.innerHTML = 'Download Game Data (2/2) ' .concat(_0x13b999) : _0x2c1832.innerHTML = 'Download Game Data ' .concat(_0x13b999); - }, - 'responseType': 'arraybuffer' - }).then(function(_0x22a1f4) { - var _0x17edbf = new Uint8Array(_0x22a1f4.data); - if (_0xa88a13.config.gameUrl.startsWith('blob:') || _0xa88a13.config.gameUrl.startsWith('file:') || _0xa88a13.config.gameUrl.startsWith('chrome-extension:') || ((window.location.protocol == 'file:' || window.location.protocol == 'chrome-extension:') && _0xa88a13.config.gameUrl.startsWith('/') && _0xa88a13.config.gameUrl.split(':').length == 1)) {_0x3512e9(_0x139f1c, _0x17edbf);return;}; - if (_0x107e8a && _0x4e171c.db) - if (_0x17edbf.length > 0x6400000) - for (var _0x2c1832 = Math.ceil(_0x17edbf.length / 0x6400000), _0x257c4d = 0x0; _0x257c4d < _0x2c1832; _0x257c4d += 0x1) { - var _0x47d2ae = _0x17edbf.slice ? _0x17edbf.slice(0x6400000 * _0x257c4d, 0x6400000 * (_0x257c4d + 0x1)) : _0x17edbf.subarray(0x6400000 * _0x257c4d, 0x6400000 * (_0x257c4d + 0x1)), - _0x6ce9f3 = '' .concat(_0x107e8a); - _0x257c4d > 0x0 && (_0x6ce9f3 = '' .concat(_0x107e8a, '-part-').concat(_0x257c4d)), _0x4d7024.saveFilenames.push(_0x6ce9f3), _0x4e171c.put(_0x6ce9f3, { - 'filename': _0x139f1c, - 'filesize': _0x17edbf.length, - 'filetype': _0x7e8d4c, - 'key': _0x6ce9f3, - 'lastaccess': new Date().valueOf(), - 'next': '' .concat(_0x107e8a, '-part-').concat(_0x257c4d + 0x1) - }), _0x1ffb98.db && _0x1ffb98.put(_0x6ce9f3, { - 'filename': _0x139f1c, - 'filesize': _0x17edbf.length, - 'filetype': _0x7e8d4c, - 'key': _0x6ce9f3, - 'data': _0x47d2ae - }); - } else _0x4d7024.saveFilenames.push(_0x107e8a), _0x4e171c.put(_0x107e8a, { - 'filename': _0x139f1c, - 'filesize': _0x17edbf.length, - 'filetype': _0x7e8d4c, - 'key': _0x107e8a, - 'lastaccess': new Date().valueOf() - }), _0x1ffb98.db && _0x1ffb98.put(_0x107e8a, { - 'filename': _0x139f1c, - 'filesize': _0x17edbf.length, - 'filetype': _0x7e8d4c, - 'key': _0x107e8a, - 'data': _0x17edbf - }); - _0x3512e9(_0x139f1c, _0x17edbf); - }).catch(function(_0x2e4d62) { - console.log(_0x2e4d62), _0x2c1832.innerHTML = 'Network Error'; - }); - }; - _0x1ffb98.db ? _0x1ffb98.get(_0x107e8a, function(_0x5afc4a) { - if (_0x5afc4a && _0x5afc4a.filename === _0x139f1c && _0x5afc4a.filesize - _0x21b526 == 0x0 && _0x5afc4a.filetype === _0x7e8d4c && _0x5afc4a.key) - if (_0x4e171c.get(_0x107e8a, function(_0x2585bd) { - _0x2585bd.lastaccess = new Date().valueOf(), _0x4e171c.put(_0x2585bd.key, _0x2585bd); - }), _0x5afc4a.filesize > 0x6400000) { - var _0x17edbf = new Uint8Array(_0x5afc4a.filesize); - _0x17edbf.set(_0x5afc4a.data); - for (var _0x2c1832 = Math.ceil(_0x5afc4a.filesize / 0x6400000), _0x36180f = [], _0x3c1e3a = 0x1; _0x3c1e3a < _0x2c1832; _0x3c1e3a += 0x1) _0x36180f.push('' .concat(_0x107e8a, '-part-').concat(_0x3c1e3a)), _0x4e171c.get('' .concat(_0x107e8a, '-part-').concat(_0x3c1e3a), function(_0x4f1393) { - _0x4f1393.lastaccess = new Date().valueOf(), _0x4e171c.put(_0x4f1393.key, _0x4f1393); - }); - _0x1ffb98.getBatch(_0x36180f, function(_0x47ffae) { - _0x47ffae.filter(function(_0x3d76ae) { - return _0x3d76ae; - }).length !== _0x36180f.length ? _0x43a689() : (_0x47ffae.forEach(function(_0x15960c, _0x92d423) { - _0x17edbf.set(_0x15960c.data, 0x6400000 * (_0x92d423 + 0x1)); - }), _0x3512e9(_0x5afc4a.filename, _0x17edbf)); - }, function() {}, 'sparse'); - } else _0x3512e9(_0x5afc4a.filename, _0x5afc4a.data); - else _0x43a689(); - }) : _0x43a689(); - }).catch(function(_0x5ec6be) { - _0x2c1832.innerHTML = 'Network Error'; - }); - }, - _0x139f68 = function() { - var _0x2591d9 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), - _0x5c896f = _0xa88a13.config.gamePatchUrl; - if (_0x5c896f) { - var _0x227b23 = _0x5c896f.split('/'), - _0x179b43 = _0x227b23[_0x227b23.length - 0x1]; - _0x179b43.indexOf('?') > -0x1 && (_0x179b43 = _0x179b43.substr(0x0, _0x179b43.indexOf('?'))); - _0x179b43.split('.').pop(); - _0x2591d9.innerHTML = 'Download Game Data (1/2)', _0x550f17.a.get(_0x5c896f, { - 'onDownloadProgress': function(_0x3da9ab) { - _0x2591d9.innerHTML = 'Download Game Data (1/2) '; - var _0x17edbf = _0x3da9ab.total ? '' .concat(Math.floor(_0x3da9ab.loaded / _0x3da9ab.total * 0x64), '%') : ''; - _0x2591d9.innerHTML += _0x17edbf; - }, - 'responseType': 'arraybuffer' - }).then(function(_0x159ae9) { - var _0x39a81f = new Uint8Array(_0x159ae9.data); - ! function(_0xe531f0, _0x1097ca) { - var _0xf6806b = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), - _0x59c7c1 = (_0xe531f0.split('.').pop(), function(_0x36004e) { - if (_0x36004e.data) { - if (0x1 === _0x36004e.data.t && (_0x36004e.target.terminate(), _0x5048db()), 0x2 === _0x36004e.data.t) { - var _0x17edbf = _0x36004e.data.file.split('/'), - _0x2c1832 = _0x17edbf.pop(), - _0x2b320e = _0x2c1832.split('.').pop(); - _0x4d7024.FS.createPath('/', _0x17edbf.join('/'), true, true), _0x4d7024.FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x36004e.data.data, true, !0x1), _0x468801 += _0x36004e.data.data.length, ['ips', 'bps', 'ups'].includes(_0x2b320e) && !_0x4d7024.gamePatch && (_0x4d7024.gamePatch = '/' + _0x17edbf.join('/') + '/' + _0x2c1832); - } - if (0x4 === _0x36004e.data.t && _0x36004e.data.total > 0x0) { - var _0x1097ca = Math.floor(_0x36004e.data.current / _0x36004e.data.total * 0x64), - _0x95ac83 = _0x36004e.data.name || ''; - _0x1097ca <= 0x64 && _0x1097ca > 0x0 && (_0xf6806b.innerHTML = 'Decompress Game Patch ' .concat(_0x95ac83, ' ').concat(_0x1097ca, '%')); - } - } - }), - _0x4c332a = !0x1, - _0x3de3e4 = _0x1097ca.slice ? _0x1097ca.slice(0x0, 0xa) : _0x1097ca.subarray(0x0, 0xa), - _0x17f736 = _0x394c59(_0x3de3e4); - '7z' === _0x17f736 ? (_0xa24f60(_0x17edbf).then(function(_0x20601d) { - _0x20601d.onmessage = _0x59c7c1, _0x20601d.postMessage(_0x1097ca); - }), _0x4c332a = true) : 'zip' === _0x17f736 ? (_0xa24f60(_0x2c1832).then(function(_0x46622d) { - _0x46622d.onmessage = _0x59c7c1, _0x46622d.postMessage(_0x1097ca); - }), _0x4c332a = true) : 'rar' == _0x17f736 && (_0x41d0bd(_0x4ce206, 'rar').then(function(_0x2ecd24) { - _0x2ecd24.onmessage = messageCallBack, _0x2ecd24.postMessage(_0x1097ca); - }), _0x4c332a = true), _0x4c332a || (_0x468801 += _0x1097ca.length, _0x4d7024.gamePatch = '/' .concat(_0xe531f0), _0x4d7024.FS.createDataFile('/', _0xe531f0, _0x1097ca, true, !0x1), _0x5048db()); - }(_0x179b43, _0x39a81f); - }).catch(function(_0x314293) { - console.log(_0x314293), _0x2591d9.innerHTML = 'Network Error'; - }); - } else _0x5048db(); - }, - _0x452592 = function() { - var _0x17edbf = _0xa88a13, - _0x2c1832 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)), - _0x5a21f7 = _0xa88a13.config.gameParentUrl; - if (_0x5a21f7 && ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x17edbf.system)) { - var _0x71bb4d = _0x5a21f7.split('/'), - _0xa1889f = _0x71bb4d[_0x71bb4d.length - 0x1]; - _0xa1889f.indexOf('?') > -0x1 && (_0xa1889f = _0xa1889f.substr(0x0, _0xa1889f.indexOf('?'))); - _0xa1889f.split('.').pop(); - _0x2c1832.innerHTML = 'Download Game Data (1/2)', _0x17edbf.config.gamePatchUrl && (_0x2c1832.innerHTML = 'Download Game Data (1/3)'), _0x550f17.a.head(_0x5a21f7, {}).then(function(_0x35c23a) { - var _0x17edbf = _0x35c23a.headers['content-length'], - _0x500ba1 = _0x35c23a.headers['content-type'], - _0x316472 = (_0x35c23a.headers['last-modified'], '' .concat(_0x1143c5, '-').concat(_0xa1889f)), - _0x31f098 = function() { - _0x550f17.a.get(_0x5a21f7, { - 'onDownloadProgress': function(_0x5e449f) { - var _0x17edbf = _0x5e449f.total ? '' .concat(Math.floor(_0x5e449f.loaded / _0x5e449f.total * 0x64), '%') : ''; - _0x2c1832.innerHTML = 'Download Game Data (1/2) ' .concat(_0x17edbf); - }, - 'responseType': 'arraybuffer' - }).then(function(_0x191007) { - var _0x17edbf = new Uint8Array(_0x191007.data); - if (_0x316472 && _0x4e171c.db) - if (_0x17edbf.length > 0x6400000) - for (var _0x2c1832 = Math.ceil(_0x17edbf.length / 0x6400000), _0x3f44d7 = 0x0; _0x3f44d7 < _0x2c1832; _0x3f44d7 += 0x1) { - var _0x15a529 = _0x17edbf.slice ? _0x17edbf.slice(0x6400000 * _0x3f44d7, 0x6400000 * (_0x3f44d7 + 0x1)) : _0x17edbf.subarray(0x6400000 * _0x3f44d7, 0x6400000 * (_0x3f44d7 + 0x1)), - _0x4a61f1 = '' .concat(_0x316472); - _0x3f44d7 > 0x0 && (_0x4a61f1 = '' .concat(_0x316472, '-part-').concat(_0x3f44d7)), _0x4d7024.saveFilenames.push(_0x4a61f1), _0x4e171c.put(_0x4a61f1, { - 'filename': _0xa1889f, - 'filesize': _0x17edbf.length, - 'filetype': _0x500ba1, - 'key': _0x4a61f1, - 'lastaccess': new Date().valueOf(), - 'next': '' .concat(_0x316472, '-part-').concat(_0x3f44d7 + 0x1) - }), _0x1ffb98.db && _0x1ffb98.put(_0x4a61f1, { - 'filename': _0xa1889f, - 'filesize': _0x17edbf.length, - 'filetype': _0x500ba1, - 'key': _0x4a61f1, - 'data': _0x15a529 - }); - } else _0x4d7024.saveFilenames.push(_0x316472), _0x4e171c.put(_0x316472, { - 'filename': _0xa1889f, - 'filesize': _0x17edbf.length, - 'filetype': _0x500ba1, - 'key': _0x316472, - 'lastaccess': new Date().valueOf() - }), _0x1ffb98.db && _0x1ffb98.put(_0x316472, { - 'filename': _0xa1889f, - 'filesize': _0x17edbf.length, - 'filetype': _0x500ba1, - 'key': _0x316472, - 'data': _0x17edbf - }); - var _0x54d79 = _0xa1889f.replace(/\#/g, ''); - try { - _0x468801 += _0x17edbf.length, _0x4d7024.FS.createDataFile('/', _0x54d79, _0x17edbf, true, !0x1), _0x139f68(); - } catch (_0x125736) { - console.log(_0x125736); - } - }).catch(function(_0x516cc3) { - console.log(_0x516cc3), _0x2c1832.innerHTML = 'Network Error'; - }); - }; - _0x1ffb98.db ? _0x1ffb98.get(_0x316472, function(_0x3e612b) { - if (_0x3e612b && _0x3e612b.filename === _0xa1889f && _0x3e612b.filesize - _0x17edbf == 0x0 && _0x3e612b.filetype === _0x500ba1 && _0x3e612b.key) - if (_0x3e612b.filesize > 0x6400000) { - var _0x2c1832 = new Uint8Array(_0x3e612b.filesize); - _0x2c1832.set(_0x3e612b.data); - for (var _0xa2197 = Math.ceil(_0x3e612b.filesize / 0x6400000), _0x6f30ae = [], _0x32aa3c = 0x1; _0x32aa3c < _0xa2197; _0x32aa3c += 0x1) _0x6f30ae.push('' .concat(_0x316472, '-part-').concat(_0x32aa3c)); - _0x1ffb98.getBatch(_0x6f30ae, function(_0x198a02) { - _0x198a02.filter(function(_0x1c8a88) { - return _0x1c8a88; - }).length !== _0x6f30ae ? _0x31f098() : (_0x198a02.forEach(function(_0x22b824, _0x16eecf) { - _0x2c1832.set(_0x22b824.data, 0x6400000 * (_0x16eecf + 0x1)); - }), _0x4d7024.FS.createDataFile('/', _0x3e612b.filename, _0x2c1832, true, !0x1), _0x139f68()); - }, function() {}, 'sparse'); - } else _0x4d7024.FS.createDataFile('/', _0x3e612b.filename, _0x3e612b.data, true, !0x1), _0x139f68(); - else _0x31f098(); - }) : _0x31f098(); - }).catch(function(_0x20f2e3) { - _0x2c1832.innerHTML = 'Network Error'; - }); - } else _0x139f68(); - }, - _0x57d85d = function(_0x5e7c8b, _0x3cff36) { - var _0x3ea97 = _0xa88a13, - _0x50119 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p2)), - _0x19a43e = (_0x5e7c8b.split('.').pop(), function(_0x1e8643) { - if (_0x1e8643.data) { - if (0x1 === _0x1e8643.data.t && (_0x50119.innerHTML = 'BIOS ready', _0x1e8643.target.terminate(), _0x452592()), 0x2 === _0x1e8643.data.t) { - var _0x17edbf = _0x1e8643.data.file.split('/'), - _0x2c1832 = _0x17edbf.pop(); - _0x2c1832.split('.').pop(); - _0x4d7024.FS.createPath('/', _0x17edbf.join('/'), true, true), _0x4d7024.FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x1e8643.data.data, true, !0x1), _0x468801 += _0x1e8643.data.data.length; - } - if (0x4 === _0x1e8643.data.t && _0x1e8643.data.total > 0x0) { - var _0x149f09 = Math.floor(_0x1e8643.data.current / _0x1e8643.data.total * 0x64), - _0x5e7c8b = _0x1e8643.data.name || ''; - _0x149f09 <= 0x64 && _0x149f09 > 0x0 && (_0x50119.innerHTML = 'Decompress BIOS ' .concat(_0x5e7c8b, ' ').concat(_0x149f09, '%')); - } - } - }), - _0x3a6560 = !0x1, - _0x12e229 = _0x3cff36.slice ? _0x3cff36.slice(0x0, 0xa) : _0x3cff36.subarray(0x0, 0xa), - _0x80852b = _0x394c59(_0x12e229); - '7z' === _0x80852b ? (_0xa24f60(_0x17edbf).then(function(_0x1b6a80) { - _0x1b6a80.onmessage = _0x19a43e, _0x1b6a80.postMessage(_0x3cff36); - }), _0x3a6560 = true) : 'zip' !== _0x80852b || ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x3ea97.system) ? 'rar' === _0x80852b && (_0x41d0bd(_0x4ce206, 'rar').then(function(_0x259be0) { - _0x259be0.onmessage = messageCallBack, _0x259be0.postMessage(_0x3cff36); - }), _0x3a6560 = true) : (_0xa24f60(_0x2c1832).then(function(_0x31c70d) { - _0x31c70d.onmessage = _0x19a43e, _0x31c70d.postMessage(_0x3cff36); - }), _0x3a6560 = true), _0x3a6560 || (_0x468801 += _0x3cff36.length, _0x50119.innerHTML = 'BIOS ready', _0x4d7024.FS.createDataFile('/', _0x5e7c8b, _0x3cff36, true, !0x1), _0x452592()); - }, - _0x10b71a = function() { - _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)).innerHTML = 'Game Core ready'; - var _0x17edbf = _0xa88a13.config.biosUrl, - _0x2c1832 = _0xa88a13; - _0xdcec2a.bindFunction.call(_0xa88a13), _0xdcec2a.setGamepadDialog.call(_0xa88a13), _0xdcec2a.setCacheDialog.call(_0xa88a13), _0xdcec2a.setLoadingDialog.call(_0xa88a13), _0xdcec2a.setNetplayDialog.call(_0xa88a13), _0xdcec2a.setCheatDialog.call(_0xa88a13), _0xdcec2a.initGamepad.call(_0xa88a13), _0xdcec2a.initKeyboard.call(_0xa88a13), _0xdcec2a.listeners.call(_0xa88a13), _0x4d7024.FS.createFolder('/', 'etc', true, true), _0x4d7024.FS.mkdir('/data'), _0x4d7024.FS.mkdir('/data/saves'), 'undefined' != typeof IDBFS ? _0x4d7024.FS.mount(IDBFS, {}, '/data/saves') : _0x4d7024.FS.mount(_0x4d7024.FS.filesystems.IDBFS, {}, '/data/saves'), _0x4d7024.FS.mkdir('/shader'), _0x4d7024.FS.syncfs(true, function(_0x1a8f12) {}), _0xdcec2a.initShaders(); - var _0x14d39f = ''; - _0x14d39f += 'savefile_directory = /data/saves\n', _0x14d39f += 'video_vsync = true\n', _0x14d39f += 'screenshot_directory = /\n', _0x14d39f += 'video_shader = /shader/shader.glslp\n', _0x14d39f += 'video_shader_enable = true\n', _0x14d39f += 'video_font_enable = false\n', _0x14d39f += 'video_scale = 1.0\n', _0x14d39f += 'video_gpu_screenshot = false\n', _0x14d39f += 'audio_latency = 96\n'; - var _0x36edb7 = _0x2593da.defaultCoreOptionsValues.call(_0xa88a13); - _0x2c1832.lightgun && ('nes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p2 = "258"\n'), 'segaMS' !== _0xa88a13.system && 'segaMD' !== _0xa88a13.system && 'segaCD' !== _0xa88a13.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' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p2 = "260"\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(_0xa88a13.system) && (_0x14d39f += 'input_libretro_device_p2 = "260"\n')), _0x2c1832.mouse && ('snes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p1 = 2\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(_0xa88a13.system) && (_0x14d39f += 'input_libretro_device_p1 = 2\n')), _0x2c1832.multitap && ('snes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p2 = 257\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(_0xa88a13.system) && (_0x14d39f += 'input_libretro_device_p2 = 257\n')), 'n64' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p1 = 5\n'), _0x2c1832.system, _0x14d39f += 'fastforward_ratio = 1.0\n', _0x14d39f += 'video_smooth = false\n'; - var _0x55117c = _0x5dc0c0(_0x36edb7, _0x2593da.storage.get('core-options') || {}), - _0x32dd27 = ''; - if (_0x55117c && Object.keys(_0x55117c).forEach(function(_0x2950d3) { - if (_0x2c1832.lightgun && 'nes' === _0x2c1832.system && 'system_type' === _0x2950d3) return !0x1; - _0x32dd27 += '' .concat(_0x2950d3, ' = "').concat(_0x55117c[_0x2950d3], '"\n'), _0x1093f4.call(_0x2c1832, _0x2c1832.elements.container, 'start-game', function(_0x362c5c) { - _0xdcec2a.setVariable(_0x2950d3, _0x55117c[_0x2950d3]); - }); - }), _0x4d7024.FS.createDataFile('/etc', 'retroarch.cfg', _0x14d39f, true, true), _0x4d7024.FS.createFolder('/home/web_user', '.config', true, true), _0x4d7024.FS.createFolder('/home/web_user/.config', 'retroarch', true, true), _0x4d7024.FS.createDataFile('/home/web_user/.config/retroarch', 'retroarch-core-options.cfg', _0x32dd27, true, true), _0x17edbf) { - var _0x12e137 = _0x17edbf.split('/'), - _0x103241 = _0x12e137[_0x12e137.length - 0x1]; - _0x103241.indexOf('?') > -0x1 && (_0x103241 = _0x103241.substr(0x0, _0x103241.indexOf('?'))); - _0x103241.split('.').pop(); - var _0x1f8424 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p2)); - _0x550f17.a.head(_0x17edbf, {}).then(function(_0x4bd3bd) { - var _0x8e30bf = _0x4bd3bd.headers['content-length'], - _0x14309b = _0x4bd3bd.headers['content-type'], - _0x51bfef = (_0x4bd3bd.headers['last-modified'], _0x2c1832.system), - _0x574747 = function() { - _0x550f17.a.get(_0x17edbf, { - 'onDownloadProgress': function(_0x107517) { - var _0x17edbf = _0x107517.total ? '' .concat(Math.floor(_0x107517.loaded / _0x107517.total * 0x64), '%') : ''; - _0x1f8424.innerHTML = 'Download BIOS ' .concat(_0x17edbf); - }, - 'responseType': 'arraybuffer' - }).then(function(_0x4b0c1d) { - var _0x17edbf = new Uint8Array(_0x4b0c1d.data); - _0xa884ea.db && _0xa884ea.put(_0x1143c5, { - 'filename': _0x103241, - 'filesize': _0x17edbf.length, - 'filetype': _0x14309b, - 'data': _0x17edbf - }), _0x57d85d(_0x103241, _0x17edbf); - }).catch(function(_0x58e374) { - _0x1f8424.innerHTML = 'Network Error'; - }); - }; - _0xa884ea.db ? _0xa884ea.get(_0x51bfef, function(_0x5cac21) { - _0x5cac21 && _0x5cac21.filename === _0x103241 && _0x5cac21.filesize - _0x8e30bf == 0x0 && _0x5cac21.filetype === _0x14309b ? _0x57d85d(_0x5cac21.filename, _0x5cac21.data) : _0x574747(); - }) : _0x574747(); - }).catch(function(_0x4f39c1) { - _0x1f8424.innerHTML = 'Network Error'; - }); - } else _0x452592(); - }, - _0x29b999 = function(_0x172278) { - var _0x17edbf; - _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); - }, - _0x4f0fcc = function(_0x18cb26) { - var _0x2c1832 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)), - _0x247459 = '', - _0x54d695 = function() { - null !== _0x4d7024.wasmData ? (window.Module.wasmBinary = _0x4d7024.wasmData, _0x4bd781(), window.Module.monitorRunDependencies = function(_0x59580a) { - 0x0 === _0x59580a && _0x10b71a(); - }, window.Module.onRuntimeInitialized = function() {}) : (_0x4bd781(), window.Module.monitorRunDependencies = function(_0x55a24a) { - console.log('monitorRunDependencies, ', _0x55a24a); - }, window.Module.onRuntimeInitialized = function() { - _0x4d7024.Module || (_0x4d7024.Module = window.Module), _0x4d7024.Module && _0x4d7024.Module.FS ? _0x4d7024.FS = _0x4d7024.Module.FS : _0x4d7024.FS = window.FS, console.log('onRuntimeInitialized'), _0x10b71a(); - }); - var _0x18cb26 = window.Module; - if (null !== _0x4d7024.wasmData && (_0x18cb26.wasmBinary = _0x4d7024.wasmData), _0x59aa33.isIos && null !== _0x4d7024.wasmData) { - var _0x17edbf = new Blob([_0x247459], { - 'type': 'text/javascript' - }), - _0x2c1832 = _0x428003('script', { - 'src': _0x18a437.createObjectURL(_0x17edbf) - }); - document.body.appendChild(_0x2c1832), _0x2c1832.onload = function() { - void 0x0 === window.addRunDependency && 'undefined' != typeof EmulatorJS && (_0x4d7024.Module = EmulatorJS(_0x18cb26), EmulatorJS = void 0x0), null !== _0x4d7024.memData && _0x29b999(_0x4d7024.memData), _0x4d7024.Module || (_0x4d7024.Module = window.Module), _0x4d7024.Module && _0x4d7024.Module.FS ? _0x4d7024.FS = _0x4d7024.Module.FS : _0x4d7024.FS = window.FS; - }; - } else _0x247459 = function(_0x3df03e) { - for (var _0x17edbf = [], _0x2c1832 = 0x0; _0x2c1832 < _0x3df03e.length; _0x2c1832 += 0x1) { - var _0xcf0289 = _0x3df03e[_0x2c1832]; - _0xcf0289 > 0xff && (_0xcf0289 &= 0xff), _0x17edbf.push(String.fromCharCode(_0xcf0289)); - } - return _0x17edbf.join(''); - }(_0x247459), window.eval(_0x247459), void 0x0 === window.addRunDependency && 'undefined' != typeof EmulatorJS && (_0x4d7024.Module = EmulatorJS(_0x18cb26), EmulatorJS = void 0x0), null !== _0x4d7024.memData && _0x29b999(_0x4d7024.memData), _0x4d7024.Module || (_0x4d7024.Module = window.Module), _0x4d7024.Module && _0x4d7024.Module.FS ? _0x4d7024.FS = _0x4d7024.Module.FS : _0x4d7024.FS = window.FS, window.EJS_MODULE = _0x4d7024.Module, window.ejs_loader = _0x4d7024, window.ejs_media = _0xdcec2a; - _0x247459 = null; - }; - _0x1093f4.call(_0xc6823, _0xc6823.elements.container, 'script-loaded', function(_0x467eee) { - _0x54d695(); - }); - var _0x21d6a1 = function(_0x3f49ec) { - if (_0x3f49ec.data) { - if (0x1 === _0x3f49ec.data.t && (_0xbae705.call(_0xc6823, _0xc6823.elements.container, 'script-loaded'), _0x3f49ec.target.terminate()), 0x2 === _0x3f49ec.data.t) { - var _0x17edbf = _0x3f49ec.data.file.split('/').pop(), - _0x58b5a7 = _0x17edbf.split('.').pop(); - _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); - } - 0x4 === _0x3f49ec.data.t && _0x3f49ec.data.total > 0x0 && (_0x2c1832.innerHTML = 'Decompress Game Core ' .concat(Math.floor(_0x3f49ec.data.current / _0x3f49ec.data.total * 0x64), '%')); - } - }; - _0xa24f60(_0x17edbf).then(function(_0x48c633) { - _0x48c633.onmessage = _0x21d6a1, _0x48c633.postMessage(_0x18cb26); - }); - }, - _0x26d6a1 = function(_0x3787ba) { - return _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true), - function() { - var _0x3787ba = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)), - _0x2c1832 = _0xa88a13; - _0x3787ba.innerHTML = 'Loading...'; - var _0x1c9c57 = setInterval(function() { - if (true === _0x528f2b && true === _0x547484 && true === _0x5e24fa) { - window.Module = { - 'TOTAL_MEMORY': 0x10000000, - 'noInitialRun': true, - 'arguments': [], - 'preRun': [], - 'postRun': [], - 'canvas': _0xb2be2a, - 'print': function(_0x4a8983) { - if (window.EJS_DEBUG_XX === true) { - console.log(_0x4a8983); - } - }, - 'printErr': function(_0x367bee) { - if (window.EJS_DEBUG_XX === true) { - console.log(_0x367bee); - } - }, - 'totalDependencies': 0x0, - 'monitorRunDependencies': function(_0x5d4b07) {}, - 'locateFile': function(_0x3fe7ca) { - var _0x3787ba = null; - if (_0x3fe7ca.includes('.worker.js')) { - Object.keys(_0x4d7024.coreFileData).includes(_0x3fe7ca) && (_0x3787ba = _0x4d7024.coreFileData[_0x3fe7ca]); - var _0x2c1832 = new Blob([''], { - 'type': 'application/javascript' - }); - return window.URL.createObjectURL(_0x2c1832); - } - return _0x3fe7ca.includes('.js.mem') && (Object.keys(_0x4d7024.coreFileData).includes(_0x3fe7ca) && (_0x3787ba = _0x4d7024.coreFileData[_0x3fe7ca]), _0x3787ba) ? (_0x4d7024.memData = null, _0x3787ba.buffer) : _0x3fe7ca; - }, - 'readAsync': function(_0x20d016, _0x9d2de4, _0x1425ee) { - if (_0x20d016 instanceof ArrayBuffer) setTimeout(function() { - _0x9d2de4(_0x20d016); - }, 0x1f4); - else { - var _0x164012 = new XMLHttpRequest(); - _0x164012.open('GET', _0x20d016, true), _0x164012.responseType = 'arraybuffer', _0x164012.onload = function() { - 0xc8 == _0x164012.status || 0x0 == _0x164012.status && _0x164012.response ? _0x9d2de4(_0x164012.response) : _0x1425ee(); - }, _0x164012.onerror = _0x1425ee, _0x164012.send(null); - } - } - }; - var _0xa88a13, _0x1dedcd = Math.ceil(new Date().valueOf() / 0x3e8); - var _0xa88a13 = (_0xc6823.customPaths && typeof _0xc6823.customPaths['v.json'] == 'string') ? _0xc6823.customPaths['v.json'] : (_0xc6823.dataPath + 'v.json?t='+_0x1dedcd); - var _0x3641d6 = function(_0x16049b, _0x55a075) { - var path = (_0xc6823.customPaths && typeof _0xc6823.customPaths[_0x16049b] == 'string') ? _0xc6823.customPaths[_0x16049b] : (_0xc6823.dataPath+_0x16049b+'?v='+_0x55a075); - _0x550f17.a.get(path, { - 'onDownloadProgress': function(_0x117e6b) { - var _0x55a075 = _0x117e6b.total ? '' .concat(Math.floor(_0x117e6b.loaded / _0x117e6b.total * 0x64), '%') : ''; - _0x3787ba.innerHTML = 'Download Game Core ' .concat(_0x55a075); - }, - 'responseType': 'arraybuffer' - }).then(function(_0x5eb80b) { - var _0x519406 = new Uint8Array(_0x5eb80b.data); - _0x24de8d.db && _0x24de8d.put(_0x16049b, { - 'version': _0x55a075, - 'data': _0x519406 - }); - var _0xea4c63 = _0x519406.slice ? _0x519406.slice(0xc) : _0x519406.subarray(0xc); - _0xea4c63.set([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c, 0x0, 0x3], 0x0), _0x519406 = null, _0x4f0fcc(_0xea4c63); - - }).catch(function(_0x2e06c8) { - _0x3787ba.innerHTML = 'Network Error'; - }); - }; - _0x550f17.a.get(_0xa88a13, {}).then(function(_0x578a2b) { - var _0x2458d5, _0x5d075f = _0x29078e[_0x2c1832.system], - _0x28ee7f = _0x578a2b.data[_0x2c1832.system], - _0x124167 = _0x28ee7f.version ? _0x28ee7f.version : 0x1, - _0x254bc2 = Boolean(_0x28ee7f.netplay), - _0x5b1dcd = Boolean(_0x28ee7f.state), - _0x9a1f1 = Boolean(_0x28ee7f.asmjs), - _0x3e4345 = Boolean(_0x28ee7f.wasm); - if ('nds' == _0x2c1832.system && ! _0x2d904a.wasm) { - _0x5b1dcd = !0x1; - }; - //alert(_0x5b1dcd) // is save/load state supported - if (_0xc6823.statesSupported === false) { - _0x5b1dcd = false; - }; - _0xc6823.setStatesSupported(_0x5b1dcd); - _0x4d7024.coreFileVersion = _0x124167; - _0x4d7024.coreFileName = _0x5d075f; - var _0x2eb141 = !0x1; - ['webgl2', 'experimental-webgl2'].includes(_0x2d904a.webgl.WEBGL_CONTEXT) && (_0x2eb141 = true); - 'undefined' != typeof EJS_N64_LEGACY && 0x1 == EJS_N64_LEGACY && (_0x2eb141 = !0x1); - if ('mame' == _0x2c1832.system) { - var _0x4921ff = _0x2c1832.config, - _0x38239e = (_0x4921ff.gameId, _0x4921ff.gameUrl.split('/')), - _0x29349f = _0x38239e[_0x38239e.length - 0x1]; - _0x29349f.indexOf('?') > -0x1 && (_0x29349f = _0x29349f.substr(0x0, _0x29349f.indexOf('?'))); - var _0x36b5a0; - _0x29349f.split('.').pop(); - _0x36b5a0 = 'https://www.emulatorjs.com/api/mame.php?name='.concat(_0x29349f), _0x550f17.a.get(_0x36b5a0, { - 'responseType': 'text' - }).then(function(_0xf30170) { - var _0x3787ba = _0xf30170.data.split('|'); - _0x4d7024.coreFileName = '' .concat(_0x2c1832.system, '-').concat(_0x3787ba[0x0]), _0x5b1dcd = '1' === _0x3787ba[0x1], _0x1e2c68.element(_0x2c1832.elements.buttons.saveState) && _0x132da7(_0x2c1832.elements.buttons.saveState, !_0x5b1dcd), _0x1e2c68.element(_0x2c1832.elements.buttons.loadState) && _0x132da7(_0x2c1832.elements.buttons.loadState, !_0x5b1dcd), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), !_0x5b1dcd), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), !_0x5b1dcd), _0x3787ba[0x0] ? (_0x2d904a.wasm && _0x3e4345 ? (_0x2458d5 = '' .concat(_0x2c1832.system, '-').concat(_0x3787ba[0x0], '-wasm.data'), _0x31a5b3 = true) : (_0x3787ba.innerHTML = 'Webassembly support is not detected in this browser', _0x2458d5 = ''), _0x2458d5 && (_0x24de8d.db ? _0x24de8d.get(_0x2458d5, function(_0x655c87) { - if (_0x655c87 && _0x655c87.version === _0x124167) { - var _0x3787ba = _0x655c87.data.slice ? _0x655c87.data.slice(0xc) : _0x655c87.data.subarray(0xc); - _0x3787ba.set([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c, 0x0, 0x3], 0x0), _0x4f0fcc(_0x3787ba); - } else _0x3641d6(_0x2458d5, _0x124167); - }) : _0x3641d6(_0x2458d5, _0x124167))) : _0x3787ba.innerHTML = 'Unsupported Game'; - }).catch(function(_0x941dfc) { - console.log(_0x941dfc), _0x3787ba.innerHTML = 'Network Error'; - }); - } else _0x2d904a.wasm && _0x3e4345 ? (_0x2458d5 = '' .concat(_0x5d075f, '-wasm.data'), 'n64' !== _0x2c1832.system || _0x2eb141 || (_0x2458d5 = '' .concat(_0x5d075f, '-legacy-wasm.data')), _0x31a5b3 = true) : _0x9a1f1 && (_0x2458d5 = '' .concat(_0x5d075f, '-asmjs.data'), 'n64' !== _0x2c1832.system || _0x2eb141 || (_0x2458d5 = '' .concat(_0x5d075f, '-legacy-asmjs.data'))), 'undefined' != typeof EJS_CUSTOM_COREFILE && (_0x2458d5 = EJS_CUSTOM_COREFILE), _0x2458d5 ? _0x24de8d.db ? _0x24de8d.get(_0x2458d5, function(_0x47a6fd) { - if (_0x47a6fd && _0x47a6fd.version === _0x124167) { - var _0x3787ba = _0x47a6fd.data.slice ? _0x47a6fd.data.slice(0xc) : _0x47a6fd.data.subarray(0xc); - _0x3787ba.set([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c, 0x0, 0x3], 0x0), _0x4f0fcc(_0x3787ba); - } else _0x3641d6(_0x2458d5, _0x124167); - }) : _0x3641d6(_0x2458d5, _0x124167) : _0x3787ba.innerHTML = 'Please upgrade your browser to the latest version'; - _0x254bc2 || _0x1e2c68.element(_0x2c1832.elements.buttons.netplay) && _0x132da7(_0x2c1832.elements.buttons.netplay, true), _0x1e2c68.element(_0x2c1832.elements.buttons.saveState) && _0x132da7(_0x2c1832.elements.buttons.saveState, !_0x5b1dcd), _0x1e2c68.element(_0x2c1832.elements.buttons.loadState) && _0x132da7(_0x2c1832.elements.buttons.loadState, !_0x5b1dcd), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), !_0x5b1dcd), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), !_0x5b1dcd); - }).catch(function(_0x2d06a9) { - _0x3787ba.innerHTML = 'Network Error'; - }), clearInterval(_0x1c9c57), _0x4d7024.romdb = _0x4e171c; - } - }, 0x1f4); - }(), !0x1; - }; - _0x455c85(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), 'click touchstart', _0x26d6a1); - if (_0xc6823.startOnLoad === true) { - _0x26d6a1() - } - } - }, - _0x27f4c4 = _0x4d7024, - _0x4a2390 = _0x2c1832(0xa1); - - function _0x3c0613(_0x3eef01) { - return function(_0x3d9b1e) { - if (Array.isArray(_0x3d9b1e)) { - for (var _0x17edbf = 0x0, _0x2c1832 = new Array(_0x3d9b1e.length); _0x17edbf < _0x3d9b1e.length; _0x17edbf++) _0x2c1832[_0x17edbf] = _0x3d9b1e[_0x17edbf]; - return _0x2c1832; - } - }(_0x3eef01) || function(_0x425c1a) { - if (Symbol.iterator in Object(_0x425c1a) || '[object Arguments]' === Object.prototype.toString.call(_0x425c1a)) return Array.from(_0x425c1a); - }(_0x3eef01) || function() { - throw new TypeError('Invalid attempt to spread non-iterable instance'); - }(); - } - - function _0xa08ac0(_0x514af5, _0x4089be) { - for (var _0x2c1832 = 0x0; _0x2c1832 < _0x4089be.length; _0x2c1832++) { - var _0x3347c8 = _0x4089be[_0x2c1832]; - _0x3347c8.enumerable = _0x3347c8.enumerable || !0x1, _0x3347c8.configurable = true, 'value' in _0x3347c8 && (_0x3347c8.writable = true), Object.defineProperty(_0x514af5, _0x3347c8.key, _0x3347c8); - } - } - var _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() { - function _0x5566a2(_0x1fcb21) { - var _0x2c1832 = _0x1fcb21.targetModal, - _0x29e6ab = _0x1fcb21.triggers, - _0x114128 = void 0x0 === _0x29e6ab ? [] : _0x29e6ab, - _0x5211ae = _0x1fcb21.onShow, - _0x402faa = void 0x0 === _0x5211ae ? function() {} : _0x5211ae, - _0x120cc3 = _0x1fcb21.onClose, - _0x48ad1c = void 0x0 === _0x120cc3 ? function() {} : _0x120cc3, - _0x6a1522 = _0x1fcb21.openTrigger, - _0x306932 = void 0x0 === _0x6a1522 ? 'data-micromodal-trigger' : _0x6a1522, - _0x446302 = _0x1fcb21.closeTrigger, - _0x2f0676 = void 0x0 === _0x446302 ? 'data-micromodal-close' : _0x446302, - _0x2a4c0e = _0x1fcb21.disableScroll, - _0x2297fa = void 0x0 !== _0x2a4c0e && _0x2a4c0e, - _0x5a3f47 = _0x1fcb21.disableFocus, - _0x4a8131 = void 0x0 !== _0x5a3f47 && _0x5a3f47, - _0x42179f = _0x1fcb21.awaitCloseAnimation, - _0x27da4d = void 0x0 !== _0x42179f && _0x42179f, - _0x1b535e = _0x1fcb21.debugMode, - _0x33d8ca = void 0x0 !== _0x1b535e && _0x1b535e, - _0xee6cb0 = _0x1fcb21.closeByEsckey, - _0x54de6a = void 0x0 === _0xee6cb0 || _0xee6cb0; - ! function(_0x27e736, _0x56010c) { - if (!(_0x27e736 instanceof _0x56010c)) throw new TypeError('Cannot call a class as a function'); - }(this, _0x5566a2), this.modal = document.getElementById(_0x2c1832), this.config = { - 'debugMode': _0x33d8ca, - 'disableScroll': _0x2297fa, - 'openTrigger': _0x306932, - 'closeTrigger': _0x2f0676, - 'onShow': _0x402faa, - 'onClose': _0x48ad1c, - 'awaitCloseAnimation': _0x27da4d, - 'disableFocus': _0x4a8131, - 'closeByEsckey': _0x54de6a - }, _0x114128.length > 0x0 && this.registerTriggers.apply(this, _0x3c0613(_0x114128)), this.onClick = this.onClick.bind(this), this.onKeydown = this.onKeydown.bind(this); - } - var _0x17edbf, _0x2c1832, _0x5021cc; - return _0x17edbf = _0x5566a2, (_0x2c1832 = [{ - 'key': 'registerTriggers', - 'value': function() { - for (var _0x5566a2 = this, _0x17edbf = arguments.length, _0x2c1832 = new Array(_0x17edbf), _0x4e24fa = 0x0; _0x4e24fa < _0x17edbf; _0x4e24fa++) _0x2c1832[_0x4e24fa] = arguments[_0x4e24fa]; - _0x2c1832.forEach(function(_0x511ded) { - _0x511ded.addEventListener('click', function() { - return _0x5566a2.showModal(); - }); - }); - } - }, { - 'key': 'showModal', - 'value': function() { - this.activeElement = document.activeElement, this.modal.setAttribute('aria-hidden', 'false'), this.modal.classList.add(_0x449eac({ - 'is-open': true - })), this.setFocusToFirstNode(), this.addEventListeners(), this.config.onShow(this.modal); - } - }, { - 'key': 'closeModal', - 'value': function() { - var _0x5566a2 = this.modal; - this.modal.setAttribute('aria-hidden', 'true'), this.removeEventListeners(), this.config.onClose(this.modal), this.config.awaitCloseAnimation ? this.modal.addEventListener('animationend', function _0x17edbf() { - _0x5566a2.classList.remove(_0x449eac({ - 'is-open': true - })), _0x5566a2.removeEventListener('animationend', _0x17edbf, !0x1); - }, !0x1) : _0x5566a2.classList.remove(_0x449eac({ - 'is-open': true - })); - } - }, { - 'key': 'addEventListeners', - 'value': function() { - this.modal.addEventListener('touchstart', this.onClick), this.modal.addEventListener('click', this.onClick), document.addEventListener('keydown', this.onKeydown); - } - }, { - 'key': 'removeEventListeners', - 'value': function() { - this.modal.removeEventListener('touchstart', this.onClick), this.modal.removeEventListener('click', this.onClick), document.removeEventListener('keydown', this.onKeydown); - } - }, { - 'key': 'onClick', - 'value': function(_0x6c9df3) { - _0x6c9df3.target.hasAttribute(this.config.closeTrigger) && (this.closeModal(), _0x6c9df3.preventDefault()); - } - }, { - 'key': 'onKeydown', - 'value': function(_0xe2d057) { - this.config.closeByEsckey && 0x1b === _0xe2d057.keyCode && this.closeModal(_0xe2d057), 0x9 === _0xe2d057.keyCode && this.maintainFocus(_0xe2d057); - } - }, { - 'key': 'getFocusableNodes', - 'value': function() { - var _0x5566a2 = this.modal.querySelectorAll(_0x1eda08); - return Object.keys(_0x5566a2).map(function(_0x1bd160) { - return _0x5566a2[_0x1bd160]; - }); - } - }, { - 'key': 'setFocusToFirstNode', - 'value': function() { - if (!this.config.disableFocus) { - var _0x5566a2 = this.getFocusableNodes(); - _0x5566a2.length && _0x5566a2[0x0].focus(); - } - } - }, { - 'key': 'maintainFocus', - 'value': function(_0x15092b) { - var _0x17edbf = this.getFocusableNodes(); - if (this.modal.contains(document.activeElement)) { - var _0x2c1832 = _0x17edbf.indexOf(document.activeElement); - _0x15092b.shiftKey && 0x0 === _0x2c1832 && (_0x17edbf[_0x17edbf.length - 0x1].focus(), _0x15092b.preventDefault()), _0x15092b.shiftKey || _0x2c1832 !== _0x17edbf.length - 0x1 || (_0x17edbf[0x0].focus(), _0x15092b.preventDefault()); - } else _0x17edbf[0x0].focus(); - } - }]) && _0xa08ac0(_0x17edbf.prototype, _0x2c1832), _0x5021cc && _0xa08ac0(_0x17edbf, _0x5021cc), _0x5566a2; - }(), _0xf43a92 = null, _0x214f42 = function(_0x31caa5) { - if (!document.getElementById(_0x31caa5)) return !0x1; - }, _0x3a9bfc = function(_0x48c135, _0x61240d) { - if (function(_0x28b4fb) { - _0x28b4fb.length <= 0x0 && (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;', '')); - }(_0x48c135), !_0x61240d) return true; - for (var _0x2c1832 in _0x61240d) _0x214f42(_0x2c1832); - return true; - }, { - 'init': function(_0x3f1b32) { - var _0x17edbf = Object.assign({}, { - 'openTrigger': 'data-micromodal-trigger' - }, _0x3f1b32), - _0x2c1832 = _0x3c0613(document.querySelectorAll('[' .concat(_0x17edbf.openTrigger, ']'))), - _0x537e55 = function(_0x5e363a, _0x9390ce) { - var _0x2c1832 = []; - return _0x5e363a.forEach(function(_0x305145) { - var _0x13d441 = _0x305145.attributes[_0x9390ce].value; - void 0x0 === _0x2c1832[_0x13d441] && (_0x2c1832[_0x13d441] = []), _0x2c1832[_0x13d441].push(_0x305145); - }), _0x2c1832; - }(_0x2c1832, _0x17edbf.openTrigger); - if (true !== _0x17edbf.debugMode || !0x1 !== _0x3a9bfc(_0x2c1832, _0x537e55)) - for (var _0x383dff in _0x537e55) { - var _0x34a8e0 = _0x537e55[_0x383dff]; - _0x17edbf.targetModal = _0x383dff, _0x17edbf.triggers = _0x3c0613(_0x34a8e0), new _0x4fc27f(_0x17edbf); - } - }, - 'show': function(_0x2a3fcf, _0x472cd6) { - var _0x2c1832 = _0x472cd6 || {}; - return _0x2c1832.targetModal = _0x2a3fcf, true === _0x2c1832.debugMode && !0x1 === _0x214f42(_0x2a3fcf) ? _0xf43a92 = null : (_0xf43a92 = new _0x4fc27f(_0x2c1832)).showModal(), _0xf43a92; - }, - 'close': function() { - _0xf43a92.closeModal(); - } - }), - _0x378b5c = { - 'defaultControllers': { - 0: { - 0: { - 'value': '88', - 'value2': '1' - }, - 1: { - 'value': '83', - 'value2': '3' - }, - 2: { - 'value': '16', - 'value2': '8' - }, - 3: { - 'value': '13', - 'value2': '9' - }, - 4: { - 'value': '38', - 'value2': '12' - }, - 5: { - 'value': '40', - 'value2': '13' - }, - 6: { - 'value': '37', - 'value2': '14' - }, - 7: { - 'value': '39', - 'value2': '15' - }, - 8: { - 'value': '90', - 'value2': '0' - }, - 9: { - 'value': '65', - 'value2': '2' - }, - 10: { - 'value': '81', - 'value2': '4' - }, - 11: { - 'value': '69', - 'value2': '5' - }, - 12: { - 'value': '82', - 'value2': '6' - }, - 13: { - 'value': '87', - 'value2': '7' - }, - 14: {}, - 15: {}, - 16: { - 'value': '72' - }, - 17: { - 'value': '70' - }, - 18: { - 'value': '71' - }, - 19: { - 'value': '84' - }, - 20: {'value': '76'}, - 21: {'value': '74'}, - 22: {'value': '75'}, - 23: {'value': '73'}, - 24: {}, - 25: {}, - 26: {} - }, - 1: {}, - 2: {}, - 3: {} - }, - 'controllers': {}, - 'virtualGamepadContainer': null, - 'keyMap': { - 8: 'backspace', - 9: 'tab', - 13: 'enter', - 16: 'shift', - 17: 'ctrl', - 18: 'alt', - 19: 'pause/break', - 20: 'caps lock', - 27: 'escape', - 32: 'space', - 33: 'page up', - 34: 'page down', - 35: 'end', - 36: 'home', - 37: 'left arrow', - 38: 'up arrow', - 39: 'right arrow', - 40: 'down arrow', - 45: 'insert', - 46: 'delete', - 48: '0', - 49: '1', - 50: '2', - 51: '3', - 52: '4', - 53: '5', - 54: '6', - 55: '7', - 56: '8', - 57: '9', - 65: 'a', - 66: 'b', - 67: 'c', - 68: 'd', - 69: 'e', - 70: 'f', - 71: 'g', - 72: 'h', - 73: 'i', - 74: 'j', - 75: 'k', - 76: 'l', - 77: 'm', - 78: 'n', - 79: 'o', - 80: 'p', - 81: 'q', - 82: 'r', - 83: 's', - 84: 't', - 85: 'u', - 86: 'v', - 87: 'w', - 88: 'x', - 89: 'y', - 90: 'z', - 91: 'left window key', - 92: 'right window key', - 93: 'select key', - 96: 'numpad 0', - 97: 'numpad 1', - 98: 'numpad 2', - 99: 'numpad 3', - 100: 'numpad 4', - 101: 'numpad 5', - 102: 'numpad 6', - 103: 'numpad 7', - 104: 'numpad 8', - 105: 'numpad 9', - 106: 'multiply', - 107: 'add', - 109: 'subtract', - 110: 'decimal point', - 111: 'divide', - 112: 'f1', - 113: 'f2', - 114: 'f3', - 115: 'f4', - 116: 'f5', - 117: 'f6', - 118: 'f7', - 119: 'f8', - 120: 'f9', - 121: 'f10', - 122: 'f11', - 123: 'f12', - 144: 'num lock', - 145: 'scroll lock', - 186: 'semi-colon', - 187: 'equal sign', - 188: 'comma', - 189: 'dash', - 190: 'period', - 191: 'forward slash', - 192: 'grave accent', - 219: 'open bracket', - 220: 'back slash', - 221: 'close braket', - 222: 'single quote' - }, - 'gamepad': null, - 'allowCheat': true, - 'connection': null, - 'connected': !0x1, - 'playerName': '', - 'players': [], - 'waitingList': {}, - 'roomMaster': null, - 'inputsData': {}, - 'coreOptionData': {}, - 'currentFrame': 0x0, - 'wait': !0x1, - 'progressHelper': {}, - 'icons': { - 'lock': '' - }, - 'disableInput': !0x1, - 'disableControl': function(_0x5459be) { - if (_0x5459be) { - 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); - _0x378b5c.disableInput = true; - } else _0x378b5c.disableInput = !0x1; - }, - 'loadRoomsListTimer': null, - 'loadRoomsList': function() {}, - 'stopLoadRooms': function() { - _0x378b5c.loadRoomsListTimer && clearTimeout(_0x378b5c.loadRoomsListTimer); - }, - 'openRoom': function() {}, - 'isPaused': null, - 'setVolume': null, - 'setVariable': null, - 'simulateInput': null, - 'simulateInputFn': null, - 'toggleShader': null, - 'saveState': null, - 'screenRecord': null, - 'loadState': null, - 'quickSaveState': null, - 'quickLoadState': null, - 'changeStateSlot': null, - 'getScreenData': null, - 'getStateInfo': null, - 'setCheat': null, - 'resetCheat': null, - 'getGameCoreOptions': null, - 'classNames': { - 'dialog-container': _0x449eac({ - 'dialog-container': true - }), - 'tabs': _0x449eac({ - 'tabs': true - }), - 'dialog-title': _0x449eac({ - 'dialog-title': true - }), - 'dialog-content': _0x449eac({ - 'dialog-content': true - }), - 'dialog-buttons': _0x449eac({ - 'dialog-buttons': true - }), - 'overlay': _0x449eac({ - 'overlay': true - }), - 'key-setting-popup': _0x449eac({ - 'key-setting-popup': true - }), - 'tabs-panel': _0x449eac({ - 'tabs-panel': true - }), - 'tabs-content': _0x449eac({ - 'tabs-content': true - }), - 'button-container': _0x449eac({ - 'button-container': true - }), - 'set': _0x449eac({ - 'set': true - }), - 'active': _0x449eac({ - 'active': true - }), - 'btn-cancel': _0x449eac({ - 'btn-cancel': true - }), - 'btn-reset': _0x449eac({ - 'btn-reset': true - }), - 'btn-clear': _0x449eac({ - 'btn-clear': true - }), - 'btn-create': _0x449eac({ - 'btn-create': true - }), - 'btn-submit': _0x449eac({ - 'btn-submit': true - }), - 'btn-join-room': _0x449eac({ - 'btn-join-room': true - }), - 'btn-quit': _0x449eac({ - 'btn-quit': true - }), - 'btn-create-room': _0x449eac({ - 'btn-create-room': true - }), - 'netplay-player-name': _0x449eac({ - 'netplay-player-name': true - }), - 'netplay-roomlist': _0x449eac({ - 'netplay-roomlist': true - }), - 'netplay-room-name-input': _0x449eac({ - 'netplay-room-name-input': true - }), - 'netplay-room-password-input': _0x449eac({ - 'netplay-room-password-input': true - }), - 'netplay-create-room-set': _0x449eac({ - 'netplay-create-room-set': true - }), - 'netplay-room': _0x449eac({ - 'netplay-room': true - }), - 'modal': _0x449eac({ - 'modal': true - }), - 'modal__overlay': _0x449eac({ - 'modal__overlay': true - }), - 'modal__container': _0x449eac({ - 'modal__container': true - }), - 'modal__header': _0x449eac({ - 'modal__header': true - }), - 'modal__title': _0x449eac({ - 'modal__title': true - }), - 'modal__close': _0x449eac({ - 'modal__close': true - }), - 'modal__content': _0x449eac({ - 'modal__content': true - }), - 'modal__btn': _0x449eac({ - 'modal__btn': true - }), - 'modal__btn-primary': _0x449eac({ - 'modal__btn-primary': true - }), - 'micromodal-slide': _0x449eac({ - 'micromodal-slide': true - }), - 'modal__errmsg': _0x449eac({ - 'modal__errmsg': true - }), - 'modal__footer': _0x449eac({ - 'modal__footer': true - }), - 'cheats-add': _0x449eac({ - 'cheats-add': true - }), - 'cheats-list': _0x449eac({ - 'cheats-list': true - }), - 'cheat-code-input': _0x449eac({ - 'cheat-code-input': true - }), - 'cheat-name-input': _0x449eac({ - 'cheat-name-input': true - }), - 'ejs-switch': _0x449eac({ - 'ejs-switch': true - }), - 'ejs-delete-cheat': _0x449eac({ - 'ejs-delete-cheat': true - }) - }, - 'initShaders': function() { - for (var _0xa88a13 = _0x5032e6, _0x17edbf = Object.keys(_0xa88a13), _0x2c1832 = '', _0x26fb6a = 0x0; _0x26fb6a < _0x17edbf.length; _0x26fb6a += 0x1) _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); - }, - 'setGamepadDialog': function() { - var _0xa88a13 = this; - _0xa88a13.elements.dialogs.gamepad.innerHTML = '\n
    \n
    \n

    Control Settings

    \n
    \n \n \n
    \n
    \n \n
    \n
    \n
    \n Update\n Reset\n Clear\n Cancel\n
    \n \n
    \n ' - - var _0x17edbf = '\n '), - _0x2c1832 = '\n
    \n
    \n \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n Set\n
    \n
    \n
    ') - if ('nes' === _0xa88a13.system) { - var _0x48ee51 = { - 0: 'B', - 2: 'SELECT', - 3: 'START', - 4: 'UP', - 5: 'DOWN', - 6: 'LEFT', - 7: 'RIGHT', - 8: 'A', - 24: 'QUICK SAVE STATE', - 25: 'QUICK LOAD STATE', - 26: 'CHANGE STATE SLOT' - } - } else if ('snes' === _0xa88a13.system) { - var _0x48ee51 = { - 0: 'B', - 1: 'Y', - 2: 'SELECT', - 3: 'START', - 4: 'UP', - 5: 'DOWN', - 6: 'LEFT', - 7: 'RIGHT', - 8: 'A', - 9: 'X', - 10: 'L', - 11: 'R', - 24: 'QUICK SAVE STATE', - 25: 'QUICK LOAD STATE', - 26: 'CHANGE STATE SLOT' - }; - } else if ('n64' === _0xa88a13.system) { - var _0x48ee51 = { - 0: 'B', - 3: 'START', - 4: 'UP', - 5: 'DOWN', - 6: 'LEFT', - 7: 'RIGHT', - 8: 'A', - 10: 'L', - 11: 'R', - 12: 'Z', - 19: 'L STICK UP', - 18: 'L STICK DOWN', - 17: 'L STICK LEFT', - 16: 'L STICK RIGHT', - 23: 'R STICK UP', - 22: 'R STICK DOWN', - 21: 'R STICK LEFT', - 20: 'R STICK RIGHT', - 24: 'QUICK SAVE STATE', - 25: 'QUICK LOAD STATE', - 26: 'CHANGE STATE SLOT' - }; - } else if ('nds' === _0xa88a13.system) { - var _0x48ee51 = { - 0: 'B', - 1: 'Y', - 2: 'SELECT', - 3: 'START', - 4: 'UP', - 5: 'DOWN', - 6: 'LEFT', - 7: 'RIGHT', - 8: 'A', - 9: 'X', - 10: 'L', - 11: 'R', - 14: 'Microphone', - 24: 'QUICK SAVE STATE', - 25: 'QUICK LOAD STATE', - 26: 'CHANGE STATE SLOT' - }; - } else { - var _0x48ee51 = { - 0: 'B', - 1: 'Y', - 2: 'SELECT', - 3: 'START', - 4: 'UP', - 5: 'DOWN', - 6: 'LEFT', - 7: 'RIGHT', - 8: 'A', - 9: 'X', - 10: 'L', - 11: 'R', - 12: 'L2', - 13: 'R2', - 14: 'L3', - 15: 'R3', - 19: 'L STICK UP', - 18: 'L STICK DOWN', - 17: 'L STICK LEFT', - 16: 'L STICK RIGHT', - 23: 'R STICK UP', - 22: 'R STICK DOWN', - 21: 'R STICK LEFT', - 20: 'R STICK RIGHT', - 24: 'QUICK SAVE STATE', - 25: 'QUICK LOAD STATE', - 26: 'CHANGE STATE SLOT' - }; - } - if ('arcade' === _0xa88a13.system) { - _0x48ee51[2] = 'INSERT COIN' - } - if (_0xa88a13.statesSupported === false) { - delete _0x48ee51[24] - delete _0x48ee51[25] - delete _0x48ee51[26] - } - - for (var _0x501790 = [0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x0, 0x9, 0x1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x13, 0x12, 0x11, 0x10, 0x17, 0x16, 0x15, 0x14, 0x18, 0x19, 26], _0x50fd12 = function(_0x88827f) { - _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['tabs-content'])).innerHTML += _0x17edbf.replace(/{index}/g, _0x88827f), _0x501790.forEach(function(_0x1bf162) { - _0x48ee51[_0x1bf162] && (_0xa88a13.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x88827f)).innerHTML += _0x2c1832.replace(/{index}/g, _0x88827f).replace(/{id}/g, _0x1bf162).replace(/{label}/g, _0x48ee51[_0x1bf162])); - }), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'); - }, _0x3f0824 = 0x0; _0x3f0824 <= 0x3; _0x3f0824 += 0x1) _0x50fd12(_0x3f0824); - Object.keys(_0x378b5c.controllers).forEach(function(_0x23d419) { - _0x378b5c.controllers[_0x23d419] && Object.keys(_0x378b5c.controllers[_0x23d419]).forEach(function(_0x21e62d) { - var _0x294e35 = _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x21e62d, '"][data-index="').concat(_0x23d419, '"][data-type="1"]')), - _0x1849bc = _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x21e62d, '"][data-index="').concat(_0x23d419, '"][data-type="2"]')); - if (!_0x294e35 || !_0x1849bc) return !0x1; - var _0x19d43b = _0x378b5c.controllers[_0x23d419][_0x21e62d]; - _0x19d43b && (_0x19d43b.type && 0x1 !== 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) + 0x1)), _0x1849bc.setAttribute('data-value', _0x19d43b.value2))); - }); - }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-submit'])), 'click', function(_0x5f19bd) { - var _0x2c1832 = _0xa88a13.elements.dialogs.gamepad.querySelectorAll('input'), - _0x2844f7 = {}; - return Array.from(_0x2c1832).forEach(function(_0x33c024) { - var _0x5f19bd, _0x2c1832 = _0x33c024.getAttribute('data-index'), - _0x124d0a = _0x33c024.getAttribute('data-value'); - 0x2 === parseInt(_0x33c024.getAttribute('data-type'), 0xa) && (_0x5f19bd = _0x33c024.getAttribute('data-value')); - var _0x54b9af = _0x33c024.getAttribute('data-id'); - _0x2844f7[_0x2c1832] || (_0x2844f7[_0x2c1832] = {}), _0x2844f7[_0x2c1832][_0x54b9af] || (_0x2844f7[_0x2c1832][_0x54b9af] = {}), _0x124d0a && (_0x2844f7[_0x2c1832][_0x54b9af].value = _0x124d0a), _0x5f19bd && (_0x2844f7[_0x2c1832][_0x54b9af].value2 = _0x5f19bd); - }), _0x2593da.storage.set({ - 'controllers': _0x2844f7 - }), _0x378b5c.controllers = _0x2844f7, _0x132da7(_0xa88a13.elements.dialogs.gamepad, true), _0xa88a13.elements.container.focus(), _0x5f19bd.stopPropagation(), !0x1; - }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-reset'])), 'click', function(_0x5f19bd) { - _0x378b5c.controllers = JSON.parse(JSON.stringify(_0x378b5c.defaultControllers)) - localStorage.removeItem(_0x2593da.storage.key) - var _0x2c1832 = _0xa88a13.elements.dialogs.gamepad.querySelectorAll('input') - for (var i=0; i<_0x2c1832.length; i++) { - var player = _0x2c1832[i].getAttribute('data-index') - var controlOrGamepad = _0x2c1832[i].getAttribute('data-type') - var buttonId = _0x2c1832[i].getAttribute('data-id') - var a = (controlOrGamepad == 1) ? 'value' : 'value2' - if (_0x378b5c.defaultControllers[player] && _0x378b5c.defaultControllers[player][buttonId] && _0x378b5c.defaultControllers[player][buttonId][a]) { - if (controlOrGamepad == 1) { - _0x2c1832[i].value = _0x378b5c.keyMap[_0x378b5c.defaultControllers[player][buttonId][a]] - } else { - _0x2c1832[i].value = 'button ' + (parseInt(_0x378b5c.defaultControllers[player][buttonId][a])+1) - } - _0x2c1832[i].setAttribute('data-value', _0x378b5c.defaultControllers[player][buttonId][a]) - } else { - _0x2c1832[i].value = '' - _0x2c1832[i].setAttribute('data-value', '') - } - } - }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-clear'])), 'click', function(_0x5f19bd) { - var c = {0:{}, 1:{}, 2:{}, 3:{}} - for (var k in _0x48ee51) { - c[0][k] = {} - c[1][k] = {} - c[2][k] = {} - c[3][k] = {} - } - _0x378b5c.controllers = c - localStorage.setItem(_0x2593da.storage.key, JSON.stringify({controllers: _0x378b5c.controllers})) - var _0x2c1832 = _0xa88a13.elements.dialogs.gamepad.querySelectorAll('input') - for (var i=0; i<_0x2c1832.length; i++) { - _0x2c1832[i].value = '' - _0x2c1832[i].setAttribute('data-value', '') - } - }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x16d598) { - return _0x132da7(_0xa88a13.elements.dialogs.gamepad, true), _0xa88a13.elements.container.focus(), _0x16d598.stopPropagation(), !0x1; - }), Array.from(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames.tabs, ' li'))).forEach(function(_0x523f7b) { - _0x1093f4.call(_0xa88a13, _0x523f7b, 'mousedown', function(_0xa99a78) { - _0x3a8e2f(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames.tabs, ' li')), _0x378b5c.classNames.active, !0x1), _0x3a8e2f(_0x523f7b, _0x378b5c.classNames.active, true); - var _0xb8a227 = _0x523f7b.querySelector('a').getAttribute('aria-controls'); - return Array.from(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames['tabs-content'], ' .').concat(_0x378b5c.classNames['tabs-panel']))).forEach(function(_0x1c29a4) { - _0x132da7(_0x1c29a4, true); - }), _0x132da7(_0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['tabs-content'], ' #').concat(_0xb8a227)), !0x1), _0xa99a78.stopPropagation(), !0x1; - }); - }), _0xbae705.call(_0xa88a13, _0xa88a13.elements.dialogs.gamepad.querySelector('[aria-controls="controls-0"]').parentNode, 'mousedown'); - var _0x11b11a = _0xa88a13.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay)); - _0x1093f4.call(_0xa88a13, _0x11b11a, 'mousedown', function(_0x15c7de) { - _0x132da7(_0x11b11a, true), _0x15c7de.stopPropagation(); - }), Array.from(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames['button-container']))).forEach(function(_0x16f092) { - _0x1093f4.call(_0xa88a13, _0x16f092, 'mousedown', function(_0xdb1c93) { - _0xbae705.call(_0xa88a13, _0x16f092.querySelector('a.' .concat(_0x378b5c.classNames.set)), _0xdb1c93.type, true, {}); - }); - }), Array.from(_0xa88a13.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames['tabs-panel'], ' a.').concat(_0x378b5c.classNames.set))).forEach(function(_0x397818) { - _0x1093f4.call(_0xa88a13, _0x397818, 'mousedown', function(_0x1e1d79) { - var _0x2c1832 = _0x397818.parentNode.parentNode, - _0x4e649c = _0x2c1832.getAttribute('data-id'), - _0x431719 = _0x2c1832.getAttribute('data-index'), - _0x4a6f6f = _0x2c1832.getAttribute('data-label'); - _0x132da7(_0x11b11a, !0x1), _0x11b11a.setAttribute('data-id', _0x4e649c), _0x11b11a.setAttribute('data-index', _0x431719); - var _0x179623 = '[ ' .concat(_0x4a6f6f, ' ]'); - _0x378b5c.gamepad.gamepads[_0x431719] && _0x4e649c < 0x10 ? _0x179623 += '
    Gamepad:' .concat(_0x378b5c.gamepad.gamepads[_0x431719].id, '
    Press keyboard or gamepad
    Press escape (esc) to clear') : _0x179623 += '
    Press keyboard
    Press escape (esc) to clear', _0x11b11a.querySelector('.' .concat(_0x378b5c.classNames['key-setting-popup'])).innerHTML = _0x179623, _0x1e1d79.stopPropagation(); - }); - }); - }, - 'setCacheDialog': function() { - var _0xa88a13 = this; - _0xa88a13.elements.dialogs.cache.innerHTML = '\n
    \n
    \n

    Cache Manager

    \n
    \n
    \n\n
    \n
    \n Close\n
    \n
    \n '), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x5d6721) { - return _0x132da7(_0xa88a13.elements.dialogs.cache, true), _0xa88a13.elements.container.focus(), _0x5d6721.stopPropagation(), !0x1; - }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-title'], ' a')), 'click', function(_0x46992d) { - return _0x27f4c4.romdb && (_0x27f4c4.romdb.clear(), _0xa88a13.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-content'])).innerHTML = '
    Empty
    '), _0x46992d.stopPropagation(), !0x1; - }); - }, - 'showLoading': function(_0x108b55) { - _0x4d8495.show('modal-6ed698f3d04061f5', { - 'closeByEsckey': !0x1 - }), _0x108b55 && console.log(''), _0x132da7(this.elements.dialogs.loading, !0x1); - }, - 'hideLoading': function() { - _0x4d8495.close(), _0x132da7(this.elements.dialogs.loading, true); - }, - 'setLoadingDialog': function() { - this.elements.dialogs.loading && (this.elements.dialogs.loading.innerHTML = '\n ')); - }, - 'setCheatDialog': function() { - var _0xa88a13 = this; - if (_0xa88a13.elements.dialogs.cheat) { - _0xa88a13.elements.dialogs.cheat.innerHTML = '\n
    \n
    \n

    Cheats

    \n
    \n
    \n
    \n \n
    \n
    \n
    \n Add Cheat\n OK\n Close\n
    \n
    \n\n \n\n \n '); - var _0x17edbf = _0xa88a13.elements.dialogs.cheat.querySelector('#modal-85cd7a1c543a484b'); - _0x1093f4.call(this, _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['cheats-add'])), 'click', function(_0x2a74b5) { - return _0x4d8495.show('modal-85cd7a1c543a484b', { - 'closeTrigger': 'data-modal-close' - }), !0x1; - }); - var _0x2c1832 = _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['cheats-list'])); - _0x1093f4.call(this, _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x1c01ce) { - var _0x184e2c = _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-name-input'])).value, - _0x15ccbb = _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-code-input'])).value; - if (_0x184e2c && _0x15ccbb) { - var _0x2c3108 = _0x2c1832.querySelectorAll('input:checked'); - _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-name-input'])).value = '', _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-code-input'])).value = '', _0x4d8495.close(); - var _0x5b2cff = _0xa88a13.cheats.length; - _0xa88a13.cheats.push([_0x184e2c, _0x15ccbb]), _0x2c1832.innerHTML += '
    \n \n \n ×\n
    '), _0x2c3108.forEach(function(_0x1fb248, _0x7bb84b) { - _0x2c1832.querySelector('#ejs-cheat-switch-' .concat(_0x7bb84b)).setAttribute('checked', 'checked'); - }); - } - return 'localStorage' in window && localStorage.setItem('' .concat(_0xa88a13.system, '-').concat(_0xa88a13.startName, '-cheats'), JSON.stringify(_0xa88a13.cheats)), _0x1c01ce.stopPropagation(), !0x1; - }); - var _0x257001 = function() { - if ('localStorage' in window) { - var _0x17edbf = localStorage.getItem('' .concat(_0xa88a13.system, '-').concat(_0xa88a13.startName, '-cheats')); - try { - _0x17edbf = JSON.parse(_0x17edbf); - } catch (_0x101b3e) {} - _0x17edbf && (_0xa88a13.cheats = _0x17edbf); - } - _0x2c1832.innerHTML = '', _0xa88a13.cheats && Array.isArray(_0xa88a13.cheats) && _0xa88a13.cheats.forEach(function(_0x245035, _0x116996) { - var _0x4ac35a = _0x245035[0x0]; - _0x245035[0x1]; - _0x2c1832.innerHTML += '
    \n \n \n ×\n
    '); - }); - }; - _0x1093f4.call(_0xa88a13, _0x2c1832, 'click', function(_0x576733) { - if (_0x576733.target && _0x576733.target.classList.contains(_0x378b5c.classNames['ejs-delete-cheat']) && _0x576733.target.getAttribute('data-idx')) { - var _0x5b10b7 = _0x576733.target.getAttribute('data-idx'); - _0xa88a13.cheats.splice(_0x5b10b7, 0x1), 'localStorage' in window && localStorage.setItem('' .concat(_0xa88a13.system, '-').concat(_0xa88a13.startName, '-cheats'), JSON.stringify(_0xa88a13.cheats)); - var _0x557895 = []; - _0x2c1832.querySelectorAll('input').forEach(function(_0xab0ba8, _0x1f3597) { - _0x557895[_0x1f3597] = !!_0x2c1832.querySelector('#ejs-cheat-switch-' .concat(_0x1f3597, ':checked')); - }), _0x557895.splice(_0x5b10b7, 0x1), _0x257001(), _0x557895.forEach(function(_0x2e22be, _0x2247c4) { - _0x2e22be && _0x2c1832.querySelector('#ejs-cheat-switch-' .concat(_0x2247c4)).setAttribute('checked', 'checked'); - }); - } - return _0x576733.stopPropagation(), !0x1; - }), _0x1093f4.call(_0xa88a13, _0xa88a13.elements.container, 'start-game', function(_0x4c266e) { - _0x257001(); - }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x4adb2c) { - return _0x132da7(_0xa88a13.elements.dialogs.cheat, true), _0x4adb2c.stopPropagation(), _0xa88a13.elements.container.focus(), !0x1; - }), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-submit'])), 'click', function(_0x5785f6) { - return _0x378b5c.resetCheat(), _0x2c1832.querySelectorAll('input:checked').forEach(function(_0xeb7426, _0x45b02d) { - var _0x27e2c1 = _0xa88a13.cheats[_0xeb7426.value]; - _0x27e2c1 && _0x378b5c.setCheat(_0x45b02d, 0x1, _0x27e2c1[0x1]); - }), _0x132da7(_0xa88a13.elements.dialogs.cheat, true), _0xa88a13.elements.container.focus(), !0x1; - }), 'arcade' !== _0xa88a13.system && 'mame' !== _0xa88a13.system && 'mame2003' !== _0xa88a13.system && 'mame2010' !== _0xa88a13.system || (_0x1e2c68.element(_0xa88a13.elements.buttons.cheat) && _0x132da7(_0xa88a13.elements.buttons.cheat, true), _0x378b5c.allowCheat = !0x1), _0x378b5c.setCheat || (_0x132da7(_0xa88a13.elements.buttons.cheat, true), _0x378b5c.allowCheat = !0x1); - } - }, - 'setNetplayDialog': function() { - var _0xa88a13 = this, - _0x17edbf = this; - if (_0x17edbf.elements.dialogs.netplay) { - _0x17edbf.elements.dialogs.netplay.innerHTML = '\n
    \n
    \n

    Netplay

    \n
    \n
    \n \n\n \n
    \n \n
    \n\n \n \n \n \n \n \n \n \n \n \n '), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x3d4554) { - return _0x132da7(_0x17edbf.elements.dialogs.netplay, true), _0x378b5c.disableControl(!0x1), _0x378b5c.stopLoadRooms(), _0x3d4554.stopPropagation(), _0x17edbf.elements.container.focus(), !0x1; - }), window.setInterval(function() { - var _0xa88a13 = '
      '; - _0x378b5c.players.forEach(function(_0x20c45e, _0x14d0b2) { - var _0x57ec9c = null; - _0x20c45e ? (_0x378b5c.connection.peers[_0x20c45e] ? _0x57ec9c = _0x378b5c.connection.peers[_0x20c45e].extra : _0x378b5c.connection.userid === _0x20c45e && (_0x57ec9c = _0x378b5c.connection.extra), _0xa88a13 += '
    • ' .concat(_0x14d0b2 + 0x1, '. ').concat(_0x57ec9c.name, '
    • ')) : _0xa88a13 += '
    • ' .concat(_0x14d0b2 + 0x1, '.
    • '); - }), _0xa88a13 += '
    ', _0x17edbf.elements.widgets.netplay.innerHTML = _0xa88a13; - }, 0x1f4); - var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-9de6c4e9ce2b9361'), - _0x36bde0 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-85cd7a1c543a484a'), - _0x5289c1 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-7d8fd50ed642340b'), - _0x325651 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-5aa765d61d8327de'), - _0x3d0d28 = {}; - _0x378b5c.connection = new _0x4a2390.a(); - var _0x10d51e = 'wss://ws.emulatorjs.com/'; - _0x378b5c.connection.socketURL = '/', _0x378b5c.connection.socketURL = _0x10d51e, _0x378b5c.connection.socketMessageEvent = 'emulatorjs-message', _0x378b5c.connection.socketCustomEvent = 'emulatorjs-custom-message'; - var _0xda20e9 = _0x59aa33.info(); - _0x378b5c.connection.extra = { - 'name': _0x378b5c.playerName, - 'game_id': _0x17edbf.config.gameId, - 'browser_name': _0xda20e9.name, - 'room_name': ' ', - 'domain': document.domain - }, _0x378b5c.connection.socketMessageEvent = 'netplay', _0x378b5c.connection.enableFileSharing = true, _0x378b5c.connection.enableLogs = !0x1, _0x378b5c.connection.session = { - 'data': true - }, _0x378b5c.connection.sdpConstraints.mandatory = { - 'OfferToReceiveAudio': !0x1, - 'OfferToReceiveVideo': !0x1 - }, _0x378b5c.connection.onclose = function(_0x4fec07) {}, _0x378b5c.connection.iceServers = [{ - 'urls': 'turn:turn.emulatorjs.com:3478', - 'credential': 'dSnmrtehverella', - 'username': 'ejs' - }, { - 'urls': ['stun:stun.l.google.com:19302', 'stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302', 'stun:stun.l.google.com:19302?transport=udp'] - }], _0x378b5c.connection.maxParticipantsAllowed = 0x4, _0x378b5c.netPlayInitFrame = 0x0; - var _0x1eb137 = 0x0, - _0x52eb7d = !0x1; - Module.postMainLoop = function() { - var _0xa88a13; - if (_0x378b5c.currentFrame = parseInt(_0x378b5c.currentFrameNum(), 0xa), _0x378b5c.connected) - if (_0x1eb137 += 0x1, _0x378b5c.connection.isInitiator) _0x1eb137 >= 0x1 && function() { - for (var _0xa88a13 = [], _0x17edbf = _0x378b5c.currentFrame - 0x1; _0x17edbf < _0x378b5c.currentFrame; _0x17edbf += 0x1) _0x378b5c.inputsData[_0x17edbf] ? _0x378b5c.inputsData[_0x17edbf].forEach(function(_0x2a02da, _0x1b2066) { - _0xa88a13.push('' .concat(_0x2a02da.index, '|').concat(_0x2a02da.key, '|').concat(_0x2a02da.status, '|').concat(_0x2a02da.frame)); - }) : _0xa88a13.push('-1|||' .concat(_0x17edbf)); - _0x378b5c.connection.send(JSON.stringify({ - 'act': 'sync-control', - 'value': _0xa88a13 - })), _0x1eb137 = 0x0, _0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3125e4, _0x31ea67) { - _0x3125e4 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3125e4] = null, delete _0x378b5c.inputsData[_0x3125e4]); - }); - }(); - else { - if (_0x378b5c.coreOptionData[_0x378b5c.currentFrame]) { - var _0x2c1832 = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].key, - _0x4fd0cc = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].value; - _0x2593da.updateCoreOptions.call(_0x17edbf, _0x2c1832, _0x4fd0cc), delete _0x378b5c.coreOptionData[_0x378b5c.currentFrame]; - } - 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) { - _0x4bb42f.index >= 0x0 && _0x378b5c.simulateInputFn(_0x4bb42f.index, _0x4bb42f.key, _0x4bb42f.status); - }); - else { - _0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(); - var _0x3a10d1 = !0x1, - _0x42763c = Object.keys(_0x378b5c.inputsData); - 0x0 == _0x42763c.length && (_0x3a10d1 = true); - for (var _0x58af15 = 0x0; _0x58af15 < _0x42763c.length; _0x58af15 += 0x1) { - if (_0x42763c[_0x58af15] > _0x378b5c.currentFrame) { - console.log('lost', _0x378b5c.currentFrame), _0x3a10d1 = true; - break; - } - } - _0x3a10d1 ? _0x378b5c.wait || (!_0x52eb7d || _0x52eb7d < new Date().valueOf() - 0xbb8) && (_0x378b5c.inputsData = {}, _0x52eb7d = new Date().valueOf(), _0x378b5c.connection.send(JSON.stringify({ - 'act': 'sync-mem', - 'value': _0x378b5c.connection.userid - }), _0x378b5c.roomMaster)) : (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop()); - } - _0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3aa393, _0x3a7829) { - _0x3aa393 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3aa393] = null, delete _0x378b5c.inputsData[_0x3aa393]); - }); - } - }, _0x378b5c.connection.onopen = function(_0x4b10d6) { - _0x378b5c.connected = true, _0x378b5c.connection.isInitiator && (-0x1 === _0x378b5c.players.indexOf(_0x4b10d6.userid) && (_0x378b5c.players.filter(function(_0x3eafb3, _0xabd7b7) { - return null == _0x3eafb3; - }).length > 0x0 ? _0x378b5c.players.forEach(function(_0xbf0f19, _0xa9d540) { - null != _0xbf0f19 || _0x378b5c.players.includes(_0x4b10d6.userid) || (_0x378b5c.players[_0xa9d540] = _0x4b10d6.userid); - }) : _0x378b5c.players.push(_0x4b10d6.userid)), _0x378b5c.connection.send(JSON.stringify({ - 'act': 'get-players-result', - 'value': _0x378b5c.players, - 'coreOptions': _0x2593da.coreOptionsValues, - 'newuser': _0x4b10d6.userid, - 'master': _0x378b5c.connection.userid - }))), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf); - }, _0x378b5c.connection.onFileStart = function(_0x50eb3a) { - var _0x2c1832 = _0x50eb3a.name.split('-'); - '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 = {}; - }, _0x378b5c.connection.onFileProgress = function(_0x44a04b) { - var _0x17edbf = _0x378b5c.progressHelper[_0x44a04b.remoteUserId]; - _0x17edbf.current = _0x44a04b.currentPosition || _0x44a04b.maxChunks || _0x17edbf.max; - }, _0x378b5c.connection.onFileEnd = function(_0x45d454) { - _0x378b5c.hideLoading.call(_0x17edbf); - var _0x2c1832 = _0x45d454.name.split('-'), - _0x3795d9 = _0x2c1832[0x0] >> 0x0; - '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, { - 'responseType': 'arraybuffer' - }).then(function(_0x37db4c) { - _0x378b5c.inputsData = {}; - var _0x2c1832 = new Uint8Array(_0x37db4c.data); - _0x378b5c.loadState(_0x2c1832, _0x3795d9), _0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1, _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop(); - })) : '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, { - 'responseType': 'arraybuffer' - }).then(function(_0x4d241b) { - var _0x2c1832 = new Uint8Array(_0x4d241b.data); - _0x378b5c.loadState(_0x2c1832, _0x3795d9), _0x378b5c.wait = !0x1, _0x378b5c.disableInput = !0x1, _0x378b5c.connection.send(JSON.stringify({ - 'act': 'wait-end', - 'value': _0x378b5c.connection.userid - })), _0x378b5c.hideLoading.call(_0x17edbf), _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop(); - }))), _0x378b5c.connection.isInitiator || console.log('recv mem end', _0x378b5c.currentFrame, _0x45d454.name); - }; - var _0x3bdb35 = !0x1; - _0x378b5c.connection.onmessage = function(_0x32e81a) { - var _0x2c1832, _0x2dca58 = _0x32e81a.data || _0x32e81a; - try { - _0x2c1832 = JSON.parse(_0x2dca58); - } catch (_0x3fb9cc) { - _0x2c1832 = null; - } - if (_0x2c1832) { - 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() { - _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1; - }, 0x30))), 'sync-control' === _0x2c1832.act) { - var _0xb051c1 = _0x2c1832.value; - _0x17edbf.playing || _0x378b5c.wait; - var _0x2ef644 = _0x378b5c.connection.userid; - _0x378b5c.players.indexOf(_0x2ef644); - _0x378b5c.connection.isInitiator, _0xb051c1.forEach(function(_0x308105, _0x383237) { - var _0x2c1832 = _0x308105.split('|'), - _0x25a5c4 = _0x2c1832[0x0] >> 0x0, - _0x2b3afd = _0x2c1832[0x1] >> 0x0, - _0x4f5761 = _0x2c1832[0x2] >> 0x0, - _0x249303 = _0x2c1832[0x3] >> 0x0, - _0x54e0fd = _0x378b5c.currentFrame; - _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({ - 'index': _0x25a5c4, - 'key': _0x2b3afd, - 'status': _0x4f5761, - 'frame': _0x54e0fd - }), _0x378b5c.simulateInputFn(_0x25a5c4, _0x2b3afd, _0x4f5761)), _0x3bdb35 || _0x54e0fd - 0xa >= _0x249303 && (_0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x3bdb35 = true, _0x378b5c.wait = true, setTimeout(function() { - _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1; - }, 0x30))) : ('' !== _0x25a5c4 && _0x378b5c.inputsData[_0x249303].push({ - 'index': _0x25a5c4, - 'key': _0x2b3afd, - 'status': _0x4f5761, - 'frame': _0x249303 - }), _0x378b5c.inputsData[_0x378b5c.currentFrame] && _0x27f4c4.Module.resumeMainLoop(), _0x54e0fd + 0xa <= _0x249303 && _0x249303 > _0x378b5c.netPlayInitFrame + 0x64 && _0x378b5c.connection.send(JSON.stringify({ - 'act': 'short-pause', - 'value': _0x2ef644 - }), _0x378b5c.roomMaster)); - }); - } - if (_0x2c1832.act, _0x2c1832.act, 'update-core-option' === _0x2c1832.act && (_0x378b5c.connection.isInitiator || (_0x378b5c.coreOptionData[_0x2c1832.frame] = { - 'key': _0x2c1832.key, - 'value': _0x2c1832.value - })), 'restart-game' === _0x2c1832.act && (_0x378b5c.inputsData = {}, _0x378b5c.connection.send(JSON.stringify({ - 'act': 'sync-mem', - 'value': _0x378b5c.connection.userid - }), _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) { - _0x378b5c.wait = true, _0x378b5c.systemPause(0x1); - var _0x2a5bce = _0x2c1832.value; - _0x378b5c.disableControl(true), _0x378b5c.connection.send(JSON.stringify({ - 'act': 'wait', - 'value': _0x2a5bce - })); - for (var _0x8624ae = _0x378b5c.getStateInfo().split('|'), _0x99810a = _0x8624ae[0x0] >> 0x0, _0x96975a = new Uint8Array(_0x99810a), _0x4aea80 = _0x8624ae[0x1] >> 0x0, _0x2d2ba0 = 0x0; _0x2d2ba0 < _0x99810a; _0x2d2ba0 += 0x1) _0x96975a[_0x2d2ba0] = _0x27f4c4.Module.getValue(_0x4aea80 + _0x2d2ba0); - _0x27f4c4.FS.createDataFile('/', 'game.state', _0x96975a, true, true), _0x27f4c4.Module.cwrap('load_state', 'number', ['string', 'number'])('game.state', 0x0), _0x27f4c4.FS.unlink('game.state'), _0x378b5c.inputsData = {}; - var _0x49054f = new File([_0x96975a], '' .concat(0x0, '-game.state'), { - 'type': '', - 'lastModified': new Date() - }); - _0x378b5c.connection.shareFile(_0x49054f, _0x2a5bce); - } - if (_0x2c1832.act, 'get-players-result' === _0x2c1832.act && (_0x378b5c.players = _0x2c1832.value, _0x378b5c.roomMaster = _0x2c1832.master, _0x2c1832.newuser === _0x378b5c.connection.userid)) { - var _0x418ccb = _0x2593da.coreOptionsValues; - _0x2c1832.coreOptions && Object.keys(_0x2c1832.coreOptions).forEach(function(_0x3f4c8f) { - _0x418ccb[_0x3f4c8f] !== _0x2c1832.coreOptions[_0x3f4c8f] && _0x2593da.updateCoreOptions.call(_0x17edbf, _0x3f4c8f, _0x2c1832.coreOptions[_0x3f4c8f]); - }), _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.disableControl(true), setTimeout(function() { - _0x378b5c.connection.send(JSON.stringify({ - 'act': 'sync-mem', - 'value': _0x378b5c.connection.userid - }), _0x378b5c.roomMaster); - }, 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); - } - } - }, _0x378b5c.connection.onUserStatusChanged = function(_0x4188ba) { - if ('offline' === _0x4188ba.status) { - var _0x17edbf = _0x378b5c.players.indexOf(_0x4188ba.userid); - _0x17edbf >= 0x0 && (_0x378b5c.players[_0x17edbf] = null); - } - _0x4188ba.status; - }, _0x378b5c.connection.onExtraDataUpdated = function(_0x20ce61) { - _0x20ce61.userid === _0x378b5c.connection.userid && (_0x378b5c.connection.extra = _0x20ce61.extra); - }, _0x378b5c.connection.onleave = function(_0x30ebc6) { - if (_0x30ebc6.userid) { - var _0x2c1832 = _0x378b5c.players.indexOf(_0x30ebc6.userid); - _0x2c1832 >= 0x0 && (_0x378b5c.players[_0x2c1832] = null); - } - _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({ - 'act': 'wait-end', - 'value': _0x378b5c.connection.userid - }))), _0x378b5c.openRoom(_0x17edbf), _0x378b5c.inputsData = {}, _0x378b5c.hideLoading.call(_0x17edbf); - }; - var _0x2fba43 = function() { - try { - _0x378b5c.connection.onbeforeunload(); - } catch (_0xac619d) {} - _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) { - _0x132da7(_0x3d296d, !0x1); - }), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf); - }; - _0x378b5c.connection.close = _0x2fba43, _0x378b5c.connection.disconnect = _0x2fba43, _0x378b5c.connection.leave = _0x2fba43; - var _0x3f9c57, _0x10c0ad = function(_0x42ff74, _0x306f0b, _0x345d4d) { - _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) { - _0x132da7(_0x2911fb, true); - }), _0x378b5c.connection.socket && _0x378b5c.connection.socket.on('set-isInitiator-true', function(_0x31da46) { - _0x31da46 === _0x378b5c.connection.sessionid && (_0x378b5c.connection.socket.emit('extra-data-updated', _0x378b5c.connection.extra), _0x378b5c.connection.send(JSON.stringify({ - 'act': 'room-master', - 'value': _0x378b5c.connection.userid - })), _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) { - _0x132da7(_0x132034, !0x1); - })); - })) : (_0x4d8495.close(), _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = _0x345d4d, _0x4d8495.show('modal-7d8fd50ed642340b', { - 'closeTrigger': 'data-modal-close' - })); - }, - _0x1e0cdb = function(_0x5b3f13) { - var _0x2c1832 = _0x5b3f13.target.getAttribute('data-id'); - if ('Y' === _0x5b3f13.target.getAttribute('data-password')) _0x4d8495.show('modal-5aa765d61d8327de', { - 'closeTrigger': 'data-modal-close' - }), _0x325651.setAttribute('data-id', _0x2c1832); - else { - _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.userid = _0x378b5c.connection.token(); - try { - _0x378b5c.connection.join(_0x2c1832, _0x10c0ad); - } catch (_0x2767b9) { - _0x378b5c.hideLoading.call(_0x17edbf), _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = 'Error', _0x4d8495.show('modal-7d8fd50ed642340b', { - 'closeTrigger': 'data-modal-close' - }); - } - } - return _0x5b3f13.stopPropagation(), !0x1; - }; - _0x378b5c.loadRoomsList = function() { - _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), true), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), true); - var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])).querySelector('tbody'), - _0x5cf2be = ['htt', 'ps://ws.emulatorjs.com/list?game_id=', _0x17edbf.config.gameId, '&domain=', document.domain].join(''); - _0x550f17.a.get(_0x5cf2be, {}).then(function(_0x37c60b) { - if (_0x37c60b.data) { - var _0x4782da = [], - _0x28e87d = []; - _0x2c1832.querySelectorAll('tr').forEach(function(_0x1e5a22) { - _0x28e87d.push(_0x1e5a22.getAttribute('id')); - }), Object.keys(_0x37c60b.data).forEach(function(_0x47ae0e) { - var _0x4a8f4c = _0x37c60b.data[_0x47ae0e]; - if (_0x4782da.push(_0x47ae0e), _0x28e87d.includes(_0x47ae0e)) { - var _0x2d672f = _0x2c1832.querySelector('tr[id="' .concat(_0x47ae0e, '"]')); - _0x2c1832.removeChild(_0x2d672f); - } - var _0x295f41 = document.createElement('tr'); - _0x295f41.setAttribute('id', _0x47ae0e); - var _0xa2ea61 = _0x4a8f4c.password ? _0x378b5c.icons.lock : '', - _0x5452b6 = _0x4a8f4c.password ? 'Y' : 'N', - _0xb3121d = _0x4a8f4c.current < _0x4a8f4c.max ? 'Join') : '', - _0x5c8146 = _0x4a8f4c.country ? _0x4a8f4c.country : '?'; - _0x295f41.innerHTML = '[' .concat(_0x5c8146, '] ').concat(_0xa2ea61, ' ').concat(_0x4a8f4c.room_name, '').concat(_0x4a8f4c.current, '/').concat(_0x4a8f4c.max, '').concat(_0xb3121d, ''), _0x1093f4.call(_0xa88a13, _0x295f41.querySelector('.' .concat(_0x378b5c.classNames['btn-join-room'])), 'click', _0x1e0cdb), _0x2c1832.appendChild(_0x295f41); - }), _0x2c1832.querySelectorAll('tr').forEach(function(_0x24dcf7) { - _0x4782da.includes(_0x24dcf7.id) || _0x2c1832.removeChild(_0x24dcf7); - }); - } - _0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0); - }).catch(function(_0x227055) { - console.log('Network Error', _0x227055), _0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0); - }); - }, _0x378b5c.openRoom = function(_0x10625f) { - _0x378b5c.stopLoadRooms(), _0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), true), _0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), !0x1), _0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), true), _0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), !0x1), _0x378b5c.resetCheat(), _0x132da7(_0x10625f.elements.buttons.cheat, true); - var _0x17edbf = _0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), - _0x2c1832 = _0x17edbf.querySelector('p[data-room-password]'); - null === _0x378b5c.connection.password ? _0x132da7(_0x2c1832, true) : (_0x132da7(_0x2c1832, !0x1), _0x2c1832.querySelector('span').innerText = _0x378b5c.connection.password); - var _0x18c1cb = _0x17edbf.querySelector('tbody'); - _0x18c1cb.innerHTML = '', _0x17edbf.querySelector('strong').innerText = _0x3d0d28.room_name, _0x378b5c.players.forEach(function(_0x938d55, _0xf3d39a) { - var _0x2c1832 = null; - if (_0x938d55 && (_0x378b5c.connection.peers[_0x938d55] ? _0x2c1832 = _0x378b5c.connection.peers[_0x938d55].extra : _0x378b5c.connection.userid === _0x938d55 && (_0x2c1832 = _0x378b5c.connection.extra), _0x2c1832 && _0x2c1832.name)) { - var _0x564064 = document.createElement('tr'); - _0x564064.innerHTML = '' .concat(_0xf3d39a + 0x1, '').concat(_0x2c1832.name, ''), _0x18c1cb.appendChild(_0x564064); - } - }); - }, _0x1093f4.call(this, _0x325651.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x9ac969) { - var _0x2c1832 = _0x325651.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value; - _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.password = _0x2c1832; - var _0xcf7207 = _0x325651.getAttribute('data-id'); - _0x378b5c.connection.join(_0xcf7207, function(_0x1a0deb, _0x1ef6c8, _0x1ad18e) { - _0x10c0ad(_0x1a0deb, 0x0, _0x1ad18e), _0x1a0deb && _0x325651.classList.remove(_0x449eac({ - 'is-open': true - })); - }), _0x9ac969.stopPropagation(); - }), _0x1093f4.call(this, _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x43f795) { - var _0x17edbf = _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['netplay-player-name'])).value; - _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(); - }), _0x1093f4.call(this, _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x202cf6) { - var _0x2c1832 = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-name-input'])).value; - _0x2c1832 = _0x2c1832.replace(/<|>/g, ''); - var _0x3510ed = _0x36bde0.querySelector('select[data-max-players] option:checked').value; - _0x3510ed < 0x2 && (_0x3510ed = 0x2), _0x3510ed > 0x4 && (_0x3510ed = 0x4); - for (var _0x1264b2 = 0x0; _0x1264b2 < _0x3510ed; _0x1264b2++) _0x378b5c.players[_0x1264b2] = null; - _0x378b5c.connection.maxParticipantsAllowed = _0x3510ed; - var _0x140bcf = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value; - _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) { - _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; - })) : _0x3f9c57.closeModal(), _0x202cf6.stopPropagation(); - }), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), 'click', function(_0x48cb26) { - return _0x3f9c57 = _0x4d8495.show('modal-85cd7a1c543a484a', { - 'closeTrigger': 'data-modal-close', - 'onClose': function() { - _0x17edbf.elements.container.focus(); - } - }), _0x48cb26.stopPropagation(), !0x1; - }), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), 'click', function(_0x68459d) { - return _0x378b5c.connection.close(), _0x378b5c.stopLoadRooms(), _0x378b5c.loadRoomsList(), _0x378b5c.inputsData = {}, _0x68459d.stopPropagation(), !0x1; - }); - } - window._0x378b5c = _0x378b5c - }, - 'initKeyboard': function() { - var _0xa88a13 = this, - _0x17edbf = this, - _0x2c1832 = this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay)); - _0x1093f4.call(this, document.body, 'keydown keyup', function(_0x459b32) { - if (_0x459b32.which >= 0x70 && _0x459b32.which <= 0x7b); - else { - var _0x335c01 = !_0xa88a13.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden, - _0x2eb03e = 'keydown' === _0x459b32.type; - if (_0x2eb03e && _0x335c01) { - var _0x1a3a47 = _0x2c1832.getAttribute('data-index'), - _0x1394cb = _0x2c1832.getAttribute('data-id'), - _0x2c8fd1 = null; - if (_0x459b32.key && _0x378b5c.keyMap[_0x459b32.keyCode] === 'escape') { - (_0x2c8fd1 = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1394cb, '"][data-index="').concat(_0x1a3a47, '"][data-type="1"]'))).setAttribute('data-value', '') - _0x2c8fd1.value = '' - _0x132da7(_0x2c1832, true); - return; - }; - var _0x1a3a47 = _0x2c1832.getAttribute('data-index'), - _0x1394cb = _0x2c1832.getAttribute('data-id'), - _0x2c8fd1 = null; - _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); - } else Object.keys(_0x378b5c.controllers).forEach(function(_0x3863d2) { - Object.keys(_0x378b5c.controllers[_0x3863d2]).forEach(function(_0x509939) { - if (parseInt(_0x378b5c.controllers[_0x3863d2][_0x509939].value, 0xa) === _0x459b32.keyCode && ['24', '25', '26'].includes(_0x509939) && _0x459b32.type == 'keydown' && ! _0x459b32.repeat) { - if (_0x509939 == '24') {//save - _0x378b5c.quickSaveState() - } else if (_0x509939 == '25') {//load - _0x378b5c.quickLoadState() - } else if (_0x509939 == '26') {//load - _0x378b5c.changeStateSlot() - } - // quick save/load button - } - parseInt(_0x378b5c.controllers[_0x3863d2][_0x509939].value, 0xa) === _0x459b32.keyCode && (_0x2eb03e ? _0x509939 >= 0x10 && _0x509939 <= 0x17 ? _0x378b5c.simulateInput(_0x3863d2, _0x509939, 0x7fff) : _0x378b5c.simulateInput(_0x3863d2, _0x509939, 0x1) : _0x378b5c.simulateInput(_0x3863d2, _0x509939, 0x0)); - }); - }); - } - }), document.body.addEventListener('keydown', function(_0x14d612) { - var _0x2c1832 = _0x14d612.keyCode ? _0x14d612.keyCode : _0x14d612.which; - [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(); - }); - }, - 'initGamepad': function() { - var _0xa88a13 = this, - _0x17edbf = this, - _0x2c1832 = this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay)), - _0x181250 = new _0x4ad1c6[('Gamepad')](); - _0x378b5c.gamepad = _0x181250, _0x181250.init() && (_0x181250.bind(_0x4ad1c6.Gamepad.Event.TICK, function(_0x2fe35d) { - _0x2fe35d.forEach(function(_0x2b21f8) { - var _0x17edbf; - _0x2b21f8 && _0x2b21f8.axes && _0x2b21f8.axes[0x9] && ((_0x17edbf = _0x2b21f8.axes[0x9]) < 3.28571 ? 0x1 == _0x17edbf ? (_0x2b21f8.extra_buttons[0xc].pressed || (_0x2b21f8.extra_buttons[0xc] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xc, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })), _0x2b21f8.extra_buttons[0xe].pressed || (_0x2b21f8.extra_buttons[0xe] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xe, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - }))) : _0x17edbf <= -0.7142857 && _0x17edbf >= -0.714291 ? (_0x2b21f8.extra_buttons[0xc].pressed || (_0x2b21f8.extra_buttons[0xc] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xc, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })), _0x2b21f8.extra_buttons[0xf].pressed || (_0x2b21f8.extra_buttons[0xf] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xf, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - }))) : _0x17edbf >= 0.42856 && _0x17edbf <= 0.42858 ? (_0x2b21f8.extra_buttons[0xd].pressed || (_0x2b21f8.extra_buttons[0xd] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xd, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })), _0x2b21f8.extra_buttons[0xe].pressed || (_0x2b21f8.extra_buttons[0xe] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xe, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - }))) : _0x17edbf >= -0.14287 && _0x17edbf <= -0.14285 ? (_0x2b21f8.extra_buttons[0xd].pressed || (_0x2b21f8.extra_buttons[0xd] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xd, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })), _0x2b21f8.extra_buttons[0xf].pressed || (_0x2b21f8.extra_buttons[0xf] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xf, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - }))) : _0x17edbf <= -0x1 && _0x17edbf >= -1.01 ? _0x2b21f8.extra_buttons[0xc].pressed || (_0x2b21f8.extra_buttons[0xc] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xc, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })) : _0x17edbf >= 0.142857 && _0x17edbf <= 0.142858 ? _0x2b21f8.extra_buttons[0xd].pressed || (_0x2b21f8.extra_buttons[0xd] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xd, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })) : _0x17edbf >= 0.7142857 && _0x17edbf <= 0.7142858 ? _0x2b21f8.extra_buttons[0xe].pressed || (_0x2b21f8.extra_buttons[0xe] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xe, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })) : _0x17edbf <= -0.42857 && _0x17edbf >= -0.42858 && (_0x2b21f8.extra_buttons[0xf].pressed || (_0x2b21f8.extra_buttons[0xf] = { - 'pressed': true, - 'value': 0x1 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, { - 'index': 0xf, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - }))) : (_0x2b21f8.extra_buttons[0xc].pressed && (_0x2b21f8.extra_buttons[0xc] = { - 'pressed': !0x1, - 'value': 0x0 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, { - 'index': 0xc, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })), _0x2b21f8.extra_buttons[0xd].pressed && (_0x2b21f8.extra_buttons[0xd] = { - 'pressed': !0x1, - 'value': 0x0 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, { - 'index': 0xd, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })), _0x2b21f8.extra_buttons[0xe].pressed && (_0x2b21f8.extra_buttons[0xe] = { - 'pressed': !0x1, - 'value': 0x0 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, { - 'index': 0xe, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })), _0x2b21f8.extra_buttons[0xf].pressed && (_0x2b21f8.extra_buttons[0xf] = { - 'pressed': !0x1, - 'value': 0x0 - }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, { - 'index': 0xf, - 'gamepad': _0x2b21f8, - 'gamepadIndex': _0x2b21f8.index - })))); - }); - }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, function(_0x15761a) { - if (!_0xa88a13.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden) { - var _0x387018, _0xdd4205 = parseInt(_0x2c1832.getAttribute('data-index'), 0xa), - _0x1f4ee2 = _0x2c1832.getAttribute('data-id'); - if (_0x15761a.gamepad.index === parseInt(_0xdd4205, 0xa)) { - for (var _0x211087 = 0x0; _0x211087 < 0x20 && ((_0x387018 = _0x15761a.gamepad.buttons[_0x211087]) || (_0x387018 = _0x15761a.gamepad.extra_buttons[_0x211087]), !_0x387018 || !('number' == typeof _0x387018 && 0x1 === _0x387018 || 'number' == typeof _0x387018.value && 0x1 === _0x387018.value)); _0x211087 += 0x1); - var _0x126d2d = null; - (_0x126d2d = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1f4ee2, '"][data-index="').concat(_0xdd4205, '"][data-type="2"]'))).setAttribute('data-value', _0x15761a.index), _0x126d2d.value = 'button ' .concat(_0x15761a.index + 0x1), _0x132da7(_0x2c1832, true); - } - } else Object.keys(_0x378b5c.controllers[_0x15761a.gamepad.index.toString()]).forEach(function(_0x3cf4d3) { - var _0x5cf388 = _0x15761a.gamepad.index.toString(); - if (parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(_0x15761a.index, 0xa) && ['24', '25', '26'].includes(_0x3cf4d3)) { - if (_0x3cf4d3 == '24') {//save - _0x378b5c.quickSaveState() - } else if (_0x3cf4d3 == '25') {//load - _0x378b5c.quickLoadState() - } else if (_0x3cf4d3 == '26') {//load - _0x378b5c.changeStateSlot() - } - } - parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(_0x15761a.index, 0xa) && parseInt(_0x5cf388, 0xa) === parseInt(_0x15761a.gamepad.index, 0xa) && _0x378b5c.simulateInput(_0x5cf388, _0x3cf4d3, 0x1); - }); - }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.BUTTON_UP, function(_0x3220b3) { - Object.keys(_0x378b5c.controllers).forEach(function(_0x302c3e) { - Object.keys(_0x378b5c.controllers[_0x302c3e]).forEach(function(_0x14eb8a) { - parseInt(_0x378b5c.controllers[_0x302c3e][_0x14eb8a].value2, 0xa) === parseInt(_0x3220b3.index, 0xa) && parseInt(_0x302c3e, 0xa) === parseInt(_0x3220b3.gamepad.index, 0xa) && _0x378b5c.simulateInput(_0x302c3e, _0x14eb8a, 0x0); - }); - }); - }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.AXIS_CHANGED, function(_0x31f017) { - if (!_0xa88a13.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden) { - if (parseInt(_0x31f017.value) !== 0) { - var _0x1f4ee2 = _0x2c1832.getAttribute('data-id'), - _0xdd4205 = parseInt(_0x2c1832.getAttribute('data-index'), 0xa); - var _0x126d2d = _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1f4ee2, '"][data-index="').concat(_0xdd4205, '"][data-type="2"]')) - _0x126d2d.setAttribute('data-value', _0x31f017.axis + ':' + _0x31f017.value) - _0x126d2d.value = _0x31f017.axis + ':' + _0x31f017.value - _0x132da7(_0x2c1832, true) - } - } else { - if (! _0x378b5c.prevButtons) { - _0x378b5c.prevButtons = {} - } - var quit = false - var _0x5cf388 = _0x31f017.gamepad.index.toString(); - if (! _0x378b5c.prevButtons[_0x5cf388]) { - _0x378b5c.prevButtons[_0x5cf388] = {} - } - if (! _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis]) { - _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis] = 0 - } - if (! _0x378b5c.prevButtons[_0x5cf388].buttonID) { - _0x378b5c.prevButtons[_0x5cf388].buttonID = 0 - } - for (var w=0; w 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x10, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x11, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x11, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x10, 0x0))), 'LEFT_STICK_Y' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x12, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x13, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x13, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x12, 0x0))), 'RIGHT_STICK_X' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x14, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x15, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x15, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x14, 0x0))), 'RIGHT_STICK_Y' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x16, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x17, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x17, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x16, 0x0))); - }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.DISCONNECTED, function(_0x1c996a) { - [0x0, 0x1, 0x2, 0x3].forEach(function(_0x429f30) { - var _0x2c1832 = _0x181250.gamepads[_0x429f30]; - _0x17edbf.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x429f30, ' .gamepad-name')).innerHTML = _0x2c1832 ? _0x2c1832.id : 'n/a'; - }); - }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.CONNECTED, function(_0x748f24) { - Object.keys(_0x181250.gamepads).forEach(function(_0x327c74) { - var _0x2c1832 = _0x181250.gamepads[_0x327c74]; - _0x17edbf.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x327c74, ' .gamepad-name')).innerHTML = _0x2c1832 ? _0x2c1832.id : 'n/a'; - }); - })); - }, - 'setShader': function(_0x4cbec3) { - if ('disabled' === _0x4cbec3) _0x27f4c4.FS.unlink('/shader/shader.glslp', ''), _0x378b5c.toggleShader && _0x378b5c.toggleShader(0x0); - else { - _0x378b5c.toggleShader && _0x378b5c.toggleShader(0x0); - var _0x17edbf = '/shader/' .concat(_0x4cbec3); - _0x27f4c4.FS.writeFile('/shader/shader.glslp', function(_0x52407e) { - if (!(_0x52407e instanceof Int32Array)) throw new Error('uintArrayToString: Only accepts Int32Array parameter'); - for (var _0x17edbf = '', _0x2c1832 = 0x0, _0x4d451e = _0x52407e.length; _0x2c1832 < _0x4d451e; _0x2c1832 += 0x1) { - var _0x37c7b6 = _0x52407e[_0x2c1832]; - if (_0x37c7b6 > 0xffff) throw new Error('Invalid value attempted to be serialised'); - _0x17edbf += String.fromCharCode(_0x37c7b6); - } - return _0x17edbf; - }(new Int32Array(_0x27f4c4.FS.readFile(_0x17edbf)))), _0x378b5c.toggleShader && _0x378b5c.toggleShader(0x1); - } - }, - 'toggleVirtualGamepad': function(_0x1ed80b) { - var _0xa88a13 = this; - if (null === _0x378b5c.virtualGamepadContainer) { - _0x378b5c.virtualGamepadContainer = _0x428003('div', { - 'class': _0x449eac({ - 'ejs-virtual-gamepad': true - }), - 'hidden': '' - }), this.elements.container.appendChild(_0x378b5c.virtualGamepadContainer), _0x378b5c.virtualGamepadContainer.innerHTML = '\n
    \n
    \n
    L
    \n
    R
    \n
    \n
    \n
    \n
    SELECT
    \n
    START
    \n
    MENU
    \n
    \n
    \n
    A
    \n
    B
    \n
    X
    \n
    Y
    \n
    \n
    '), _0x132da7(_0x378b5c.virtualGamepadContainer, !_0x1ed80b); - var _0x17edbf = _0x3a58c8.a.create({ - 'zone': _0x530042.call(this, '.' .concat(_0x449eac({ - 'ejs-virtual-gamepad': true - }), ' .').concat(_0x449eac({ - 'left': true - }))), - 'mode': 'static', - 'position': { - 'left': '50%', - 'top': '50%' - }, - 'color': 'red' - }); - _0x17edbf.on('end', function(_0x27f006, _0x1fb527) { - _0x378b5c.syncInput(0x0, 0x4, 0x0), _0x378b5c.syncInput(0x0, 0x5, 0x0), _0x378b5c.syncInput(0x0, 0x6, 0x0), _0x378b5c.syncInput(0x0, 0x7, 0x0); - }), _0x17edbf.on('move', function(_0x1b060e, _0x4ae7d6) { - var _0x2c1832 = _0x4ae7d6.angle.degree; - _0x2c1832 >= 0x1e && _0x2c1832 < 0x96 ? _0x378b5c.syncInput(0x0, 0x4, 0x1) : window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x4, 0x0); - }, 0x1e), _0x2c1832 >= 0xd2 && _0x2c1832 < 0x14a ? _0x378b5c.syncInput(0x0, 0x5, 0x1) : window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x5, 0x0); - }, 0x1e), _0x2c1832 >= 0x78 && _0x2c1832 < 0xf0 ? _0x378b5c.syncInput(0x0, 0x6, 0x1) : window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x6, 0x0); - }, 0x1e), _0x2c1832 >= 0x12c || _0x2c1832 >= 0x0 && _0x2c1832 < 0x3c ? _0x378b5c.syncInput(0x0, 0x7, 0x1) : window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x7, 0x0); - }, 0x1e); - }); - var _0x2c1832 = _0x449eac({ - 'virtual-gamepad': true - }), - _0x2ec721 = _0x449eac({ - 'touch': true - }); - _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832)), 'touchmove', function(_0x2ae626) { - _0x2ae626.stopPropagation(); - }), _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ - 'b_a': true - }))), 'touchstart touchend', function(_0x185083) { - 'touchend' === _0x185083.type ? (_0x3a8e2f(_0x185083.target, _0x2ec721, !0x1), window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x8, 0x0); - }, 0x1e)) : (_0x3a8e2f(_0x185083.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x8, 0x1)), _0x185083.stopPropagation(); - }), _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ - 'b_b': true - }))), 'touchstart touchend', function(_0x213c3d) { - 'touchend' === _0x213c3d.type ? (_0x3a8e2f(_0x213c3d.target, _0x2ec721, !0x1), window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x0, 0x0); - }, 0x1e)) : (_0x3a8e2f(_0x213c3d.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x0, 0x1)), _0x213c3d.stopPropagation(); - }), _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ - 'b_x': true - }))), 'touchstart touchend', function(_0x5ce708) { - 'touchend' === _0x5ce708.type ? (_0x3a8e2f(_0x5ce708.target, _0x2ec721, !0x1), window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x9, 0x0); - }, 0x1e)) : (_0x3a8e2f(_0x5ce708.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x9, 0x1)), _0x5ce708.stopPropagation(); - }), _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ - 'b_y': true - }))), 'touchstart touchend', function(_0x1cfae6) { - 'touchend' === _0x1cfae6.type ? (_0x3a8e2f(_0x1cfae6.target, _0x2ec721, !0x1), window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x1, 0x0); - }, 0x1e)) : (_0x3a8e2f(_0x1cfae6.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x1, 0x1)), _0x1cfae6.stopPropagation(); - }), _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ - 'b_l': true - }))), 'touchstart touchend', function(_0x1a50ab) { - 'touchend' === _0x1a50ab.type ? (_0x3a8e2f(_0x1a50ab.target, _0x2ec721, !0x1), window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0xa, 0x0); - }, 0x1e)) : (_0x3a8e2f(_0x1a50ab.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0xa, 0x1)), _0x1a50ab.stopPropagation(); - }), _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ - 'b_r': true - }))), 'touchstart touchend', function(_0x3b8139) { - 'touchend' === _0x3b8139.type ? (_0x3a8e2f(_0x3b8139.target, _0x2ec721, !0x1), window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0xb, 0x0); - }, 0x1e)) : (_0x3a8e2f(_0x3b8139.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0xb, 0x1)), _0x3b8139.stopPropagation(); - }), _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ - 'b_start': true - }))), 'touchstart touchend', function(_0x47af91) { - 'touchend' === _0x47af91.type ? (_0x3a8e2f(_0x47af91.target, _0x2ec721, !0x1), window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x3, 0x0); - }, 0x1e)) : (_0x3a8e2f(_0x47af91.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x3, 0x1)), _0x47af91.stopPropagation(); - }), _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ - 'b_c': true - }))), 'touchstart touchend', function(_0x47af91) { - _0x5ab74d.toggleControls.call(_0xa88a13, true); - setTimeout(function() { - _0x5ab74d.toggleControls.call(_0xa88a13, false); - }, 5000) - }), _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832, ' .').concat(_0x449eac({ - 'b_select': true - }))), 'touchstart touchend', function(_0x37f594) { - 'touchend' === _0x37f594.type ? (_0x3a8e2f(_0x37f594.target, _0x2ec721, !0x1), window.setTimeout(function() { - _0x378b5c.syncInput(0x0, 0x2, 0x0); - }, 0x1e)) : (_0x3a8e2f(_0x37f594.target, _0x2ec721, true), _0x378b5c.syncInput(0x0, 0x2, 0x1)), _0x37f594.stopPropagation(); - }); - } else _0x132da7(_0x378b5c.virtualGamepadContainer, !_0x1ed80b); - }, - 'setup': function() { - var _0xa88a13 = this; - if (this.game) { - if (_0x378b5c.playerName = _0xa88a13.config.playerName, _0x3a8e2f(this.elements.container, this.config.classNames.type, true), this.elements.container.setAttribute('tabindex', '0'), this.color) { - var _0x17edbf = function(_0x175d8e) { - var _0x17edbf = _0x175d8e.toLowerCase(); - if (_0x17edbf && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/ .test(_0x17edbf)) { - if (0x4 === _0x17edbf.length) { - for (var _0x2c1832 = '#', _0x4c881f = 0x1; _0x4c881f < 0x4; _0x4c881f += 0x1) _0x2c1832 += _0x17edbf.slice(_0x4c881f, _0x4c881f + 0x1).concat(_0x17edbf.slice(_0x4c881f, _0x4c881f + 0x1)); - _0x17edbf = _0x2c1832; - } - for (var _0x5ac4ff = [], _0x324169 = 0x1; _0x324169 < 0x7; _0x324169 += 0x2) _0x5ac4ff.push(parseInt('0x' .concat(_0x17edbf.slice(_0x324169, _0x324169 + 0x2)), 0x10)); - return _0x5ac4ff; - } - return null; - }(this.color); - _0x17edbf && this.elements.container.setAttribute('style', '--ejs-primary-color: ' .concat(_0x17edbf[0x0], ', ').concat(_0x17edbf[0x1], ', ').concat(_0x17edbf[0x2])); - } - if (this.elements.wrapper = _0x428003('div', { - 'class': this.config.classNames.video - }), _0x580edd(this.game, this.elements.wrapper), 'video' !== _0xa88a13.game.tagName.toLocaleLowerCase()) { - var _0x2c1832 = this.config.volume; - Object.defineProperty(_0xa88a13.game, 'volume', { - 'get': function() { - return _0x2c1832; - }, - 'set': function(_0x4cca18) { - _0x2c1832 = _0x4cca18, _0xbae705.call(_0xa88a13, _0xa88a13.game, 'volumechange'); - } - }); - var _0x541fe1 = _0xa88a13.storage.get('muted'); - Object.defineProperty(_0xa88a13.game, 'muted', { - 'get': function() { - return _0x541fe1; - }, - 'set': function(_0x54b6e0) { - var _0x2c1832 = !!_0x1e2c68.boolean(_0x54b6e0) && _0x54b6e0; - _0x541fe1 = _0x2c1832, _0xbae705.call(_0xa88a13, _0xa88a13.game, 'volumechange'); - } - }); - } - window.addEventListener('beforeunload', function(_0x34b11a) { - if (_0xa88a13.started) { - var _0x2c1832 = _0xa88a13.startName.split('/').pop().split('.'), - _0x478412 = _0x2c1832.slice(0x0, _0x2c1832.length - 0x1).join('.'); - _0x27f4c4.FS.syncfs(function(_0x1026f5) {}); - try { - var _0x40d46a = 'srm'; - 'nds' === _0xa88a13.system && (_0x40d46a = 'dsv'), _0x27f4c4.FS.unlink('/data/saves/' .concat(_0x478412, '.').concat(_0x40d46a)); - } catch (_0x2c3bc8) { - console.log('fail to save'); - } - _0x378b5c.saveSavFiles(), _0x27f4c4.FS.syncfs(function(_0x2c4b20) {}); - } - }, true); - } else console.warn('No game element found!'); - }, - 'listeners': function() { - var _0xa88a13 = this; - _0xa88a13.elements.buttons.restart && _0x1093f4.call(_0xa88a13, _0xa88a13.elements.buttons.restart, 'click', function(_0x5cfc51) { - if (_0x378b5c.restartGame(), _0x378b5c.inputsData = {}, _0x378b5c.connected && _0x378b5c.connection.isInitiator) { - for (var _0x17edbf = _0x378b5c.getStateInfo().split('|'), _0x2c1832 = _0x17edbf[0x0] >> 0x0, _0x1036de = (_0x17edbf[0x2], new Uint8Array(_0x2c1832)), _0x532138 = _0x17edbf[0x1] >> 0x0, _0x5a4c27 = 0x0; _0x5a4c27 < _0x2c1832; _0x5a4c27 += 0x1) _0x1036de[_0x5a4c27] = _0x27f4c4.Module.getValue(_0x532138 + _0x5a4c27); - var _0x5a3d1a = new File([_0x1036de], '0-game.state', { - 'type': '', - 'lastModified': new Date() - }); - _0x378b5c.connection.shareFile(_0x5a3d1a), _0x378b5c.inputsData = {}, _0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x378b5c.disableControl(true); - } - }), _0xa88a13.elements.buttons.screenRecord && _0x1093f4.call(_0xa88a13, _0xa88a13.elements.buttons.screenRecord, 'click', function(_0x5cfc51) { - - if (! _0xa88a13.recordData) { - _0xa88a13.recordData = {started:false, data:[], stopped: false} - } - if (! _0xa88a13.recordData.started) { //start recording - _0xa88a13.elements.buttons.screenRecord.getElementsByClassName('ejs--74c6d4176d27e37a19d2e9e61de8f4')[0].innerHTML = 'Stop Screen Recording'; - if (MediaRecorder.isTypeSupported('video/webm; codecs=h264')) { - var options = {mimeType: 'video/webm; codecs=h264'}; // video/webm; codecs=h264,opus - } else if (MediaRecorder.isTypeSupported('video/webm; codecs=H264')) { - var options = {mimeType: 'video/webm; codecs=H264'}; - } else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp9')) { - var options = {mimeType: 'video/webm; codecs=vp9'}; - } else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp8')) { - var options = {mimeType: 'video/webm; codecs=vp8'}; - } else if (MediaRecorder.isTypeSupported('video/webm; codecs=avc1')) { - var options = {mimeType: 'video/webm; codecs=avc1'}; - } else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp9.0')) { - var options = {mimeType: 'video/webm; codecs=vp9.0'}; - } else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp8.0')) { - var options = {mimeType: 'video/webm; codecs=vp8.0'}; - } else { - var options = {}; - } - _0xa88a13.recordData.stream = _0x27f4c4.Module.canvas.captureStream(30); - _0xa88a13.recordData.recorder = new MediaRecorder(_0xa88a13.recordData.stream, options); - //_0xa88a13.recordData.recorder.addTrack() // TODO - find audio element - _0xa88a13.recordData.recorder.ondataavailable = function(e) { - if (e.data.size > 0) { - _0xa88a13.recordData.data.push(e.data) - } - if (_0xa88a13.recordData.stopped) { - var a = document.createElement("a") - a.href = window.URL.createObjectURL(new Blob(_0xa88a13.recordData.data, {type: "video/webm"})) - a.download = 'record.webm' - a.click() - window.URL.revokeObjectURL(a.href) - delete _0xa88a13.recordData - _0xa88a13.elements.buttons.screenRecord.getElementsByClassName('ejs--74c6d4176d27e37a19d2e9e61de8f4')[0].innerHTML = 'Start Screen Recording'; - } - } - _0xa88a13.recordData.recorder.start() - _0xa88a13.recordData.started = true - } else if (_0xa88a13.recordData.started) { //stop recording - _0xa88a13.recordData.recorder.stop() - _0xa88a13.recordData.stopped = true - } - - }), _0xa88a13.elements.buttons.play && Array.from(_0xa88a13.elements.buttons.play).forEach(function(_0x24495b) { - _0x1093f4.call(_0xa88a13, _0x24495b, 'click', function(_0x966382) { - _0xa88a13.playing ? (_0xa88a13.playing = !0x1, _0x27f4c4.Module.pauseMainLoop(), _0x378b5c.connected && _0x378b5c.connection.isInitiator && _0x378b5c.connection.send(JSON.stringify({ - 'act': 'pause' - })), _0xbae705.call(_0xa88a13, _0xa88a13.elements.container, 'pause', !0x1, { - 'pause': true - })) : (_0xa88a13.playing = true, _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.connected && _0x378b5c.connection.isInitiator && _0x378b5c.connection.send(JSON.stringify({ - 'act': 'resume' - })), _0xbae705.call(_0xa88a13, _0xa88a13.elements.container, 'pause', !0x1, { - 'pause': !0x1 - })); - }); - }), _0xa88a13.elements.buttons.netplay && _0x1093f4.call(_0xa88a13, _0xa88a13.elements.buttons.netplay, 'click', function(_0x2317b9) { - _0x378b5c.disableControl(true), _0x132da7(_0xa88a13.elements.dialogs.netplay, !0x1), _0x378b5c.players.length > 0x0 ? _0x378b5c.openRoom(_0xa88a13) : (_0x378b5c.stopLoadRooms(), _0x378b5c.loadRoomsList()), _0x378b5c.playerName || _0x4d8495.show('modal-9de6c4e9ce2b9361', { - 'closeByEsckey': !0x1 - }); - }), _0xa88a13.elements.buttons.cheat && _0x1093f4.call(_0xa88a13, _0xa88a13.elements.buttons.cheat, 'click', function(_0x44b01a) { - _0x132da7(_0xa88a13.elements.dialogs.cheat, !0x1); - }); - _0x1093f4.call(_0xa88a13, _0xa88a13.elements.container, 'savestate', function(_0x25b541) { - var _0x2c1832 = _0x25b541.detail.state; - if (_0x1e2c68.function(_0xa88a13.config.onsavestate)) _0xa88a13.config.onsavestate.call(null, { - 'screenshot': _0x25b541.detail.screenshot, - 'state': _0x2c1832 - }); - else { - var _0x2b5fc8 = new Blob([_0x2c1832]), - _0x152605 = _0xa88a13.startName.split('/').pop().split('.'), - _0x51d471 = _0x152605.slice(0x0, _0x152605.length - 0x1).join('.') - if (typeof _0xa88a13.gameName == 'string') { - var _0x51d471 = _0xa88a13.gameName - } - var _0x49f6b6 = _0x51d471 ? '' .concat(_0x51d471, '.state') : 'game.state'; - _0x4e4ca6()(_0x2b5fc8, _0x49f6b6); - } - _0xa88a13.elements.container.focus(); - }); - _0xa88a13.game.stateloadField = _0x428003('input'), _0xa88a13.game.stateloadField.type = 'file', _0xa88a13.game.stateloadField.onchange = function _0x17edbf(_0xcd4599) { - var _0xfd246e, _0x3fdd71 = _0xcd4599.target.files; - _0x3fdd71.length > 0x0 && ((_0xfd246e = new FileReader()).file_name = _0x3fdd71[0x0].name, _0xfd246e.onload = function() { - var _0xa88a13 = new Uint8Array(_0xfd246e.result); - EJS_loadState(_0xa88a13); - }, _0xfd246e.readAsArrayBuffer(_0x3fdd71[0x0])), _0xa88a13.game.stateloadField = _0x428003('input'), _0xa88a13.game.stateloadField.type = 'file', _0xa88a13.game.stateloadField.onchange = _0x17edbf; - }, _0x1093f4.call(_0xa88a13, _0xa88a13.elements.container, 'loadstate', function(_0x13504c) { - _0x1e2c68.function(_0xa88a13.config.onloadstate) ? _0xa88a13.config.onloadstate.call(null, _0xa88a13.loadState) : _0xa88a13.game.stateloadField.click(), _0xa88a13.elements.container.focus(); - }), document.addEventListener('visibilitychange', function() { - 'hidden' === document.visibilityState ? console.log('hidden') : console.log('active'); - }); - }, - 'bindFunction': function() { - var _0xa88a13 = this, - _0x17edbf = _0xa88a13.system; - if (_0x27f4c4.Module && _0x27f4c4.Module._set_volume) { - var _0x2c1832 = _0x27f4c4.Module.cwrap('set_volume', 'null', ['number']); - _0x378b5c.setVolume = function() { - var _0x17edbf = 0x0; - _0xa88a13.volume < 0x1 && (_0x17edbf = 0x0 === _0xa88a13.volume ? -0x50 : 0x1e * _0xa88a13.volume - 0x1e, _0x2c1832(_0x17edbf)), _0xa88a13.muted && (_0x17edbf = -0x50), _0x2c1832(_0x17edbf); - }; - } - _0x378b5c.setVariable = _0x27f4c4.Module.cwrap('set_variable', 'null', ['string', 'string']), _0x378b5c.simulateInputFn = _0x27f4c4.Module.cwrap('simulate_input', 'null', ['number', 'number', 'number']); - var _0x2c63cc = { - 0: null, - 1: null, - 2: null, - 3: null, - 4: null, - 5: null, - 6: null, - 7: null, - 8: null, - 9: null, - 10: null, - 11: null, - 12: null, - 13: null, - 14: null, - 15: null, - 16: null, - 17: null, - 18: null, - 19: null, - 20: null, - 21: null, - 22: null, - 23: null, - 24: null, - 25: null, - 26: null, - 27: null, - 28: null, - 29: null, - 30: null, - 31: null - }; - _0x378b5c.simulateInput = function(_0x249751, _0x480d05, _0x50f784) { - if (_0x378b5c.connected) { - if (_0xa88a13.playing && !_0x378b5c.disableInput) { - var _0x35b9c1 = _0x378b5c.connection.userid, - _0x4d96ad = _0x378b5c.roomMaster === _0x35b9c1, - _0xf1bb97 = _0x378b5c.players.indexOf(_0x35b9c1), - _0x52e1f4 = _0x378b5c.currentFrameNum(); - _0x249751 >> 0x0 == 0x0 && (_0x2c63cc[_0x480d05] !== _0x50f784 && (_0x4d96ad ? (_0x378b5c.inputsData[_0x52e1f4] || (_0x378b5c.inputsData[_0x52e1f4] = []), _0x378b5c.inputsData[_0x52e1f4].push({ - 'index': _0xf1bb97, - 'key': _0x480d05, - 'status': _0x50f784, - 'frame': _0x52e1f4 - }), _0x378b5c.simulateInputFn(_0xf1bb97, _0x480d05, _0x50f784)) : _0x378b5c.connection.send(JSON.stringify({ - 'act': 'sync-control', - 'value': ['' .concat(_0xf1bb97, '|').concat(_0x480d05, '|').concat(_0x50f784, '|').concat(_0x52e1f4)] - }), _0x378b5c.roomMaster)), _0x2c63cc[_0x480d05] = _0x50f784); - } - } else _0x378b5c.disableInput || _0x378b5c.simulateInputFn(_0x249751, _0x480d05, _0x50f784); - }, _0x378b5c.syncInput = _0x378b5c.simulateInput; - var _0x762355 = _0x27f4c4.Module.cwrap('shader_enable', 'null', ['number']); - _0x378b5c.toggleShader = function(_0x433182) { - return _0x762355(_0x433182); - }, _0x378b5c.getStateInfo = _0x27f4c4.Module.cwrap('get_state_info', 'string', []), _0x378b5c.saveState = function() { - var _0xa88a13, _0x17edbf = _0x378b5c.getStateInfo().split('|'), - _0x2c1832 = _0x17edbf[0x0] >> 0x0; - if (_0x2c1832 > 0x0) { - _0xa88a13 = new Uint8Array(_0x2c1832); - for (var _0x2ef6be = _0x17edbf[0x1] >> 0x0, _0x3cc34b = 0x0; _0x3cc34b < _0x2c1832; _0x3cc34b++) _0xa88a13[_0x3cc34b] = _0x27f4c4.Module.getValue(_0x2ef6be + _0x3cc34b); - } - return _0xa88a13; - }; - var _0x25a7a2 = _0x27f4c4.Module.cwrap('load_state', 'number', ['string', 'number']); - _0x378b5c.loadState = function(_0x4389ae, _0x1d4918) { - var _0x91cd69; - if (_0x91cd69 = _0x4389ae, _0x27f4c4.FS.createDataFile('/', 'game.state', _0x91cd69, true, true), null === _0x1d4918 && (_0x1d4918 = 0x0), _0x25a7a2('game.state', _0x1d4918), 'arcade' === _0x17edbf ? setTimeout(function() { - _0x378b5c.getStateInfo(), _0x25a7a2('game.state', _0x1d4918), _0x27f4c4.FS.unlink('game.state'); - }, 0xa) : _0x27f4c4.FS.unlink('game.state'), _0x378b5c.connected && _0x378b5c.connection.isInitiator) { - for (var _0x54607c = _0x378b5c.getStateInfo().split('|'), _0x1ab9c9 = _0x54607c[0x0] >> 0x0, _0xce58ec = (_0x54607c[0x2], new Uint8Array(_0x1ab9c9)), _0x4aff4f = _0x54607c[0x1] >> 0x0, _0x3bfae0 = 0x0; _0x3bfae0 < _0x1ab9c9; _0x3bfae0 += 0x1) _0xce58ec[_0x3bfae0] = _0x27f4c4.Module.getValue(_0x4aff4f + _0x3bfae0); - var _0x227419 = new File([_0xce58ec], '0-game.state', { - 'type': '', - 'lastModified': new Date() - }); - _0x378b5c.connection.shareFile(_0x227419), _0x378b5c.inputsData = {}, _0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x378b5c.disableControl(true); - } - _0xa88a13.elements.container.focus(); - }, _0x27f4c4.Module._set_cheat && (_0x378b5c.setCheat = _0x27f4c4.Module.cwrap('set_cheat', 'number', ['number', 'number', 'string'])), _0x27f4c4.Module._reset_cheat && (_0x378b5c.resetCheat = _0x27f4c4.Module._reset_cheat), _0x378b5c.quickSaveState = function() { - if (_0xa88a13.started && !_0x378b5c.connected) { - if (_0xa88a13.statesSupported === false) { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'CANNOT CURRENTLY SAVE STATE'; - for (var i=0; i<_0x378b5c.saveMsgTransitions.length; i++) { - _0x378b5c.saveMsgTransitions[i] = false; - } - var a = _0x378b5c.saveMsgTransitions.length; - _0x378b5c.saveMsgTransitions.push(true); - setTimeout(function() { - if (_0x378b5c.saveMsgTransitions[a]) { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; - _0x378b5c.saveMsgTransitions = []; - } - }, 1500) - return; - } - if (_0x2593da && typeof _0x2593da.getCoreOptionsValues == 'function') { - var slot = _0x2593da.getCoreOptionsValues()['save-state-slot']; - if (! slot) { - slot = 1; - } - } else { - var slot = 1; - } - var name = slot + '-quick.state'; - try { - _0x27f4c4.FS.unlink(name); - } catch (_0x4b4d4c) {} - var success = true; - try { - var _0x17edbf = _0x378b5c.saveState(); - _0x27f4c4.FS.createDataFile('/', name, _0x17edbf, true, true); - } catch(e) { - success = false; - } - if (! success) { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'FAILED TO SAVE STATE TO SLOT ' + slot; - } else { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'STATE SAVED TO SLOT ' + slot; - } - for (var i=0; i<_0x378b5c.saveMsgTransitions.length; i++) { - _0x378b5c.saveMsgTransitions[i] = false; - } - var a = _0x378b5c.saveMsgTransitions.length; - _0x378b5c.saveMsgTransitions.push(true); - setTimeout(function() { - if (_0x378b5c.saveMsgTransitions[a]) { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; - _0x378b5c.saveMsgTransitions = []; - } - }, 1500) - } - }, _0x378b5c.saveMsgTransitions = [], _0x378b5c.quickLoadState = function() { - if (_0xa88a13.started && !_0x378b5c.connected) { - if (_0xa88a13.statesSupported === false) { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'CANNOT CURRENTLY LOAD STATE'; - for (var i=0; i<_0x378b5c.saveMsgTransitions.length; i++) { - _0x378b5c.saveMsgTransitions[i] = false; - } - var a = _0x378b5c.saveMsgTransitions.length; - _0x378b5c.saveMsgTransitions.push(true); - setTimeout(function() { - if (_0x378b5c.saveMsgTransitions[a]) { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; - _0x378b5c.saveMsgTransitions = []; - } - }, 1500) - return; - } - if (_0x2593da && typeof _0x2593da.getCoreOptionsValues == 'function') { - var slot = _0x2593da.getCoreOptionsValues()['save-state-slot']; - if (! slot) { - slot = 1; - } - } else { - var slot = 1; - } - var name = slot + '-quick.state'; - var success = true; - try { - _0x25a7a2(name, 0x0), 'arcade' === _0x17edbf && setTimeout(function() { - _0x378b5c.getStateInfo(), _0x25a7a2(name, 0x0); - }, 0xa); - } catch (_0x4ee386) { - success = false; - } - if (! success) { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'FAILED TO LOAD STATE FROM SLOT ' + slot; - } else { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'LOADED STATE FROM SLOT ' + slot; - } - for (var i=0; i<_0x378b5c.saveMsgTransitions.length; i++) { - _0x378b5c.saveMsgTransitions[i] = false; - } - var a = _0x378b5c.saveMsgTransitions.length; - _0x378b5c.saveMsgTransitions.push(true); - setTimeout(function() { - if (_0x378b5c.saveMsgTransitions[a]) { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; - _0x378b5c.saveMsgTransitions = []; - } - }, 1500) - } - }, _0x378b5c.changeStateSlot = function(e) { - if (_0x2593da && typeof _0x2593da.getCoreOptionsValues == 'function') { - var slot = _0x2593da.getCoreOptionsValues()['save-state-slot']; - if (! slot) { - slot = 1; - } - } else { - var slot = 1; - } - var newSlot; - if (typeof e != 'number') { - newSlot = slot + 1; - } else { - newSlot = e; - } - if (newSlot > 9) { - newSlot = 1; - } - _0x7f9f36.updateCoreOptions.call(_0xa88a13, 'save-state-slot', newSlot) - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'SET SAVE STATE SLOT TO ' + newSlot; - for (var i=0; i<_0x378b5c.saveMsgTransitions.length; i++) { - _0x378b5c.saveMsgTransitions[i] = false; - } - var a = _0x378b5c.saveMsgTransitions.length; - _0x378b5c.saveMsgTransitions.push(true); - setTimeout(function() { - if (_0x378b5c.saveMsgTransitions[a]) { - _0xa88a13.elements.widgets.stateInfoDiv.innerHTML = ''; - _0x378b5c.saveMsgTransitions = []; - } - }, 1500) - }, window.EJS_loadState = function(_0x4dd6a5) { - _0x378b5c.loadState(_0x4dd6a5, 0x0), setTimeout(function() { - if (_0x378b5c.connected) { - var _0x17edbf = new File([_0x4dd6a5], '0-game.state', { - 'type': '', - 'lastModified': new Date() - }); - _0x378b5c.connection.shareFile(_0x17edbf), _0x378b5c.inputsData = {}, _0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x378b5c.disableControl(true); - } - }, 0x1e); - }; - var _0x840cf4 = _0x27f4c4.Module.cwrap('cmd_take_screenshot', '', []); - _0x378b5c.getScreenData = function() { - return _0x378b5c.toggleShader(0x0), _0x840cf4(), _0x378b5c.toggleShader(0x1), _0x27f4c4.FS.readFile('screenshot.png'); - }, _0x378b5c.restartGame = _0x27f4c4.Module.cwrap('system_restart', '', []), _0x378b5c.currentFrameNum = _0x27f4c4.Module.cwrap('get_current_frame_count', '', []), _0x378b5c.saveSavFiles = _0x27f4c4.Module.cwrap('cmd_savefiles', '', []), _0x27f4c4.Module._get_core_options && (_0x378b5c.getGameCoreOptions = _0x27f4c4.Module.cwrap('get_core_options', 'string', [])), _0x378b5c.systemPause = function(_0x29d94a) { - return !0x1; - }, _0x378b5c.controllers = _0x2593da.storage.get('controllers'), _0x378b5c.controllers || (_0x378b5c.controllers = JSON.parse(JSON.stringify(_0x378b5c.defaultControllers))); - } - }, - _0xdcec2a = _0x378b5c; - - function _0x5005e6(_0x7f3270, _0x477158) { - return function(_0x20890f) { - if (Array.isArray(_0x20890f)) return _0x20890f; - }(_0x7f3270) || function(_0x557107, _0x409476) { - var _0x2c1832 = [], - _0x488a47 = true, - _0x34f76e = !0x1, - _0x19606f = void 0x0; - try { - for (var _0x328f4d, _0x4d9086 = _0x557107[Symbol.iterator](); !(_0x488a47 = (_0x328f4d = _0x4d9086.next()).done) && (_0x2c1832.push(_0x328f4d.value), !_0x409476 || _0x2c1832.length !== _0x409476); _0x488a47 = true); - } catch (_0x13c09a) { - _0x34f76e = true, _0x19606f = _0x13c09a; - } finally { - try { - _0x488a47 || null == _0x4d9086.return || _0x4d9086.return(); - } finally { - if (_0x34f76e) throw _0x19606f; - } - } - return _0x2c1832; - }(_0x7f3270, _0x477158) || function() { - throw new TypeError('Invalid attempt to destructure non-iterable instance'); - }(); - } - var _0x7f9f36 = { - 'storage': null, - 'coreOptionsValues': {}, - 'contextMenu': null, - 'normalOptions': { - 'shader': { - 'label': 'Shader', - 'options': { - 'disabled': 'Disabled', - '2xScaleHQ.glslp': '2xScaleHQ', - '4xScaleHQ.glslp': '4xScaleHQ', - 'crt-easymode.glslp': 'CRT easymode', - 'crt-aperture.glslp': 'CRT aperture', - 'crt-geom.glslp': 'CRT geom' - }, - 'default': 'disabled' - }, - 'virtual-gamepad': { - 'label': 'Virtual Gamepad', - 'options': { - 'disabled': 'Disabled', - 'enabled': 'Enabled' - }, - 'default': 'enabled' - } - }, - 'defaultCoreOptionsValues': function() { - var _0xa88a13 = {}; - switch (this.system) { - case 'pce': - _0xa88a13 = { - 'pce_nospritelimit': 'enabled' - }; - break; - case 'jaguar': - _0xa88a13 = { - 'virtualjaguar_doom_res_hack': 'enabled' - }; - break; - case 'psx': - _0xa88a13 = { - 'pcsx_rearmed_memcard2': 'enabled' - }; - break; - case 'nds': - _0xa88a13 = {}; - } - return _0xa88a13; - }, - 'getCoreOptionsValues': function() { - var _0xa88a13 = _0x7f9f36.storage.get('core-options'); - return _0x1e2c68.empty(_0xa88a13) && (_0xa88a13 = {}), _0xa88a13; - }, - 'getCoreOptions': function() { - var _0xa88a13 = {}; - switch (this.system) { - case 'nes': - _0xa88a13.fceumm_palette = { - 'label': 'Color Palette', - 'options': { - 'default': 'Default', - 'asqrealc': 'asqrealc', - 'nintendo-vc': 'nintendo-vc', - 'rgb': 'rgb', - 'yuv-v3': 'yuv-v3', - 'unsaturated-final': 'unsaturated-final', - 'sony-cxa2025as-us': 'sony-cxa2025as-us', - 'pal': 'pal', - 'bmf-final2': 'bmf-final2', - 'bmf-final3': 'bmf-final3', - 'smooth-fbx': 'smooth-fbx', - 'composite-direct-fbx': 'composite-direct-fbx', - 'pvm-style-d93-fbx': 'pvm-style-d93-fbx', - 'nescap': 'nescap', - 'ntsc-hardware-fbx': 'ntsc-hardware-fbx', - 'nes-classic-fbx-fs': 'nes-classic-fbx-fs', - 'wavebeam': 'wavebeam' - }, - 'default': 'default' - }, _0xa88a13.fceumm_nospritelimit = { - 'label': 'No Sprite Limit', - 'options': { - 'enabled': 'Enabled', - 'disabled': 'Disabled' - }, - 'default': 'disabled' - }, _0xa88a13.fceumm_sndquality = { - 'label': 'Sound Quality', - 'options': { - 'Low': 'Low', - 'High': 'High', - 'Very High': 'Very High' - }, - 'default': 'Low' - }, this.lightgun || (_0xa88a13.system_type = { - 'label': '4 Players Support', - 'options': { - 'nes': 'NES', - 'famicom': 'Famicom' - }, - 'default': 'nes', - 'netplay': true - }), _0xa88a13.fceumm_turbo_enable = { - 'label': 'Turbo Enable', - 'options': ['None', 'Player 1', 'Player 2', 'Both'], - 'default': 'None', - 'netplay': true - }, _0xa88a13.fceumm_region = { - 'label': 'Region', - 'options': ['Auto', 'NTSC', 'PAL', 'Dendy'], - 'default': 'Auto', - 'netplay': true - }; - break; - case 'snes': - _0xa88a13 = { - 'snes9x_next_overclock': { - 'label': 'SuperFX Overclock', - 'options': { - 'disabled': 'Disabled(10MHz)', - '40MHz': '40MHz', - '60MHz': '60MHz', - '80MHz': '80MHz', - '100MHz': '100MHz' - }, - 'default': 'disabled', - 'netplay': true - } - }; - break; - case 'snes2002': - case 'snes2005': - case 'snes2010': - _0xa88a13 = {}; - break; - case 'gb': - _0xa88a13 = { - 'gambatte_gb_colorization': { - 'label': 'GB Colorization', - 'options': { - 'disabled': 'Disabled', - 'auto': 'auto', - 'internal': 'internal' - }, - 'default': 'disabled' - }, - 'gambatte_gb_internal_palette': { - 'label': 'Internal Palette', - 'options': { - 'GBC - Blue': 'GBC - Blue', - 'GBC - Brown': 'GBC - Brown', - 'GBC - Dark Blue': 'GBC - Dark Blue', - 'GBC - Dark Brown': 'GBC - Dark Brown', - 'GBC - Dark Green': 'GBC - Dark Green', - 'GBC - Grayscale': 'GBC - Grayscale', - 'GBC - Green': 'GBC - Green', - 'GBC - Inverted': 'GBC - Inverted', - 'GBC - Orange': 'GBC - Orange', - 'GBC - Pastel Mix': 'GBC - Pastel Mix', - 'GBC - Red': 'GBC - Red', - 'GBC - Yellow': 'GBC - Yellow' - }, - 'default': 'GBC - Blue' - } - }; - break; - case 'gba': - _0xa88a13 = { - 'mgba_solar_sensor_level': { - 'label': 'Solar sensor level', - 'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'], - 'default': '0' - }, - 'mgba_frameskip': { - 'label': 'Frameskip', - 'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'], - 'default': '0' - } - }; - break; - case 'vbanext': - _0xa88a13 = { - 'vbanext_turboenable': { - 'label': 'Enable Turbo Buttons', - 'options': ['disabled', 'enabled'], - 'default': 'disabled' - }, - 'vbanext_turbodelay': { - 'label': 'Turbo Delay in frames', - 'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15'], - 'default': '2' - } - }; - break; - case 'n64': - _0xa88a13 = { - 'glupen64-aspect': { - 'label': 'Aspect Ratio (Need to refresh page)', - 'options': ['4:3', '16:9'], - 'default': '4:3' - }, - 'glupen64-43screensize': { - 'label': '4:3 Resolution', - 'options': ['320x240', '640x480', '960x720', '1280x960'], - 'default': '320x240' - }, - 'glupen64-169screensize': { - 'label': '16:9 Resolution', - 'options': ['640x360', '960x540', '1280x720'], - 'default': '640x360' - }, - 'glupen64-pak1': { - 'label': 'Player 1 Pak', - 'options': ['none', 'memory', 'rumble'], - 'default': 'none', - 'netplay': true - }, - 'glupen64-pak2': { - 'label': 'Player 2 Pak', - 'options': ['none', 'memory', 'rumble'], - 'default': 'none', - 'netplay': true - }, - 'glupen64-pak3': { - 'label': 'Player 3 Pak', - 'options': ['none', 'memory', 'rumble'], - 'default': 'none', - 'netplay': true - }, - 'glupen64-pak4': { - 'label': 'Player 4 Pak', - 'options': ['none', 'memory', 'rumble'], - 'default': 'none', - 'netplay': true - } - }; - break; - case 'nds': - _0xa88a13 = { - 'desmume_screens_layout': { - 'label': 'Screen layout', - 'options': ['top/bottom', 'bottom/top', 'left/right', 'right/left', 'top only', 'bottom only', 'quick switch', 'hybrid/top', 'hybrid/bottom'], - 'default': 'top/bottom' - }, - 'screen_rotation': { - 'label': 'Screen Rotation', - 'options': { - 0: '0°', - 90: '90°', - 180: '180°', - 270: '270°' - }, - 'default': 0x0 - }, - 'desmume_frameskip': { - 'label': 'Frameskip', - 'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], - 'default': '0' - } - }, _0x2d904a.wasm || delete _0xa88a13.screen_rotation; - break; - case 'vb': - case 'pce': - _0xa88a13 = {}; - break; - case 'segaMS': - case 'segaGG': - case 'segaMD': - case 'segaCD': - _0xa88a13 = { - 'genesis_plus_gx_no_sprite_limit': { - 'label': 'No Sprite Limit', - 'options': ['disabled', 'enabled'], - 'default': 'disabled' - }, - 'genesis_plus_gx_overclock': { - 'label': 'CPU speed', - 'options': ['100%', '125%', '150%', '175%', '200%'], - 'default': '100%', - 'netplay': true - }, - 'genesis_plus_gx_sound_output': { - 'label': 'Sound output', - 'options': ['stereo', 'mono'], - 'default': 'stereo' - } - }; - break; - case 'sega32x': - _0xa88a13 = { - 'picodrive_sprlim': { - 'label': 'No sprite limit', - 'options': ['disabled', 'enabled'], - 'default': 'disabled' - } - }; - break; - case 'segaSaturn': - _0xa88a13 = { - 'yabause_frameskip': { - 'label': 'Frameskip', - 'options': ['disabled', 'enabled'], - 'default': 'disabled' - } - }; - break; - case 'msx': - _0xa88a13 = { - 'bluemsx_nospritelimits': { - 'label': 'No Sprite Limit', - 'options': ['OFF', 'ON'], - 'default': 'OFF' - } - }; - break; - case 'ws': - case 'ngp': - _0xa88a13 = {}; - break; - case 'jaguar': - _0xa88a13 = { - 'virtualjaguar_usefastblitter': { - 'label': 'Fast Blitter', - 'options': ['disabled', 'enabled'], - 'default': 'disabled' - }, - 'virtualjaguar_bios': { - 'label': 'Bios', - 'options': ['disabled', 'enabled'], - 'default': 'disabled' - } - }; - break; - case 'psx': - _0xa88a13 = { - 'pcsx_rearmed_frameskip': { - 'label': 'Frameskip', - 'options': [0x0, 0x1, 0x2, 0x3], - 'default': 0x0, - 'netplay': true - }, - 'pcsx_rearmed_memcard2': { - 'label': 'Enable second memory card', - 'options': ['enabled', 'disabled'], - 'default': 'enabled', - 'netplay': true - }, - 'pcsx_rearmed_pad1type': { - 'label': 'Pad 1 Type', - 'options': ['default', 'none', 'standard', 'analog', 'negcon'], - 'default': 'default', - 'netplay': true - }, - 'pcsx_rearmed_pad2type': { - 'label': 'Pad 2 Type', - 'options': ['default', 'none', 'standard', 'analog', 'negcon'], - 'default': 'default', - 'netplay': true - }, - 'pcsx_rearmed_pad3type': { - 'label': 'Pad 3 Type', - 'options': ['default', 'none', 'standard', 'analog', 'negcon'], - 'default': 'default', - 'netplay': true - }, - 'pcsx_rearmed_pad4type': { - 'label': 'Pad 4 Type', - 'options': ['default', 'none', 'standard', 'analog', 'negcon'], - 'default': 'default', - 'netplay': true - }, - 'pcsx_rearmed_vibration': { - 'label': 'Enable Vibration', - 'options': ['enabled', 'disabled'], - 'default': 'enabled', - 'netplay': true - }, - 'pcsx_rearmed_neon_interlace_enable': { - 'label': 'Enable interlacing mode(s)', - 'options': ['enabled', 'disabled'], - 'default': 'disabled', - 'netplay': true - }, - 'pcsx_rearmed_neon_enhancement_enable': { - 'label': 'Enhanced resolution (slow)', - 'options': ['enabled', 'disabled'], - 'default': 'disabled', - 'netplay': true - }, - 'pcsx_rearmed_neon_enhancement_no_main': { - 'label': 'Enhanced resolution speed hack', - 'options': ['enabled', 'disabled'], - 'default': 'disabled', - 'netplay': true - } - }; - break; - case 'arcade': - case 'fba0.2.97.29': - _0xa88a13 = { - 'fba-aspect': { - 'label': 'Aspect ratio', - 'options': ['DAR', 'PAR'], - 'default': 'DAR' - }, - 'fba-frameskip': { - 'label': 'Frameskip', - 'options': ['0', '1', '2', '3', '4', '5'], - 'default': '0', - 'netplay': true - }, - 'fba-cpu-speed-adjust': { - 'label': 'CPU overclock', - 'options': ['100', '110', '120', '130', '140', '150', '160', '170', '180', '190', '200'], - 'default': '100', - 'netplay': true - }, - 'fba-diagnostic-input': { - 'label': 'Diagnostic Input', - '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'], - 'default': 'None', - 'netplay': true - }, - 'fba-neogeo-mode': { - 'label': 'Force Neo Geo mode', - 'options': ['MVS', 'AES', 'UNIBIOS', 'DIPSWITCH'], - 'default': 'MVS', - 'netplay': true - } - }; - break; - case 'mame2003': - case 'mame2010': - case 'mame': - _0xa88a13 = {}; - break; - default: - _0xa88a13 = {}, console.warn('Unsupported emulator'); - } - if (this.statesSupported === true) { - _0xa88a13['save-state-slot'] = { - 'label': 'Save State Slot', - 'options': [1, 2, 3, 4, 5, 6, 7, 8, 9], - 'default': 1, - 'netplay': false - } - } - _0xdcec2a.getGameCoreOptions && _0xdcec2a.getGameCoreOptions().split('\n').forEach(function(_0x2bef5a, _0x49b64b) { - var _0x5995db = _0x2bef5a.split('; '), - _0x16274c = _0x5995db[0x0]; - if (0x0 === _0x16274c.indexOf('fba-dipswitch-')) { - var _0x757776 = _0x5995db[0x1].split('|'), - _0x1f895e = _0x16274c.replace(/_/g, ' ').replace(/.+\-(.+)/, '$1'); - _0xa88a13[_0x16274c] = { - 'label': _0x1f895e, - 'options': _0x757776.slice(0x1, -0x1), - 'default': _0x757776[0x0].replace('(Default) ', ''), - 'netplay': true - }; - } - }); - return _0xa88a13; - }, - 'supportNetPlay': function() { - if (this.lightgun || this.mouse) return !0x1; - var _0xa88a13 = window.RTCPeerConnection || window.webkitPeerConnection00 || window.webkitRTCPeerConnection || window.mozRTCPeerConnection, - _0x17edbf = window.mozRTCIceCandidate || window.RTCIceCandidate, - _0x2c1832 = window.mozRTCSessionDescription || window.RTCSessionDescription; - return !!(_0xa88a13 && _0x17edbf && _0x2c1832) && !!(_0xa88a13 && 'createDataChannel' in _0xa88a13.prototype); - }, - 'isNetPlay': function() {}, - 'findElements': function() { - try { - return this.elements.controls = _0x530042.call(this, this.config.selectors.controls.wrapper), this.elements.buttons = { - 'play': _0x23ffa1.call(this, this.config.selectors.buttons.play), - 'pause': _0x530042.call(this, this.config.selectors.buttons.pause), - 'restart': _0x530042.call(this, this.config.selectors.buttons.restart), - 'mute': _0x530042.call(this, this.config.selectors.buttons.mute), - 'settings': _0x530042.call(this, this.config.selectors.buttons.settings), - 'fullscreen': _0x530042.call(this, this.config.selectors.buttons.fullscreen), - 'saveState': _0x530042.call(this, this.config.selectors.buttons.saveState), - 'screenRecord': _0x530042.call(this, this.config.selectors.buttons.screenRecord), - 'loadState': _0x530042.call(this, this.config.selectors.buttons.loadState), - 'gamepad': _0x530042.call(this, this.config.selectors.buttons.gamepad), - 'netplay': _0x530042.call(this, this.config.selectors.buttons.netplay), - 'cheat': _0x530042.call(this, this.config.selectors.buttons.cheat) - }, this.elements.inputs = { - 'volume': _0x530042.call(this, this.config.selectors.inputs.volume) - }, true; - } catch (_0x527381) { - return this.debug.warn('It looks like there is a problem with your custom controls HTML', _0x527381), !0x1; - } - }, - 'createIcon': function(_0x43d42f, _0x42a597) { - var _0x2c1832 = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - _0x154f99(_0x2c1832, _0x5dc0c0(_0x42a597, { - 'role': 'presentation', - 'focusable': 'false' - })); - var _0x50b7a7 = document.createElement('div'); - _0x50b7a7.innerHTML = '' .concat(this.icons[_0x43d42f], ''); - for (var _0x373099 = _0x50b7a7.childNodes[0x0].childNodes, _0x804f4d = 0x0; _0x804f4d < _0x373099.length; _0x804f4d += 0x1) _0x2c1832.appendChild(_0x373099[_0x804f4d]); - return _0x2c1832; - }, - 'createLabel': function(_0x185043) { - var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : {}, - _0x2c1832 = _0xb9b2ff.get(_0x185043, this.config), - _0x3d681f = {}; - _0x3d681f[_0x17edbf.class] = true, _0x3d681f[this.config.classNames.hidden] = true; - var _0x58a1d4 = Object.assign({}, _0x17edbf, { - 'class': [_0x17edbf.class, this.config.classNames.tooltip].filter(Boolean).join(' ') - }); - return _0x428003('span', _0x58a1d4, _0x2c1832); - }, - 'createBadge': function(_0x415aef) { - if (_0x1e2c68.empty(_0x415aef)) return null; - var _0x17edbf = _0x428003('span', { - 'class': this.config.classNames.menu.value - }); - return _0x17edbf.appendChild(_0x428003('span', { - 'class': this.config.classNames.menu.badge - }, _0x415aef)), _0x17edbf; - }, - 'createButton': function(_0x427a85, _0x493eb2) { - var _0x2c1832, _0x325832, _0xcb618b, _0x25c678, _0x58309d = _0x428003('button'), - _0x183584 = Object.assign({}, _0x493eb2), - _0x2345d2 = _0x9fdcea(_0x427a85), - _0x2ca20d = !0x1; - 'type' in _0x183584 || (_0x183584.type = 'button'); - var _0x34225b = _0x449eac({ - 'ejs__control': true - }); - switch ('class' in _0x183584 ? _0x183584.class.includes(_0x34225b) || (_0x183584.class += ' ' .concat(_0x34225b)) : _0x183584.class = _0x34225b, _0x427a85) { - case 'play': - _0x2ca20d = true, _0x2c1832 = 'play', _0xcb618b = 'pause', _0x325832 = 'play', _0x25c678 = 'pause'; - break; - case 'mute': - _0x2ca20d = true, _0x2c1832 = 'mute', _0xcb618b = 'unmute', _0x325832 = 'volume', _0x25c678 = 'muted'; - break; - case 'fullscreen': - _0x2ca20d = true, _0x2c1832 = 'enterFullscreen', _0xcb618b = 'exitFullscreen', _0x325832 = 'enter-fullscreen', _0x25c678 = 'exit-fullscreen'; - break; - default: - _0x2c1832 = _0x2345d2, _0x325832 = _0x427a85; - } - return _0x2ca20d ? (_0x58309d.appendChild(_0x7f9f36.createIcon.call(this, _0x25c678, { - 'class': _0x449eac({ - 'icon--pressed': true - }) - })), _0x58309d.appendChild(_0x7f9f36.createIcon.call(this, _0x325832, { - 'class': _0x449eac({ - 'icon--not-pressed': true - }) - })), _0x58309d.appendChild(_0x7f9f36.createLabel.call(this, _0xcb618b, { - 'class': _0x449eac({ - 'icon--pressed': true - }) - })), _0x58309d.appendChild(_0x7f9f36.createLabel.call(this, _0x2c1832, { - 'class': _0x449eac({ - 'icon--not-pressed': true - }) - }))) : (_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; - }, - 'createRange': function(_0x491b4a, _0x5f154a) { - var _0x2c1832 = _0x428003('input', _0x5dc0c0(_0xa949a8(this.config.selectors.inputs[_0x491b4a]), { - 'type': 'range', - 'min': 0x0, - 'max': 0x64, - 'step': 0.1, - 'value': 0x0, - 'autocomplete': 'off', - 'role': 'slider', - 'aria-label': _0xb9b2ff.get(_0x491b4a, this.config), - 'aria-valuemin': 0x0, - 'aria-valuemax': 0x64, - 'aria-valuenow': 0x0 - }, _0x5f154a)); - return this.elements.inputs[_0x491b4a] = _0x2c1832, _0x7f9f36.updateRangeFill.call(this, _0x2c1832), _0x2c1832; - }, - 'bindMenuItemShortcuts': function(_0x1830d1, _0x2770c2) { - var _0x2c1832 = this; - _0x1093f4(_0x1830d1, 'keydown keyup', function(_0x4bb9d6) { - if ([0x20, 0x26, 0x27, 0x28].includes(_0x4bb9d6.which) && (_0x4bb9d6.preventDefault(), _0x4bb9d6.stopPropagation(), 'keydown' !== _0x4bb9d6.type)) { - var _0x20ac7b, _0x51717d = _0x13f491(_0x1830d1, '[role="menuitemradio"]'); - if (!_0x51717d && [0x20, 0x27].includes(_0x4bb9d6.which)) _0x7f9f36.showMenuPanel.call(_0x2c1832, _0x2770c2, true); - 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)); - } - }, !0x1), _0x1093f4(_0x1830d1, 'keyup', function(_0x3844f5) { - 0xd === _0x3844f5.which && _0x7f9f36.focusFirstMenuItem.call(_0x2c1832, null, true); - }); - }, - 'createMenuItem': function(_0x52a95b) { - var _0x17edbf = this, - _0x2c1832 = _0x52a95b.value, - _0x231912 = _0x52a95b.list, - _0x57313b = _0x52a95b.type, - _0x19be70 = _0x52a95b.title, - _0x4ae558 = _0x52a95b.badge, - _0x34a012 = void 0x0 === _0x4ae558 ? null : _0x4ae558, - _0x7dbb2e = _0x52a95b.checked, - _0x200580 = void 0x0 !== _0x7dbb2e && _0x7dbb2e, - _0x4bb1a2 = _0xa949a8(this.config.selectors.inputs[_0x57313b]), - _0xb8fbbd = _0x428003('button', _0x5dc0c0(_0x4bb1a2, { - 'type': 'button', - 'role': 'menuitemradio', - 'class': '' .concat(this.config.classNames.control, ' ').concat(_0x4bb1a2.class ? _0x4bb1a2.class : '').trim(), - 'aria-checked': _0x200580, - 'value': _0x2c1832 - })), - _0x560073 = _0x428003('span'); - _0x560073.innerHTML = _0x19be70, _0x1e2c68.element(_0x34a012) && _0x560073.appendChild(_0x34a012), _0xb8fbbd.appendChild(_0x560073), Object.defineProperty(_0xb8fbbd, 'checked', { - 'enumerable': true, - 'get': function() { - return 'true' === _0xb8fbbd.getAttribute('aria-checked'); - }, - 'set': function(_0x2da7f0) { - _0x2da7f0 && Array.from(_0xb8fbbd.parentNode.children).filter(function(_0x480c16) { - return _0x13f491(_0x480c16, '[role="menuitemradio"]'); - }).forEach(function(_0x363b12) { - return _0x363b12.setAttribute('aria-checked', 'false'); - }), _0xb8fbbd.setAttribute('aria-checked', _0x2da7f0 ? 'true' : 'false'); - } - }); - var _0x449ec7 = _0x7f9f36.getCoreOptions.call(this); - this.listeners.bind(_0xb8fbbd, 'click keyup', function(_0x270d0d) { - _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({ - 'act': 'update-core-option', - 'key': _0x57313b, - 'value': _0x2c1832, - 'frame': _0xdcec2a.currentFrame - }))) : _0x7f9f36.updateCoreOptions.call(_0x17edbf, _0x57313b, _0x2c1832)), _0x7f9f36.showMenuPanel.call(_0x17edbf, 'home', _0x1e2c68.keyboardEvent(_0x270d0d))); - }, _0x57313b, !0x1), _0x7f9f36.bindMenuItemShortcuts.call(this, _0xb8fbbd, _0x57313b), _0x231912.appendChild(_0xb8fbbd); - }, - 'updateVolume': function() { - _0x1e2c68.element(this.elements.inputs.volume) && _0x7f9f36.setRange.call(this, this.elements.inputs.volume, this.muted ? 0x0 : this.volume), _0x1e2c68.element(this.elements.buttons.mute) && (this.elements.buttons.mute.pressed = this.muted || 0x0 === this.volume); - }, - 'setRange': function(_0x1c075b) { - var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : 0x0; - _0x1e2c68.element(_0x1c075b) && (_0x1c075b.value = _0x17edbf, _0x7f9f36.updateRangeFill.call(this, _0x1c075b)); - }, - 'updateRangeFill': function(_0x2dbde1) { - var _0x17edbf = _0x1e2c68.event(_0x2dbde1) ? _0x2dbde1.target : _0x2dbde1; - if (_0x1e2c68.element(_0x17edbf) && 'range' === _0x17edbf.getAttribute('type')) { - if (_0x13f491(_0x17edbf, this.config.selectors.inputs.volume)) { - var _0x2c1832 = 0x64 * _0x17edbf.value; - _0x17edbf.setAttribute('aria-valuenow', _0x2c1832), _0x17edbf.setAttribute('aria-valuetext', '' .concat(_0x2c1832.toFixed(0x1), '%')); - } else _0x17edbf.setAttribute('aria-valuenow', _0x17edbf.value); - _0x59aa33.isWebkit && _0x17edbf.style.setProperty('--value', '' .concat(_0x17edbf.value / _0x17edbf.max * 0x64, '%')); - } - }, - 'toggleMenuButton': function(_0x249814, _0x2948e9) { - _0x132da7(this.elements.settings.buttons[_0x249814], !_0x2948e9); - }, - 'updateNormalOptions': function(_0x255b79, _0x505484) { - this.elements.settings.buttons[_0x255b79].querySelector('.' .concat(this.config.classNames.menu.value)).innerHTML = _0x7f9f36.normalOptions[_0x255b79].options[_0x505484]; - var _0x2c1832 = {}; - _0x2c1832[_0x255b79] = _0x505484, _0x7f9f36.storage.set(_0x2c1832), 'shader' === _0x255b79 && _0xdcec2a.setShader(_0x505484), 'virtual-gamepad' === _0x255b79 && _0xdcec2a.toggleVirtualGamepad.call(this, 'enabled' === _0x505484); - }, - 'updateCoreOptions': function(_0x41c4ad, _0x15823e) { - if ('nds' == this.system && !_0x2d904a.wasm) return true; - if (_0x7f9f36.coreOptionsValues[_0x41c4ad] = _0x15823e, 'psx' === this.system && _0x27f4c4.Module.pauseMainLoop(), _0xdcec2a.setVariable(_0x41c4ad, _0x15823e), 'psx' === this.system && (setTimeout(function() { - _0x27f4c4.Module.resumeMainLoop(); - }, 0x64), setTimeout(function() { - _0x27f4c4.Module.resumeMainLoop(); - }, 0xc8)), 'nds' === this.system && _0x2d904a.wasm) { - var _0x2c1832 = this.elements.wrapper.querySelector('canvas'); - if ('screen_rotation' === _0x41c4ad) switch (_0x2c1832.style.transform = 'rotate(' + _0x15823e + 'deg)', _0x15823e) { - case '0': - _0xdcec2a.setVariable('desmume_input_rotation', '0'); - break; - case '90': - _0xdcec2a.setVariable('desmume_input_rotation', '270'); - break; - case '180': - _0xdcec2a.setVariable('desmume_input_rotation', '180'); - break; - case '270': - _0xdcec2a.setVariable('desmume_input_rotation', '90'); - } - } - if ('arcade' === this.system || 'fba0.2.97.29' === this.system) { - var _0x567ccc = this.elements.wrapper.querySelector('canvas'); - _0x567ccc.height = 'fba-aspect' === _0x41c4ad && 'PAR' === _0x15823e ? _0x567ccc.width / 0x10 * 0x9 : _0x567ccc.width / 0x4 * 0x3; - } - var _0x31bdec = _0x7f9f36.getCoreOptions.call(this), - _0x3efd0b = _0x7f9f36.storage.get('core-options'); - if (_0x1e2c68.empty(_0x3efd0b) && (_0x3efd0b = {}), _0x3efd0b[_0x41c4ad] = _0x15823e, _0x7f9f36.storage.set({ - 'core-options': _0x3efd0b - }), this.elements.settings.buttons[_0x41c4ad]) { - var _0xe95e6a = this.elements.settings.buttons[_0x41c4ad].querySelector('.' .concat(this.config.classNames.menu.value)); - _0x1e2c68.object(_0x31bdec[_0x41c4ad].options) ? _0xe95e6a.innerHTML = _0x31bdec[_0x41c4ad].options[_0x15823e] : _0xe95e6a.innerHTML = _0x15823e; - } - }, - 'setOptionMenuItem': function(_0x2f0e6a, _0x85969e) { - var _0x2c1832 = this, - _0x549dac = this.elements.settings.panels.home.querySelector('[role="menu"]'), - _0x43777f = this.elements.settings.popup.children[0x0]; - Object.keys(_0x2f0e6a).forEach(function(_0x4fcbcf) { - var _0x177975 = _0x4fcbcf, - _0x5f3e0f = _0x428003('button', _0x5dc0c0(_0xa949a8(_0x2c1832.config.selectors.buttons.settings), { - 'type': 'button', - 'class': _0x449eac({ - 'ejs__control': true, - 'ejs__control--forward': true - }), - 'role': 'menuitem', - 'item': _0x4fcbcf, - 'aria-haspopup': true - })); - _0x1093f4(_0x5f3e0f, 'click', function() { - _0x7f9f36.showMenuPanel.call(_0x2c1832, _0x177975, !0x1); - }); - var _0x1d5857, _0x1838f9 = _0x428003('span', null, _0x2f0e6a[_0x4fcbcf].label), - _0x455b20 = _0x428003('span', { - 'class': _0x2c1832.config.classNames.menu.value - }); - _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); - var _0x3f3775 = _0x428003('div', { - 'data-pane': escape(_0x177975), - 'hidden': '' - }), - _0x288440 = _0x428003('button', { - 'type': 'button', - 'class': _0x449eac({ - 'ejs__control': true, - 'ejs__control--back': true - }) - }); - _0x288440.appendChild(_0x428003('span', { - 'aria-hidden': true - }, _0x2f0e6a[_0x4fcbcf].label)), _0x288440.appendChild(_0x428003('span', { - 'class': _0x449eac({ - 'ejs__sr-only': true - }) - }, _0xb9b2ff.get('menuBack', _0x2c1832.config))), _0x1093f4(_0x3f3775, 'keydown', function(_0x462a4d) { - 0x25 === _0x462a4d.which && (_0x462a4d.preventDefault(), _0x462a4d.stopPropagation(), _0x7f9f36.showMenuPanel.call(_0x2c1832, 'home', true)); - }, !0x1), _0x1093f4(_0x288440, 'click', function() { - _0x7f9f36.showMenuPanel.call(_0x2c1832, 'home', !0x1); - }), _0x3f3775.appendChild(_0x288440), _0x3f3775.appendChild(_0x428003('div', { - 'role': 'menu' - })), _0x43777f.appendChild(_0x3f3775), _0x2c1832.elements.settings.buttons[_0x177975] = _0x5f3e0f, _0x2c1832.elements.settings.panels[_0x177975] = _0x3f3775; - var _0x2c172f = _0x3f3775.querySelector('[role="menu"]'); - ! function(_0x301c01) { - if (_0x1e2c68.element(_0x301c01)) - for (var _0x85969e = _0x301c01.childNodes.length; _0x85969e > 0x0;) _0x301c01.removeChild(_0x301c01.lastChild), _0x85969e -= 0x1; - }(_0x2c172f), _0x1e2c68.object(_0x2f0e6a[_0x4fcbcf].options) ? Object.keys(_0x2f0e6a[_0x4fcbcf].options).forEach(function(_0x281296) { - _0x7f9f36.createMenuItem.call(_0x2c1832, { - 'value': _0x281296, - 'list': _0x2c172f, - 'type': _0x177975, - 'title': _0x2f0e6a[_0x4fcbcf].options[_0x281296], - 'badge': null, - 'checked': Boolean(_0x1d5857 === _0x281296) - }); - }) : _0x1e2c68.array(_0x2f0e6a[_0x4fcbcf].options) && _0x2f0e6a[_0x4fcbcf].options.forEach(function(_0x28a341) { - _0x7f9f36.createMenuItem.call(_0x2c1832, { - 'value': _0x28a341, - 'list': _0x2c172f, - 'type': _0x177975, - 'title': _0x28a341, - 'badge': null, - 'checked': Boolean(_0x1d5857 === _0x28a341) - }); - }); - }); - }, - 'setNormalOptionsMenu': function() { - var _0xa88a13 = this, - _0x17edbf = this, - _0x2c1832 = {}; - _0x2c1832.orientation = _0x7f9f36.storage.get('orientation'), _0x2c1832.shader = _0x7f9f36.storage.get('shader'), _0x17edbf.touch ? (_0x2c1832['virtual-gamepad'] = _0x7f9f36.storage.get('virtual-gamepad'), _0x1093f4.call(_0x17edbf, _0x17edbf.elements.container, 'start-game', function() { - ('enabled' === _0x2c1832['virtual-gamepad'] || _0x1e2c68.empty(_0x2c1832['virtual-gamepad'])) && _0xdcec2a.toggleVirtualGamepad.call(_0x17edbf, true); - })) : delete _0x7f9f36.normalOptions['virtual-gamepad'], _0x7f9f36.setOptionMenuItem.call(this, _0x7f9f36.normalOptions, _0x2c1832), _0x1093f4.call(_0x17edbf, _0x17edbf.elements.container, 'start-game', function() { - var _0x2c1832 = _0xa88a13, - _0x42a7b1 = {}; - _0xdcec2a.getGameCoreOptions && _0xdcec2a.getGameCoreOptions().split('\n').forEach(function(_0x4a987e, _0x10bd7a) { - var _0x2c1832 = _0x4a987e.split('; '), - _0x1ddc5f = _0x2c1832[0x0]; - if (0x0 === _0x1ddc5f.indexOf('fba-dipswitch-')) { - var _0xbd808 = _0x2c1832[0x1].split('|'), - _0x3c4b1a = _0x1ddc5f.replace(/_/g, ' ').replace(/.+\-(.+)/, '$1'); - _0x42a7b1[_0x1ddc5f] = { - 'label': _0x3c4b1a, - 'options': _0xbd808.slice(0x1, -0x1), - 'default': _0xbd808[0x0].replace('(Default) ', ''), - 'netplay': true - }; - } - }); - var _0x27d859 = _0x7f9f36.storage.get('core-options'); - _0x7f9f36.coreOptionsValues = _0x27d859 || {}, _0x7f9f36.setOptionMenuItem.call(_0x17edbf, _0x42a7b1, _0x7f9f36.coreOptionsValues), Object.keys(_0x7f9f36.coreOptionsValues).forEach(function(_0x51fc4e, _0x4b3613) { - _0x7f9f36.updateCoreOptions.call(_0x2c1832, _0x51fc4e, _0x7f9f36.coreOptionsValues[_0x51fc4e]); - }), 'nds' == _0x17edbf.system && (_0x27f4c4.Module._fast_forward_2 ? _0x27f4c4.Module._fast_forward_2(0x1) : _0x27f4c4.Module._fast_forward && _0x27f4c4.Module._fast_forward(0x1)); - }); - }, - 'updateCoreOptionMenuItems': function() { - var _0xa88a13 = this.elements.settings.panels.home.querySelector('[role="menu"]'), - _0x17edbf = _0x7f9f36.getCoreOptions.call(this); - _0xdcec2a.connected && !_0xdcec2a.connection.isInitiator ? Object.keys(_0x17edbf).forEach(function(_0x480587) { - _0x17edbf[_0x480587].netplay && _0xa88a13.querySelector('[item="' .concat(_0x480587, '"]')).setAttribute('disabled', ''); - }) : Object.keys(_0x17edbf).forEach(function(_0x20e093) { - _0xa88a13.querySelector('[item="' .concat(_0x20e093, '"]')).removeAttribute('disabled'); - }); - }, - 'setCoreOptionsMenu': function() { - this.elements.settings.panels.home.querySelector('[role="menu"]'), this.elements.settings.popup.children[0x0]; - var _0xa88a13 = _0x7f9f36.getCoreOptions.call(this), - _0x17edbf = _0x7f9f36.storage.get('core-options'); - _0x7f9f36.coreOptionsValues = _0x17edbf || {}, _0x7f9f36.setOptionMenuItem.call(this, _0xa88a13, _0x17edbf); - }, - 'checkMenu': function() { - var _0xa88a13 = this.elements.settings.buttons; - !_0x1e2c68.empty(_0xa88a13) && Object.values(_0xa88a13).some(function(_0x200331) { - return !_0x200331.hidden; - }); - _0x132da7(this.elements.settings.menu, !0x1); - }, - 'focusFirstMenuItem': function(_0x303d68) { - var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] && arguments[0x1]; - if (!this.elements.settings.popup.hidden) { - var _0x2c1832 = _0x303d68; - _0x1e2c68.element(_0x2c1832) || (_0x2c1832 = Object.values(this.elements.settings.panels).find(function(_0xe94c5e) { - return !_0xe94c5e.hidden; - })); - var _0x2f3a13 = _0x2c1832.querySelector('[role^="menuitem"]'); - _0x31cc23.call(this, _0x2f3a13, _0x17edbf); - } - }, - 'toggleMenu': function(_0x28d6c6) { - var _0x17edbf = this.elements.settings.popup, - _0x2c1832 = this.elements.buttons.settings; - if (_0x1e2c68.element(_0x17edbf) && _0x1e2c68.element(_0x2c1832)) { - var _0x614270 = _0x17edbf.hidden, - _0x14f1b5 = _0x614270; - if (_0x1e2c68.boolean(_0x28d6c6)) _0x14f1b5 = _0x28d6c6; - else if (_0x1e2c68.keyboardEvent(_0x28d6c6) && 0x1b === _0x28d6c6.which) _0x14f1b5 = !0x1; - else if (_0x1e2c68.event(_0x28d6c6)) { - var _0xcf75ac = _0x17edbf.contains(_0x28d6c6.target); - if (_0xcf75ac || !_0xcf75ac && _0x28d6c6.target !== _0x2c1832 && _0x14f1b5) return; - } - _0x2c1832.setAttribute('aria-expanded', _0x14f1b5); - _0x132da7(_0x17edbf, !_0x14f1b5); - _0x3a8e2f(this.elements.container, this.config.classNames.menu.open, _0x14f1b5); - _0x14f1b5 && _0x1e2c68.keyboardEvent(_0x28d6c6) ? _0x7f9f36.focusFirstMenuItem.call(this, null, true) : _0x14f1b5 || _0x614270 || _0x31cc23.call(this, _0x2c1832, _0x1e2c68.keyboardEvent(_0x28d6c6)); - } - }, - 'getMenuSize': function(_0x55fe13) { - var _0x17edbf = _0x55fe13.cloneNode(true); - _0x17edbf.style.position = 'absolute'; - _0x17edbf.style.opacity = 0; - _0x17edbf.removeAttribute('hidden'); - _0x55fe13.parentNode.appendChild(_0x17edbf); - var _0x2c1832 = _0x17edbf.scrollWidth, - _0x5edd1b = _0x17edbf.scrollHeight; - return _0x12a55d(_0x17edbf), { - 'width': _0x2c1832, - 'height': _0x5edd1b - }; - }, - 'showLoadStatePanel': function() {}, - 'showMenuPanel': function() { - var _0xa88a13 = this, - _0x17edbf = arguments.length > 0x0 && void 0x0 !== arguments[0x0] ? arguments[0x0] : '', - _0x2c1832 = arguments.length > 0x1 && void 0x0 !== arguments[0x1] && arguments[0x1], - _0x7f4281 = _0x530042.call(this, '[data-pane="' .concat(escape(_0x17edbf), '"]')); - if (_0x1e2c68.element(_0x7f4281)) { - var _0x3d6729 = _0x7f4281.parentNode, - _0x381f57 = Array.from(_0x3d6729.children).find(function(_0x57c652) { - return !_0x57c652.hidden; - }); - if (_0x2d904a.transitions && !_0x2d904a.reducedMotion) { - _0x3d6729.style.width = '' .concat(_0x381f57.scrollWidth, 'px'); - _0x3d6729.style.height = '' .concat(_0x381f57.scrollHeight, 'px'); - var _0x29dd37 = _0x7f9f36.getMenuSize.call(this, _0x7f4281), - _0x37447f = function _0x17edbf(_0x40854f) { - _0x40854f.target === _0x3d6729 && ['width', 'height'].includes(_0x40854f.propertyName) && (_0x3d6729.style.width = '', _0x3d6729.style.height = '', _0x20109b.call(_0xa88a13, _0x3d6729, _0x5a2767, _0x17edbf)); - }; - _0x1093f4.call(this, _0x3d6729, _0x5a2767, _0x37447f), _0x3d6729.style.width = '' .concat(_0x29dd37.width, 'px'), _0x3d6729.style.height = '' .concat(_0x29dd37.height, 'px'); - } - _0x132da7(_0x381f57, true); - _0x132da7(_0x7f4281, false); - _0x7f9f36.focusFirstMenuItem.call(this, _0x7f4281, _0x2c1832); - } - }, - 'setLoadState': function(_0x526828, _0x2ce330) { - _0x526828.appendChild(_0x7f9f36.createButton.call(this, 'load-state', { - 'aria-haspopup': true, - 'aria-expanded': !0x1 - })); - var _0x2c1832 = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__dialog': true, - 'ejs__load-state__container': true - }), - 'hidden': '' - }), - _0x2e5e96 = _0x428003('div'); - _0x2c1832.appendChild(_0x2e5e96); - _0x530042.call(this, '.' .concat(_0x449eac({ - 'ejs__dialogs': true - }))).appendChild(_0x2c1832); - this.elements.dialogs.loadState = _0x2c1832; - }, - 'setScreenRecord': function(_0x4c3fdd, _0x289259) { - if (! window.MediaRecorder) { - return; - }; - var _0x2c1832 = _0x7f9f36.createButton.call(this, 'screen-record', { - 'aria-haspopup': true, - 'aria-expanded': !0x1, - 'style': 'margin-right:auto;' - }); - _0x4c3fdd.appendChild(_0x2c1832); - var _0x13c0e4 = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__dialog': true, - 'ejs__screenRecord__container': true - }), - 'hidden': '' - }), - _0xe2c02a = _0x428003('div'); - _0x13c0e4.appendChild(_0xe2c02a); - _0x530042.call(this, '.' .concat(_0x449eac({ - 'ejs__dialogs': true - }))).appendChild(_0x13c0e4); - this.elements.dialogs.screenRecord = _0x13c0e4; - }, - 'setGamepad': function(_0x4c3fdd, _0x289259) { - var _0x2c1832 = _0x7f9f36.createButton.call(this, 'gamepad', { - 'aria-haspopup': true, - 'aria-expanded': !0x1, - 'style': 'margin-right:auto;' - }); - _0x4c3fdd.appendChild(_0x2c1832); - var _0x13c0e4 = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__dialog': true, - 'ejs__gamepad__container': true - }), - 'hidden': '' - }), - _0xe2c02a = _0x428003('div'); - _0x13c0e4.appendChild(_0xe2c02a); - _0x530042.call(this, '.' .concat(_0x449eac({ - 'ejs__dialogs': true - }))).appendChild(_0x13c0e4); - this.elements.dialogs.gamepad = _0x13c0e4; - }, - 'setCheat': function(_0x328075, _0x21ca37) { - var _0x2c1832 = _0x7f9f36.createButton.call(this, 'cheat', { - 'aria-haspopup': true, - 'aria-expanded': !0x1, - 'style': 'margin-right:auto;' - }); - _0x328075.appendChild(_0x2c1832); - var _0x173db3 = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__dialog': true, - 'ejs__cheat__container': true - }), - 'hidden': '' - }), - _0x460961 = _0x428003('div'); - _0x173db3.appendChild(_0x460961); - _0x530042.call(this, '.' .concat(_0x449eac({ - 'ejs__dialogs': true - }))).appendChild(_0x173db3); - this.elements.dialogs.cheat = _0x173db3; - }, - 'setStateInfoBarWidget': function() { - var _0xa88a13 = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__widget': true - }) - }), - _0x17edbf = _0x428003('div'); - _0x17edbf.style = 'color: red;font-size: 17px;padding:10px;text-align:left;text-shadow:1px 1px 1px #000' - _0xa88a13.appendChild(_0x17edbf); - _0x530042.call(this, '.' .concat(_0x449eac({ - 'ejs__widgets': true - }))).appendChild(_0xa88a13); - this.elements.widgets.stateInfo = _0xa88a13; - this.elements.widgets.stateInfoDiv = _0x17edbf; - }, - 'setNetplayWidgets': function() { - var _0xa88a13 = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__widget': true, - 'ejs__widget_netplay': true - }) - }), - _0x17edbf = _0x428003('div'); - _0xa88a13.appendChild(_0x17edbf); - _0x530042.call(this, '.' .concat(_0x449eac({ - 'ejs__widgets': true - }))).appendChild(_0xa88a13); - this.elements.widgets.netplay = _0xa88a13; - }, - 'setNetplay': function(_0x1859f4, _0x50544d) { - _0x1859f4.appendChild(_0x7f9f36.createButton.call(this, 'netplay', { - 'aria-haspopup': true, - 'aria-expanded': !0x1 - })); - var _0x2c1832 = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__dialog': true, - 'ejs__netplay__container': true - }), - 'hidden': '' - }), - _0x4f63e0 = _0x428003('div'); - _0x2c1832.appendChild(_0x4f63e0); - _0x530042.call(this, '.' .concat(_0x449eac({ - 'ejs__dialogs': true - }))).appendChild(_0x2c1832); - this.elements.dialogs.netplay = _0x2c1832; - _0x7f9f36.setNetplayWidgets.call(this); - }, - 'toggleContextMenu': function(_0x24b1f3, _0x4b9d55) { - if (_0x350d73(_0x24b1f3.target, _0x449eac({ - 'ejs__dialogs': true - }))) { - var _0x2c1832 = _0x7f9f36.contextMenu.timer; - if (this.started) { - var _0x2a1dda = _0x530042.call(this, '.' .concat(_0x449eac({ - 'ejs__contextmenu': true - }), ' ul')); - if (_0x4b9d55) { - _0x7f9f36.contextMenu.style.display = 'block', _0x7f9f36.contextMenu.style.left = '' .concat(_0x24b1f3.layerX, 'px'), _0x7f9f36.contextMenu.style.top = '' .concat(_0x24b1f3.layerY, 'px'); - var _0x1b48e7 = _0x23ffa1.call(this, '.' .concat(_0x449eac({ - 'ejs__contextmenu': true - }), ' ul li')); - if (Array.from(_0x1b48e7).forEach(function(_0x228a1f, _0x123a07) {}), null === _0x2a1dda.getAttribute('menu')) { - var _0x14264d = _0x428003('li', {}); - _0x14264d.appendChild(_0x428003('a', { - 'target': '_blank', - 'href': 'https://github.com/ethanaobrien/emulatorjs' - }, 'EmulatorJS v' .concat(this.version))), _0x2a1dda.appendChild(_0x14264d), _0x2a1dda.setAttribute('menu', ''); - } - _0x2c1832 && clearTimeout(_0x2c1832), _0x2c1832 = setTimeout(function() {}, 0xfa0), _0x7f9f36.contextMenu.timer = _0x2c1832; - } else _0x7f9f36.contextMenu.style.display = 'none'; - } - } - }, - 'create': function(_0x42e40d) { - var _0xa88a13 = this; - _0x7f9f36.storage = new _0x2f61ba(this, 'ejs_' .concat(this.system, '_settings')); - var _0x17edbf = _0x428003('div', _0xa949a8(this.config.selectors.controls.wrapper)); - _0x7f9f36.contextMenu = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__contextmenu': true - }), - 'style': 'position: absolute; display:none;z-index:9' - }) - var contextHtml = ['
      ', '
    '] - var contextFunctions = [] - function addContextHtml(title, hidden, functi0n) { - if (typeof functi0n == 'function') { - contextFunctions.push(functi0n) - } else { - contextFunctions.push(function(){}) - } - var i = contextHtml.length - 1 - if (hidden) { - contextHtml.splice(i, 0, '') - } else { - contextHtml.splice(i, 0, '
  • '+title+'
  • ') - } - } - addContextHtml('Take Screenshot', false, function(_0x20faaa) { - var _0x4e898a = _0x378b5c.getScreenData(); - _0x4e4ca6()(new Blob([_0x4e898a]), 'game.png'); - return false; - }) - addContextHtml('Cache Manage', true, function(_0x275730) { - if (_0x27f4c4.romdb) { - _0x132da7(_0xa88a13.elements.dialogs.cache, !0x1); - var _0x3360eb = _0xa88a13.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-content'])); - _0x3360eb.innerHTML = '
    Loading
    ', _0x27f4c4.romdb.getAll(function(_0x43586d) { - if (_0x43586d) { - var _0x275730 = _0x428003('table', { - 'style': 'width:100%;padding-left:10px;text-align:left' - }), - _0x1ab9e9 = _0x428003('tbody'); - _0x43586d.length > 0x0 ? (_0x3360eb.innerHTML = '', _0x43586d.forEach(function(_0x32b0b7, _0x2d0e11) { - if (_0x32b0b7.key && !/-part-\d+$/ .test(_0x32b0b7.key)) { - for (var _0x3360eb = Math.ceil(_0x32b0b7.filesize / 0x6400000), _0x277c67 = [_0x32b0b7.key], _0x3edb35 = 0x1; _0x3edb35 < _0x3360eb; _0x3edb35 += 0x1) _0x277c67.push('' .concat(_0x32b0b7.key, '-part-').concat(_0x3edb35)); - var _0x3e31f6 = _0x428003('tr'), - _0x5b75bd = _0x428003('td'), - _0x227405 = _0x428003('td'), - _0xac150b = _0x428003('td'); - _0x5b75bd.innerHTML = _0x32b0b7.filename, _0x227405.innerHTML = function(_0x1858c1) { - var _0x2d0e11 = -0x1; - do { - _0x1858c1 /= 0x400, _0x2d0e11++; - } while (_0x1858c1 > 0x400); - return Math.max(_0x1858c1, 0.1).toFixed(0x1) + [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'][_0x2d0e11]; - }(_0x32b0b7.filesize), _0xac150b.innerHTML = 'Remove', _0x3e31f6.appendChild(_0x5b75bd), _0x3e31f6.appendChild(_0x227405), _0x3e31f6.appendChild(_0xac150b), _0x1ab9e9.appendChild(_0x3e31f6), _0xac150b.querySelector('a').onclick = function(_0x16f22a) { - _0x27f4c4.romdb.removeBatch(_0x277c67); - try { - _0x1ab9e9.removeChild(_0x3e31f6); - } catch (_0x353628) {} - return _0x16f22a.stopPropagation(), !0x1; - }; - } - }), _0x275730.appendChild(_0x1ab9e9), _0x3360eb.appendChild(_0x275730)) : _0x3360eb.innerHTML = '
    Empty
    '; - } else _0x3360eb.innerHTML = '
    Empty
    '; - }, function() {}); - } - return false; - }) - addContextHtml('Quick Save (F2)', false, function(_0x395c73) { - _0x378b5c.quickSaveState(); - _0x2593da.contextMenu.style.display = 'none'; - }) - addContextHtml('Quick Load (F4)', false, function(_0x124f69) { - _0x378b5c.quickLoadState(); - _0x2593da.contextMenu.style.display = 'none'; - }) - - - _0x7f9f36.contextMenu.innerHTML = contextHtml.join('') - var a = _0x7f9f36.contextMenu.getElementsByTagName('li') - for (var i=0; i 0x0 && _0x7f9f36.setNetplay.call(this, _0x17edbf, _0x42e40d); - _0x7f9f36.setGamepad.call(this, _0x17edbf, _0x42e40d); - _0x7f9f36.setStateInfoBarWidget.call(this, _0x17edbf, _0x42e40d); - _0x7f9f36.setCheat.call(this, _0x17edbf, _0x42e40d); - _0x17edbf.appendChild(_0x428003('span', { - 'style': 'flex:1' - })); - var _0xd299b = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__volume': true - }) - }); - _0xd299b.appendChild(_0x7f9f36.createButton.call(this, 'mute')); - var _0x4bbcd0 = { - 'max': 0x1, - 'step': 0.01, - 'value': this.config.volume - }; - _0xd299b.appendChild(_0x7f9f36.createRange.call(this, 'volume', _0x5dc0c0(_0x4bbcd0, {}))), this.elements.volume = _0xd299b, _0x17edbf.appendChild(_0xd299b); - var _0x2746ab = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__menu': true - }) - }); - _0x2746ab.appendChild(_0x7f9f36.createButton.call(this, 'settings', { - 'aria-haspopup': true, - 'aria-expanded': !0x1 - })); - var _0x262fb8 = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__menu__container': true - }), - 'hidden': '' - }), - _0x3f3385 = _0x428003('div'), - _0x174c46 = _0x428003('div', { - 'data-pane': 'home' - }), - _0x17f3cb = _0x428003('div', { - 'role': 'menu' - }); - _0x174c46.appendChild(_0x17f3cb) - _0x3f3385.appendChild(_0x174c46) - this.elements.settings.panels.home = _0x174c46 - _0x262fb8.appendChild(_0x3f3385) - _0x2746ab.appendChild(_0x262fb8) - _0x17edbf.appendChild(_0x2746ab) - this.elements.settings.popup = _0x262fb8 - this.elements.settings.menu = _0x2746ab - _0x17edbf.appendChild(_0x7f9f36.createButton.call(this, 'fullscreen')) - var _0x19edbf = this; - _0x17edbf.addEventListener('mousedown', function() { - _0x19edbf.onButtonDiv = true; - }) - this.elements.controls = _0x17edbf - _0x7f9f36.setNormalOptionsMenu.call(this) - _0x7f9f36.setCoreOptionsMenu.call(this) - return _0x17edbf; - }, - 'inject': function() { - var _0xa88a13 = this; - this.icons = { - 'enter-fullscreen': '', - 'exit-fullscreen': '', - 'gamepad': '', - 'load-state': '', - 'muted': '', - 'netplay': '', - 'pause': '', - 'play': '', - 'restart': '', - 'save-state': '', - 'screen-record': '', - 'settings': '', - 'volume': '\n \n ', - 'cheat': '' - }, this.id = Math.floor(0x2710 * Math.random()); - var _0x17edbf = null; - this.elements.controls = null; - var _0x2c1832 = { - 'id': this.id - }, - _0x270a9e = true; - _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, { - 'id': this.id, - 'seektime': this.config.seekTime, - 'speed': this.speed, - 'quality': this.quality - }), _0x270a9e = !0x1); - var _0x1e6644, _0x3ec218 = function(_0x406126) { - var _0x17edbf = _0x406126; - return Object.entries(_0x2c1832).forEach(function(_0x3e992c) { - var _0x2c1832 = _0x5005e6(_0x3e992c, 0x2), - _0x47c2ec = _0x2c1832[0x0], - _0x547588 = _0x2c1832[0x1]; - _0x17edbf = _0x1a0e98(_0x17edbf, '{' .concat(_0x47c2ec, '}'), _0x547588); - }), _0x17edbf; - }; - 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)) { - var _0xe8272c = function(_0x176a3e) { - var _0x2c1832 = _0xa88a13.config.classNames.controlPressed; - Object.defineProperty(_0x176a3e, 'pressed', { - 'enumerable': true, - 'get': function() { - return _0x350d73(_0x176a3e, _0x2c1832); - }, - 'set': function() { - var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] && arguments[0x0]; - _0x3a8e2f(_0x176a3e, _0x2c1832, _0xa88a13); - } - }); - }; - Object.values(this.elements.buttons).filter(Boolean).forEach(function(_0x577b9b) { - _0x1e2c68.array(_0x577b9b) || _0x1e2c68.nodeList(_0x577b9b) ? Array.from(_0x577b9b).filter(Boolean).forEach(_0xe8272c) : _0xe8272c(_0x577b9b); - }); - } - window.navigator.userAgent.includes('Edge') && _0x2b30e0(_0x1e6644); - } - }, - _0x2593da = _0x7f9f36; - - function _0x28bdca(_0x5c50c3, _0x217698) { - for (var _0x2c1832 = 0x0; _0x2c1832 < _0x217698.length; _0x2c1832++) { - var _0x172cdb = _0x217698[_0x2c1832]; - _0x172cdb.enumerable = _0x172cdb.enumerable || !0x1, _0x172cdb.configurable = true, 'value' in _0x172cdb && (_0x172cdb.writable = true), Object.defineProperty(_0x5c50c3, _0x172cdb.key, _0x172cdb); - } - } - - function _0x238270() { - if (this.enabled) { - var _0xa88a13 = this.player.elements.buttons.fullscreen; - _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); - } - } - - function _0x3c983f() { - var _0xa88a13 = arguments.length > 0x0 && void 0x0 !== arguments[0x0] && arguments[0x0]; - _0xa88a13 ? this.scrollPosition = { - 'x': window.scrollX || 0x0, - 'y': window.scrollY || 0x0 - } : 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); - } - var _0x335854 = function() { - function _0x1339df(_0x5f19c6) { - var _0x2c1832 = this; - ! function(_0x143a8a, _0x32a0a1) { - if (!(_0x143a8a instanceof _0x32a0a1)) throw new TypeError('Cannot call a class as a function'); - }(this, _0x1339df), this.player = _0x5f19c6, this.prefix = _0x1339df.prefix, this.property = _0x1339df.property, this.scrollPosition = { - 'x': 0x0, - 'y': 0x0 - }, _0x1093f4.call(this.player, document, 'ms' === this.prefix ? 'MSFullscreenChange' : '' .concat(this.prefix, 'fullscreenchange'), function() { - _0x238270.call(_0x2c1832); - }), this.update(); - } - - var _0x17edbf, _0x2c1832, _0x50d347; - - _0x17edbf = _0x1339df - - _0x50d347 = [{ - 'key': 'native', - 'get': function() { - return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled); - } - }, { - 'key': 'prefix', - 'get': function() { - if (_0x1e2c68.function(document.exitFullscreen)) return ''; - var _0x1339df = ''; - return ['webkit', 'moz', 'ms'].some(function(_0xc1e0c3) { - return !(!_0x1e2c68.function(document['' .concat(_0xc1e0c3, 'ExitFullscreen')]) && !_0x1e2c68.function(document['' .concat(_0xc1e0c3, 'CancelFullScreen')]) || (_0x1339df = _0xc1e0c3, 0x0)); - }), _0x1339df; - } - }, { - 'key': 'property', - 'get': function() { - return 'moz' === this.prefix ? 'FullScreen' : 'Fullscreen'; - } - }] - - _0x2c1832 = [{ - 'key': 'update', - 'value': function() { - this.enabled, _0x3a8e2f(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled); - } - }, { - 'key': 'enter', - 'value': function() { - 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)); - } - }, { - 'key': 'exit', - 'value': function() { - if (this.enabled) - if (_0x1339df.native) - if (this.prefix) { - if (!_0x1e2c68.empty(this.prefix)) { - var _0x17edbf = 'moz' === this.prefix ? 'Cancel' : 'Exit'; - document['' .concat(this.prefix).concat(_0x17edbf).concat(this.property)](); - } - } else(document.cancelFullScreen || document.exitFullscreen).call(document); - else _0x3c983f.call(this, !0x1); - } - }, { - 'key': 'toggle', - 'value': function() { - this.active ? this.exit() : this.enter(); - } - }, { - 'key': 'enabled', - 'get': function() { - return _0x1339df.native; - } - }, { - 'key': 'active', - 'get': function() { - 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)); - } - }, { - 'key': 'target', - 'get': function() { - return _0x59aa33.isEdge ? this.player.game : this.player.elements.container; - } - }] - - _0x28bdca(_0x17edbf.prototype, _0x2c1832) - _0x50d347 && _0x28bdca(_0x17edbf, _0x50d347) - return _0x1339df; - - }(); - - function _0x42b437(_0x458e02, _0x5729e1) { - if (Array.isArray(_0x458e02)) return _0x458e02; - var _0x2c1832 = [], - _0x2e7aa7 = true, - _0x393a5f = false, - _0x3b4eca = void 0x0; - try { - for (var _0x1aca09, _0x1bb8de = _0x458e02[Symbol.iterator](); !(_0x2e7aa7 = (_0x1aca09 = _0x1bb8de.next()).done) && (_0x2c1832.push(_0x1aca09.value), !_0x5729e1 || _0x2c1832.length !== _0x5729e1); _0x2e7aa7 = true); - } catch (_0x190997) { - _0x393a5f = true, _0x3b4eca = _0x190997; - } finally { - try { - _0x2e7aa7 || null == _0x1bb8de.return || _0x1bb8de.return(); - } finally { - if (_0x393a5f) throw _0x3b4eca; - } - } - return _0x2c1832; - throw new TypeError('Invalid attempt to destructure non-iterable instance'); - } - var _0x37093c = function() { - function _0x31e271(_0x948a97) { - ! function(_0x3adedc, _0x5952e9) { - if (!(_0x3adedc instanceof _0x5952e9)) throw new TypeError('Cannot call a class as a function'); - }(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); - } - _0x31e271.prototype = { - toggleMenu: function(_0x3156ad) { - _0x2593da.toggleMenu.call(this.emulator, _0x3156ad); - }, - firstTouch: function() { - var _0x31e271 = this.emulator, - _0x17edbf = _0x31e271.elements; - _0x31e271.touch = true, _0x3a8e2f(_0x17edbf.container, _0x31e271.config.classNames.isTouch, true); - }, - setTabFocus: function(_0x20bf1f) { - var _0x17edbf = this.emulator, - _0x2c1832 = _0x17edbf.elements, - _0x48d087 = _0x17edbf; - if (clearTimeout(this.focusTimer), 'keydown' !== _0x20bf1f.type || 0x9 === _0x20bf1f.which) { - 'keydown' === _0x20bf1f.type && (this.lastKeyDown = _0x20bf1f.timeStamp); - var _0x27d4ad, _0x967a30 = _0x20bf1f.timeStamp - this.lastKeyDown <= 0x14; - ('focus' !== _0x20bf1f.type || _0x967a30) && (_0x27d4ad = _0x48d087.config.classNames.tabFocus, _0x3a8e2f(_0x23ffa1.call(_0x48d087, '.' .concat(_0x27d4ad)), _0x27d4ad, !0x1), this.focusTimer = setTimeout(function() { - var _0x20bf1f = document.activeElement; - _0x2c1832.container.contains(_0x20bf1f) && _0x3a8e2f(document.activeElement, _0x48d087.config.classNames.tabFocus, true); - }, 0xa)); - } - }, - global: function() { - var _0x31e271 = !(arguments.length > 0x0 && void 0x0 !== arguments[0x0]) || arguments[0x0], - _0x17edbf = this.emulator, - _0x2c1832 = _0x17edbf; - _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, !0x1, true), _0x1093f4.call(_0x2c1832, document.body, 'keyup', function(_0x4e289a) { - _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')); - }); - }, - container: function() { - var _0x31e271, _0x17edbf = this.emulator, - _0x2c1832 = _0x17edbf.elements, - _0x45d275 = _0x17edbf; - _0x1093f4.call(_0x45d275, _0x2c1832.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen start-game', function(_0x1ac81c) { - var _0x3953b5 = _0x2c1832.controls; - _0x3953b5 && 'enterfullscreen' === _0x1ac81c.type && (_0x3953b5.pressed = !0x1, _0x3953b5.hover = !0x1); - var _0x2c3de3 = 0x0; - if (['touchstart', 'touchmove', 'mousemove', 'start-game'].includes(_0x1ac81c.type)) { - if (_0x17edbf.system == 'nds' && ['touchstart', 'touchmove', 'mousemove'].includes(_0x1ac81c.type) && _0x27f4c4 && _0x27f4c4.Module && _0x27f4c4.Module.canvas && (document.pointerLockElement === _0x27f4c4.Module.canvas || document.mozPointerLockElement === _0x27f4c4.Module.canvas)) { - _0x5ab74d.toggleControls.call(_0x45d275, false); - return; - } - if (_0xdcec2a && (_0xdcec2a.virtualGamepadContainer == 'undefined' || _0xdcec2a.virtualGamepadContainer === null)) { - _0x5ab74d.toggleControls.call(_0x45d275, true); - _0x2c3de3 = _0x45d275.touch ? 0xbb8 : 0x7d0; - clearTimeout(_0x31e271); - _0x31e271 = setTimeout(function() { - return _0x5ab74d.toggleControls.call(_0x45d275, !0x1); - }, _0x2c3de3); - _0x2c1832.controls.setAttribute('data-timer', _0x31e271); - } - }; - }), _0x1093f4.call(_0x45d275, window, 'resize', function(_0x3e2cc5) { - var _0x17edbf = _0x45d275.elements.container.clientHeight, - _0x2c1832 = _0x23ffa1.call(_0x45d275, '.' .concat(_0x449eac({ - 'ejs__menu__container': true - }), ' [role="menu"]')); - Array.from(_0x2c1832).forEach(function(_0x43a16d) { - _0x43a16d.style.maxHeight = '' .concat(_0x17edbf - 0x5f, 'px'), _0x43a16d.style.overflow = 'auto'; - }), _0x27f4c4.Module && _0x27f4c4.Module.canvas, _0x45d275.elements.container.clientWidth / _0x45d275.elements.container.clientHeight < 1.3 ? _0x3a8e2f(_0x45d275.elements.container, _0x449eac({ - 'portrait': true - }), true) : _0x3a8e2f(_0x45d275.elements.container, _0x449eac({ - 'portrait': true - }), !0x1); - }), _0xbae705.call(_0x45d275, window, 'resize'), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'enterfullscreen', function(_0x586586) { - setTimeout(function() { - _0xbae705.call(_0x45d275, window, 'resize'); - }, 0x12c); - }), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'exitfullscreen', function(_0x4de2f3) { - setTimeout(function() { - _0xbae705.call(_0x45d275, window, 'resize'); - }, 0x12c); - }), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'start-game', function(_0x5b0a00) { - var _0x17edbf = window.document.createEvent('UIEvents'); - _0x17edbf.initUIEvent('resize', true, !0x1, window, 0x0), window.dispatchEvent(_0x17edbf), _0x3a8e2f(_0x45d275.elements.container, _0x449eac({ - 'game-started': true - }), true); - }), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'blur', function(_0x893c7a) { - var _0x17edbf = _0x893c7a.currentTarget; - setTimeout(function() { - _0x17edbf.contains(document.activeElement) || _0xbae705.call(_0x45d275, _0x45d275.elements, 'blurgame'); - }, 0x0); - }), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'focus', function(_0xe0dee3) { - var _0x17edbf = _0xe0dee3.currentTarget; - setTimeout(function() { - _0x17edbf.contains(document.activeElement) && _0xbae705.call(_0x45d275, _0x45d275.elements, 'focusgame'); - }, 0x0); - }); - }, - media: function() { - var _0x31e271 = this.emulator, - _0x17edbf = _0x31e271.elements, - _0x2c1832 = _0x31e271; - _0x1093f4.call(_0x2c1832, _0x2c1832.game, 'volumechange', function(_0x3099fe) { - return _0x2593da.updateVolume.call(_0x2c1832, _0x3099fe); - }), _0x1093f4.call(_0x2c1832, _0x17edbf.container, 'contextmenu', function(_0x5c22bc) { - _0x2c1832.touch || _0x2c1832.lightgun || _0x2593da.toggleContextMenu.call(_0x2c1832, _0x5c22bc, true), _0x5c22bc.preventDefault(); - }, !0x1), _0x1093f4.call(_0x2c1832, _0x17edbf.container, 'mousewheel', function(_0x49c974) { - _0x49c974.stopPropagation(); - }, !0x1), _0x1093f4.call(_0x2c1832, _0x17edbf.container, 'mousedown', function(_0x53ee35) { - if (_0x31e271.system == 'nds' && _0x27f4c4 && _0x27f4c4.Module && _0x27f4c4.Module.canvas && ! _0x27f4c4.isMobileDevice && !(document.pointerLockElement === _0x27f4c4.Module.canvas || document.mozPointerLockElement === _0x27f4c4.Module.canvas) && _0x31e271.started && !_0x31e271.connected) { - setTimeout(function() { - if (_0x31e271.onButtonDiv !== true) { - _0x27f4c4.Module.canvas.requestPointerLock = _0x27f4c4.Module.canvas.requestPointerLock || _0x27f4c4.Module.canvas.mozRequestPointerLock; - _0x27f4c4.Module.canvas.requestPointerLock() - } - _0x31e271.onButtonDiv = false - }, 100) - } - _0x2c1832.touch || _0x2593da.toggleContextMenu.call(_0x2c1832, _0x53ee35, !0x1); - }, !0x1), _0x1093f4.call(_0x2c1832, _0x2c1832.game, 'volumechange', function() { - _0x2c1832.storage.set({ - 'volume': _0x2c1832.volume, - 'muted': _0x2c1832.muted - }), _0xdcec2a.setVolume && _0xdcec2a.setVolume(); - }); - var _0x38e17f = _0x2c1832.config.events.concat(['keyup', 'keydown']).join(' '); - _0x1093f4.call(_0x2c1832, _0x2c1832.game, _0x38e17f, function(_0x38e438) { - var _0x2b4804 = _0x38e438.detail, - _0x1bfeb2 = void 0x0 === _0x2b4804 ? {} : _0x2b4804; - 'error' === _0x38e438.type && (_0x1bfeb2 = _0x2c1832.game.error), _0xbae705.call(_0x2c1832, _0x17edbf.container, _0x38e438.type, true, _0x1bfeb2); - }); - }, - proxy: function(_0x52d0c2, _0x500f90, _0x175ce5) { - var _0x4bb44e = this.emulator, - _0x584a64 = _0x4bb44e.config.listeners[_0x175ce5], - _0x5269fd = true; - _0x1e2c68.function(_0x584a64) && (_0x5269fd = _0x584a64.call(_0x4bb44e, _0x52d0c2)), _0x5269fd && _0x1e2c68.function(_0x500f90) && _0x500f90.call(_0x4bb44e, _0x52d0c2); - }, - bind: function(_0x4a8d46, _0x8f91ad, _0x2affda, _0x41dfb1) { - var _0x1363b1 = this, - _0x53b9a1 = !(arguments.length > 0x4 && void 0x0 !== arguments[0x4]) || arguments[0x4], - _0x5209a5 = this.emulator, - _0x27b738 = _0x5209a5, - _0x5d89ff = _0x27b738.config.listeners[_0x41dfb1], - _0x100c9f = _0x1e2c68.function(_0x5d89ff); - _0x1093f4.call(_0x27b738, _0x4a8d46, _0x8f91ad, function(_0x5a03ac) { - return _0x1363b1.proxy(_0x5a03ac, _0x2affda, _0x41dfb1); - }, _0x53b9a1 && !_0x100c9f); - }, - controls: function() { - var _0x31e271 = this, - _0x17edbf = this.emulator, - _0x2c1832 = _0x17edbf.elements, - _0x127f22 = _0x59aa33.isIE ? 'change' : 'input'; - if (this.bind(_0x2c1832.buttons.mute, 'click', function() { - _0x17edbf.muted = !_0x17edbf.muted; - }, 'mute'), this.bind(_0x2c1832.buttons.fullscreen, 'click', function() { - _0x17edbf.fullscreen.toggle(); - }, 'fullscreen'), this.bind(_0x2c1832.buttons.gamepad, 'click', function() { - _0x5ab74d.toggleControls.call(_0x17edbf, !0x1), _0x132da7(_0x2c1832.dialogs.gamepad, !0x1); - }, 'mute'), this.bind(_0x2c1832.buttons.saveState, 'click', function() { - _0xbae705.call(_0x17edbf, _0x17edbf.elements.container, 'savestate-start', !0x1, {}); - var _0x31e271 = _0xdcec2a.saveState(), - _0x2c1832 = _0xdcec2a.getScreenData(); - _0xbae705.call(_0x17edbf, _0x17edbf.elements.container, 'savestate', !0x1, { - 'state': _0x31e271, - 'screenshot': _0x2c1832 - }); - }, 'mute'), this.bind(_0x2c1832.buttons.loadState, 'click', function() { - _0xbae705.call(_0x17edbf, _0x17edbf.elements.container, 'loadstate', !0x1, {}); - }, 'mute'), this.bind(_0x2c1832.buttons.settings, 'click', function(_0x1396ee) { - _0x1396ee.stopPropagation(), _0x2593da.toggleMenu.call(_0x17edbf, _0x1396ee); - }), this.bind(_0x2c1832.buttons.settings, 'keyup', function(_0x454936) { - var _0x2c1832 = _0x454936.which; - [0xd, 0x20].includes(_0x2c1832) && (0xd !== _0x2c1832 ? (_0x454936.preventDefault(), _0x454936.stopPropagation(), _0x2593da.toggleMenu.call(_0x17edbf, _0x454936)) : _0x2593da.focusFirstMenuItem.call(_0x17edbf, null, true)); - }, null, !0x1), this.bind(_0x2c1832.settings.menu, 'keydown', function(_0x40072c) { - 0x1b === _0x40072c.which && _0x2593da.toggleMenu.call(_0x17edbf, _0x40072c); - }), _0x59aa33.isIos) { - var _0x4bd188 = _0x23ffa1.call(_0x17edbf, 'input[type="range"]'); - Array.from(_0x4bd188).forEach(function(_0x345e4c) { - return _0x31e271.bind(_0x345e4c, _0x127f22, function(_0x58e6a9) { - return _0x2b30e0(_0x58e6a9.target); - }); - }); - } - _0x59aa33.isWebkit && Array.from(_0x23ffa1.call(_0x17edbf, 'input[type="range"]')).forEach(function(_0x45c503) { - _0x31e271.bind(_0x45c503, 'input', function(_0x436691) { - return _0x2593da.updateRangeFill.call(_0x17edbf, _0x436691.target); - }); - }), this.bind(_0x2c1832.inputs.volume, _0x127f22, function(_0x42307e) { - _0x17edbf.volume = _0x42307e.target.value; - }, 'volume'), this.bind(_0x2c1832.controls, 'mouseenter mouseleave', function(_0x10170b) { - 'mouseleave' === _0x10170b.type && null === _0x10170b.toElement ? _0x2c1832.controls.hover = true : _0x2c1832.controls.hover = !_0x17edbf.touch && 'mouseenter' === _0x10170b.type; - }), this.bind(_0x2c1832.controls, 'mousedown mouseup touchstart touchend touchcancel', function(_0x4bfb22) { - if (['mousedown', 'touchstart'].includes(_0x4bfb22.type)) { - _0x2c1832.controls.pressed = true; - var _0x17edbf = _0x2c1832.controls.getAttribute('data-timer2'); - clearTimeout(_0x17edbf); - } else { - var _0x29ba04 = setTimeout(function() { - _0x2c1832.controls.pressed = !0x1; - }, 0xfa0); - _0x2c1832.controls.setAttribute('data-timer2', _0x29ba04); - } - }), this.bind(_0x2c1832.controls, 'focusin focusout', function(_0x54e607) { - var _0x466a37 = _0x17edbf.config, - _0x2ab6f3 = _0x17edbf.elements, - _0x5f0669 = 'focusin' === _0x54e607.type, - _0x11de96 = _0x2ab6f3.controls.getAttribute('data-timer'); - if (_0x3a8e2f(_0x2ab6f3.controls, _0x466a37.classNames.noTransition, _0x5f0669), _0x5ab74d.toggleControls.call(_0x17edbf, _0x5f0669), _0x5f0669) { - setTimeout(function() { - _0x3a8e2f(_0x2ab6f3.controls, _0x466a37.classNames.noTransition, !0x1); - }, 0x0); - var _0x314d11 = _0x31e271.touch ? 0xbb8 : 0xfa0; - clearTimeout(_0x11de96), _0x11de96 = setTimeout(function() { - return _0x5ab74d.toggleControls.call(_0x17edbf, !0x1); - }, _0x314d11), _0x2ab6f3.controls.setAttribute('data-timer', _0x11de96); - } - }), this.bind(_0x2c1832.inputs.volume, 'wheel', function(_0x28b2d2) { - var _0x2c1832 = _0x28b2d2.webkitDirectionInvertedFromDevice, - _0x12883c = _0x42b437([_0x28b2d2.deltaX, -_0x28b2d2.deltaY].map(function(_0x1ce956) { - return _0x2c1832 ? -_0x1ce956 : _0x1ce956; - }), 0x2), - _0x247794 = _0x12883c[0x0], - _0x5dcee2 = _0x12883c[0x1], - _0x5691ae = Math.sign(Math.abs(_0x247794) > Math.abs(_0x5dcee2) ? _0x247794 : _0x5dcee2); - _0x17edbf.increaseVolume(_0x5691ae / 0x32); - var _0x47df17 = _0x17edbf.game.volume; - (0x1 === _0x5691ae && _0x47df17 < 0x1 || -0x1 === _0x5691ae && _0x47df17 > 0x0) && _0x28b2d2.preventDefault(); - }, 'volume', !0x1), this.bind(_0x2c1832.controls, 'contextmenu', function(_0x1db0c5) { - _0x1db0c5.stopPropagation(); - }), this.bind(_0x2c1832.contextMenu, 'contextmenu', function(_0x37851d) { - _0x37851d.stopPropagation(); - }); - } - - } - return _0x31e271; - }(); - - function _0x1a3a6c(_0x5a5a15, _0x4e2d69) { - for (var _0x2c1832 = 0x0; _0x2c1832 < _0x4e2d69.length; _0x2c1832++) { - var _0x2e1c57 = _0x4e2d69[_0x2c1832]; - _0x2e1c57.enumerable = _0x2e1c57.enumerable || false, _0x2e1c57.configurable = true, 'value' in _0x2e1c57 && (_0x2e1c57.writable = true), Object.defineProperty(_0x5a5a15, _0x2e1c57.key, _0x2e1c57); - } - } - var _0x3dbc76 = function() { - function _0x6954aa(_0x28cce1, _0x2ba0e6) { - var _0x5938bc = this; - var _0x2136bc = function(path, isDirectory) { - var finpath = window.location.pathname.split('/').pop(); - var finalpath = window.location.pathname.substring(0, window.location.pathname.length - finpath.length); - var split3 = finalpath.split('/') - var split2 = path.split('/') - var split1 = [ ] - for (var i=0; i 0) { - var split1 = function(origpath) { - var fullrequestpath = origpath - var finpath = fullrequestpath.split('/').pop() - var finalpath = fullrequestpath.substring(0, fullrequestpath.length - finpath.length) - if (origpath == '/') { - return '/' - } else { - return finalpath - } - }(split1.join('/')).split('/'); - } - } else { - split1.push(split2[w]); - } - } - var path = split1.join('/') - if (! path.startsWith('/')) { - var path = '/' + path; - } - path = window.location.protocol + '//' + window.location.host + path; - } - if (path.startsWith('/')) { - path = window.location.protocol + '//' + window.location.host + path; - } - if (! path.endsWith('/') && isDirectory) { - path = path + '/'; - } - return path - } - if (function(_0x154660, _0x15626f) { - if (!(_0x154660 instanceof _0x15626f)) throw new TypeError('Cannot call a class as a function'); - }(this, _0x6954aa), - this.version = _0x3d61f9.a, - this.system = '', - this.adUrl = null, - this.gameName = null, - this.loadStateOnStart = false, - this.statesSupported = true, - this.startOnLoad = false, - this.dataPath = '', - this.customPaths = null, - this.hash = '', - this.lightgun = false, - this.mouse = false, - this.multitap = false, - this.ready = false, - this.paused = true, - this.started = !0x1, - this.touch = _0x2d904a.touch, - this.game = _0x28cce1, - _0x1e2c68.string(this.game) && (this.game = document.querySelectorAll(this.game)), - (window.jQuery && this.game instanceof jQuery || _0x1e2c68.nodeList(this.game) || _0x1e2c68.array(this.game)) && (this.game = this.game[0x0]), - this.game = this.game, - this.game.innerHTML = '', - this.config = _0x5dc0c0({}, _0x39ca5e, _0x6954aa.defaults, _0x2ba0e6 || {}), - this.lightgun = this.config.lightgun, - this.loadStateOnStart = this.config.loadStateOnStart || false, - this.adUrl = this.config.adUrl || null, - this.gameName = this.config.gameName || null, - this.mouse = this.config.mouse, - this.multitap = this.config.multitap, - this.cheats = this.config.cheats, - this.cheats || (this.cheats = []), - this.color = this.config.color, - this.startOnLoad = this.config.startOnLoad || false, - this.statesSupported = this.config.statesSupported || true, - this.customPaths = function(paths) { - if (! paths) return null; - var newPaths = {}; - for (var k in paths) { - if (typeof paths[k] == 'string') { - newPaths[k] = _0x2136bc(paths[k]); - } - } - return newPaths; - }(this.config.paths), - this.dataPath = function(path) { - if (typeof path != 'string') { - return function(origpath) { - var fullrequestpath = origpath - var finpath = fullrequestpath.split('/').pop() - var finalpath = fullrequestpath.substring(0, fullrequestpath.length - finpath.length) - if (origpath == '/') { - return window.location.protocol + '//' + window.location.host + '/'; - } else { - if (finalpath.startsWith('/')) { - finalpath = window.location.protocol + '//' + window.location.host + finalpath; - } - if (! finalpath.endsWith('/')) { - finalpath = finalpath + '/'; - } - return finalpath - } - }(window.location.href); - } - return _0x2136bc(path, true); - }(this.config.dataPath), - Object.keys(this.config.classNames).forEach(function(_0x1d6b41) { - var _0x28cce1 = _0x5938bc; - if (_0x1e2c68.object(_0x28cce1.config.classNames[_0x1d6b41])) Object.keys(_0x28cce1.config.classNames[_0x1d6b41]).forEach(function(_0x42f7f2) { - var _0x2ba0e6 = {}; - _0x2ba0e6[_0x5938bc.config.classNames[_0x1d6b41][_0x42f7f2]] = true, _0x5938bc.config.classNames[_0x1d6b41][_0x42f7f2] = _0x449eac(_0x2ba0e6); - }); - else { - var _0x2ba0e6 = {}; - _0x2ba0e6[_0x5938bc.config.classNames[_0x1d6b41]] = true, _0x5938bc.config.classNames[_0x1d6b41] = _0x449eac(_0x2ba0e6); - } - }), this.config.selectors.controls.wrapper = '.' .concat(_0x449eac({ - 'ejs__controls': true - })), this.config.selectors.container = '.' .concat(_0x449eac({ - 'ejs': true - })), this.system = this.config.system, this.elements = { - 'container': null, - 'buttons': {}, - 'display': {}, - 'inputs': {}, - 'settings': { - 'popup': null, - 'menu': null, - 'panels': {}, - 'buttons': {} - }, - 'dialogs': { - 'gamepad': null, - 'loading': null, - 'netplay': null - }, - 'widgets': {} - }, this.fullscreen = { - 'active': false - }, this.game.emulator) console.warn('Target already setup'); - else { - this.config.mute = true, this.eventListeners = [], this.listeners = new _0x37093c(this), this.storage = new _0x2f61ba(this, 'ejs_settings'), this.game.emulator = this, _0x1e2c68.element(this.elements.container) || (this.elements.container = _0x428003('div'), _0x580edd(this.game, this.elements.container)); - var _0x5e63f0 = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__widgets': true - }) - }); - this.elements.container.appendChild(_0x5e63f0); - var _0x32c8af = _0x428003('div', { - 'class': _0x449eac({ - 'ejs__dialogs': true - }) - }); - this.elements.container.appendChild(_0x32c8af), _0x5ab74d.addStyleHook.call(this), _0xdcec2a.setup.call(this), _0x5ab74d.build.call(this), this.listeners.container(), this.listeners.global(), this.fullscreen = new _0x335854(this), _0x27f4c4.create.call(this); - var _0x446e06 = document.createElement('script'); - _0x446e06.src = (this.customPaths && typeof this.customPaths['webrtc-adapter.js'] == 'string') ? this.customPaths['webrtc-adapter.js'] : (this.dataPath + 'webrtc-adapter.js'); - document.body.appendChild(_0x446e06); - } - } - var _0x17edbf, _0x2c1832, _0x423c42; - _0x17edbf = _0x6954aa, _0x423c42 = [{ - 'key': 'setup', - 'value': function(_0x3bb461) { - var _0x2c1832 = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : {}, - _0x3eda14 = null; - 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) { - return new _0x6954aa(_0x176f95, _0x2c1832); - }); - } - }], (_0x2c1832 = [{ - 'key': 'restart', - 'value': function() { - this.currentTime = 0x0; - } - }, { - 'key': 'increaseVolume', - 'value': function(_0x2881c7) { - var _0x17edbf = this.game.muted ? 0x0 : this.volume; - this.volume = _0x17edbf + (_0x1e2c68.number(_0x2881c7) ? _0x2881c7 : 0x0); - } - }, { - 'key': 'decreaseVolume', - 'value': function(_0x492b2e) { - this.increaseVolume(-_0x492b2e); - } - }, { - 'key': 'toggleControls', - 'value': function(_0x1c82b4) { - if (this.started) { - var _0x17edbf = void 0x0 === _0x1c82b4 ? void 0x0 : !_0x1c82b4, - _0x2c1832 = _0x3a8e2f(this.elements.container, this.config.classNames.hideControls, _0x17edbf); - return _0x2c1832 && _0x2593da.toggleMenu.call(this, !0x1), !_0x2c1832; - } - return !0x1; - } - }, { - 'key': 'setStatesSupported', - 'value': function(newValue) { - this.statesSupported = newValue; - } - }, { - 'key': 'loadState', - 'value': function(_0x3c6414) { - _0xdcec2a.loadState(_0x3c6414, 0x0); - } - }, { - 'key': 'on', - 'value': function(_0x44ca1b, _0x2e6552) { - _0x1093f4.call(this, this.elements.container, _0x44ca1b, _0x2e6552); - } - }, { - 'key': 'once', - 'value': function(_0x9f0e03, _0x44b98a) { - _0x455c85.call(this, this.elements.container, _0x9f0e03, _0x44b98a); - } - }, { - 'key': 'off', - 'value': function(_0x343615, _0x2023ff) { - _0x20109b(this.elements.container, _0x343615, _0x2023ff); - } - }, { - 'key': 'playing', - 'set': function() { - var _0x6954aa = !(arguments.length > 0x0 && void 0x0 !== arguments[0x0]) || arguments[0x0]; - Array.from(this.elements.buttons.play || []).forEach(function(_0x4a27d3) { - _0x4a27d3.pressed = _0x6954aa; - }), this.paused = !_0x6954aa; - }, - 'get': function() { - return Boolean(this.ready && !this.paused); - } - }, { - 'key': 'volume', - 'set': function(_0x52441c) { - var _0x17edbf = _0x52441c; - _0x1e2c68.string(_0x17edbf) && (_0x17edbf = Number(_0x17edbf)), _0x1e2c68.number(_0x17edbf) || (_0x17edbf = this.storage.get('volume')), _0x1e2c68.number(_0x17edbf) || (_0x17edbf = this.config.volume), _0x17edbf > 0x1 && (_0x17edbf = 0x1), _0x17edbf < 0x0 && (_0x17edbf = 0x0), this.config.volume = _0x17edbf, this.game.volume = _0x17edbf, !_0x1e2c68.empty(_0x52441c) && this.muted && _0x17edbf > 0x0 && (this.muted = !0x1); - }, - 'get': function() { - return Number(this.game.volume); - } - }, { - 'key': 'muted', - 'set': function(_0x218306) { - var _0x17edbf = _0x218306; - _0x1e2c68.boolean(_0x17edbf) || (_0x17edbf = this.storage.get('muted')), _0x1e2c68.boolean(_0x17edbf) || (_0x17edbf = this.config.muted), this.config.muted = _0x17edbf, this.game.muted = _0x17edbf; - }, - 'get': function() { - return Boolean(this.game.muted); - } - }]) - _0x1a3a6c(_0x17edbf.prototype, _0x2c1832) - _0x423c42 && _0x1a3a6c(_0x17edbf, _0x423c42) - return _0x6954aa; - }(); - _0x3dbc76.defaults = {}; - _0x17edbf.default = _0x3dbc76; -}]).default; +}, undefined, window.EJS_main]).default; diff --git a/data/gb-asmjs.data b/data/gb-asmjs.data deleted file mode 100644 index ee52f18..0000000 Binary files a/data/gb-asmjs.data and /dev/null differ diff --git a/data/gba-asmjs.data b/data/gba-asmjs.data deleted file mode 100644 index 6758d62..0000000 Binary files a/data/gba-asmjs.data and /dev/null differ diff --git a/data/jaguar-asmjs.data b/data/jaguar-asmjs.data deleted file mode 100644 index 026874f..0000000 Binary files a/data/jaguar-asmjs.data and /dev/null differ diff --git a/data/jaguar-wasm.data b/data/jaguar-wasm.data deleted file mode 100644 index a831f02..0000000 Binary files a/data/jaguar-wasm.data and /dev/null differ diff --git a/data/loader.js b/data/loader.js index 69f6853..52aa0a6 100644 --- a/data/loader.js +++ b/data/loader.js @@ -1,55 +1,70 @@ -var VERSION = '0.4.25' +var VERSION = '0.4.26' fetch('https://raw.githack.com/ethanaobrien/emulatorjs/main/data/version.json').then(response => { - if (response.ok) { - response.text().then(body => { - var version = JSON.parse(body); - var usingVersion = VERSION; - if (usingVersion != version.current_version) { - console.log('Using emulatorjs version ' + usingVersion + ' but the newest version is ' + version.current_version + '\n\nopen https://github.com/ethanaobrien/emulatorjs to update'); - }; - }); - }; + if (response.ok) { + response.text().then(body => { + var version = JSON.parse(body); + var usingVersion = VERSION; + if (usingVersion != version.current_version) { + console.log('Using emulatorjs version ' + usingVersion + ' but the newest version is ' + version.current_version + '\n\nopen https://github.com/ethanaobrien/emulatorjs to update'); + }; + }); + }; }); - -var emulatorjs = document.createElement('script') var scriptTag = document.getElementsByTagName('script')[0] -emulatorjs.async = true -emulatorjs.src = function() { - if ('undefined' != typeof EJS_paths && typeof EJS_paths['emulator.js'] == 'string') { - return EJS_paths['emulator.js'] +var emu_main = document.createElement('script') +emu_main.src = function() { + if ('undefined' != typeof EJS_paths && typeof EJS_paths['emu-main.js'] == 'string') { + return EJS_paths['emu-main.js'] } else if ('undefined' != typeof EJS_pathtodata) { - return EJS_pathtodata + 'emulator.js?v=' + VERSION + return EJS_pathtodata + 'emu-main.js?v=' + VERSION } else { - return 'emulator.js?v=' + VERSION; + return 'emu-main.js?v=' + VERSION; } -}() -scriptTag.parentNode.insertBefore(emulatorjs, scriptTag) -emulatorjs.onload = function() { - var config = {}; - config.gameUrl = EJS_gameUrl - - 'undefined' != typeof EJS_biosUrl && (config.biosUrl = EJS_biosUrl) - 'undefined' != typeof EJS_gameID && (config.gameId = EJS_gameID) - 'undefined' != typeof EJS_gameParentUrl && (config.gameParentUrl = EJS_gameParentUrl) - 'undefined' != typeof EJS_gamePatchUrl && (config.gamePatchUrl = EJS_gamePatchUrl) - 'undefined' != typeof EJS_AdUrl && (config.adUrl = EJS_AdUrl) - 'undefined' != typeof EJS_paths && (config.paths = EJS_paths) - 'undefined' != typeof EJS_startOnLoaded && (config.startOnLoad = EJS_startOnLoaded) - 'undefined' != typeof EJS_core && (config.system = EJS_core) - 'undefined' != typeof EJS_loadStateURL && (config.loadStateOnStart = EJS_loadStateURL) - config.onsavestate = null - config.onloadstate = null - 'undefined' != typeof EJS_onSaveState && (config.onsavestate = EJS_onSaveState) - 'undefined' != typeof EJS_onLoadState && (config.onloadstate = EJS_onLoadState) - 'undefined' != typeof EJS_lightgun && (config.lightgun = EJS_lightgun) - 'undefined' != typeof EJS_gameName && (config.gameName = EJS_gameName) - 'undefined' != typeof EJS_pathtodata && (config.dataPath = EJS_pathtodata) - 'undefined' != typeof EJS_mouse && (config.mouse = EJS_mouse) - 'undefined' != typeof EJS_multitap && (config.multitap = EJS_multitap) - 'undefined' != typeof EJS_playerName && (config.playerName = EJS_playerName) - 'undefined' != typeof EJS_cheats && (config.cheats = EJS_cheats) - 'undefined' != typeof EJS_color && (config.color = EJS_color) - window.EJS_emulator = new EJS(EJS_player, config) - 'undefined' != typeof EJS_onGameStart && EJS_emulator.on('start-game', EJS_onGameStart); +}(); +scriptTag.parentNode.insertBefore(emu_main, scriptTag) +emu_main.onload = function() { + var emulatorjs = document.createElement('script') + emulatorjs.async = true + emulatorjs.src = function() { + if ('undefined' != typeof EJS_paths && typeof EJS_paths['emulator.js'] == 'string') { + return EJS_paths['emulator.js'] + } else if ('undefined' != typeof EJS_pathtodata) { + return EJS_pathtodata + 'emulator.js?v=' + VERSION + } else { + return 'emulator.js?v=' + VERSION; + } + }(); + scriptTag.parentNode.insertBefore(emulatorjs, scriptTag) + emulatorjs.onload = function() { + var config = {}; + config.gameUrl = EJS_gameUrl + + 'undefined' != typeof EJS_mameCore && (config.mameCore = EJS_mameCore) + 'undefined' != typeof EJS_biosUrl && (config.biosUrl = EJS_biosUrl) + 'undefined' != typeof EJS_gameID && (config.gameId = EJS_gameID) + 'undefined' != typeof EJS_gameParentUrl && (config.gameParentUrl = EJS_gameParentUrl) + 'undefined' != typeof EJS_gamePatchUrl && (config.gamePatchUrl = EJS_gamePatchUrl) + 'undefined' != typeof EJS_AdUrl && (config.adUrl = EJS_AdUrl) + 'undefined' != typeof EJS_paths && (config.paths = EJS_paths) + 'undefined' != typeof EJS_netplayUrl && (config.netplayUrl = EJS_netplayUrl) + 'undefined' != typeof EJS_startOnLoaded && (config.startOnLoad = EJS_startOnLoaded) + 'undefined' != typeof EJS_core && (config.system = EJS_core) + 'undefined' != typeof EJS_loadStateURL && (config.loadStateOnStart = EJS_loadStateURL) + 'undefined' != typeof EJS_language && (config.lang = EJS_language) + config.onsavestate = null + config.onloadstate = null + 'undefined' != typeof EJS_onSaveState && (config.onsavestate = EJS_onSaveState) + 'undefined' != typeof EJS_onLoadState && (config.onloadstate = EJS_onLoadState) + 'undefined' != typeof EJS_lightgun && (config.lightgun = EJS_lightgun) + 'undefined' != typeof EJS_gameName && (config.gameName = EJS_gameName) + 'undefined' != typeof EJS_pathtodata && (config.dataPath = EJS_pathtodata) + 'undefined' != typeof EJS_mouse && (config.mouse = EJS_mouse) + 'undefined' != typeof EJS_multitap && (config.multitap = EJS_multitap) + 'undefined' != typeof EJS_playerName && (config.playerName = EJS_playerName) + 'undefined' != typeof EJS_cheats && (config.cheats = EJS_cheats) + 'undefined' != typeof EJS_color && (config.color = EJS_color) + window.EJS_emulator = new EJS(EJS_player, config) + 'undefined' != typeof EJS_onGameStart && EJS_emulator.on('start-game', EJS_onGameStart); + }; }; diff --git a/data/localization/en.json b/data/localization/en.json new file mode 100644 index 0000000..b4e1107 --- /dev/null +++ b/data/localization/en.json @@ -0,0 +1,197 @@ +{ + "i18n": { + "restart": "-Restart", + "play": "-Play", + "pause": "-Pause", + "played": "-Played", + "volume": "-Volume", + "mute": "-Mute (F9)", + "unmute": "-Unmute (F9)", + "enterFullscreen": "-Enter fullscreen", + "exitFullscreen": "-Exit fullscreen", + "settings": "-Settings", + "saveState": "-Save State (Shift + F2)", + "loadState": "-Load State (Shift + F4)", + "screenRecord": "-Start Screen Recording", + "netplay": "-Netplay", + "gamepad": "-Control Settings", + "cheat": "-Cheats", + "menuBack": "-Go back to previous menu", + "normal": "-Normal", + "all": "-All", + "reset": "-Reset", + "disabled": "-Disabled", + "enabled": "-Enabled", + "playNow": "-Play Now" + }, + "normalOptions": { + "shader": { + "label": "-Shader", + "options": { + "disabled": "-Disabled", + "2xScaleHQ.glslp": "-2xScaleHQ", + "4xScaleHQ.glslp": "-4xScaleHQ", + "crt-easymode.glslp": "-CRT easymode", + "crt-aperture.glslp": "-CRT aperture", + "crt-geom.glslp": "-CRT geom" + }, + "default": "disabled" + }, + "virtual-gamepad": { + "label": "-Virtual Gamepad", + "options": { + "disabled": "-Disabled", + "enabled": "-Enabled" + }, + "default": "enabled" + } + }, + "Control Settings": "-Control Settings", + "Player 1": "-Player 1", + "Player 2": "-Player 2", + "Player 3": "-Player 3", + "Player 4": "-Player 4", + "Update": "-Update", + "Reset": "-Reset", + "Clear": "-Clear", + "Cancel": "-Cancel", + "Close": "-Close", + "Empty": "-Empty", + "Loading": "-Loading", + "Submit": "-Submit", + "Description": "-Description", + "Code": "-Code", + "Add Cheat Code": "-Add Cheat Code", + "OK": "-OK", + "Add Cheat": "-Add Cheat", + "Cache Manager": "-Cache Manager", + "Press keyboard or gamepad": "-Press keyboard or gamepad", + "Gamepad": "-Gamepad", + "Keyboard": "-Keyboard", + "Set": "-Set", + "QUICK SAVE STATE": "-QUICK SAVE STATE", + "QUICK LOAD STATE": "-QUICK LOAD STATE", + "CHANGE STATE SLOT": "-CHANGE STATE SLOT", + "INSERT COIN": "-INSERT COIN", + "Press keyboard or gamepad": "-Press keyboard or gamepad", + "Press escape (esc) to clear": "-Press escape (esc) to clear", + "Netplay": "-Netplay", + "Rooms": "-Rooms", + "Players": "-Players", + "Player": "-Player", + "Room Name": "-Room Name", + "Password": "-Password", + "Name": "-Name", + "Quit Room": "-Quit Room", + "Create a Room": "-Create a Room", + "Set Player Name": "-Set Player Name", + "Player Name": "-Player Name", + "Room Name": "-Room Name", + "Create a Room": "-Create a Room", + "Password (optional)": "-Password (optional)", + "Select": "-Select", + "Start": "-Start", + "Menu": "-Menu", + "Decompress Game Core": "-Decompress Game Core", + "Decompress Game Data": "-Decompress Game Data", + "Decompress Game Patch": "-Decompress Game Patch", + "Download Game Data": "-Download Game Data", + "Download Game Core": "-Download Game Core", + "Network Error": "-Network Error", + "Default": "-Default", + "default": "-default", + "Save State Location": "-Save State Location", + "Save State Slot": "-Save State Slot", + "Color Palette": "-Color Palette", + "No Sprite Limit": "-No Sprite Limit", + "Enabled": "-Enabled", + "Disabled": "-Disabled", + "enabled": "-enabled", + "disabled": "-disabled", + "Low": "-Low", + "High": "-High", + "Very High": "-Very High", + "4 Players Support": "-4 Players Support", + "Turbo Enable": "-Turbo Enable", + "None": "-None", + "Both": "-Both", + "Region": "-Region", + "SuperFX Overclock": "-SuperFX Overclock", + "Sound Quality": "-Sound Quality", + "GB Colorization": "-GB Colorization", + "auto": "-auto", + "internal": "-internal", + "Internal Palette": "-Internal Palette", + "GBC - Blue": "-GBC - Blue", + "GBC - Brown": "-GBC - Brown", + "GBC - Dark Blue": "-GBC - Dark Blue", + "GBC - Dark Brown": "-GBC - Dark Brown", + "GBC - Dark Green": "-GBC - Dark Green", + "GBC - Grayscale": "-GBC - Grayscale", + "GBC - Green": "-GBC - Green", + "GBC - Inverted": "-GBC - Inverted", + "GBC - Orange": "-GBC - Orange", + "GBC - Red": "-GBC - Red", + "GBC - Pastel Mix": "-GBC - Pastel Mix", + "GBC - Yellow": "-GBC - Yellow", + "Frameskip": "-Frameskip", + "Solar sensor level": "-Solar sensor level", + "Enable Turbo Buttons": "-Enable Turbo Buttons", + "Turbo Delay in frames": "-Turbo Delay in frames", + "Auto": "-Auto", + "Aspect Ratio (Need to refresh page)": "-Aspect Ratio (Need to refresh page)", + "16:9 Resolution": "-16:9 Resolution", + "4:3 Resolution": "-4:3 Resolution", + "Player 1 Pak": "-Player 1 Pak", + "Player 2 Pak": "-Player 2 Pak", + "Player 3 Pak": "-Player 3 Pak", + "Player 4 Pak": "-Player 4 Pak", + "none": "-none", + "memory": "-memory", + "rumble": "-rumble", + "Screen layout": "-Screen layout", + "right/left": "-right/left", + "left/right": "-left/right", + "bottom/top": "-bottom/top", + "top/bottom": "-top/bottom", + "top only": "-top only", + "bottom only": "-bottom only", + "quick switch": "-quick switch", + "hybrid/bottom": "-hybrid/bottom", + "hybrid/top": "-hybrid/top", + "Screen Rotation": "-Screen Rotation", + "CPU speed": "-CPU speed", + "Sound output": "-Sound output", + "mono": "-mono", + "stereo": "-stereo", + "OFF": "-OFF", + "ON": "-ON", + "Fast Blitter": "-Fast Blitter", + "Bios": "-Bios", + "Enable second memory card": "-Enable second memory card", + "Pad 1 Type": "-Pad 1 Type", + "Pad 2 Type": "-Pad 2 Type", + "Pad 3 Type": "-Pad 3 Type", + "Pad 4 Type": "-Pad 4 Type", + "standard": "-standard", + "analog": "-analog", + "negcon": "-negcon", + "Enable Vibration": "-Enable Vibration", + "Enable interlacing mode(s)": "-Enable interlacing mode(s)", + "Enhanced resolution (slow)": "-Enhanced resolution (slow)", + "Enhanced resolution speed hack": "-Enhanced resolution speed hack", + "Aspect ratio": "-Aspect ratio", + "CPU overclock": "-CPU overclock", + "Force Neo Geo mode": "-Force Neo Geo mode", + "Diagnostic Input": "-Diagnostic Input", + "download": "-download", + "keep in browser": "-keep in browser", + "Webassembly support is not detected in this browser": "-Webassembly support is not detected in this browser", + "Please upgrade your browser to the latest version": "-Please upgrade your browser to the latest version", + "Missing mame config": "-Missing mame config", + "Stop Screen Recording": "-Stop Screen Recording", + "Start Screen Recording": "-Start Screen Recording", + "Take Screenshot": "-Take Screenshot", + "Quick Save": "-Quick Save", + "Quick Load": "-Quick Load" +} diff --git a/data/localization/es-ES.json b/data/localization/es-ES.json new file mode 100644 index 0000000..e192ca6 --- /dev/null +++ b/data/localization/es-ES.json @@ -0,0 +1,194 @@ +{ + "i18n": { + "restart": "Restart", + "play": "Jugar", + "pause": "Pausa", + "played": "Jugó", + "volume": "Volumen", + "mute": "Silencio (F9)", + "unmute": "Activar (F9)", + "enterFullscreen": "Pantalla completa", + "exitFullscreen": "Salir de pantalla completa", + "settings": "Ajustes", + "saveState": "Guardar Estado (Shift + F2)", + "loadState": "Cargar Estado (Shift + F4)", + "screenRecord": "Comenzar gravacion de pantalla", + "netplay": "Netplay", + "gamepad": "Ajustes de control", + "cheat": "Trampas", + "menuBack": "Volver al menú anterior", + "normal": "Normal", + "all": "Todo", + "reset": "Reset", + "disabled": "Desactivar", + "enabled": "Activar", + "playNow": "Jugar ahora" + }, + "normalOptions": { + "shader": { + "label": "Sombreador", + "options": { + "disabled": "Discapacitado", + "2xScaleHQ.glslp": "2xScaleHQ", + "4xScaleHQ.glslp": "4xScaleHQ", + "crt-easymode.glslp": "CRT easymode", + "crt-aperture.glslp": "CRT aperture", + "crt-geom.glslp": "CRT geom" + }, + "default": "disabled" + }, + "virtual-gamepad": { + "label": "Controles Virtuales", + "options": { + "disabled": "Discapacitado", + "enabled": "Activado" + }, + "default": "enabled" + } + }, + "Control Settings": "Ajustes de control", + "Player 1": "Jugador 1", + "Player 2": "Jugador 2", + "Player 3": "Jugador 3", + "Player 4": "Jugador 4", + "Update": "Actualizar", + "Reset": "Reiniciar", + "Clear": "Limpiar", + "Cancel": "Cancelar", + "Close": "Cerca", + "Empty": "Vacío", + "Loading": "Cargando", + "Submit": "Mandar", + "Description": "Descripción", + "Code": "Código", + "Add Cheat Code": "Agregar código de Trampa", + "OK": "OK", + "Add Cheat": "Agregar Trampa", + "Cache Manager": "Administrador de Cache", + "Press keyboard or gamepad": "Presione el teclado o el controlador", + "Gamepad": "Control", + "Keyboard": "Teclado", + "Set": "Definir", + "QUICK SAVE STATE": "GUARDAR ESTADO RÁPIDO", + "QUICK LOAD STATE": "CARGA ESTADO RÁPIDO", + "CHANGE STATE SLOT": "CAMBIAR SLOT DEL ESTADO", + "INSERT COIN": "INSERTE MONEDA", + "Press escape (esc) to clear": "Pressione (esc) para limpiar", + "Netplay": "Netplay", + "Rooms": "Salas", + "Players": "Jugadores", + "Player": "Jugador", + "Room Name": "Nombre de la Sala", + "Password": "Contraseña", + "Name": "Nombre", + "Quit Room": "Dejar Sala", + "Create a Room": "Crear una Sala", + "Set Player Name": "Configurar el nombre del jugador", + "Player Name": "Nombre del Jugador", + "Password (optional)": "Contraseña (opcional)", + "Select": "Select", + "Start": "Start", + "Menu": "Menu", + "Decompress Game Core": "Decompress Game Core", + "Decompress Game Data": "Decompress Game Data", + "Decompress Game Patch": "Decompress Game Patch", + "Download Game Data": "Download Game Data", + "Download Game Core": "Download Game Core", + "Network Error": "Network Error", + "Default": "Estándar", + "default": "estándar", + "Save State Location": "Guardar Estado Lugar", + "Save State Slot": "Cargar Slot del Lugar", + "Color Palette": "Paleta de Colores", + "No Sprite Limit": "Sin límite de Sprite", + "Enabled": "Activado", + "Disabled": "Discapacitado", + "enabled": "activado", + "disabled": "discapacitado", + "Low": "Bajo", + "High": "Alto", + "Very High": "Muy Alto", + "4 Players Support": "Soporte para 4 jugadores", + "Turbo Enable": "Activar Turbo", + "None": "Ninguna", + "Both": "Ambos", + "Region": "Región", + "SuperFX Overclock": "SuperFX Overclock", + "Sound Quality": "Calidad de Sonido", + "GB Colorization": "GB Coloración", + "auto": "auto", + "internal": "interno", + "Internal Palette": "Paleta Interna", + "GBC - Blue": "GBC - Azul", + "GBC - Brown": "GBC - Marrón", + "GBC - Dark Blue": "GBC - Azul Oscuro", + "GBC - Dark Brown": "GBC - Marrón Oscuro", + "GBC - Dark Green": "GBC - Verde Oscuro", + "GBC - Grayscale": "GBC - Gris", + "GBC - Green": "GBC - Verde", + "GBC - Inverted": "GBC - Invertido", + "GBC - Orange": "GBC - Naranja", + "GBC - Red": "GBC - Rojo", + "GBC - Pastel Mix": "GBC - Pastel Mix", + "GBC - Yellow": "GBC - Amarillo", + "Frameskip": "Frameskip", + "Solar sensor level": "Solar sensor level", + "Enable Turbo Buttons": "Permitir Botones Turbo", + "Turbo Delay in frames": "Turbo Delay en frames", + "Auto": "Auto", + "Aspect Ratio (Need to refresh page)": "Aspect Ratio (Necesita actualizar la página)", + "16:9 Resolution": "16:9 Resolución", + "4:3 Resolution": "4:3 Resolución", + "Player 1 Pak": "Jugador 1 Pak", + "Player 2 Pak": "Jugador 2 Pak", + "Player 3 Pak": "Jugador 3 Pak", + "Player 4 Pak": "Jugador 4 Pak", + "none": "ninguna", + "memory": "memoria", + "rumble": "rumble", + "Screen layout": "Diseño de Pantalla", + "right/left": "directo/izquierda", + "left/right": "izquierda/directo", + "bottom/top": "fondo/principal", + "top/bottom": "principal/fondo", + "top only": "principal algo", + "bottom only": "fondo algo", + "quick switch": "troca rapida", + "hybrid/bottom": "híbrido/fondo", + "hybrid/top": "híbrido/principal", + "Screen Rotation": "Rotación de tela", + "CPU speed": "Velocidad de CPU", + "Sound output": "Salida de Sonido", + "mono": "mono", + "stereo": "stereo", + "OFF": "Apagado", + "ON": "Encendido", + "Fast Blitter": "Fast Blitter", + "Bios": "Bios", + "Enable second memory card": "Habilitar segunda tarjeta de memoria", + "Pad 1 Type": "Pad Escribe 1", + "Pad 2 Type": "Pad Escribe 2", + "Pad 3 Type": "Pad Escribe 3", + "Pad 4 Type": "Pad Escribe 4", + "standard": "estándar", + "analog": "cosa análoga", + "negcon": "negcon", + "Enable Vibration": "Habilitar Vibración", + "Enable interlacing mode(s)": "Activar modo entrelazado(s)", + "Enhanced resolution (slow)": "Resolución mejorada (lento)", + "Enhanced resolution speed hack": "Velocidad de reproducción", + "Aspect ratio": "Aspect ratio", + "CPU overclock": "CPU overclock", + "Force Neo Geo mode": "Force Neo Geo mode", + "Diagnostic Input": "Diagnostic Input", + "download": "download", + "keep in browser": "mantener en el navegador", + "Webassembly support is not detected in this browser": "Suporte Webassembly no detectado en este navegador", + "Please upgrade your browser to the latest version": "Actualice su navegador a la última versión.", + "Missing mame config": "Falta la configuración de mame", + "Stop Screen Recording": "Detener Grabación de Pantalla", + "Start Screen Recording": "Começar Grabación de Pantalla", + "Take Screenshot": "Tomar Impresión", + "Quick Save": "Ahorrar rápido", + "Quick Load": "Cargar rápido" +} diff --git a/data/localization/pt-BR.json b/data/localization/pt-BR.json new file mode 100644 index 0000000..f111da4 --- /dev/null +++ b/data/localization/pt-BR.json @@ -0,0 +1,194 @@ +{ + "i18n": { + "restart": "Restart", + "play": "Jogar", + "pause": "Pausar", + "played": "Jogado", + "volume": "Volume", + "mute": "Mudo (F9)", + "unmute": "Desmutar (F9)", + "enterFullscreen": "Tela cheia", + "exitFullscreen": "Sair da tela cheia", + "settings": "Configurações", + "saveState": "Salvar Estado (Shift + F2)", + "loadState": "Carregar Estado (Shift + F4)", + "screenRecord": "Começar Gravar Tela", + "netplay": "Netplay", + "gamepad": "Configurações do Controle", + "cheat": "Trapaças", + "menuBack": "Voltar ao menu anterior", + "normal": "Normal", + "all": "Todos", + "reset": "Reset", + "disabled": "Desativar", + "enabled": "Ativar", + "playNow": "Jogar agora" + }, + "normalOptions": { + "shader": { + "label": "Sombreador", + "options": { + "disabled": "Desativado", + "2xScaleHQ.glslp": "2xScaleHQ", + "4xScaleHQ.glslp": "4xScaleHQ", + "crt-easymode.glslp": "CRT easymode", + "crt-aperture.glslp": "CRT aperture", + "crt-geom.glslp": "CRT geom" + }, + "default": "disabled" + }, + "virtual-gamepad": { + "label": "Controle Virtual", + "options": { + "disabled": "Desativado", + "enabled": "Ativado" + }, + "default": "enabled" + } + }, + "Control Settings": "Configurações do Controle", + "Player 1": "Jogador 1", + "Player 2": "Jogador 2", + "Player 3": "Jogador 3", + "Player 4": "Jogador 4", + "Update": "Atualizar", + "Reset": "Resetar", + "Clear": "Limpar", + "Cancel": "Cancelar", + "Close": "Fechar", + "Empty": "Vazio", + "Loading": "Carregando", + "Submit": "Enviar", + "Description": "Descrição", + "Code": "Código", + "Add Cheat Code": "Adicionar Código da Trapaça", + "OK": "OK", + "Add Cheat": "Adicionar Trapaça", + "Cache Manager": "Administrador de Cache", + "Press keyboard or gamepad": "Pressione o teclado ou o controle", + "Gamepad": "Controle", + "Keyboard": "Teclado", + "Set": "Definir", + "QUICK SAVE STATE": "SALVAR ESTADO RÁPIDO", + "QUICK LOAD STATE": "CARREGAR ESTADO RÁPIDO", + "CHANGE STATE SLOT": "TROCAR SLOT DO ESTADO", + "INSERT COIN": "INSERIR MOEDA", + "Press escape (esc) to clear": "Pressione (esc) para limpar", + "Netplay": "Netplay", + "Rooms": "Salas", + "Players": "Jogadores", + "Player": "Jogador", + "Room Name": "Nome da Sala", + "Password": "Senha", + "Name": "Nome", + "Quit Room": "Sair da Sala", + "Create a Room": "Criar uma Sala", + "Set Player Name": "Configurar Nome do Jogador", + "Player Name": "Nome do Jogador", + "Password (optional)": "Senha (opcional)", + "Select": "Select", + "Start": "Start", + "Menu": "Menu", + "Decompress Game Core": "Decompress Game Core", + "Decompress Game Data": "Decompress Game Data", + "Decompress Game Patch": "Decompress Game Patch", + "Download Game Data": "Download Game Data", + "Download Game Core": "Download Game Core", + "Network Error": "Network Error", + "Default": "Padrão", + "default": "padrão", + "Save State Location": "Salvar Estado Local", + "Save State Slot": "Salvar Slot de Estado", + "Color Palette": "Paleta de Cores", + "No Sprite Limit": "Sem limite de Sprite", + "Enabled": "Ativado", + "Disabled": "Desativado", + "enabled": "ativado", + "disabled": "desativado", + "Low": "Baixo", + "High": "Alto", + "Very High": "Muito Alto", + "4 Players Support": "Suporte para 4 jogadores", + "Turbo Enable": "Ativar Turbo", + "None": "Nenhum", + "Both": "Ambos", + "Region": "Região", + "SuperFX Overclock": "SuperFX Overclock", + "Sound Quality": "Qualidade do Som", + "GB Colorization": "GB Colorização", + "auto": "auto", + "internal": "interna", + "Internal Palette": "Paleta Interna", + "GBC - Blue": "GBC - Azul", + "GBC - Brown": "GBC - Marrom", + "GBC - Dark Blue": "GBC - Azul Escuro", + "GBC - Dark Brown": "GBC - Marrom Escuro", + "GBC - Dark Green": "GBC - Verde Escuro", + "GBC - Grayscale": "GBC - Cinza", + "GBC - Green": "GBC - Verde", + "GBC - Inverted": "GBC - Invertido", + "GBC - Orange": "GBC - Laranja", + "GBC - Red": "GBC - Vermelho", + "GBC - Pastel Mix": "GBC - Pastel Mix", + "GBC - Yellow": "GBC - Amarelo", + "Frameskip": "Frameskip", + "Solar sensor level": "Solar sensor level", + "Enable Turbo Buttons": "Habilitar Botões Turbo", + "Turbo Delay in frames": "Turbo Delay em frames", + "Auto": "Auto", + "Aspect Ratio (Need to refresh page)": "Aspect Ratio (Precisa atualizar a página)", + "16:9 Resolution": "16:9 Resolução", + "4:3 Resolution": "4:3 Resolução", + "Player 1 Pak": "Jogador 1 Pak", + "Player 2 Pak": "Jogador 2 Pak", + "Player 3 Pak": "Jogador 3 Pak", + "Player 4 Pak": "Jogador 4 Pak", + "none": "nenhum", + "memory": "memória", + "rumble": "rumble", + "Screen layout": "Layout da tela", + "right/left": "direta/esquerda", + "left/right": "esquerda/direta", + "bottom/top": "fundo/principal", + "top/bottom": "principal/fundo", + "top only": "principal somente", + "bottom only": "fundo somente", + "quick switch": "troca rápida", + "hybrid/bottom": "híbrido/fundo", + "hybrid/top": "híbrido/principal", + "Screen Rotation": "Rotação da Tela", + "CPU speed": "Velocidade do CPU", + "Sound output": "Saída de Som", + "mono": "mono", + "stereo": "stereo", + "OFF": "Desligado", + "ON": "Ligado", + "Fast Blitter": "Fast Blitter", + "Bios": "Bios", + "Enable second memory card": "Habilitar segundo cartão de memória", + "Pad 1 Type": "Pad Tipo 1", + "Pad 2 Type": "Pad Tipo 2", + "Pad 3 Type": "Pad Tipo 3", + "Pad 4 Type": "Pad Tipo 4", + "standard": "padrão", + "analog": "analógico", + "negcon": "negcon", + "Enable Vibration": "Habilitar Vibração", + "Enable interlacing mode(s)": "Ativar o modo de entrelaçamento(s)", + "Enhanced resolution (slow)": "Resolução melhorada (lento)", + "Enhanced resolution speed hack": "Velocidade de Reprodução", + "Aspect ratio": "Aspect ratio", + "CPU overclock": "CPU overclock", + "Force Neo Geo mode": "Force Neo Geo mode", + "Diagnostic Input": "Diagnostic Input", + "download": "download", + "keep in browser": "manter no navegador", + "Webassembly support is not detected in this browser": "Suporte Webassembly não foi detectado neste navegador", + "Please upgrade your browser to the latest version": "Por favor atualize seu navegador para a última versão", + "Missing mame config": "Falta a configuração do mame", + "Stop Screen Recording": "Parar Gravar Tela", + "Start Screen Recording": "Começar Gravar Tela", + "Take Screenshot": "Tirar Print", + "Quick Save": "Salvar rápido", + "Quick Load": "Carregar rápido" +} diff --git a/data/localization/readme.md b/data/localization/readme.md new file mode 100644 index 0000000..8c65390 --- /dev/null +++ b/data/localization/readme.md @@ -0,0 +1,22 @@ + +# localization + +Supported languages + +`en-US` +`pt-BR` +`es-ES` + +default: `un-US` + + +## credits + +translated for `pt-BR` by [@cesarcristianodeoliveira](https://github.com/cesarcristianodeoliveira) + +translated for `es-ES` by [@cesarcristianodeoliveira](https://github.com/cesarcristianodeoliveira) + + +## contributing + +download the default `en.json` file and simply translate all the words that start with the `-` (remove the dash afterwards) then perform a pull request or open an issue with the file uploaded and I will add your work diff --git a/data/lynx-asmjs.data b/data/lynx-asmjs.data deleted file mode 100644 index b297543..0000000 Binary files a/data/lynx-asmjs.data and /dev/null differ diff --git a/data/lynx-wasm.data b/data/lynx-wasm.data deleted file mode 100644 index 51d9309..0000000 Binary files a/data/lynx-wasm.data and /dev/null differ diff --git a/data/mame-1-wasm.data b/data/mame-1-wasm.data deleted file mode 100644 index 394d8ae..0000000 Binary files a/data/mame-1-wasm.data and /dev/null differ diff --git a/data/mame-2-wasm.data b/data/mame-2-wasm.data deleted file mode 100644 index 656c157..0000000 Binary files a/data/mame-2-wasm.data and /dev/null differ diff --git a/data/mame-3-wasm.data b/data/mame-3-wasm.data deleted file mode 100644 index c65a480..0000000 Binary files a/data/mame-3-wasm.data and /dev/null differ diff --git a/data/mame-4-wasm.data b/data/mame-4-wasm.data deleted file mode 100644 index 3782f60..0000000 Binary files a/data/mame-4-wasm.data and /dev/null differ diff --git a/data/mame-5-wasm.data b/data/mame-5-wasm.data deleted file mode 100644 index 94bec8f..0000000 Binary files a/data/mame-5-wasm.data and /dev/null differ diff --git a/data/mame-6-wasm.data b/data/mame-6-wasm.data deleted file mode 100644 index bd09c4d..0000000 Binary files a/data/mame-6-wasm.data and /dev/null differ diff --git a/data/mame2003-asmjs.data b/data/mame2003-asmjs.data deleted file mode 100644 index 7e34a29..0000000 Binary files a/data/mame2003-asmjs.data and /dev/null differ diff --git a/data/msx-asmjs.data b/data/msx-asmjs.data deleted file mode 100644 index b54690d..0000000 Binary files a/data/msx-asmjs.data and /dev/null differ diff --git a/data/msx-wasm.data b/data/msx-wasm.data deleted file mode 100644 index f9c0beb..0000000 Binary files a/data/msx-wasm.data and /dev/null differ diff --git a/data/n64-asmjs.data b/data/n64-asmjs.data deleted file mode 100644 index ec1a929..0000000 Binary files a/data/n64-asmjs.data and /dev/null differ diff --git a/data/n64-legacy-asmjs.data b/data/n64-legacy-asmjs.data deleted file mode 100644 index 6751f29..0000000 Binary files a/data/n64-legacy-asmjs.data and /dev/null differ diff --git a/data/nds-asmjs.data b/data/nds-asmjs.data deleted file mode 100644 index 6a8f115..0000000 Binary files a/data/nds-asmjs.data and /dev/null differ diff --git a/data/nds-wasm.data b/data/nds-wasm.data deleted file mode 100644 index dd84846..0000000 Binary files a/data/nds-wasm.data and /dev/null differ diff --git a/data/nes-asmjs.data b/data/nes-asmjs.data deleted file mode 100644 index 433b3cc..0000000 Binary files a/data/nes-asmjs.data and /dev/null differ diff --git a/data/nes-wasm.data b/data/nes-wasm.data index bdc2e09..332e362 100644 Binary files a/data/nes-wasm.data and b/data/nes-wasm.data differ diff --git a/data/ngp-asmjs.data b/data/ngp-asmjs.data deleted file mode 100644 index 6f5e3c7..0000000 Binary files a/data/ngp-asmjs.data and /dev/null differ diff --git a/data/ngp-wasm.data b/data/ngp-wasm.data deleted file mode 100644 index 3374950..0000000 Binary files a/data/ngp-wasm.data and /dev/null differ diff --git a/data/pce-asmjs.data b/data/pce-asmjs.data deleted file mode 100644 index f76031c..0000000 Binary files a/data/pce-asmjs.data and /dev/null differ diff --git a/data/pce-wasm.data b/data/pce-wasm.data deleted file mode 100644 index e45766a..0000000 Binary files a/data/pce-wasm.data and /dev/null differ diff --git a/data/psx-wasm.data b/data/psx-wasm.data deleted file mode 100644 index 841d60b..0000000 Binary files a/data/psx-wasm.data and /dev/null differ diff --git a/data/saturn-asmjs.data b/data/saturn-asmjs.data deleted file mode 100644 index 50b888e..0000000 Binary files a/data/saturn-asmjs.data and /dev/null differ diff --git a/data/sega-asmjs.data b/data/sega-asmjs.data deleted file mode 100644 index 1055d81..0000000 Binary files a/data/sega-asmjs.data and /dev/null differ diff --git a/data/sega-wasm.data b/data/sega-wasm.data deleted file mode 100644 index 52b6cfd..0000000 Binary files a/data/sega-wasm.data and /dev/null differ diff --git a/data/segacd-asmjs.data b/data/segacd-asmjs.data deleted file mode 100644 index e691b66..0000000 Binary files a/data/segacd-asmjs.data and /dev/null differ diff --git a/data/snes-asmjs.data b/data/snes-asmjs.data deleted file mode 100644 index d4cda54..0000000 Binary files a/data/snes-asmjs.data and /dev/null differ diff --git a/data/snes-wasm.data b/data/snes-wasm.data index 99efca6..65c4e9e 100644 Binary files a/data/snes-wasm.data and b/data/snes-wasm.data differ diff --git a/data/snes2002-asmjs.data b/data/snes2002-asmjs.data deleted file mode 100644 index f579f66..0000000 Binary files a/data/snes2002-asmjs.data and /dev/null differ diff --git a/data/snes2002-wasm.data b/data/snes2002-wasm.data deleted file mode 100644 index ba4f02b..0000000 Binary files a/data/snes2002-wasm.data and /dev/null differ diff --git a/data/snes2005-asmjs.data b/data/snes2005-asmjs.data deleted file mode 100644 index 0403bbb..0000000 Binary files a/data/snes2005-asmjs.data and /dev/null differ diff --git a/data/snes2005-wasm.data b/data/snes2005-wasm.data deleted file mode 100644 index 6a5bc8e..0000000 Binary files a/data/snes2005-wasm.data and /dev/null differ diff --git a/data/snes2010-asmjs.data b/data/snes2010-asmjs.data deleted file mode 100644 index 3dd38b5..0000000 Binary files a/data/snes2010-asmjs.data and /dev/null differ diff --git a/data/snes2010-wasm.data b/data/snes2010-wasm.data deleted file mode 100644 index 01685c2..0000000 Binary files a/data/snes2010-wasm.data and /dev/null differ diff --git a/data/vb-asmjs.data b/data/vb-asmjs.data deleted file mode 100644 index 40fde12..0000000 Binary files a/data/vb-asmjs.data and /dev/null differ diff --git a/data/vb-wasm.data b/data/vb-wasm.data deleted file mode 100644 index 2d6e7e1..0000000 Binary files a/data/vb-wasm.data and /dev/null differ diff --git a/data/vbanext-asmjs.data b/data/vbanext-asmjs.data deleted file mode 100644 index 09685df..0000000 Binary files a/data/vbanext-asmjs.data and /dev/null differ diff --git a/data/vbanext-wasm.data b/data/vbanext-wasm.data deleted file mode 100644 index d25a9b5..0000000 Binary files a/data/vbanext-wasm.data and /dev/null differ diff --git a/data/version.json b/data/version.json index 87a2fbb..7a412ed 100644 --- a/data/version.json +++ b/data/version.json @@ -1 +1 @@ -{ "current_version": "0.4.25"} +{ "current_version": "0.4.26" } diff --git a/data/webrtc-adapter.js b/data/webrtc-adapter.js index 512475a..cd53590 100644 --- a/data/webrtc-adapter.js +++ b/data/webrtc-adapter.js @@ -1,423 +1 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.adapter=f()}})(function(){var define,module,exports;return(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i0&&arguments[0]!==undefined?arguments[0]:{},window=_ref.window;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{shimChrome:true,shimFirefox:true,shimEdge:true,shimSafari:true};var logging=utils.log;var browserDetails=utils.detectBrowser(window);var adapter={browserDetails:browserDetails,commonShim:commonShim,extractVersion:utils.extractVersion,disableLog:utils.disableLog,disableWarnings:utils.disableWarnings};switch(browserDetails.browser){case 'chrome':if(!chromeShim||!chromeShim.shimPeerConnection||!options.shimChrome){logging('Chrome shim is not included in this adapter release.');return adapter;} -logging('adapter.js shimming chrome.');adapter.browserShim=chromeShim;chromeShim.shimGetUserMedia(window);chromeShim.shimMediaStream(window);chromeShim.shimPeerConnection(window);chromeShim.shimOnTrack(window);chromeShim.shimAddTrackRemoveTrack(window);chromeShim.shimGetSendersWithDtmf(window);chromeShim.shimGetStats(window);chromeShim.shimSenderReceiverGetStats(window);chromeShim.fixNegotiationNeeded(window);commonShim.shimRTCIceCandidate(window);commonShim.shimConnectionState(window);commonShim.shimMaxMessageSize(window);commonShim.shimSendThrowTypeError(window);commonShim.removeAllowExtmapMixed(window);break;case 'firefox':if(!firefoxShim||!firefoxShim.shimPeerConnection||!options.shimFirefox){logging('Firefox shim is not included in this adapter release.');return adapter;} -logging('adapter.js shimming firefox.');adapter.browserShim=firefoxShim;firefoxShim.shimGetUserMedia(window);firefoxShim.shimPeerConnection(window);firefoxShim.shimOnTrack(window);firefoxShim.shimRemoveStream(window);firefoxShim.shimSenderGetStats(window);firefoxShim.shimReceiverGetStats(window);firefoxShim.shimRTCDataChannel(window);commonShim.shimRTCIceCandidate(window);commonShim.shimConnectionState(window);commonShim.shimMaxMessageSize(window);commonShim.shimSendThrowTypeError(window);break;case 'edge':if(!edgeShim||!edgeShim.shimPeerConnection||!options.shimEdge){logging('MS edge shim is not included in this adapter release.');return adapter;} -logging('adapter.js shimming edge.');adapter.browserShim=edgeShim;edgeShim.shimGetUserMedia(window);edgeShim.shimGetDisplayMedia(window);edgeShim.shimPeerConnection(window);edgeShim.shimReplaceTrack(window);commonShim.shimMaxMessageSize(window);commonShim.shimSendThrowTypeError(window);break;case 'safari':if(!safariShim||!options.shimSafari){logging('Safari shim is not included in this adapter release.');return adapter;} -logging('adapter.js shimming safari.');adapter.browserShim=safariShim;safariShim.shimRTCIceServerUrls(window);safariShim.shimCreateOfferLegacy(window);safariShim.shimCallbacksAPI(window);safariShim.shimLocalStreamsAPI(window);safariShim.shimRemoteStreamsAPI(window);safariShim.shimTrackEventTransceiver(window);safariShim.shimGetUserMedia(window);commonShim.shimRTCIceCandidate(window);commonShim.shimMaxMessageSize(window);commonShim.shimSendThrowTypeError(window);commonShim.removeAllowExtmapMixed(window);break;default:logging('Unsupported browser!');break;} -return adapter;}},{"./chrome/chrome_shim":3,"./common_shim":6,"./edge/edge_shim":7,"./firefox/firefox_shim":11,"./safari/safari_shim":14,"./utils":15}],3:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.shimGetDisplayMedia=exports.shimGetUserMedia=undefined;var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};var _getusermedia=require('./getusermedia');Object.defineProperty(exports,'shimGetUserMedia',{enumerable:true,get:function get(){return _getusermedia.shimGetUserMedia;}});var _getdisplaymedia=require('./getdisplaymedia');Object.defineProperty(exports,'shimGetDisplayMedia',{enumerable:true,get:function get(){return _getdisplaymedia.shimGetDisplayMedia;}});exports.shimMediaStream=shimMediaStream;exports.shimOnTrack=shimOnTrack;exports.shimGetSendersWithDtmf=shimGetSendersWithDtmf;exports.shimGetStats=shimGetStats;exports.shimSenderReceiverGetStats=shimSenderReceiverGetStats;exports.shimAddTrackRemoveTrackWithNative=shimAddTrackRemoveTrackWithNative;exports.shimAddTrackRemoveTrack=shimAddTrackRemoveTrack;exports.shimPeerConnection=shimPeerConnection;exports.fixNegotiationNeeded=fixNegotiationNeeded;var _utils=require('../utils.js');var utils=_interopRequireWildcard(_utils);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}} -function shimMediaStream(window){window.MediaStream=window.MediaStream||window.webkitMediaStream;} -function shimOnTrack(window){if((typeof window==='undefined'?'undefined':_typeof(window))==='object'&&window.RTCPeerConnection&&!('ontrack'in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,'ontrack',{get:function get(){return this._ontrack;},set:function set(f){if(this._ontrack){this.removeEventListener('track',this._ontrack);} -this.addEventListener('track',this._ontrack=f);},enumerable:true,configurable:true});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var _this=this;if(!this._ontrackpoly){this._ontrackpoly=function(e){e.stream.addEventListener('addtrack',function(te){var receiver=void 0;if(window.RTCPeerConnection.prototype.getReceivers){receiver=_this.getReceivers().find(function(r){return r.track&&r.track.id===te.track.id;});}else{receiver={track:te.track};} -var event=new Event('track');event.track=te.track;event.receiver=receiver;event.transceiver={receiver:receiver};event.streams=[e.stream];_this.dispatchEvent(event);});e.stream.getTracks().forEach(function(track){var receiver=void 0;if(window.RTCPeerConnection.prototype.getReceivers){receiver=_this.getReceivers().find(function(r){return r.track&&r.track.id===track.id;});}else{receiver={track:track};} -var event=new Event('track');event.track=track;event.receiver=receiver;event.transceiver={receiver:receiver};event.streams=[e.stream];_this.dispatchEvent(event);});};this.addEventListener('addstream',this._ontrackpoly);} -return origSetRemoteDescription.apply(this,arguments);};}else{utils.wrapPeerConnectionEvent(window,'track',function(e){if(!e.transceiver){Object.defineProperty(e,'transceiver',{value:{receiver:e.receiver}});} -return e;});}} -function shimGetSendersWithDtmf(window){if((typeof window==='undefined'?'undefined':_typeof(window))==='object'&&window.RTCPeerConnection&&!('getSenders'in window.RTCPeerConnection.prototype)&&'createDTMFSender'in window.RTCPeerConnection.prototype){var shimSenderWithDtmf=function shimSenderWithDtmf(pc,track){return{track:track,get dtmf(){if(this._dtmf===undefined){if(track.kind==='audio'){this._dtmf=pc.createDTMFSender(track);}else{this._dtmf=null;}} -return this._dtmf;},_pc:pc};};if(!window.RTCPeerConnection.prototype.getSenders){window.RTCPeerConnection.prototype.getSenders=function(){this._senders=this._senders||[];return this._senders.slice();};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){var sender=origAddTrack.apply(this,arguments);if(!sender){sender=shimSenderWithDtmf(this,track);this._senders.push(sender);} -return sender;};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){origRemoveTrack.apply(this,arguments);var idx=this._senders.indexOf(sender);if(idx!==-1){this._senders.splice(idx,1);}};} -var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this2=this;this._senders=this._senders||[];origAddStream.apply(this,[stream]);stream.getTracks().forEach(function(track){_this2._senders.push(shimSenderWithDtmf(_this2,track));});};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;this._senders=this._senders||[];origRemoveStream.apply(this,[stream]);stream.getTracks().forEach(function(track){var sender=_this3._senders.find(function(s){return s.track===track;});if(sender){_this3._senders.splice(_this3._senders.indexOf(sender),1);}});};}else if((typeof window==='undefined'?'undefined':_typeof(window))==='object'&&window.RTCPeerConnection&&'getSenders'in window.RTCPeerConnection.prototype&&'createDTMFSender'in window.RTCPeerConnection.prototype&&window.RTCRtpSender&&!('dtmf'in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;window.RTCPeerConnection.prototype.getSenders=function(){var _this4=this;var senders=origGetSenders.apply(this,[]);senders.forEach(function(sender){return sender._pc=_this4;});return senders;};Object.defineProperty(window.RTCRtpSender.prototype,'dtmf',{get:function get(){if(this._dtmf===undefined){if(this.track.kind==='audio'){this._dtmf=this._pc.createDTMFSender(this.track);}else{this._dtmf=null;}} -return this._dtmf;}});}} -function shimGetStats(window){if(!window.RTCPeerConnection){return;} -var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(selector,successCallback,errorCallback){var _this5=this;var args=arguments;if(arguments.length>0&&typeof selector==='function'){return origGetStats.apply(this,arguments);} -if(origGetStats.length===0&&(arguments.length===0||typeof arguments[0]!=='function')){return origGetStats.apply(this,[]);} -var fixChromeStats_=function fixChromeStats_(response){var standardReport={};var reports=response.result();reports.forEach(function(report){var standardStats={id:report.id,timestamp:report.timestamp,type:{localcandidate:'local-candidate',remotecandidate:'remote-candidate'}[report.type]||report.type};report.names().forEach(function(name){standardStats[name]=report.stat(name);});standardReport[standardStats.id]=standardStats;});return standardReport;};var makeMapStats=function makeMapStats(stats){return new Map(Object.keys(stats).map(function(key){return[key,stats[key]];}));};if(arguments.length>=2){var successCallbackWrapper_=function successCallbackWrapper_(response){args[1](makeMapStats(fixChromeStats_(response)));};return origGetStats.apply(this,[successCallbackWrapper_,arguments[0]]);} -return new Promise(function(resolve,reject){origGetStats.apply(_this5,[function(response){resolve(makeMapStats(fixChromeStats_(response)));},reject]);}).then(successCallback,errorCallback);};} -function shimSenderReceiverGetStats(window){if(!((typeof window==='undefined'?'undefined':_typeof(window))==='object'&&window.RTCPeerConnection&&window.RTCRtpSender&&window.RTCRtpReceiver)){return;} -if(!('getStats'in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;if(origGetSenders){window.RTCPeerConnection.prototype.getSenders=function(){var _this6=this;var senders=origGetSenders.apply(this,[]);senders.forEach(function(sender){return sender._pc=_this6;});return senders;};} -var origAddTrack=window.RTCPeerConnection.prototype.addTrack;if(origAddTrack){window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);sender._pc=this;return sender;};} -window.RTCRtpSender.prototype.getStats=function(){var sender=this;return this._pc.getStats().then(function(result){return(utils.filterStats(result,sender.track,true));});};} -if(!('getStats'in window.RTCRtpReceiver.prototype)){var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;if(origGetReceivers){window.RTCPeerConnection.prototype.getReceivers=function(){var _this7=this;var receivers=origGetReceivers.apply(this,[]);receivers.forEach(function(receiver){return receiver._pc=_this7;});return receivers;};} -utils.wrapPeerConnectionEvent(window,'track',function(e){e.receiver._pc=e.srcElement;return e;});window.RTCRtpReceiver.prototype.getStats=function(){var receiver=this;return this._pc.getStats().then(function(result){return utils.filterStats(result,receiver.track,false);});};} -if(!('getStats'in window.RTCRtpSender.prototype&&'getStats'in window.RTCRtpReceiver.prototype)){return;} -var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof window.MediaStreamTrack){var track=arguments[0];var sender=void 0;var receiver=void 0;var err=void 0;this.getSenders().forEach(function(s){if(s.track===track){if(sender){err=true;}else{sender=s;}}});this.getReceivers().forEach(function(r){if(r.track===track){if(receiver){err=true;}else{receiver=r;}} -return r.track===track;});if(err||sender&&receiver){return Promise.reject(new DOMException('There are more than one sender or receiver for the track.','InvalidAccessError'));}else if(sender){return sender.getStats();}else if(receiver){return receiver.getStats();} -return Promise.reject(new DOMException('There is no sender or receiver for the track.','InvalidAccessError'));} -return origGetStats.apply(this,arguments);};} -function shimAddTrackRemoveTrackWithNative(window){window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this8=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{};return Object.keys(this._shimmedLocalStreams).map(function(streamId){return _this8._shimmedLocalStreams[streamId][0];});};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){if(!stream){return origAddTrack.apply(this,arguments);} -this._shimmedLocalStreams=this._shimmedLocalStreams||{};var sender=origAddTrack.apply(this,arguments);if(!this._shimmedLocalStreams[stream.id]){this._shimmedLocalStreams[stream.id]=[stream,sender];}else if(this._shimmedLocalStreams[stream.id].indexOf(sender)===-1){this._shimmedLocalStreams[stream.id].push(sender);} -return sender;};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this9=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{};stream.getTracks().forEach(function(track){var alreadyExists=_this9.getSenders().find(function(s){return s.track===track;});if(alreadyExists){throw new DOMException('Track already exists.','InvalidAccessError');}});var existingSenders=this.getSenders();origAddStream.apply(this,arguments);var newSenders=this.getSenders().filter(function(newSender){return existingSenders.indexOf(newSender)===-1;});this._shimmedLocalStreams[stream.id]=[stream].concat(newSenders);};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){this._shimmedLocalStreams=this._shimmedLocalStreams||{};delete this._shimmedLocalStreams[stream.id];return origRemoveStream.apply(this,arguments);};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this10=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{};if(sender){Object.keys(this._shimmedLocalStreams).forEach(function(streamId){var idx=_this10._shimmedLocalStreams[streamId].indexOf(sender);if(idx!==-1){_this10._shimmedLocalStreams[streamId].splice(idx,1);} -if(_this10._shimmedLocalStreams[streamId].length===1){delete _this10._shimmedLocalStreams[streamId];}});} -return origRemoveTrack.apply(this,arguments);};} -function shimAddTrackRemoveTrack(window){if(!window.RTCPeerConnection){return;} -var browserDetails=utils.detectBrowser(window);if(window.RTCPeerConnection.prototype.addTrack&&browserDetails.version>=65){return shimAddTrackRemoveTrackWithNative(window);} -var origGetLocalStreams=window.RTCPeerConnection.prototype.getLocalStreams;window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this11=this;var nativeStreams=origGetLocalStreams.apply(this);this._reverseStreams=this._reverseStreams||{};return nativeStreams.map(function(stream){return _this11._reverseStreams[stream.id];});};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this12=this;this._streams=this._streams||{};this._reverseStreams=this._reverseStreams||{};stream.getTracks().forEach(function(track){var alreadyExists=_this12.getSenders().find(function(s){return s.track===track;});if(alreadyExists){throw new DOMException('Track already exists.','InvalidAccessError');}});if(!this._reverseStreams[stream.id]){var newStream=new window.MediaStream(stream.getTracks());this._streams[stream.id]=newStream;this._reverseStreams[newStream.id]=stream;stream=newStream;} -origAddStream.apply(this,[stream]);};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){this._streams=this._streams||{};this._reverseStreams=this._reverseStreams||{};origRemoveStream.apply(this,[this._streams[stream.id]||stream]);delete this._reverseStreams[this._streams[stream.id]?this._streams[stream.id].id:stream.id];delete this._streams[stream.id];};window.RTCPeerConnection.prototype.addTrack=function(track,stream){var _this13=this;if(this.signalingState==='closed'){throw new DOMException('The RTCPeerConnection\'s signalingState is \'closed\'.','InvalidStateError');} -var streams=[].slice.call(arguments,1);if(streams.length!==1||!streams[0].getTracks().find(function(t){return t===track;})){throw new DOMException('The adapter.js addTrack polyfill only supports a single '+' stream which is associated with the specified track.','NotSupportedError');} -var alreadyExists=this.getSenders().find(function(s){return s.track===track;});if(alreadyExists){throw new DOMException('Track already exists.','InvalidAccessError');} -this._streams=this._streams||{};this._reverseStreams=this._reverseStreams||{};var oldStream=this._streams[stream.id];if(oldStream){oldStream.addTrack(track);Promise.resolve().then(function(){_this13.dispatchEvent(new Event('negotiationneeded'));});}else{var newStream=new window.MediaStream([track]);this._streams[stream.id]=newStream;this._reverseStreams[newStream.id]=stream;this.addStream(newStream);} -return this.getSenders().find(function(s){return s.track===track;});};function replaceInternalStreamId(pc,description){var sdp=description.sdp;Object.keys(pc._reverseStreams||[]).forEach(function(internalId){var externalStream=pc._reverseStreams[internalId];var internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(internalStream.id,'g'),externalStream.id);});return new RTCSessionDescription({type:description.type,sdp:sdp});} -function replaceExternalStreamId(pc,description){var sdp=description.sdp;Object.keys(pc._reverseStreams||[]).forEach(function(internalId){var externalStream=pc._reverseStreams[internalId];var internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(externalStream.id,'g'),internalStream.id);});return new RTCSessionDescription({type:description.type,sdp:sdp});} -['createOffer','createAnswer'].forEach(function(method){var nativeMethod=window.RTCPeerConnection.prototype[method];window.RTCPeerConnection.prototype[method]=function(){var _this14=this;var args=arguments;var isLegacyCall=arguments.length&&typeof arguments[0]==='function';if(isLegacyCall){return nativeMethod.apply(this,[function(description){var desc=replaceInternalStreamId(_this14,description);args[0].apply(null,[desc]);},function(err){if(args[1]){args[1].apply(null,err);}},arguments[2]]);} -return nativeMethod.apply(this,arguments).then(function(description){return replaceInternalStreamId(_this14,description);});};});var origSetLocalDescription=window.RTCPeerConnection.prototype.setLocalDescription;window.RTCPeerConnection.prototype.setLocalDescription=function(){if(!arguments.length||!arguments[0].type){return origSetLocalDescription.apply(this,arguments);} -arguments[0]=replaceExternalStreamId(this,arguments[0]);return origSetLocalDescription.apply(this,arguments);};var origLocalDescription=Object.getOwnPropertyDescriptor(window.RTCPeerConnection.prototype,'localDescription');Object.defineProperty(window.RTCPeerConnection.prototype,'localDescription',{get:function get(){var description=origLocalDescription.get.apply(this);if(description.type===''){return description;} -return replaceInternalStreamId(this,description);}});window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this15=this;if(this.signalingState==='closed'){throw new DOMException('The RTCPeerConnection\'s signalingState is \'closed\'.','InvalidStateError');} -if(!sender._pc){throw new DOMException('Argument 1 of RTCPeerConnection.removeTrack '+'does not implement interface RTCRtpSender.','TypeError');} -var isLocal=sender._pc===this;if(!isLocal){throw new DOMException('Sender was not created by this connection.','InvalidAccessError');} -this._streams=this._streams||{};var stream=void 0;Object.keys(this._streams).forEach(function(streamid){var hasTrack=_this15._streams[streamid].getTracks().find(function(track){return sender.track===track;});if(hasTrack){stream=_this15._streams[streamid];}});if(stream){if(stream.getTracks().length===1){this.removeStream(this._reverseStreams[stream.id]);}else{stream.removeTrack(sender.track);} -this.dispatchEvent(new Event('negotiationneeded'));}};} -function shimPeerConnection(window){if(!window.RTCPeerConnection&&window.webkitRTCPeerConnection){window.RTCPeerConnection=window.webkitRTCPeerConnection;} -if(!window.RTCPeerConnection){return;} -['setLocalDescription','setRemoteDescription','addIceCandidate'].forEach(function(method){var nativeMethod=window.RTCPeerConnection.prototype[method];window.RTCPeerConnection.prototype[method]=function(){arguments[0]=new(method==='addIceCandidate'?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]);return nativeMethod.apply(this,arguments);};});var nativeAddIceCandidate=window.RTCPeerConnection.prototype.addIceCandidate;window.RTCPeerConnection.prototype.addIceCandidate=function(){if(!arguments[0]){if(arguments[1]){arguments[1].apply(null);} -return Promise.resolve();} -return nativeAddIceCandidate.apply(this,arguments);};} -function fixNegotiationNeeded(window){utils.wrapPeerConnectionEvent(window,'negotiationneeded',function(e){var pc=e.target;if(pc.signalingState!=='stable'){return;} -return e;});}},{"../utils.js":15,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.shimGetDisplayMedia=shimGetDisplayMedia;function shimGetDisplayMedia(window,getSourceId){if(window.navigator.mediaDevices&&'getDisplayMedia'in window.navigator.mediaDevices){return;} -if(!window.navigator.mediaDevices){return;} -if(typeof getSourceId!=='function'){console.error('shimGetDisplayMedia: getSourceId argument is not '+'a function');return;} -window.navigator.mediaDevices.getDisplayMedia=function(constraints){return getSourceId(constraints).then(function(sourceId){var widthSpecified=constraints.video&&constraints.video.width;var heightSpecified=constraints.video&&constraints.video.height;var frameRateSpecified=constraints.video&&constraints.video.frameRate;constraints.video={mandatory:{chromeMediaSource:'desktop',chromeMediaSourceId:sourceId,maxFrameRate:frameRateSpecified||3}};if(widthSpecified){constraints.video.mandatory.maxWidth=widthSpecified;} -if(heightSpecified){constraints.video.mandatory.maxHeight=heightSpecified;} -return window.navigator.mediaDevices.getUserMedia(constraints);});};}},{}],5:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};exports.shimGetUserMedia=shimGetUserMedia;var _utils=require('../utils.js');var utils=_interopRequireWildcard(_utils);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}} -var logging=utils.log;function shimGetUserMedia(window){var navigator=window&&window.navigator;if(!navigator.mediaDevices){return;} -var browserDetails=utils.detectBrowser(window);var constraintsToChrome_=function constraintsToChrome_(c){if((typeof c==='undefined'?'undefined':_typeof(c))!=='object'||c.mandatory||c.optional){return c;} -var cc={};Object.keys(c).forEach(function(key){if(key==='require'||key==='advanced'||key==='mediaSource'){return;} -var r=_typeof(c[key])==='object'?c[key]:{ideal:c[key]};if(r.exact!==undefined&&typeof r.exact==='number'){r.min=r.max=r.exact;} -var oldname_=function oldname_(prefix,name){if(prefix){return prefix+name.charAt(0).toUpperCase()+name.slice(1);} -return name==='deviceId'?'sourceId':name;};if(r.ideal!==undefined){cc.optional=cc.optional||[];var oc={};if(typeof r.ideal==='number'){oc[oldname_('min',key)]=r.ideal;cc.optional.push(oc);oc={};oc[oldname_('max',key)]=r.ideal;cc.optional.push(oc);}else{oc[oldname_('',key)]=r.ideal;cc.optional.push(oc);}} -if(r.exact!==undefined&&typeof r.exact!=='number'){cc.mandatory=cc.mandatory||{};cc.mandatory[oldname_('',key)]=r.exact;}else{['min','max'].forEach(function(mix){if(r[mix]!==undefined){cc.mandatory=cc.mandatory||{};cc.mandatory[oldname_(mix,key)]=r[mix];}});}});if(c.advanced){cc.optional=(cc.optional||[]).concat(c.advanced);} -return cc;};var shimConstraints_=function shimConstraints_(constraints,func){if(browserDetails.version>=61){return func(constraints);} -constraints=JSON.parse(JSON.stringify(constraints));if(constraints&&_typeof(constraints.audio)==='object'){var remap=function remap(obj,a,b){if(a in obj&&!(b in obj)){obj[b]=obj[a];delete obj[a];}};constraints=JSON.parse(JSON.stringify(constraints));remap(constraints.audio,'autoGainControl','googAutoGainControl');remap(constraints.audio,'noiseSuppression','googNoiseSuppression');constraints.audio=constraintsToChrome_(constraints.audio);} -if(constraints&&_typeof(constraints.video)==='object'){var face=constraints.video.facingMode;face=face&&((typeof face==='undefined'?'undefined':_typeof(face))==='object'?face:{ideal:face});var getSupportedFacingModeLies=browserDetails.version<66;if(face&&(face.exact==='user'||face.exact==='environment'||face.ideal==='user'||face.ideal==='environment')&&!(navigator.mediaDevices.getSupportedConstraints&&navigator.mediaDevices.getSupportedConstraints().facingMode&&!getSupportedFacingModeLies)){delete constraints.video.facingMode;var matches=void 0;if(face.exact==='environment'||face.ideal==='environment'){matches=['back','rear'];}else if(face.exact==='user'||face.ideal==='user'){matches=['front'];} -if(matches){return navigator.mediaDevices.enumerateDevices().then(function(devices){devices=devices.filter(function(d){return d.kind==='videoinput';});var dev=devices.find(function(d){return matches.some(function(match){return d.label.toLowerCase().includes(match);});});if(!dev&&devices.length&&matches.includes('back')){dev=devices[devices.length-1];} -if(dev){constraints.video.deviceId=face.exact?{exact:dev.deviceId}:{ideal:dev.deviceId};} -constraints.video=constraintsToChrome_(constraints.video);logging('chrome: '+JSON.stringify(constraints));return func(constraints);});}} -constraints.video=constraintsToChrome_(constraints.video);} -logging('chrome: '+JSON.stringify(constraints));return func(constraints);};var shimError_=function shimError_(e){if(browserDetails.version>=64){return e;} -return{name:{PermissionDeniedError:'NotAllowedError',PermissionDismissedError:'NotAllowedError',InvalidStateError:'NotAllowedError',DevicesNotFoundError:'NotFoundError',ConstraintNotSatisfiedError:'OverconstrainedError',TrackStartError:'NotReadableError',MediaDeviceFailedDueToShutdown:'NotAllowedError',MediaDeviceKillSwitchOn:'NotAllowedError',TabCaptureError:'AbortError',ScreenCaptureError:'AbortError',DeviceCaptureError:'AbortError'}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function toString(){return this.name+(this.message&&': ')+this.message;}};};var getUserMedia_=function getUserMedia_(constraints,onSuccess,onError){shimConstraints_(constraints,function(c){navigator.webkitGetUserMedia(c,onSuccess,function(e){if(onError){onError(shimError_(e));}});});};navigator.getUserMedia=getUserMedia_.bind(navigator);if(navigator.mediaDevices.getUserMedia){var origGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(cs){return shimConstraints_(cs,function(c){return origGetUserMedia(c).then(function(stream){if(c.audio&&!stream.getAudioTracks().length||c.video&&!stream.getVideoTracks().length){stream.getTracks().forEach(function(track){track.stop();});throw new DOMException('','NotFoundError');} -return stream;},function(e){return Promise.reject(shimError_(e));});});};}}},{"../utils.js":15}],6:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};exports.shimRTCIceCandidate=shimRTCIceCandidate;exports.shimMaxMessageSize=shimMaxMessageSize;exports.shimSendThrowTypeError=shimSendThrowTypeError;exports.shimConnectionState=shimConnectionState;exports.removeAllowExtmapMixed=removeAllowExtmapMixed;var _sdp=require('sdp');var _sdp2=_interopRequireDefault(_sdp);var _utils=require('./utils');var utils=_interopRequireWildcard(_utils);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}} -function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};} -function shimRTCIceCandidate(window){if(!window.RTCIceCandidate||window.RTCIceCandidate&&'foundation'in window.RTCIceCandidate.prototype){return;} -var NativeRTCIceCandidate=window.RTCIceCandidate;window.RTCIceCandidate=function(args){if((typeof args==='undefined'?'undefined':_typeof(args))==='object'&&args.candidate&&args.candidate.indexOf('a=')===0){args=JSON.parse(JSON.stringify(args));args.candidate=args.candidate.substr(2);} -if(args.candidate&&args.candidate.length){var nativeCandidate=new NativeRTCIceCandidate(args);var parsedCandidate=_sdp2.default.parseCandidate(args.candidate);var augmentedCandidate=Object.assign(nativeCandidate,parsedCandidate);augmentedCandidate.toJSON=function(){return{candidate:augmentedCandidate.candidate,sdpMid:augmentedCandidate.sdpMid,sdpMLineIndex:augmentedCandidate.sdpMLineIndex,usernameFragment:augmentedCandidate.usernameFragment};};return augmentedCandidate;} -return new NativeRTCIceCandidate(args);};window.RTCIceCandidate.prototype=NativeRTCIceCandidate.prototype;utils.wrapPeerConnectionEvent(window,'icecandidate',function(e){if(e.candidate){Object.defineProperty(e,'candidate',{value:new window.RTCIceCandidate(e.candidate),writable:'false'});} -return e;});} -function shimMaxMessageSize(window){if(window.RTCSctpTransport||!window.RTCPeerConnection){return;} -var browserDetails=utils.detectBrowser(window);if(!('sctp'in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,'sctp',{get:function get(){return typeof this._sctp==='undefined'?null:this._sctp;}});} -var sctpInDescription=function sctpInDescription(description){if(!description||!description.sdp){return false;} -var sections=_sdp2.default.splitSections(description.sdp);sections.shift();return sections.some(function(mediaSection){var mLine=_sdp2.default.parseMLine(mediaSection);return mLine&&mLine.kind==='application'&&mLine.protocol.indexOf('SCTP')!==-1;});};var getRemoteFirefoxVersion=function getRemoteFirefoxVersion(description){var match=description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(match===null||match.length<2){return-1;} -var version=parseInt(match[1],10);return version!==version?-1:version;};var getCanSendMaxMessageSize=function getCanSendMaxMessageSize(remoteIsFirefox){var canSendMaxMessageSize=65536;if(browserDetails.browser==='firefox'){if(browserDetails.version<57){if(remoteIsFirefox===-1){canSendMaxMessageSize=16384;}else{canSendMaxMessageSize=2147483637;}}else if(browserDetails.version<60){canSendMaxMessageSize=browserDetails.version===57?65535:65536;}else{canSendMaxMessageSize=2147483637;}} -return canSendMaxMessageSize;};var getMaxMessageSize=function getMaxMessageSize(description,remoteIsFirefox){var maxMessageSize=65536;if(browserDetails.browser==='firefox'&&browserDetails.version===57){maxMessageSize=65535;} -var match=_sdp2.default.matchPrefix(description.sdp,'a=max-message-size:');if(match.length>0){maxMessageSize=parseInt(match[0].substr(19),10);}else if(browserDetails.browser==='firefox'&&remoteIsFirefox!==-1){maxMessageSize=2147483637;} -return maxMessageSize;};var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){this._sctp=null;if(sctpInDescription(arguments[0])){var isFirefox=getRemoteFirefoxVersion(arguments[0]);var canSendMMS=getCanSendMaxMessageSize(isFirefox);var remoteMMS=getMaxMessageSize(arguments[0],isFirefox);var maxMessageSize=void 0;if(canSendMMS===0&&remoteMMS===0){maxMessageSize=Number.POSITIVE_INFINITY;}else if(canSendMMS===0||remoteMMS===0){maxMessageSize=Math.max(canSendMMS,remoteMMS);}else{maxMessageSize=Math.min(canSendMMS,remoteMMS);} -var sctp={};Object.defineProperty(sctp,'maxMessageSize',{get:function get(){return maxMessageSize;}});this._sctp=sctp;} -return origSetRemoteDescription.apply(this,arguments);};} -function shimSendThrowTypeError(window){if(!(window.RTCPeerConnection&&'createDataChannel'in window.RTCPeerConnection.prototype)){return;} -function wrapDcSend(dc,pc){var origDataChannelSend=dc.send;dc.send=function(){var data=arguments[0];var length=data.length||data.size||data.byteLength;if(dc.readyState==='open'&&pc.sctp&&length>pc.sctp.maxMessageSize){throw new TypeError('Message too large (can send a maximum of '+pc.sctp.maxMessageSize+' bytes)');} -return origDataChannelSend.apply(dc,arguments);};} -var origCreateDataChannel=window.RTCPeerConnection.prototype.createDataChannel;window.RTCPeerConnection.prototype.createDataChannel=function(){var dataChannel=origCreateDataChannel.apply(this,arguments);wrapDcSend(dataChannel,this);return dataChannel;};utils.wrapPeerConnectionEvent(window,'datachannel',function(e){wrapDcSend(e.channel,e.target);return e;});} -function shimConnectionState(window){if(!window.RTCPeerConnection||'connectionState'in window.RTCPeerConnection.prototype){return;} -var proto=window.RTCPeerConnection.prototype;Object.defineProperty(proto,'connectionState',{get:function get(){return{completed:'connected',checking:'connecting'}[this.iceConnectionState]||this.iceConnectionState;},enumerable:true,configurable:true});Object.defineProperty(proto,'onconnectionstatechange',{get:function get(){return this._onconnectionstatechange||null;},set:function set(cb){if(this._onconnectionstatechange){this.removeEventListener('connectionstatechange',this._onconnectionstatechange);delete this._onconnectionstatechange;} -if(cb){this.addEventListener('connectionstatechange',this._onconnectionstatechange=cb);}},enumerable:true,configurable:true});['setLocalDescription','setRemoteDescription'].forEach(function(method){var origMethod=proto[method];proto[method]=function(){if(!this._connectionstatechangepoly){this._connectionstatechangepoly=function(e){var pc=e.target;if(pc._lastConnectionState!==pc.connectionState){pc._lastConnectionState=pc.connectionState;var newEvent=new Event('connectionstatechange',e);pc.dispatchEvent(newEvent);} -return e;};this.addEventListener('iceconnectionstatechange',this._connectionstatechangepoly);} -return origMethod.apply(this,arguments);};});} -function removeAllowExtmapMixed(window){if(!window.RTCPeerConnection){return;} -var browserDetails=utils.detectBrowser(window);if(browserDetails.browser==='chrome'&&browserDetails.version>=71){return;} -var nativeSRD=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(desc){if(desc&&desc.sdp&&desc.sdp.indexOf('\na=extmap-allow-mixed')!==-1){desc.sdp=desc.sdp.split('\n').filter(function(line){return line.trim()!=='a=extmap-allow-mixed';}).join('\n');} -return nativeSRD.apply(this,arguments);};}},{"./utils":15,"sdp":17}],7:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.shimGetDisplayMedia=exports.shimGetUserMedia=undefined;var _getusermedia=require('./getusermedia');Object.defineProperty(exports,'shimGetUserMedia',{enumerable:true,get:function get(){return _getusermedia.shimGetUserMedia;}});var _getdisplaymedia=require('./getdisplaymedia');Object.defineProperty(exports,'shimGetDisplayMedia',{enumerable:true,get:function get(){return _getdisplaymedia.shimGetDisplayMedia;}});exports.shimPeerConnection=shimPeerConnection;exports.shimReplaceTrack=shimReplaceTrack;var _utils=require('../utils');var utils=_interopRequireWildcard(_utils);var _filtericeservers=require('./filtericeservers');var _rtcpeerconnectionShim=require('rtcpeerconnection-shim');var _rtcpeerconnectionShim2=_interopRequireDefault(_rtcpeerconnectionShim);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};} -function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}} -function shimPeerConnection(window){var browserDetails=utils.detectBrowser(window);if(window.RTCIceGatherer){if(!window.RTCIceCandidate){window.RTCIceCandidate=function(args){return args;};} -if(!window.RTCSessionDescription){window.RTCSessionDescription=function(args){return args;};} -if(browserDetails.version<15025){var origMSTEnabled=Object.getOwnPropertyDescriptor(window.MediaStreamTrack.prototype,'enabled');Object.defineProperty(window.MediaStreamTrack.prototype,'enabled',{set:function set(value){origMSTEnabled.set.call(this,value);var ev=new Event('enabled');ev.enabled=value;this.dispatchEvent(ev);}});}} -if(window.RTCRtpSender&&!('dtmf'in window.RTCRtpSender.prototype)){Object.defineProperty(window.RTCRtpSender.prototype,'dtmf',{get:function get(){if(this._dtmf===undefined){if(this.track.kind==='audio'){this._dtmf=new window.RTCDtmfSender(this);}else if(this.track.kind==='video'){this._dtmf=null;}} -return this._dtmf;}});} -if(window.RTCDtmfSender&&!window.RTCDTMFSender){window.RTCDTMFSender=window.RTCDtmfSender;} -var RTCPeerConnectionShim=(0,_rtcpeerconnectionShim2.default)(window,browserDetails.version);window.RTCPeerConnection=function(config){if(config&&config.iceServers){config.iceServers=(0,_filtericeservers.filterIceServers)(config.iceServers,browserDetails.version);utils.log('ICE servers after filtering:',config.iceServers);} -return new RTCPeerConnectionShim(config);};window.RTCPeerConnection.prototype=RTCPeerConnectionShim.prototype;} -function shimReplaceTrack(window){if(window.RTCRtpSender&&!('replaceTrack'in window.RTCRtpSender.prototype)){window.RTCRtpSender.prototype.replaceTrack=window.RTCRtpSender.prototype.setTrack;}}},{"../utils":15,"./filtericeservers":8,"./getdisplaymedia":9,"./getusermedia":10,"rtcpeerconnection-shim":16}],8:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.filterIceServers=filterIceServers;var _utils=require('../utils');var utils=_interopRequireWildcard(_utils);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}} -function filterIceServers(iceServers,edgeVersion){var hasTurn=false;iceServers=JSON.parse(JSON.stringify(iceServers));return iceServers.filter(function(server){if(server&&(server.urls||server.url)){var urls=server.urls||server.url;if(server.url&&!server.urls){utils.deprecated('RTCIceServer.url','RTCIceServer.urls');} -var isString=typeof urls==='string';if(isString){urls=[urls];} -urls=urls.filter(function(url){if(url.indexOf('stun:')===0){return false;} -var validTurn=url.startsWith('turn')&&!url.startsWith('turn:[')&&url.includes('transport=udp');if(validTurn&&!hasTurn){hasTurn=true;return true;} -return validTurn&&!hasTurn;});delete server.url;server.urls=isString?urls[0]:urls;return!!urls.length;}});}},{"../utils":15}],9:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.shimGetDisplayMedia=shimGetDisplayMedia;function shimGetDisplayMedia(window){if(!('getDisplayMedia'in window.navigator)){return;} -if(!window.navigator.mediaDevices){return;} -if(window.navigator.mediaDevices&&'getDisplayMedia'in window.navigator.mediaDevices){return;} -window.navigator.mediaDevices.getDisplayMedia=window.navigator.getDisplayMedia.bind(window.navigator);}},{}],10:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.shimGetUserMedia=shimGetUserMedia;function shimGetUserMedia(window){var navigator=window&&window.navigator;var shimError_=function shimError_(e){return{name:{PermissionDeniedError:'NotAllowedError'}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function toString(){return this.name;}};};var origGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(c){return origGetUserMedia(c).catch(function(e){return Promise.reject(shimError_(e));});};}},{}],11:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.shimGetDisplayMedia=exports.shimGetUserMedia=undefined;var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};var _getusermedia=require('./getusermedia');Object.defineProperty(exports,'shimGetUserMedia',{enumerable:true,get:function get(){return _getusermedia.shimGetUserMedia;}});var _getdisplaymedia=require('./getdisplaymedia');Object.defineProperty(exports,'shimGetDisplayMedia',{enumerable:true,get:function get(){return _getdisplaymedia.shimGetDisplayMedia;}});exports.shimOnTrack=shimOnTrack;exports.shimPeerConnection=shimPeerConnection;exports.shimSenderGetStats=shimSenderGetStats;exports.shimReceiverGetStats=shimReceiverGetStats;exports.shimRemoveStream=shimRemoveStream;exports.shimRTCDataChannel=shimRTCDataChannel;var _utils=require('../utils');var utils=_interopRequireWildcard(_utils);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}} -function shimOnTrack(window){if((typeof window==='undefined'?'undefined':_typeof(window))==='object'&&window.RTCTrackEvent&&'receiver'in window.RTCTrackEvent.prototype&&!('transceiver'in window.RTCTrackEvent.prototype)){Object.defineProperty(window.RTCTrackEvent.prototype,'transceiver',{get:function get(){return{receiver:this.receiver};}});}} -function shimPeerConnection(window){var browserDetails=utils.detectBrowser(window);if((typeof window==='undefined'?'undefined':_typeof(window))!=='object'||!(window.RTCPeerConnection||window.mozRTCPeerConnection)){return;} -if(!window.RTCPeerConnection&&window.mozRTCPeerConnection){window.RTCPeerConnection=window.mozRTCPeerConnection;} -['setLocalDescription','setRemoteDescription','addIceCandidate'].forEach(function(method){var nativeMethod=window.RTCPeerConnection.prototype[method];window.RTCPeerConnection.prototype[method]=function(){arguments[0]=new(method==='addIceCandidate'?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]);return nativeMethod.apply(this,arguments);};});var nativeAddIceCandidate=window.RTCPeerConnection.prototype.addIceCandidate;window.RTCPeerConnection.prototype.addIceCandidate=function(){if(!arguments[0]){if(arguments[1]){arguments[1].apply(null);} -return Promise.resolve();} -return nativeAddIceCandidate.apply(this,arguments);};var modernStatsTypes={inboundrtp:'inbound-rtp',outboundrtp:'outbound-rtp',candidatepair:'candidate-pair',localcandidate:'local-candidate',remotecandidate:'remote-candidate'};var nativeGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(selector,onSucc,onErr){return nativeGetStats.apply(this,[selector||null]).then(function(stats){if(browserDetails.version<53&&!onSucc){try{stats.forEach(function(stat){stat.type=modernStatsTypes[stat.type]||stat.type;});}catch(e){if(e.name!=='TypeError'){throw e;} -stats.forEach(function(stat,i){stats.set(i,Object.assign({},stat,{type:modernStatsTypes[stat.type]||stat.type}));});}} -return stats;}).then(onSucc,onErr);};} -function shimSenderGetStats(window){if(!((typeof window==='undefined'?'undefined':_typeof(window))==='object'&&window.RTCPeerConnection&&window.RTCRtpSender)){return;} -if(window.RTCRtpSender&&'getStats'in window.RTCRtpSender.prototype){return;} -var origGetSenders=window.RTCPeerConnection.prototype.getSenders;if(origGetSenders){window.RTCPeerConnection.prototype.getSenders=function(){var _this=this;var senders=origGetSenders.apply(this,[]);senders.forEach(function(sender){return sender._pc=_this;});return senders;};} -var origAddTrack=window.RTCPeerConnection.prototype.addTrack;if(origAddTrack){window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);sender._pc=this;return sender;};} -window.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map());};} -function shimReceiverGetStats(window){if(!((typeof window==='undefined'?'undefined':_typeof(window))==='object'&&window.RTCPeerConnection&&window.RTCRtpSender)){return;} -if(window.RTCRtpSender&&'getStats'in window.RTCRtpReceiver.prototype){return;} -var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;if(origGetReceivers){window.RTCPeerConnection.prototype.getReceivers=function(){var _this2=this;var receivers=origGetReceivers.apply(this,[]);receivers.forEach(function(receiver){return receiver._pc=_this2;});return receivers;};} -utils.wrapPeerConnectionEvent(window,'track',function(e){e.receiver._pc=e.srcElement;return e;});window.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track);};} -function shimRemoveStream(window){if(!window.RTCPeerConnection||'removeStream'in window.RTCPeerConnection.prototype){return;} -window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;utils.deprecated('removeStream','removeTrack');this.getSenders().forEach(function(sender){if(sender.track&&stream.getTracks().includes(sender.track)){_this3.removeTrack(sender);}});};} -function shimRTCDataChannel(window){if(window.DataChannel&&!window.RTCDataChannel){window.RTCDataChannel=window.DataChannel;}}},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.shimGetDisplayMedia=shimGetDisplayMedia;function shimGetDisplayMedia(window,preferredMediaSource){if(window.navigator.mediaDevices&&'getDisplayMedia'in window.navigator.mediaDevices){return;} -if(!window.navigator.mediaDevices){return;} -window.navigator.mediaDevices.getDisplayMedia=function(constraints){if(!(constraints&&constraints.video)){var err=new DOMException('getDisplayMedia without video '+'constraints is undefined');err.name='NotFoundError';err.code=8;return Promise.reject(err);} -if(constraints.video===true){constraints.video={mediaSource:preferredMediaSource};}else{constraints.video.mediaSource=preferredMediaSource;} -return window.navigator.mediaDevices.getUserMedia(constraints);};}},{}],13:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};exports.shimGetUserMedia=shimGetUserMedia;var _utils=require('../utils');var utils=_interopRequireWildcard(_utils);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}} -function shimGetUserMedia(window){var browserDetails=utils.detectBrowser(window);var navigator=window&&window.navigator;var MediaStreamTrack=window&&window.MediaStreamTrack;navigator.getUserMedia=function(constraints,onSuccess,onError){utils.deprecated('navigator.getUserMedia','navigator.mediaDevices.getUserMedia');navigator.mediaDevices.getUserMedia(constraints).then(onSuccess,onError);};if(!(browserDetails.version>55&&'autoGainControl'in navigator.mediaDevices.getSupportedConstraints())){var remap=function remap(obj,a,b){if(a in obj&&!(b in obj)){obj[b]=obj[a];delete obj[a];}};var nativeGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(c){if((typeof c==='undefined'?'undefined':_typeof(c))==='object'&&_typeof(c.audio)==='object'){c=JSON.parse(JSON.stringify(c));remap(c.audio,'autoGainControl','mozAutoGainControl');remap(c.audio,'noiseSuppression','mozNoiseSuppression');} -return nativeGetUserMedia(c);};if(MediaStreamTrack&&MediaStreamTrack.prototype.getSettings){var nativeGetSettings=MediaStreamTrack.prototype.getSettings;MediaStreamTrack.prototype.getSettings=function(){var obj=nativeGetSettings.apply(this,arguments);remap(obj,'mozAutoGainControl','autoGainControl');remap(obj,'mozNoiseSuppression','noiseSuppression');return obj;};} -if(MediaStreamTrack&&MediaStreamTrack.prototype.applyConstraints){var nativeApplyConstraints=MediaStreamTrack.prototype.applyConstraints;MediaStreamTrack.prototype.applyConstraints=function(c){if(this.kind==='audio'&&(typeof c==='undefined'?'undefined':_typeof(c))==='object'){c=JSON.parse(JSON.stringify(c));remap(c,'autoGainControl','mozAutoGainControl');remap(c,'noiseSuppression','mozNoiseSuppression');} -return nativeApplyConstraints.apply(this,[c]);};}}}},{"../utils":15}],14:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};exports.shimLocalStreamsAPI=shimLocalStreamsAPI;exports.shimRemoteStreamsAPI=shimRemoteStreamsAPI;exports.shimCallbacksAPI=shimCallbacksAPI;exports.shimGetUserMedia=shimGetUserMedia;exports.shimConstraints=shimConstraints;exports.shimRTCIceServerUrls=shimRTCIceServerUrls;exports.shimTrackEventTransceiver=shimTrackEventTransceiver;exports.shimCreateOfferLegacy=shimCreateOfferLegacy;var _utils=require('../utils');var utils=_interopRequireWildcard(_utils);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}} -function shimLocalStreamsAPI(window){if((typeof window==='undefined'?'undefined':_typeof(window))!=='object'||!window.RTCPeerConnection){return;} -if(!('getLocalStreams'in window.RTCPeerConnection.prototype)){window.RTCPeerConnection.prototype.getLocalStreams=function(){if(!this._localStreams){this._localStreams=[];} -return this._localStreams;};} -if(!('addStream'in window.RTCPeerConnection.prototype)){var _addTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addStream=function(stream){var _this=this;if(!this._localStreams){this._localStreams=[];} -if(!this._localStreams.includes(stream)){this._localStreams.push(stream);} -stream.getTracks().forEach(function(track){return _addTrack.call(_this,track,stream);});};window.RTCPeerConnection.prototype.addTrack=function(track,stream){if(stream){if(!this._localStreams){this._localStreams=[stream];}else if(!this._localStreams.includes(stream)){this._localStreams.push(stream);}} -return _addTrack.call(this,track,stream);};} -if(!('removeStream'in window.RTCPeerConnection.prototype)){window.RTCPeerConnection.prototype.removeStream=function(stream){var _this2=this;if(!this._localStreams){this._localStreams=[];} -var index=this._localStreams.indexOf(stream);if(index===-1){return;} -this._localStreams.splice(index,1);var tracks=stream.getTracks();this.getSenders().forEach(function(sender){if(tracks.includes(sender.track)){_this2.removeTrack(sender);}});};}} -function shimRemoteStreamsAPI(window){if((typeof window==='undefined'?'undefined':_typeof(window))!=='object'||!window.RTCPeerConnection){return;} -if(!('getRemoteStreams'in window.RTCPeerConnection.prototype)){window.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[];};} -if(!('onaddstream'in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,'onaddstream',{get:function get(){return this._onaddstream;},set:function set(f){var _this3=this;if(this._onaddstream){this.removeEventListener('addstream',this._onaddstream);this.removeEventListener('track',this._onaddstreampoly);} -this.addEventListener('addstream',this._onaddstream=f);this.addEventListener('track',this._onaddstreampoly=function(e){e.streams.forEach(function(stream){if(!_this3._remoteStreams){_this3._remoteStreams=[];} -if(_this3._remoteStreams.includes(stream)){return;} -_this3._remoteStreams.push(stream);var event=new Event('addstream');event.stream=stream;_this3.dispatchEvent(event);});});}});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var pc=this;if(!this._onaddstreampoly){this.addEventListener('track',this._onaddstreampoly=function(e){e.streams.forEach(function(stream){if(!pc._remoteStreams){pc._remoteStreams=[];} -if(pc._remoteStreams.indexOf(stream)>=0){return;} -pc._remoteStreams.push(stream);var event=new Event('addstream');event.stream=stream;pc.dispatchEvent(event);});});} -return origSetRemoteDescription.apply(pc,arguments);};}} -function shimCallbacksAPI(window){if((typeof window==='undefined'?'undefined':_typeof(window))!=='object'||!window.RTCPeerConnection){return;} -var prototype=window.RTCPeerConnection.prototype;var createOffer=prototype.createOffer;var createAnswer=prototype.createAnswer;var setLocalDescription=prototype.setLocalDescription;var setRemoteDescription=prototype.setRemoteDescription;var addIceCandidate=prototype.addIceCandidate;prototype.createOffer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0];var promise=createOffer.apply(this,[options]);if(!failureCallback){return promise;} -promise.then(successCallback,failureCallback);return Promise.resolve();};prototype.createAnswer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0];var promise=createAnswer.apply(this,[options]);if(!failureCallback){return promise;} -promise.then(successCallback,failureCallback);return Promise.resolve();};var withCallback=function withCallback(description,successCallback,failureCallback){var promise=setLocalDescription.apply(this,[description]);if(!failureCallback){return promise;} -promise.then(successCallback,failureCallback);return Promise.resolve();};prototype.setLocalDescription=withCallback;withCallback=function withCallback(description,successCallback,failureCallback){var promise=setRemoteDescription.apply(this,[description]);if(!failureCallback){return promise;} -promise.then(successCallback,failureCallback);return Promise.resolve();};prototype.setRemoteDescription=withCallback;withCallback=function withCallback(candidate,successCallback,failureCallback){var promise=addIceCandidate.apply(this,[candidate]);if(!failureCallback){return promise;} -promise.then(successCallback,failureCallback);return Promise.resolve();};prototype.addIceCandidate=withCallback;} -function shimGetUserMedia(window){var navigator=window&&window.navigator;if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var mediaDevices=navigator.mediaDevices;var _getUserMedia=mediaDevices.getUserMedia.bind(mediaDevices);navigator.mediaDevices.getUserMedia=function(constraints){return _getUserMedia(shimConstraints(constraints));};} -if(!navigator.getUserMedia&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){navigator.getUserMedia=function(constraints,cb,errcb){navigator.mediaDevices.getUserMedia(constraints).then(cb,errcb);}.bind(navigator);}} -function shimConstraints(constraints){if(constraints&&constraints.video!==undefined){return Object.assign({},constraints,{video:utils.compactObject(constraints.video)});} -return constraints;} -function shimRTCIceServerUrls(window){var OrigPeerConnection=window.RTCPeerConnection;window.RTCPeerConnection=function(pcConfig,pcConstraints){if(pcConfig&&pcConfig.iceServers){var newIceServers=[];for(var i=0;i=pos&&parseInt(match[pos],10);} -function wrapPeerConnectionEvent(window,eventNameToWrap,wrapper){if(!window.RTCPeerConnection){return;} -var proto=window.RTCPeerConnection.prototype;var nativeAddEventListener=proto.addEventListener;proto.addEventListener=function(nativeEventName,cb){if(nativeEventName!==eventNameToWrap){return nativeAddEventListener.apply(this,arguments);} -var wrappedCallback=function wrappedCallback(e){var modifiedEvent=wrapper(e);if(modifiedEvent){cb(modifiedEvent);}};this._eventMap=this._eventMap||{};this._eventMap[cb]=wrappedCallback;return nativeAddEventListener.apply(this,[nativeEventName,wrappedCallback]);};var nativeRemoveEventListener=proto.removeEventListener;proto.removeEventListener=function(nativeEventName,cb){if(nativeEventName!==eventNameToWrap||!this._eventMap||!this._eventMap[cb]){return nativeRemoveEventListener.apply(this,arguments);} -var unwrappedCb=this._eventMap[cb];delete this._eventMap[cb];return nativeRemoveEventListener.apply(this,[nativeEventName,unwrappedCb]);};Object.defineProperty(proto,'on'+eventNameToWrap,{get:function get(){return this['_on'+eventNameToWrap];},set:function set(cb){if(this['_on'+eventNameToWrap]){this.removeEventListener(eventNameToWrap,this['_on'+eventNameToWrap]);delete this['_on'+eventNameToWrap];} -if(cb){this.addEventListener(eventNameToWrap,this['_on'+eventNameToWrap]=cb);}},enumerable:true,configurable:true});} -function disableLog(bool){if(typeof bool!=='boolean'){return new Error('Argument type: '+(typeof bool==='undefined'?'undefined':_typeof(bool))+'. Please use a boolean.');} -logDisabled_=bool;return bool?'adapter.js logging disabled':'adapter.js logging enabled';} -function disableWarnings(bool){if(typeof bool!=='boolean'){return new Error('Argument type: '+(typeof bool==='undefined'?'undefined':_typeof(bool))+'. Please use a boolean.');} -deprecationWarnings_=!bool;return 'adapter.js deprecation warnings '+(bool?'disabled':'enabled');} -function log(){if((typeof window==='undefined'?'undefined':_typeof(window))==='object'){if(logDisabled_){return;} -if(typeof console!=='undefined'&&typeof console.log==='function'){console.log.apply(console,arguments);}}} -function deprecated(oldMethod,newMethod){if(!deprecationWarnings_){return;} -console.warn(oldMethod+' is deprecated, please use '+newMethod+' instead.');} -function detectBrowser(window){var navigator=window.navigator;var result={browser:null,version:null};if(typeof window==='undefined'||!window.navigator){result.browser='Not a browser.';return result;} -if(navigator.mozGetUserMedia){result.browser='firefox';result.version=extractVersion(navigator.userAgent,/Firefox\/(\d+)\./,1);}else if(navigator.webkitGetUserMedia||window.isSecureContext===false&&window.webkitRTCPeerConnection&&!window.RTCIceGatherer){result.browser='chrome';result.version=extractVersion(navigator.userAgent,/Chrom(e|ium)\/(\d+)\./,2);}else if(navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)){result.browser='edge';result.version=extractVersion(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2);}else if(window.RTCPeerConnection&&navigator.userAgent.match(/AppleWebKit\/(\d+)\./)){result.browser='safari';result.version=extractVersion(navigator.userAgent,/AppleWebKit\/(\d+)\./,1);}else{result.browser='Not a supported browser.';return result;} -return result;} -function compactObject(data){if((typeof data==='undefined'?'undefined':_typeof(data))!=='object'){return data;} -return Object.keys(data).reduce(function(accumulator,key){var isObject=_typeof(data[key])==='object';var value=isObject?compactObject(data[key]):data[key];var isEmptyObject=isObject&&!Object.keys(value).length;if(value===undefined||isEmptyObject){return accumulator;} -return Object.assign(accumulator,_defineProperty({},key,value));},{});} -function walkStats(stats,base,resultSet){if(!base||resultSet.has(base.id)){return;} -resultSet.set(base.id,base);Object.keys(base).forEach(function(name){if(name.endsWith('Id')){walkStats(stats,stats.get(base[name]),resultSet);}else if(name.endsWith('Ids')){base[name].forEach(function(id){walkStats(stats,stats.get(id),resultSet);});}});} -function filterStats(result,track,outbound){var streamStatsType=outbound?'outbound-rtp':'inbound-rtp';var filteredResult=new Map();if(track===null){return filteredResult;} -var trackStats=[];result.forEach(function(value){if(value.type==='track'&&value.trackIdentifier===track.id){trackStats.push(value);}});trackStats.forEach(function(trackStat){result.forEach(function(stats){if(stats.type===streamStatsType&&stats.trackId===trackStat.id){walkStats(result,stats,filteredResult);}});});return filteredResult;}},{}],16:[function(require,module,exports){'use strict';var SDPUtils=require('sdp');function fixStatsType(stat){return{inboundrtp:'inbound-rtp',outboundrtp:'outbound-rtp',candidatepair:'candidate-pair',localcandidate:'local-candidate',remotecandidate:'remote-candidate'}[stat.type]||stat.type;} -function writeMediaSection(transceiver,caps,type,stream,dtlsRole){var sdp=SDPUtils.writeRtpDescription(transceiver.kind,caps);sdp+=SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters());sdp+=SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(),type==='offer'?'actpass':dtlsRole||'active');sdp+='a=mid:'+transceiver.mid+'\r\n';if(transceiver.rtpSender&&transceiver.rtpReceiver){sdp+='a=sendrecv\r\n';}else if(transceiver.rtpSender){sdp+='a=sendonly\r\n';}else if(transceiver.rtpReceiver){sdp+='a=recvonly\r\n';}else{sdp+='a=inactive\r\n';} -if(transceiver.rtpSender){var trackId=transceiver.rtpSender._initialTrackId||transceiver.rtpSender.track.id;transceiver.rtpSender._initialTrackId=trackId;var msid='msid:'+(stream?stream.id:'-')+' '+ -trackId+'\r\n';sdp+='a='+msid;sdp+='a=ssrc:'+transceiver.sendEncodingParameters[0].ssrc+ -' '+msid;if(transceiver.sendEncodingParameters[0].rtx){sdp+='a=ssrc:'+transceiver.sendEncodingParameters[0].rtx.ssrc+ -' '+msid;sdp+='a=ssrc-group:FID '+ -transceiver.sendEncodingParameters[0].ssrc+' '+ -transceiver.sendEncodingParameters[0].rtx.ssrc+ -'\r\n';}} -sdp+='a=ssrc:'+transceiver.sendEncodingParameters[0].ssrc+ -' cname:'+SDPUtils.localCName+'\r\n';if(transceiver.rtpSender&&transceiver.sendEncodingParameters[0].rtx){sdp+='a=ssrc:'+transceiver.sendEncodingParameters[0].rtx.ssrc+ -' cname:'+SDPUtils.localCName+'\r\n';} -return sdp;} -function filterIceServers(iceServers,edgeVersion){var hasTurn=false;iceServers=JSON.parse(JSON.stringify(iceServers));return iceServers.filter(function(server){if(server&&(server.urls||server.url)){var urls=server.urls||server.url;if(server.url&&!server.urls){console.warn('RTCIceServer.url is deprecated! Use urls instead.');} -var isString=typeof urls==='string';if(isString){urls=[urls];} -urls=urls.filter(function(url){var validTurn=url.indexOf('turn:')===0&&url.indexOf('transport=udp')!==-1&&url.indexOf('turn:[')===-1&&!hasTurn;if(validTurn){hasTurn=true;return true;} -return url.indexOf('stun:')===0&&edgeVersion>=14393&&url.indexOf('?transport=udp')===-1;});delete server.url;server.urls=isString?urls[0]:urls;return!!urls.length;}});} -function getCommonCapabilities(localCapabilities,remoteCapabilities){var commonCapabilities={codecs:[],headerExtensions:[],fecMechanisms:[]};var findCodecByPayloadType=function(pt,codecs){pt=parseInt(pt,10);for(var i=0;i0;i--){this._iceGatherers.push(new window.RTCIceGatherer({iceServers:config.iceServers,gatherPolicy:config.iceTransportPolicy}));}}else{config.iceCandidatePoolSize=0;} -this._config=config;this.transceivers=[];this._sdpSessionId=SDPUtils.generateSessionId();this._sdpSessionVersion=0;this._dtlsRole=undefined;this._isClosed=false;};Object.defineProperty(RTCPeerConnection.prototype,'localDescription',{configurable:true,get:function(){return this._localDescription;}});Object.defineProperty(RTCPeerConnection.prototype,'remoteDescription',{configurable:true,get:function(){return this._remoteDescription;}});RTCPeerConnection.prototype.onicecandidate=null;RTCPeerConnection.prototype.onaddstream=null;RTCPeerConnection.prototype.ontrack=null;RTCPeerConnection.prototype.onremovestream=null;RTCPeerConnection.prototype.onsignalingstatechange=null;RTCPeerConnection.prototype.oniceconnectionstatechange=null;RTCPeerConnection.prototype.onconnectionstatechange=null;RTCPeerConnection.prototype.onicegatheringstatechange=null;RTCPeerConnection.prototype.onnegotiationneeded=null;RTCPeerConnection.prototype.ondatachannel=null;RTCPeerConnection.prototype._dispatchEvent=function(name,event){if(this._isClosed){return;} -this.dispatchEvent(event);if(typeof this['on'+name]==='function'){this['on'+name](event);}};RTCPeerConnection.prototype._emitGatheringStateChange=function(){var event=new Event('icegatheringstatechange');this._dispatchEvent('icegatheringstatechange',event);};RTCPeerConnection.prototype.getConfiguration=function(){return this._config;};RTCPeerConnection.prototype.getLocalStreams=function(){return this.localStreams;};RTCPeerConnection.prototype.getRemoteStreams=function(){return this.remoteStreams;};RTCPeerConnection.prototype._createTransceiver=function(kind,doNotAdd){var hasBundleTransport=this.transceivers.length>0;var transceiver={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:kind,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:true};if(this.usingBundle&&hasBundleTransport){transceiver.iceTransport=this.transceivers[0].iceTransport;transceiver.dtlsTransport=this.transceivers[0].dtlsTransport;}else{var transports=this._createIceAndDtlsTransports();transceiver.iceTransport=transports.iceTransport;transceiver.dtlsTransport=transports.dtlsTransport;} -if(!doNotAdd){this.transceivers.push(transceiver);} -return transceiver;};RTCPeerConnection.prototype.addTrack=function(track,stream){if(this._isClosed){throw makeError('InvalidStateError','Attempted to call addTrack on a closed peerconnection.');} -var alreadyExists=this.transceivers.find(function(s){return s.track===track;});if(alreadyExists){throw makeError('InvalidAccessError','Track already exists.');} -var transceiver;for(var i=0;i=15025){stream.getTracks().forEach(function(track){pc.addTrack(track,stream);});}else{var clonedStream=stream.clone();stream.getTracks().forEach(function(track,idx){var clonedTrack=clonedStream.getTracks()[idx];track.addEventListener('enabled',function(event){clonedTrack.enabled=event.enabled;});});clonedStream.getTracks().forEach(function(track){pc.addTrack(track,clonedStream);});}};RTCPeerConnection.prototype.removeTrack=function(sender){if(this._isClosed){throw makeError('InvalidStateError','Attempted to call removeTrack on a closed peerconnection.');} -if(!(sender instanceof window.RTCRtpSender)){throw new TypeError('Argument 1 of RTCPeerConnection.removeTrack '+ -'does not implement interface RTCRtpSender.');} -var transceiver=this.transceivers.find(function(t){return t.rtpSender===sender;});if(!transceiver){throw makeError('InvalidAccessError','Sender was not created by this connection.');} -var stream=transceiver.stream;transceiver.rtpSender.stop();transceiver.rtpSender=null;transceiver.track=null;transceiver.stream=null;var localStreams=this.transceivers.map(function(t){return t.stream;});if(localStreams.indexOf(stream)===-1&&this.localStreams.indexOf(stream)>-1){this.localStreams.splice(this.localStreams.indexOf(stream),1);} -this._maybeFireNegotiationNeeded();};RTCPeerConnection.prototype.removeStream=function(stream){var pc=this;stream.getTracks().forEach(function(track){var sender=pc.getSenders().find(function(s){return s.track===track;});if(sender){pc.removeTrack(sender);}});};RTCPeerConnection.prototype.getSenders=function(){return this.transceivers.filter(function(transceiver){return!!transceiver.rtpSender;}).map(function(transceiver){return transceiver.rtpSender;});};RTCPeerConnection.prototype.getReceivers=function(){return this.transceivers.filter(function(transceiver){return!!transceiver.rtpReceiver;}).map(function(transceiver){return transceiver.rtpReceiver;});};RTCPeerConnection.prototype._createIceGatherer=function(sdpMLineIndex,usingBundle){var pc=this;if(usingBundle&&sdpMLineIndex>0){return this.transceivers[0].iceGatherer;}else if(this._iceGatherers.length){return this._iceGatherers.shift();} -var iceGatherer=new window.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});Object.defineProperty(iceGatherer,'state',{value:'new',writable:true});this.transceivers[sdpMLineIndex].bufferedCandidateEvents=[];this.transceivers[sdpMLineIndex].bufferCandidates=function(event){var end=!event.candidate||Object.keys(event.candidate).length===0;iceGatherer.state=end?'completed':'gathering';if(pc.transceivers[sdpMLineIndex].bufferedCandidateEvents!==null){pc.transceivers[sdpMLineIndex].bufferedCandidateEvents.push(event);}};iceGatherer.addEventListener('localcandidate',this.transceivers[sdpMLineIndex].bufferCandidates);return iceGatherer;};RTCPeerConnection.prototype._gather=function(mid,sdpMLineIndex){var pc=this;var iceGatherer=this.transceivers[sdpMLineIndex].iceGatherer;if(iceGatherer.onlocalcandidate){return;} -var bufferedCandidateEvents=this.transceivers[sdpMLineIndex].bufferedCandidateEvents;this.transceivers[sdpMLineIndex].bufferedCandidateEvents=null;iceGatherer.removeEventListener('localcandidate',this.transceivers[sdpMLineIndex].bufferCandidates);iceGatherer.onlocalcandidate=function(evt){if(pc.usingBundle&&sdpMLineIndex>0){return;} -var event=new Event('icecandidate');event.candidate={sdpMid:mid,sdpMLineIndex:sdpMLineIndex};var cand=evt.candidate;var end=!cand||Object.keys(cand).length===0;if(end){if(iceGatherer.state==='new'||iceGatherer.state==='gathering'){iceGatherer.state='completed';}}else{if(iceGatherer.state==='new'){iceGatherer.state='gathering';} -cand.component=1;cand.ufrag=iceGatherer.getLocalParameters().usernameFragment;var serializedCandidate=SDPUtils.writeCandidate(cand);event.candidate=Object.assign(event.candidate,SDPUtils.parseCandidate(serializedCandidate));event.candidate.candidate=serializedCandidate;event.candidate.toJSON=function(){return{candidate:event.candidate.candidate,sdpMid:event.candidate.sdpMid,sdpMLineIndex:event.candidate.sdpMLineIndex,usernameFragment:event.candidate.usernameFragment};};} -var sections=SDPUtils.getMediaSections(pc._localDescription.sdp);if(!end){sections[event.candidate.sdpMLineIndex]+='a='+event.candidate.candidate+'\r\n';}else{sections[event.candidate.sdpMLineIndex]+='a=end-of-candidates\r\n';} -pc._localDescription.sdp=SDPUtils.getDescription(pc._localDescription.sdp)+ -sections.join('');var complete=pc.transceivers.every(function(transceiver){return transceiver.iceGatherer&&transceiver.iceGatherer.state==='completed';});if(pc.iceGatheringState!=='gathering'){pc.iceGatheringState='gathering';pc._emitGatheringStateChange();} -if(!end){pc._dispatchEvent('icecandidate',event);} -if(complete){pc._dispatchEvent('icecandidate',new Event('icecandidate'));pc.iceGatheringState='complete';pc._emitGatheringStateChange();}};window.setTimeout(function(){bufferedCandidateEvents.forEach(function(e){iceGatherer.onlocalcandidate(e);});},0);};RTCPeerConnection.prototype._createIceAndDtlsTransports=function(){var pc=this;var iceTransport=new window.RTCIceTransport(null);iceTransport.onicestatechange=function(){pc._updateIceConnectionState();pc._updateConnectionState();};var dtlsTransport=new window.RTCDtlsTransport(iceTransport);dtlsTransport.ondtlsstatechange=function(){pc._updateConnectionState();};dtlsTransport.onerror=function(){Object.defineProperty(dtlsTransport,'state',{value:'failed',writable:true});pc._updateConnectionState();};return{iceTransport:iceTransport,dtlsTransport:dtlsTransport};};RTCPeerConnection.prototype._disposeIceAndDtlsTransports=function(sdpMLineIndex){var iceGatherer=this.transceivers[sdpMLineIndex].iceGatherer;if(iceGatherer){delete iceGatherer.onlocalcandidate;delete this.transceivers[sdpMLineIndex].iceGatherer;} -var iceTransport=this.transceivers[sdpMLineIndex].iceTransport;if(iceTransport){delete iceTransport.onicestatechange;delete this.transceivers[sdpMLineIndex].iceTransport;} -var dtlsTransport=this.transceivers[sdpMLineIndex].dtlsTransport;if(dtlsTransport){delete dtlsTransport.ondtlsstatechange;delete dtlsTransport.onerror;delete this.transceivers[sdpMLineIndex].dtlsTransport;}};RTCPeerConnection.prototype._transceive=function(transceiver,send,recv){var params=getCommonCapabilities(transceiver.localCapabilities,transceiver.remoteCapabilities);if(send&&transceiver.rtpSender){params.encodings=transceiver.sendEncodingParameters;params.rtcp={cname:SDPUtils.localCName,compound:transceiver.rtcpParameters.compound};if(transceiver.recvEncodingParameters.length){params.rtcp.ssrc=transceiver.recvEncodingParameters[0].ssrc;} -transceiver.rtpSender.send(params);} -if(recv&&transceiver.rtpReceiver&¶ms.codecs.length>0){if(transceiver.kind==='video'&&transceiver.recvEncodingParameters&&edgeVersion<15019){transceiver.recvEncodingParameters.forEach(function(p){delete p.rtx;});} -if(transceiver.recvEncodingParameters.length){params.encodings=transceiver.recvEncodingParameters;}else{params.encodings=[{}];} -params.rtcp={compound:transceiver.rtcpParameters.compound};if(transceiver.rtcpParameters.cname){params.rtcp.cname=transceiver.rtcpParameters.cname;} -if(transceiver.sendEncodingParameters.length){params.rtcp.ssrc=transceiver.sendEncodingParameters[0].ssrc;} -transceiver.rtpReceiver.receive(params);}};RTCPeerConnection.prototype.setLocalDescription=function(description){var pc=this;if(['offer','answer'].indexOf(description.type)===-1){return Promise.reject(makeError('TypeError','Unsupported type "'+description.type+'"'));} -if(!isActionAllowedInSignalingState('setLocalDescription',description.type,pc.signalingState)||pc._isClosed){return Promise.reject(makeError('InvalidStateError','Can not set local '+description.type+ -' in state '+pc.signalingState));} -var sections;var sessionpart;if(description.type==='offer'){sections=SDPUtils.splitSections(description.sdp);sessionpart=sections.shift();sections.forEach(function(mediaSection,sdpMLineIndex){var caps=SDPUtils.parseRtpParameters(mediaSection);pc.transceivers[sdpMLineIndex].localCapabilities=caps;});pc.transceivers.forEach(function(transceiver,sdpMLineIndex){pc._gather(transceiver.mid,sdpMLineIndex);});}else if(description.type==='answer'){sections=SDPUtils.splitSections(pc._remoteDescription.sdp);sessionpart=sections.shift();var isIceLite=SDPUtils.matchPrefix(sessionpart,'a=ice-lite').length>0;sections.forEach(function(mediaSection,sdpMLineIndex){var transceiver=pc.transceivers[sdpMLineIndex];var iceGatherer=transceiver.iceGatherer;var iceTransport=transceiver.iceTransport;var dtlsTransport=transceiver.dtlsTransport;var localCapabilities=transceiver.localCapabilities;var remoteCapabilities=transceiver.remoteCapabilities;var rejected=SDPUtils.isRejected(mediaSection)&&SDPUtils.matchPrefix(mediaSection,'a=bundle-only').length===0;if(!rejected&&!transceiver.rejected){var remoteIceParameters=SDPUtils.getIceParameters(mediaSection,sessionpart);var remoteDtlsParameters=SDPUtils.getDtlsParameters(mediaSection,sessionpart);if(isIceLite){remoteDtlsParameters.role='server';} -if(!pc.usingBundle||sdpMLineIndex===0){pc._gather(transceiver.mid,sdpMLineIndex);if(iceTransport.state==='new'){iceTransport.start(iceGatherer,remoteIceParameters,isIceLite?'controlling':'controlled');} -if(dtlsTransport.state==='new'){dtlsTransport.start(remoteDtlsParameters);}} -var params=getCommonCapabilities(localCapabilities,remoteCapabilities);pc._transceive(transceiver,params.codecs.length>0,false);}});} -pc._localDescription={type:description.type,sdp:description.sdp};if(description.type==='offer'){pc._updateSignalingState('have-local-offer');}else{pc._updateSignalingState('stable');} -return Promise.resolve();};RTCPeerConnection.prototype.setRemoteDescription=function(description){var pc=this;if(['offer','answer'].indexOf(description.type)===-1){return Promise.reject(makeError('TypeError','Unsupported type "'+description.type+'"'));} -if(!isActionAllowedInSignalingState('setRemoteDescription',description.type,pc.signalingState)||pc._isClosed){return Promise.reject(makeError('InvalidStateError','Can not set remote '+description.type+ -' in state '+pc.signalingState));} -var streams={};pc.remoteStreams.forEach(function(stream){streams[stream.id]=stream;});var receiverList=[];var sections=SDPUtils.splitSections(description.sdp);var sessionpart=sections.shift();var isIceLite=SDPUtils.matchPrefix(sessionpart,'a=ice-lite').length>0;var usingBundle=SDPUtils.matchPrefix(sessionpart,'a=group:BUNDLE ').length>0;pc.usingBundle=usingBundle;var iceOptions=SDPUtils.matchPrefix(sessionpart,'a=ice-options:')[0];if(iceOptions){pc.canTrickleIceCandidates=iceOptions.substr(14).split(' ').indexOf('trickle')>=0;}else{pc.canTrickleIceCandidates=false;} -sections.forEach(function(mediaSection,sdpMLineIndex){var lines=SDPUtils.splitLines(mediaSection);var kind=SDPUtils.getKind(mediaSection);var rejected=SDPUtils.isRejected(mediaSection)&&SDPUtils.matchPrefix(mediaSection,'a=bundle-only').length===0;var protocol=lines[0].substr(2).split(' ')[2];var direction=SDPUtils.getDirection(mediaSection,sessionpart);var remoteMsid=SDPUtils.parseMsid(mediaSection);var mid=SDPUtils.getMid(mediaSection)||SDPUtils.generateIdentifier();if(rejected||(kind==='application'&&(protocol==='DTLS/SCTP'||protocol==='UDP/DTLS/SCTP'))){pc.transceivers[sdpMLineIndex]={mid:mid,kind:kind,protocol:protocol,rejected:true};return;} -if(!rejected&&pc.transceivers[sdpMLineIndex]&&pc.transceivers[sdpMLineIndex].rejected){pc.transceivers[sdpMLineIndex]=pc._createTransceiver(kind,true);} -var transceiver;var iceGatherer;var iceTransport;var dtlsTransport;var rtpReceiver;var sendEncodingParameters;var recvEncodingParameters;var localCapabilities;var track;var remoteCapabilities=SDPUtils.parseRtpParameters(mediaSection);var remoteIceParameters;var remoteDtlsParameters;if(!rejected){remoteIceParameters=SDPUtils.getIceParameters(mediaSection,sessionpart);remoteDtlsParameters=SDPUtils.getDtlsParameters(mediaSection,sessionpart);remoteDtlsParameters.role='client';} -recvEncodingParameters=SDPUtils.parseRtpEncodingParameters(mediaSection);var rtcpParameters=SDPUtils.parseRtcpParameters(mediaSection);var isComplete=SDPUtils.matchPrefix(mediaSection,'a=end-of-candidates',sessionpart).length>0;var cands=SDPUtils.matchPrefix(mediaSection,'a=candidate:').map(function(cand){return SDPUtils.parseCandidate(cand);}).filter(function(cand){return cand.component===1;});if((description.type==='offer'||description.type==='answer')&&!rejected&&usingBundle&&sdpMLineIndex>0&&pc.transceivers[sdpMLineIndex]){pc._disposeIceAndDtlsTransports(sdpMLineIndex);pc.transceivers[sdpMLineIndex].iceGatherer=pc.transceivers[0].iceGatherer;pc.transceivers[sdpMLineIndex].iceTransport=pc.transceivers[0].iceTransport;pc.transceivers[sdpMLineIndex].dtlsTransport=pc.transceivers[0].dtlsTransport;if(pc.transceivers[sdpMLineIndex].rtpSender){pc.transceivers[sdpMLineIndex].rtpSender.setTransport(pc.transceivers[0].dtlsTransport);} -if(pc.transceivers[sdpMLineIndex].rtpReceiver){pc.transceivers[sdpMLineIndex].rtpReceiver.setTransport(pc.transceivers[0].dtlsTransport);}} -if(description.type==='offer'&&!rejected){transceiver=pc.transceivers[sdpMLineIndex]||pc._createTransceiver(kind);transceiver.mid=mid;if(!transceiver.iceGatherer){transceiver.iceGatherer=pc._createIceGatherer(sdpMLineIndex,usingBundle);} -if(cands.length&&transceiver.iceTransport.state==='new'){if(isComplete&&(!usingBundle||sdpMLineIndex===0)){transceiver.iceTransport.setRemoteCandidates(cands);}else{cands.forEach(function(candidate){maybeAddCandidate(transceiver.iceTransport,candidate);});}} -localCapabilities=window.RTCRtpReceiver.getCapabilities(kind);if(edgeVersion<15019){localCapabilities.codecs=localCapabilities.codecs.filter(function(codec){return codec.name!=='rtx';});} -sendEncodingParameters=transceiver.sendEncodingParameters||[{ssrc:(2*sdpMLineIndex+2)*1001}];var isNewTrack=false;if(direction==='sendrecv'||direction==='sendonly'){isNewTrack=!transceiver.rtpReceiver;rtpReceiver=transceiver.rtpReceiver||new window.RTCRtpReceiver(transceiver.dtlsTransport,kind);if(isNewTrack){var stream;track=rtpReceiver.track;if(remoteMsid&&remoteMsid.stream==='-'){}else if(remoteMsid){if(!streams[remoteMsid.stream]){streams[remoteMsid.stream]=new window.MediaStream();Object.defineProperty(streams[remoteMsid.stream],'id',{get:function(){return remoteMsid.stream;}});} -Object.defineProperty(track,'id',{get:function(){return remoteMsid.track;}});stream=streams[remoteMsid.stream];}else{if(!streams.default){streams.default=new window.MediaStream();} -stream=streams.default;} -if(stream){addTrackToStreamAndFireEvent(track,stream);transceiver.associatedRemoteMediaStreams.push(stream);} -receiverList.push([track,rtpReceiver,stream]);}}else if(transceiver.rtpReceiver&&transceiver.rtpReceiver.track){transceiver.associatedRemoteMediaStreams.forEach(function(s){var nativeTrack=s.getTracks().find(function(t){return t.id===transceiver.rtpReceiver.track.id;});if(nativeTrack){removeTrackFromStreamAndFireEvent(nativeTrack,s);}});transceiver.associatedRemoteMediaStreams=[];} -transceiver.localCapabilities=localCapabilities;transceiver.remoteCapabilities=remoteCapabilities;transceiver.rtpReceiver=rtpReceiver;transceiver.rtcpParameters=rtcpParameters;transceiver.sendEncodingParameters=sendEncodingParameters;transceiver.recvEncodingParameters=recvEncodingParameters;pc._transceive(pc.transceivers[sdpMLineIndex],false,isNewTrack);}else if(description.type==='answer'&&!rejected){transceiver=pc.transceivers[sdpMLineIndex];iceGatherer=transceiver.iceGatherer;iceTransport=transceiver.iceTransport;dtlsTransport=transceiver.dtlsTransport;rtpReceiver=transceiver.rtpReceiver;sendEncodingParameters=transceiver.sendEncodingParameters;localCapabilities=transceiver.localCapabilities;pc.transceivers[sdpMLineIndex].recvEncodingParameters=recvEncodingParameters;pc.transceivers[sdpMLineIndex].remoteCapabilities=remoteCapabilities;pc.transceivers[sdpMLineIndex].rtcpParameters=rtcpParameters;if(cands.length&&iceTransport.state==='new'){if((isIceLite||isComplete)&&(!usingBundle||sdpMLineIndex===0)){iceTransport.setRemoteCandidates(cands);}else{cands.forEach(function(candidate){maybeAddCandidate(transceiver.iceTransport,candidate);});}} -if(!usingBundle||sdpMLineIndex===0){if(iceTransport.state==='new'){iceTransport.start(iceGatherer,remoteIceParameters,'controlling');} -if(dtlsTransport.state==='new'){dtlsTransport.start(remoteDtlsParameters);}} -var commonCapabilities=getCommonCapabilities(transceiver.localCapabilities,transceiver.remoteCapabilities);var hasRtx=commonCapabilities.codecs.filter(function(c){return c.name.toLowerCase()==='rtx';}).length;if(!hasRtx&&transceiver.sendEncodingParameters[0].rtx){delete transceiver.sendEncodingParameters[0].rtx;} -pc._transceive(transceiver,direction==='sendrecv'||direction==='recvonly',direction==='sendrecv'||direction==='sendonly');if(rtpReceiver&&(direction==='sendrecv'||direction==='sendonly')){track=rtpReceiver.track;if(remoteMsid){if(!streams[remoteMsid.stream]){streams[remoteMsid.stream]=new window.MediaStream();} -addTrackToStreamAndFireEvent(track,streams[remoteMsid.stream]);receiverList.push([track,rtpReceiver,streams[remoteMsid.stream]]);}else{if(!streams.default){streams.default=new window.MediaStream();} -addTrackToStreamAndFireEvent(track,streams.default);receiverList.push([track,rtpReceiver,streams.default]);}}else{delete transceiver.rtpReceiver;}}});if(pc._dtlsRole===undefined){pc._dtlsRole=description.type==='offer'?'active':'passive';} -pc._remoteDescription={type:description.type,sdp:description.sdp};if(description.type==='offer'){pc._updateSignalingState('have-remote-offer');}else{pc._updateSignalingState('stable');} -Object.keys(streams).forEach(function(sid){var stream=streams[sid];if(stream.getTracks().length){if(pc.remoteStreams.indexOf(stream)===-1){pc.remoteStreams.push(stream);var event=new Event('addstream');event.stream=stream;window.setTimeout(function(){pc._dispatchEvent('addstream',event);});} -receiverList.forEach(function(item){var track=item[0];var receiver=item[1];if(stream.id!==item[2].id){return;} -fireAddTrack(pc,track,receiver,[stream]);});}});receiverList.forEach(function(item){if(item[2]){return;} -fireAddTrack(pc,item[0],item[1],[]);});window.setTimeout(function(){if(!(pc&&pc.transceivers)){return;} -pc.transceivers.forEach(function(transceiver){if(transceiver.iceTransport&&transceiver.iceTransport.state==='new'&&transceiver.iceTransport.getRemoteCandidates().length>0){console.warn('Timeout for addRemoteCandidate. Consider sending '+ -'an end-of-candidates notification');transceiver.iceTransport.addRemoteCandidate({});}});},4000);return Promise.resolve();};RTCPeerConnection.prototype.close=function(){this.transceivers.forEach(function(transceiver){if(transceiver.iceTransport){transceiver.iceTransport.stop();} -if(transceiver.dtlsTransport){transceiver.dtlsTransport.stop();} -if(transceiver.rtpSender){transceiver.rtpSender.stop();} -if(transceiver.rtpReceiver){transceiver.rtpReceiver.stop();}});this._isClosed=true;this._updateSignalingState('closed');};RTCPeerConnection.prototype._updateSignalingState=function(newState){this.signalingState=newState;var event=new Event('signalingstatechange');this._dispatchEvent('signalingstatechange',event);};RTCPeerConnection.prototype._maybeFireNegotiationNeeded=function(){var pc=this;if(this.signalingState!=='stable'||this.needNegotiation===true){return;} -this.needNegotiation=true;window.setTimeout(function(){if(pc.needNegotiation){pc.needNegotiation=false;var event=new Event('negotiationneeded');pc._dispatchEvent('negotiationneeded',event);}},0);};RTCPeerConnection.prototype._updateIceConnectionState=function(){var newState;var states={'new':0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};this.transceivers.forEach(function(transceiver){if(transceiver.iceTransport&&!transceiver.rejected){states[transceiver.iceTransport.state]++;}});newState='new';if(states.failed>0){newState='failed';}else if(states.checking>0){newState='checking';}else if(states.disconnected>0){newState='disconnected';}else if(states.new>0){newState='new';}else if(states.connected>0){newState='connected';}else if(states.completed>0){newState='completed';} -if(newState!==this.iceConnectionState){this.iceConnectionState=newState;var event=new Event('iceconnectionstatechange');this._dispatchEvent('iceconnectionstatechange',event);}};RTCPeerConnection.prototype._updateConnectionState=function(){var newState;var states={'new':0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};this.transceivers.forEach(function(transceiver){if(transceiver.iceTransport&&transceiver.dtlsTransport&&!transceiver.rejected){states[transceiver.iceTransport.state]++;states[transceiver.dtlsTransport.state]++;}});states.connected+=states.completed;newState='new';if(states.failed>0){newState='failed';}else if(states.connecting>0){newState='connecting';}else if(states.disconnected>0){newState='disconnected';}else if(states.new>0){newState='new';}else if(states.connected>0){newState='connected';} -if(newState!==this.connectionState){this.connectionState=newState;var event=new Event('connectionstatechange');this._dispatchEvent('connectionstatechange',event);}};RTCPeerConnection.prototype.createOffer=function(){var pc=this;if(pc._isClosed){return Promise.reject(makeError('InvalidStateError','Can not call createOffer after close'));} -var numAudioTracks=pc.transceivers.filter(function(t){return t.kind==='audio';}).length;var numVideoTracks=pc.transceivers.filter(function(t){return t.kind==='video';}).length;var offerOptions=arguments[0];if(offerOptions){if(offerOptions.mandatory||offerOptions.optional){throw new TypeError('Legacy mandatory/optional constraints not supported.');} -if(offerOptions.offerToReceiveAudio!==undefined){if(offerOptions.offerToReceiveAudio===true){numAudioTracks=1;}else if(offerOptions.offerToReceiveAudio===false){numAudioTracks=0;}else{numAudioTracks=offerOptions.offerToReceiveAudio;}} -if(offerOptions.offerToReceiveVideo!==undefined){if(offerOptions.offerToReceiveVideo===true){numVideoTracks=1;}else if(offerOptions.offerToReceiveVideo===false){numVideoTracks=0;}else{numVideoTracks=offerOptions.offerToReceiveVideo;}}} -pc.transceivers.forEach(function(transceiver){if(transceiver.kind==='audio'){numAudioTracks--;if(numAudioTracks<0){transceiver.wantReceive=false;}}else if(transceiver.kind==='video'){numVideoTracks--;if(numVideoTracks<0){transceiver.wantReceive=false;}}});while(numAudioTracks>0||numVideoTracks>0){if(numAudioTracks>0){pc._createTransceiver('audio');numAudioTracks--;} -if(numVideoTracks>0){pc._createTransceiver('video');numVideoTracks--;}} -var sdp=SDPUtils.writeSessionBoilerplate(pc._sdpSessionId,pc._sdpSessionVersion++);pc.transceivers.forEach(function(transceiver,sdpMLineIndex){var track=transceiver.track;var kind=transceiver.kind;var mid=transceiver.mid||SDPUtils.generateIdentifier();transceiver.mid=mid;if(!transceiver.iceGatherer){transceiver.iceGatherer=pc._createIceGatherer(sdpMLineIndex,pc.usingBundle);} -var localCapabilities=window.RTCRtpSender.getCapabilities(kind);if(edgeVersion<15019){localCapabilities.codecs=localCapabilities.codecs.filter(function(codec){return codec.name!=='rtx';});} -localCapabilities.codecs.forEach(function(codec){if(codec.name==='H264'&&codec.parameters['level-asymmetry-allowed']===undefined){codec.parameters['level-asymmetry-allowed']='1';} -if(transceiver.remoteCapabilities&&transceiver.remoteCapabilities.codecs){transceiver.remoteCapabilities.codecs.forEach(function(remoteCodec){if(codec.name.toLowerCase()===remoteCodec.name.toLowerCase()&&codec.clockRate===remoteCodec.clockRate){codec.preferredPayloadType=remoteCodec.payloadType;}});}});localCapabilities.headerExtensions.forEach(function(hdrExt){var remoteExtensions=transceiver.remoteCapabilities&&transceiver.remoteCapabilities.headerExtensions||[];remoteExtensions.forEach(function(rHdrExt){if(hdrExt.uri===rHdrExt.uri){hdrExt.id=rHdrExt.id;}});});var sendEncodingParameters=transceiver.sendEncodingParameters||[{ssrc:(2*sdpMLineIndex+1)*1001}];if(track){if(edgeVersion>=15019&&kind==='video'&&!sendEncodingParameters[0].rtx){sendEncodingParameters[0].rtx={ssrc:sendEncodingParameters[0].ssrc+1};}} -if(transceiver.wantReceive){transceiver.rtpReceiver=new window.RTCRtpReceiver(transceiver.dtlsTransport,kind);} -transceiver.localCapabilities=localCapabilities;transceiver.sendEncodingParameters=sendEncodingParameters;});if(pc._config.bundlePolicy!=='max-compat'){sdp+='a=group:BUNDLE '+pc.transceivers.map(function(t){return t.mid;}).join(' ')+'\r\n';} -sdp+='a=ice-options:trickle\r\n';pc.transceivers.forEach(function(transceiver,sdpMLineIndex){sdp+=writeMediaSection(transceiver,transceiver.localCapabilities,'offer',transceiver.stream,pc._dtlsRole);sdp+='a=rtcp-rsize\r\n';if(transceiver.iceGatherer&&pc.iceGatheringState!=='new'&&(sdpMLineIndex===0||!pc.usingBundle)){transceiver.iceGatherer.getLocalCandidates().forEach(function(cand){cand.component=1;sdp+='a='+SDPUtils.writeCandidate(cand)+'\r\n';});if(transceiver.iceGatherer.state==='completed'){sdp+='a=end-of-candidates\r\n';}}});var desc=new window.RTCSessionDescription({type:'offer',sdp:sdp});return Promise.resolve(desc);};RTCPeerConnection.prototype.createAnswer=function(){var pc=this;if(pc._isClosed){return Promise.reject(makeError('InvalidStateError','Can not call createAnswer after close'));} -if(!(pc.signalingState==='have-remote-offer'||pc.signalingState==='have-local-pranswer')){return Promise.reject(makeError('InvalidStateError','Can not call createAnswer in signalingState '+pc.signalingState));} -var sdp=SDPUtils.writeSessionBoilerplate(pc._sdpSessionId,pc._sdpSessionVersion++);if(pc.usingBundle){sdp+='a=group:BUNDLE '+pc.transceivers.map(function(t){return t.mid;}).join(' ')+'\r\n';} -sdp+='a=ice-options:trickle\r\n';var mediaSectionsInOffer=SDPUtils.getMediaSections(pc._remoteDescription.sdp).length;pc.transceivers.forEach(function(transceiver,sdpMLineIndex){if(sdpMLineIndex+1>mediaSectionsInOffer){return;} -if(transceiver.rejected){if(transceiver.kind==='application'){if(transceiver.protocol==='DTLS/SCTP'){sdp+='m=application 0 DTLS/SCTP 5000\r\n';}else{sdp+='m=application 0 '+transceiver.protocol+ -' webrtc-datachannel\r\n';}}else if(transceiver.kind==='audio'){sdp+='m=audio 0 UDP/TLS/RTP/SAVPF 0\r\n'+ -'a=rtpmap:0 PCMU/8000\r\n';}else if(transceiver.kind==='video'){sdp+='m=video 0 UDP/TLS/RTP/SAVPF 120\r\n'+ -'a=rtpmap:120 VP8/90000\r\n';} -sdp+='c=IN IP4 0.0.0.0\r\n'+ -'a=inactive\r\n'+ -'a=mid:'+transceiver.mid+'\r\n';return;} -if(transceiver.stream){var localTrack;if(transceiver.kind==='audio'){localTrack=transceiver.stream.getAudioTracks()[0];}else if(transceiver.kind==='video'){localTrack=transceiver.stream.getVideoTracks()[0];} -if(localTrack){if(edgeVersion>=15019&&transceiver.kind==='video'&&!transceiver.sendEncodingParameters[0].rtx){transceiver.sendEncodingParameters[0].rtx={ssrc:transceiver.sendEncodingParameters[0].ssrc+1};}}} -var commonCapabilities=getCommonCapabilities(transceiver.localCapabilities,transceiver.remoteCapabilities);var hasRtx=commonCapabilities.codecs.filter(function(c){return c.name.toLowerCase()==='rtx';}).length;if(!hasRtx&&transceiver.sendEncodingParameters[0].rtx){delete transceiver.sendEncodingParameters[0].rtx;} -sdp+=writeMediaSection(transceiver,commonCapabilities,'answer',transceiver.stream,pc._dtlsRole);if(transceiver.rtcpParameters&&transceiver.rtcpParameters.reducedSize){sdp+='a=rtcp-rsize\r\n';}});var desc=new window.RTCSessionDescription({type:'answer',sdp:sdp});return Promise.resolve(desc);};RTCPeerConnection.prototype.addIceCandidate=function(candidate){var pc=this;var sections;if(candidate&&!(candidate.sdpMLineIndex!==undefined||candidate.sdpMid)){return Promise.reject(new TypeError('sdpMLineIndex or sdpMid required'));} -return new Promise(function(resolve,reject){if(!pc._remoteDescription){return reject(makeError('InvalidStateError','Can not add ICE candidate without a remote description'));}else if(!candidate||candidate.candidate===''){for(var j=0;j0?SDPUtils.parseCandidate(candidate.candidate):{};if(cand.protocol==='tcp'&&(cand.port===0||cand.port===9)){return resolve();} -if(cand.component&&cand.component!==1){return resolve();} -if(sdpMLineIndex===0||(sdpMLineIndex>0&&transceiver.iceTransport!==pc.transceivers[0].iceTransport)){if(!maybeAddCandidate(transceiver.iceTransport,cand)){return reject(makeError('OperationError','Can not add ICE candidate'));}} -var candidateString=candidate.candidate.trim();if(candidateString.indexOf('a=')===0){candidateString=candidateString.substr(2);} -sections=SDPUtils.getMediaSections(pc._remoteDescription.sdp);sections[sdpMLineIndex]+='a='+ -(cand.type?candidateString:'end-of-candidates') -+'\r\n';pc._remoteDescription.sdp=SDPUtils.getDescription(pc._remoteDescription.sdp)+ -sections.join('');}else{return reject(makeError('OperationError','Can not add ICE candidate'));}} -resolve();});};RTCPeerConnection.prototype.getStats=function(selector){if(selector&&selector instanceof window.MediaStreamTrack){var senderOrReceiver=null;this.transceivers.forEach(function(transceiver){if(transceiver.rtpSender&&transceiver.rtpSender.track===selector){senderOrReceiver=transceiver.rtpSender;}else if(transceiver.rtpReceiver&&transceiver.rtpReceiver.track===selector){senderOrReceiver=transceiver.rtpReceiver;}});if(!senderOrReceiver){throw makeError('InvalidAccessError','Invalid selector.');} -return senderOrReceiver.getStats();} -var promises=[];this.transceivers.forEach(function(transceiver){['rtpSender','rtpReceiver','iceGatherer','iceTransport','dtlsTransport'].forEach(function(method){if(transceiver[method]){promises.push(transceiver[method].getStats());}});});return Promise.all(promises).then(function(allStats){var results=new Map();allStats.forEach(function(stats){stats.forEach(function(stat){results.set(stat.id,stat);});});return results;});};var ortcObjects=['RTCRtpSender','RTCRtpReceiver','RTCIceGatherer','RTCIceTransport','RTCDtlsTransport'];ortcObjects.forEach(function(ortcObjectName){var obj=window[ortcObjectName];if(obj&&obj.prototype&&obj.prototype.getStats){var nativeGetstats=obj.prototype.getStats;obj.prototype.getStats=function(){return nativeGetstats.apply(this).then(function(nativeStats){var mapStats=new Map();Object.keys(nativeStats).forEach(function(id){nativeStats[id].type=fixStatsType(nativeStats[id]);mapStats.set(id,nativeStats[id]);});return mapStats;});};}});var methods=['createOffer','createAnswer'];methods.forEach(function(method){var nativeMethod=RTCPeerConnection.prototype[method];RTCPeerConnection.prototype[method]=function(){var args=arguments;if(typeof args[0]==='function'||typeof args[1]==='function'){return nativeMethod.apply(this,[arguments[2]]).then(function(description){if(typeof args[0]==='function'){args[0].apply(null,[description]);}},function(error){if(typeof args[1]==='function'){args[1].apply(null,[error]);}});} -return nativeMethod.apply(this,arguments);};});methods=['setLocalDescription','setRemoteDescription','addIceCandidate'];methods.forEach(function(method){var nativeMethod=RTCPeerConnection.prototype[method];RTCPeerConnection.prototype[method]=function(){var args=arguments;if(typeof args[1]==='function'||typeof args[2]==='function'){return nativeMethod.apply(this,arguments).then(function(){if(typeof args[1]==='function'){args[1].apply(null);}},function(error){if(typeof args[2]==='function'){args[2].apply(null,[error]);}});} -return nativeMethod.apply(this,arguments);};});['getStats'].forEach(function(method){var nativeMethod=RTCPeerConnection.prototype[method];RTCPeerConnection.prototype[method]=function(){var args=arguments;if(typeof args[1]==='function'){return nativeMethod.apply(this,arguments).then(function(){if(typeof args[1]==='function'){args[1].apply(null);}});} -return nativeMethod.apply(this,arguments);};});return RTCPeerConnection;};},{"sdp":17}],17:[function(require,module,exports){'use strict';var SDPUtils={};SDPUtils.generateIdentifier=function(){return Math.random().toString(36).substr(2,10);};SDPUtils.localCName=SDPUtils.generateIdentifier();SDPUtils.splitLines=function(blob){return blob.trim().split('\n').map(function(line){return line.trim();});};SDPUtils.splitSections=function(blob){var parts=blob.split('\nm=');return parts.map(function(part,index){return(index>0?'m='+part:part).trim()+'\r\n';});};SDPUtils.getDescription=function(blob){var sections=SDPUtils.splitSections(blob);return sections&§ions[0];};SDPUtils.getMediaSections=function(blob){var sections=SDPUtils.splitSections(blob);sections.shift();return sections;};SDPUtils.matchPrefix=function(blob,prefix){return SDPUtils.splitLines(blob).filter(function(line){return line.indexOf(prefix)===0;});};SDPUtils.parseCandidate=function(line){var parts;if(line.indexOf('a=candidate:')===0){parts=line.substring(12).split(' ');}else{parts=line.substring(10).split(' ');} -var candidate={foundation:parts[0],component:parseInt(parts[1],10),protocol:parts[2].toLowerCase(),priority:parseInt(parts[3],10),ip:parts[4],address:parts[4],port:parseInt(parts[5],10),type:parts[7]};for(var i=8;i0?parts[0].split('/')[1]:'sendrecv',uri:parts[1]};};SDPUtils.writeExtmap=function(headerExtension){return 'a=extmap:'+(headerExtension.id||headerExtension.preferredId)+ -(headerExtension.direction&&headerExtension.direction!=='sendrecv'?'/'+headerExtension.direction:'')+ -' '+headerExtension.uri+'\r\n';};SDPUtils.parseFmtp=function(line){var parsed={};var kv;var parts=line.substr(line.indexOf(' ')+1).split(';');for(var j=0;j-1){parts.attribute=line.substr(sp+1,colon-sp-1);parts.value=line.substr(colon+1);}else{parts.attribute=line.substr(sp+1);} -return parts;};SDPUtils.parseSsrcGroup=function(line){var parts=line.substr(13).split(' ');return{semantics:parts.shift(),ssrcs:parts.map(function(ssrc){return parseInt(ssrc,10);})};};SDPUtils.getMid=function(mediaSection){var mid=SDPUtils.matchPrefix(mediaSection,'a=mid:')[0];if(mid){return mid.substr(6);}};SDPUtils.parseFingerprint=function(line){var parts=line.substr(14).split(' ');return{algorithm:parts[0].toLowerCase(),value:parts[1]};};SDPUtils.getDtlsParameters=function(mediaSection,sessionpart){var lines=SDPUtils.matchPrefix(mediaSection+sessionpart,'a=fingerprint:');return{role:'auto',fingerprints:lines.map(SDPUtils.parseFingerprint)};};SDPUtils.writeDtlsParameters=function(params,setupType){var sdp='a=setup:'+setupType+'\r\n';params.fingerprints.forEach(function(fp){sdp+='a=fingerprint:'+fp.algorithm+' '+fp.value+'\r\n';});return sdp;};SDPUtils.getIceParameters=function(mediaSection,sessionpart){var lines=SDPUtils.splitLines(mediaSection);lines=lines.concat(SDPUtils.splitLines(sessionpart));var iceParameters={usernameFragment:lines.filter(function(line){return line.indexOf('a=ice-ufrag:')===0;})[0].substr(12),password:lines.filter(function(line){return line.indexOf('a=ice-pwd:')===0;})[0].substr(10)};return iceParameters;};SDPUtils.writeIceParameters=function(params){return 'a=ice-ufrag:'+params.usernameFragment+'\r\n'+ -'a=ice-pwd:'+params.password+'\r\n';};SDPUtils.parseRtpParameters=function(mediaSection){var description={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]};var lines=SDPUtils.splitLines(mediaSection);var mline=lines[0].split(' ');for(var i=3;i0?'9':'0';sdp+=' UDP/TLS/RTP/SAVPF ';sdp+=caps.codecs.map(function(codec){if(codec.preferredPayloadType!==undefined){return codec.preferredPayloadType;} -return codec.payloadType;}).join(' ')+'\r\n';sdp+='c=IN IP4 0.0.0.0\r\n';sdp+='a=rtcp:9 IN IP4 0.0.0.0\r\n';caps.codecs.forEach(function(codec){sdp+=SDPUtils.writeRtpMap(codec);sdp+=SDPUtils.writeFmtp(codec);sdp+=SDPUtils.writeRtcpFb(codec);});var maxptime=0;caps.codecs.forEach(function(codec){if(codec.maxptime>maxptime){maxptime=codec.maxptime;}});if(maxptime>0){sdp+='a=maxptime:'+maxptime+'\r\n';} -sdp+='a=rtcp-mux\r\n';if(caps.headerExtensions){caps.headerExtensions.forEach(function(extension){sdp+=SDPUtils.writeExtmap(extension);});} -return sdp;};SDPUtils.parseRtpEncodingParameters=function(mediaSection){var encodingParameters=[];var description=SDPUtils.parseRtpParameters(mediaSection);var hasRed=description.fecMechanisms.indexOf('RED')!==-1;var hasUlpfec=description.fecMechanisms.indexOf('ULPFEC')!==-1;var ssrcs=SDPUtils.matchPrefix(mediaSection,'a=ssrc:').map(function(line){return SDPUtils.parseSsrcMedia(line);}).filter(function(parts){return parts.attribute==='cname';});var primarySsrc=ssrcs.length>0&&ssrcs[0].ssrc;var secondarySsrc;var flows=SDPUtils.matchPrefix(mediaSection,'a=ssrc-group:FID').map(function(line){var parts=line.substr(17).split(' ');return parts.map(function(part){return parseInt(part,10);});});if(flows.length>0&&flows[0].length>1&&flows[0][0]===primarySsrc){secondarySsrc=flows[0][1];} -description.codecs.forEach(function(codec){if(codec.name.toUpperCase()==='RTX'&&codec.parameters.apt){var encParam={ssrc:primarySsrc,codecPayloadType:parseInt(codec.parameters.apt,10)};if(primarySsrc&&secondarySsrc){encParam.rtx={ssrc:secondarySsrc};} -encodingParameters.push(encParam);if(hasRed){encParam=JSON.parse(JSON.stringify(encParam));encParam.fec={ssrc:primarySsrc,mechanism:hasUlpfec?'red+ulpfec':'red'};encodingParameters.push(encParam);}}});if(encodingParameters.length===0&&primarySsrc){encodingParameters.push({ssrc:primarySsrc});} -var bandwidth=SDPUtils.matchPrefix(mediaSection,'b=');if(bandwidth.length){if(bandwidth[0].indexOf('b=TIAS:')===0){bandwidth=parseInt(bandwidth[0].substr(7),10);}else if(bandwidth[0].indexOf('b=AS:')===0){bandwidth=parseInt(bandwidth[0].substr(5),10)*1000*0.95 --(50*40*8);}else{bandwidth=undefined;} -encodingParameters.forEach(function(params){params.maxBitrate=bandwidth;});} -return encodingParameters;};SDPUtils.parseRtcpParameters=function(mediaSection){var rtcpParameters={};var remoteSsrc=SDPUtils.matchPrefix(mediaSection,'a=ssrc:').map(function(line){return SDPUtils.parseSsrcMedia(line);}).filter(function(obj){return obj.attribute==='cname';})[0];if(remoteSsrc){rtcpParameters.cname=remoteSsrc.value;rtcpParameters.ssrc=remoteSsrc.ssrc;} -var rsize=SDPUtils.matchPrefix(mediaSection,'a=rtcp-rsize');rtcpParameters.reducedSize=rsize.length>0;rtcpParameters.compound=rsize.length===0;var mux=SDPUtils.matchPrefix(mediaSection,'a=rtcp-mux');rtcpParameters.mux=mux.length>0;return rtcpParameters;};SDPUtils.parseMsid=function(mediaSection){var parts;var spec=SDPUtils.matchPrefix(mediaSection,'a=msid:');if(spec.length===1){parts=spec[0].substr(7).split(' ');return{stream:parts[0],track:parts[1]};} -var planB=SDPUtils.matchPrefix(mediaSection,'a=ssrc:').map(function(line){return SDPUtils.parseSsrcMedia(line);}).filter(function(msidParts){return msidParts.attribute==='msid';});if(planB.length>0){parts=planB[0].value.split(' ');return{stream:parts[0],track:parts[1]};}};SDPUtils.generateSessionId=function(){return Math.random().toString().substr(2,21);};SDPUtils.writeSessionBoilerplate=function(sessId,sessVer,sessUser){var sessionId;var version=sessVer!==undefined?sessVer:2;if(sessId){sessionId=sessId;}else{sessionId=SDPUtils.generateSessionId();} -var user=sessUser||'thisisadapterortc';return 'v=0\r\n'+ -'o='+user+' '+sessionId+' '+version+ -' IN IP4 127.0.0.1\r\n'+ -'s=-\r\n'+ -'t=0 0\r\n';};SDPUtils.writeMediaSection=function(transceiver,caps,type,stream){var sdp=SDPUtils.writeRtpDescription(transceiver.kind,caps);sdp+=SDPUtils.writeIceParameters(transceiver.iceGatherer.getLocalParameters());sdp+=SDPUtils.writeDtlsParameters(transceiver.dtlsTransport.getLocalParameters(),type==='offer'?'actpass':'active');sdp+='a=mid:'+transceiver.mid+'\r\n';if(transceiver.direction){sdp+='a='+transceiver.direction+'\r\n';}else if(transceiver.rtpSender&&transceiver.rtpReceiver){sdp+='a=sendrecv\r\n';}else if(transceiver.rtpSender){sdp+='a=sendonly\r\n';}else if(transceiver.rtpReceiver){sdp+='a=recvonly\r\n';}else{sdp+='a=inactive\r\n';} -if(transceiver.rtpSender){var msid='msid:'+stream.id+' '+ -transceiver.rtpSender.track.id+'\r\n';sdp+='a='+msid;sdp+='a=ssrc:'+transceiver.sendEncodingParameters[0].ssrc+ -' '+msid;if(transceiver.sendEncodingParameters[0].rtx){sdp+='a=ssrc:'+transceiver.sendEncodingParameters[0].rtx.ssrc+ -' '+msid;sdp+='a=ssrc-group:FID '+ -transceiver.sendEncodingParameters[0].ssrc+' '+ -transceiver.sendEncodingParameters[0].rtx.ssrc+ -'\r\n';}} -sdp+='a=ssrc:'+transceiver.sendEncodingParameters[0].ssrc+ -' cname:'+SDPUtils.localCName+'\r\n';if(transceiver.rtpSender&&transceiver.sendEncodingParameters[0].rtx){sdp+='a=ssrc:'+transceiver.sendEncodingParameters[0].rtx.ssrc+ -' cname:'+SDPUtils.localCName+'\r\n';} -return sdp;};SDPUtils.getDirection=function(mediaSection,sessionpart){var lines=SDPUtils.splitLines(mediaSection);for(var i=0;ir.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+r.sctp.maxMessageSize+" bytes)");return n.apply(t,arguments)}}var r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=r.apply(this,arguments);return t(e,this),e},s.wrapPeerConnectionEvent(e,"datachannel",function(e){return t(e.channel,e.target),e})},r.shimConnectionState=function(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;var r=e.RTCPeerConnection.prototype;Object.defineProperty(r,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(r,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(function(e){var t=r[e];r[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t,r=e.target;return r._lastConnectionState!==r.connectionState&&(r._lastConnectionState=r.connectionState,t=new Event("connectionstatechange",e),r.dispatchEvent(t)),e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),t.apply(this,arguments)}})},r.removeAllowExtmapMixed=function(e){if(!e.RTCPeerConnection)return;var t=s.detectBrowser(e);if("chrome"===t.browser&&71<=t.version)return;var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(e){return e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")&&(e.sdp=e.sdp.split("\n").filter(function(e){return"a=extmap-allow-mixed"!==e.trim()}).join("\n")),r.apply(this,arguments)}};var n,i=e("sdp"),a=(n=i)&&n.__esModule?n:{default:n},s=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}}(e("./utils"))},{"./utils":15,sdp:17}],7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=r.shimGetUserMedia=void 0;var n=e("./getusermedia");Object.defineProperty(r,"shimGetUserMedia",{enumerable:!0,get:function(){return n.shimGetUserMedia}});var i=e("./getdisplaymedia");Object.defineProperty(r,"shimGetDisplayMedia",{enumerable:!0,get:function(){return i.shimGetDisplayMedia}}),r.shimPeerConnection=function(e){var t=a.detectBrowser(e);{var r;e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025&&(r=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled"),Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){r.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})))}!e.RTCRtpSender||"dtmf"in e.RTCRtpSender.prototype||Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}});e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);var n=(0,d.default)(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=(0,s.filterIceServers)(e.iceServers,t.version),a.log("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype},r.shimReplaceTrack=function(e){!e.RTCRtpSender||"replaceTrack"in e.RTCRtpSender.prototype||(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)};var o,a=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}}(e("../utils")),s=e("./filtericeservers"),c=e("rtcpeerconnection-shim"),d=(o=c)&&o.__esModule?o:{default:o}},{"../utils":15,"./filtericeservers":8,"./getdisplaymedia":9,"./getusermedia":10,"rtcpeerconnection-shim":16}],8:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.filterIceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var t=e.urls||e.url;e.url&&!e.urls&&i.deprecated("RTCIceServer.url","RTCIceServer.urls");var r="string"==typeof t;return r&&(t=[t]),t=t.filter(function(e){if(0===e.indexOf("stun:"))return!1;e=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return e&&!n&&(n=!0)}),delete e.url,e.urls=r?t[0]:t,!!t.length}})};var i=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}}(e("../utils"))},{"../utils":15}],9:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=function(e){if(!("getDisplayMedia"in e.navigator))return;if(!e.navigator.mediaDevices)return;if(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)return;e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)}},{}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetUserMedia=function(e){var e=e&&e.navigator,t=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(e){return t(e).catch(function(e){return Promise.reject({name:{PermissionDeniedError:"NotAllowedError"}[(e=e).name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}})})}}},{}],11:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=r.shimGetUserMedia=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=e("./getusermedia");Object.defineProperty(r,"shimGetUserMedia",{enumerable:!0,get:function(){return n.shimGetUserMedia}});var i=e("./getdisplaymedia");Object.defineProperty(r,"shimGetDisplayMedia",{enumerable:!0,get:function(){return i.shimGetDisplayMedia}}),r.shimOnTrack=function(e){"object"===(void 0===e?"undefined":a(e))&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},r.shimPeerConnection=function(r){var n=s.detectBrowser(r);if("object"!==(void 0===r?"undefined":a(r))||!r.RTCPeerConnection&&!r.mozRTCPeerConnection)return;!r.RTCPeerConnection&&r.mozRTCPeerConnection&&(r.RTCPeerConnection=r.mozRTCPeerConnection);["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=r.RTCPeerConnection.prototype[e];r.RTCPeerConnection.prototype[e]=function(){return arguments[0]=new("addIceCandidate"===e?r.RTCIceCandidate:r.RTCSessionDescription)(arguments[0]),t.apply(this,arguments)}});var e=r.RTCPeerConnection.prototype.addIceCandidate;r.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?e.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())};var i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},o=r.RTCPeerConnection.prototype.getStats;r.RTCPeerConnection.prototype.getStats=function(e,t,r){return o.apply(this,[e||null]).then(function(r){if(n.version<53&&!t)try{r.forEach(function(e){e.type=i[e.type]||e.type})}catch(e){if("TypeError"!==e.name)throw e;r.forEach(function(e,t){r.set(t,Object.assign({},e,{type:i[e.type]||e.type}))})}return r}).then(t,r)}},r.shimSenderGetStats=function(e){if("object"!==(void 0===e?"undefined":a(e))||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;var r=e.RTCPeerConnection.prototype.getSenders;r&&(e.RTCPeerConnection.prototype.getSenders=function(){var t=this,e=r.apply(this,[]);return e.forEach(function(e){return e._pc=t}),e});var t=e.RTCPeerConnection.prototype.addTrack;t&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=t.apply(this,arguments);return e._pc=this,e});e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}},r.shimReceiverGetStats=function(e){if("object"!==(void 0===e?"undefined":a(e))||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;var r=e.RTCPeerConnection.prototype.getReceivers;r&&(e.RTCPeerConnection.prototype.getReceivers=function(){var t=this,e=r.apply(this,[]);return e.forEach(function(e){return e._pc=t}),e});s.wrapPeerConnectionEvent(e,"track",function(e){return e.receiver._pc=e.srcElement,e}),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},r.shimRemoveStream=function(e){if(!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype)return;e.RTCPeerConnection.prototype.removeStream=function(t){var r=this;s.deprecated("removeStream","removeTrack"),this.getSenders().forEach(function(e){e.track&&t.getTracks().includes(e.track)&&r.removeTrack(e)})}},r.shimRTCDataChannel=function(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)};var s=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}}(e("../utils"))},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=function(t,r){if(t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices)return;if(!t.navigator.mediaDevices)return;t.navigator.mediaDevices.getDisplayMedia=function(e){if(e&&e.video)return!0===e.video?e.video={mediaSource:r}:e.video.mediaSource=r,t.navigator.mediaDevices.getUserMedia(e);e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}}},{}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.shimGetUserMedia=function(e){var t=c.detectBrowser(e),n=e&&e.navigator,e=e&&e.MediaStreamTrack;{var r,i,o,a;n.getUserMedia=function(e,t,r){c.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},55=r&&parseInt(t[r],10)}function c(t,r,n){r&&!n.has(r.id)&&(n.set(r.id,r),Object.keys(r).forEach(function(e){e.endsWith("Id")?c(t,t.get(r[e]),n):e.endsWith("Ids")&&r[e].forEach(function(e){c(t,t.get(e),n)})}))}},{}],16:[function(e,t,r){"use strict";var x=e("sdp");function a(e,t,r,n,i){t=x.writeRtpDescription(e.kind,t);return t+=x.writeIceParameters(e.iceGatherer.getLocalParameters()),t+=x.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":i||"active"),t+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?t+="a=sendrecv\r\n":e.rtpSender?t+="a=sendonly\r\n":e.rtpReceiver?t+="a=recvonly\r\n":t+="a=inactive\r\n",e.rtpSender&&(i=e.rtpSender._initialTrackId||e.rtpSender.track.id,e.rtpSender._initialTrackId=i,t+="a="+(i="msid:"+(n?n.id:"-")+" "+i+"\r\n"),t+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+i,e.sendEncodingParameters[0].rtx&&(t+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+i,t+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")),t+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+x.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(t+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+x.localCName+"\r\n"),t}function O(n,i){function o(e,t){e=parseInt(e,10);for(var r=0;rn&&(n=e.maxptime)}),0