2022-02-14 17:21:00 +00:00
var VERSION = '0.4.26'
2021-08-28 21:44:00 +00:00
fetch ( 'https://raw.githack.com/ethanaobrien/emulatorjs/main/data/version.json' ) . then ( response => {
2022-02-14 17:21:00 +00:00
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' ) ;
} ;
} ) ;
} ;
2021-08-28 21:44:00 +00:00
} ) ;
2021-12-25 00:33:00 +00:00
var scriptTag = document . getElementsByTagName ( 'script' ) [ 0 ]
2022-02-14 17:21:00 +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-11 17:00:00 +00:00
} else if ( 'undefined' != typeof EJS _pathtodata ) {
2022-02-14 17:21:00 +00:00
return EJS _pathtodata + 'emu-main.js?v=' + VERSION
2022-01-11 17:00:00 +00:00
} else {
2022-02-14 17:21:00 +00:00
return 'emu-main.js?v=' + VERSION ;
2022-01-11 17:00:00 +00:00
}
2022-02-14 17:21:00 +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
'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 )
2022-02-20 21:51:00 +00:00
'undefined' != typeof EJS _oldEJSNetplayServer && ( config . oldNetplayServer = EJS _oldEJSNetplayServer )
'undefined' != typeof EJS _BETA && ( config . useBeta = EJS _BETA )
2022-02-14 17:21:00 +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 )
window . EJS _emulator = new EJS ( EJS _player , config )
'undefined' != typeof EJS _onGameStart && EJS _emulator . on ( 'start-game' , EJS _onGameStart ) ;
} ;
2021-12-25 00:33:00 +00:00
} ;