2022-01-12 22:50:40 +00:00
var VERSION = '0.4.26'
2021-08-21 03:05:09 +00:00
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 ) ;
2022-01-05 00:17:43 +00:00
var usingVersion = VERSION ;
2021-08-21 03:05:09 +00:00
if ( usingVersion != version . current _version ) {
2021-10-03 23:17:22 +00:00
console . log ( 'Using emulatorjs version ' + usingVersion + ' but the newest version is ' + version . current _version + '\n\nopen https://github.com/ethanaobrien/emulatorjs to update' ) ;
2021-08-21 03:05:09 +00:00
} ;
} ) ;
} ;
} ) ;
2021-12-01 17:46:24 +00:00
var scriptTag = document . getElementsByTagName ( 'script' ) [ 0 ]
2022-01-12 22:50:40 +00:00
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' ]
2022-01-05 00:17:43 +00:00
} else if ( 'undefined' != typeof EJS _pathtodata ) {
2022-01-12 22:50:40 +00:00
return EJS _pathtodata + 'emu-main.js?v=' + VERSION
2022-01-05 00:17:43 +00:00
} else {
2022-01-12 22:50:40 +00:00
return 'emu-main.js?v=' + VERSION ;
2022-01-05 00:17:43 +00:00
}
2022-01-12 22:50:40 +00:00
} ( ) ;
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
2022-01-23 22:37:28 +00:00
'undefined' != typeof EJS _mameCore && ( config . mameCore = EJS _mameCore )
2022-01-12 22:50:40 +00:00
'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 )
2022-01-13 20:13:07 +00:00
'undefined' != typeof EJS _netplayUrl && ( config . netplayUrl = EJS _netplayUrl )
2022-01-12 22:50:40 +00:00
'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 ) ;
} ;
2021-12-01 17:46:24 +00:00
} ;