2022-02-22 15:56:48 +00:00
( async function ( ) {
2023-03-07 16:07:38 +00:00
let VERSION = 31.6 ;
2022-05-06 20:42:58 +00:00
if ( ( window . location && [ 'localhost' , '127.0.0.1' ] . includes ( location . hostname ) ) ||
'undefined' != typeof EJS _DEBUG _XX && true === EJS _DEBUG _XX ) {
2022-09-14 18:58:31 +00:00
fetch ( 'https://raw.githack.com/EmulatorJS/EmulatorJS/main/data/version.json' ) . then ( response => {
2022-02-22 15:56:48 +00:00
if ( response . ok ) {
response . text ( ) . then ( body => {
2022-08-20 01:24:00 +00:00
let version = JSON . parse ( body ) ;
2022-02-22 15:56:48 +00:00
if ( VERSION < version . current _version ) {
2022-09-14 18:58:31 +00:00
console . log ( 'Using emulatorjs version ' + VERSION + ' but the newest version is ' + version . current _version + '\nopen https://github.com/EmulatorJS/EmulatorJS to update' ) ;
2022-02-22 15:56:48 +00:00
}
} )
}
} )
}
2022-05-16 16:45:45 +00:00
function loadStyle ( file ) {
return new Promise ( function ( resolve , reject ) {
2022-08-20 01:24:00 +00:00
let css = document . createElement ( 'link' ) ;
2022-05-16 16:45:45 +00:00
css . rel = 'stylesheet' ;
css . href = function ( ) {
if ( 'undefined' != typeof EJS _paths && typeof EJS _paths [ file ] == 'string' ) {
return EJS _paths [ file ] ;
} else if ( 'undefined' != typeof EJS _pathtodata ) {
if ( ! EJS _pathtodata . endsWith ( '/' ) ) EJS _pathtodata += '/' ;
return EJS _pathtodata + file + '?v=' + VERSION ;
} else {
return file + '?v=' + VERSION ;
}
} ( ) ;
css . onload = resolve ;
document . head . appendChild ( css ) ;
} )
}
2022-02-22 15:56:48 +00:00
function loadScript ( file ) {
return new Promise ( function ( resolve , reject ) {
2022-08-20 01:24:00 +00:00
let script = document . createElement ( 'script' ) ;
2022-02-22 15:56:48 +00:00
script . src = function ( ) {
if ( 'undefined' != typeof EJS _paths && typeof EJS _paths [ file ] == 'string' ) {
return EJS _paths [ file ] ;
} else if ( 'undefined' != typeof EJS _pathtodata ) {
2022-05-16 16:45:45 +00:00
if ( ! EJS _pathtodata . endsWith ( '/' ) ) EJS _pathtodata += '/' ;
2022-02-22 15:56:48 +00:00
return EJS _pathtodata + file + '?v=' + VERSION ;
} else {
return file + '?v=' + VERSION ;
}
} ( ) ;
2022-05-16 16:45:45 +00:00
script . onload = resolve ;
2023-01-31 22:09:05 +00:00
document . head . appendChild ( script ) ;
2022-02-22 15:56:48 +00:00
} )
}
2022-11-28 01:35:30 +00:00
const isIpad = /Macintosh/i . test ( navigator . userAgent ) && navigator . maxTouchPoints && navigator . maxTouchPoints > 1 ;
2022-11-03 23:53:19 +00:00
if ( ( 'undefined' != typeof EJS _DEBUG _XX && true === EJS _DEBUG _XX ) ||
2023-01-31 22:09:05 +00:00
/(iPad|iPhone|iPod)/gi . test ( navigator . userAgent ) || isIpad ) {
2022-05-16 16:45:45 +00:00
await loadStyle ( 'emu-css.css' ) ;
2022-02-22 15:56:48 +00:00
await loadScript ( 'emu-main.js' ) ;
await loadScript ( 'emulator.js' ) ;
2022-01-05 00:17:43 +00:00
} else {
2022-05-16 16:45:45 +00:00
await loadStyle ( 'emu-css.min.css' ) ;
await loadScript ( 'emulator.min.js' ) ;
2022-01-05 00:17:43 +00:00
}
2022-08-20 01:24:00 +00:00
let config = { } ;
2022-02-22 15:56:48 +00:00
config . gameUrl = EJS _gameUrl ;
'undefined' != typeof EJS _mameCore && ( config . mameCore = EJS _mameCore ) ;
'undefined' != typeof EJS _biosUrl && ( config . biosUrl = EJS _biosUrl ) ;
'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 ) ;
Version 3.0.5 is finally here!
Changes:
- Fixed screen recording on devices that do not support getUserMedia api.
- Added C label buttons to nintendo 64 virtual gamepad.
- Fixed EJS_color bug.
- Savestates are pulled from the core itself, to always be correct.
- Several new cores. (a5200, beetle_vb, desmume2015, fbalpha2012_cps1, fbalpha2012_cps2, fceumm, gambatte, mame2003, mednafen_psx, mednafen_psx_hw, melonds, mgba, mupen64plus_next, nestopia, snes9x)
- D-pad for virtual gamepad.
- Updated translation files to include new menu options.
- Ability to add more than one zone object to virtual gamepads.
- Added ability to set custom menu options.
- Virtual gamepad left handed mode.
- Fixed Screen record svg.
- Updated svg icons.
- Cache "clear all" button.
- Cache button moved to menu bar.
- Added feature that will display the current downloaded size when the content length is not available.
- Updated repository docs
2022-09-24 17:50:44 +00:00
'undefined' != typeof EJS _gameID && ( config . gameId = EJS _gameID ) ;
2022-02-22 15:56:48 +00:00
'undefined' != typeof EJS _netplayUrl && ( config . netplayUrl = EJS _netplayUrl ) ;
'undefined' != typeof EJS _startOnLoaded && ( config . startOnLoad = EJS _startOnLoaded ) ;
'undefined' != typeof EJS _core && ( config . system = EJS _core ) ;
2022-08-05 00:10:36 +00:00
'undefined' != typeof EJS _oldCores && ( config . oldCores = EJS _oldCores ) ;
2022-02-22 15:56:48 +00:00
'undefined' != typeof EJS _loadStateURL && ( config . loadStateOnStart = EJS _loadStateURL ) ;
Version 3.0.5 is finally here!
Changes:
- Fixed screen recording on devices that do not support getUserMedia api.
- Added C label buttons to nintendo 64 virtual gamepad.
- Fixed EJS_color bug.
- Savestates are pulled from the core itself, to always be correct.
- Several new cores. (a5200, beetle_vb, desmume2015, fbalpha2012_cps1, fbalpha2012_cps2, fceumm, gambatte, mame2003, mednafen_psx, mednafen_psx_hw, melonds, mgba, mupen64plus_next, nestopia, snes9x)
- D-pad for virtual gamepad.
- Updated translation files to include new menu options.
- Ability to add more than one zone object to virtual gamepads.
- Added ability to set custom menu options.
- Virtual gamepad left handed mode.
- Fixed Screen record svg.
- Updated svg icons.
- Cache "clear all" button.
- Cache button moved to menu bar.
- Added feature that will display the current downloaded size when the content length is not available.
- Updated repository docs
2022-09-24 17:50:44 +00:00
'undefined' != typeof EJS _defaultOptions && ( config . defaultMenuOptions = EJS _defaultOptions ) ;
2022-02-22 15:56:48 +00:00
'undefined' != typeof EJS _language && ( config . lang = EJS _language ) ;
2022-05-16 16:45:45 +00:00
'undefined' != typeof EJS _noAutoCloseAd && ( config . noAutoAdClose = EJS _noAutoCloseAd ) ;
2022-08-18 13:40:50 +00:00
'undefined' != typeof EJS _VirtualGamepadSettings && ( config . VirtualGamepadSettings = EJS _VirtualGamepadSettings ) ;
2022-08-11 20:38:29 +00:00
'undefined' != typeof EJS _Buttons && ( config . buttons = EJS _Buttons ) ;
'undefined' != typeof EJS _Settings && ( config . settings = EJS _Settings ) ;
Version 3.0.5 is finally here!
Changes:
- Fixed screen recording on devices that do not support getUserMedia api.
- Added C label buttons to nintendo 64 virtual gamepad.
- Fixed EJS_color bug.
- Savestates are pulled from the core itself, to always be correct.
- Several new cores. (a5200, beetle_vb, desmume2015, fbalpha2012_cps1, fbalpha2012_cps2, fceumm, gambatte, mame2003, mednafen_psx, mednafen_psx_hw, melonds, mgba, mupen64plus_next, nestopia, snes9x)
- D-pad for virtual gamepad.
- Updated translation files to include new menu options.
- Ability to add more than one zone object to virtual gamepads.
- Added ability to set custom menu options.
- Virtual gamepad left handed mode.
- Fixed Screen record svg.
- Updated svg icons.
- Cache "clear all" button.
- Cache button moved to menu bar.
- Added feature that will display the current downloaded size when the content length is not available.
- Updated repository docs
2022-09-24 17:50:44 +00:00
'undefined' != typeof EJS _CacheLimit && ( config . cacheLimit = EJS _CacheLimit ) ;
2022-02-22 15:56:48 +00:00
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 ) ;
2022-05-24 21:46:10 +00:00
window . EJS _emulator = await new EJS ( EJS _player , config ) ;
2022-02-22 15:56:48 +00:00
'undefined' != typeof EJS _onGameStart && EJS _emulator . on ( 'start-game' , EJS _onGameStart ) ;
} ) ( ) ;