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-04 21:06:17 +00:00
var usingVersion = '0.4.25' ;
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 emulatorjs = document . createElement ( 'script' )
var scriptTag = document . getElementsByTagName ( 'script' ) [ 0 ]
2021-12-02 18:35:30 +00:00
emulatorjs . async = true
2022-01-04 21:06:17 +00:00
emulatorjs . src = EJS _pathtodata + 'emulator.js?v=' + '0.4.25'
2021-12-01 17:46:24 +00:00
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 )
2021-12-07 14:04:53 +00:00
'undefined' != typeof EJS _AdUrl && ( config . adUrl = EJS _AdUrl )
2022-01-04 21:06:17 +00:00
'undefined' != typeof EJS _core && ( config . system = EJS _core )
'undefined' != typeof EJS _loadStateURL && ( config . loadStateOnStart = EJS _loadStateURL )
2021-12-01 17:46:24 +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 )
2021-12-02 18:35:30 +00:00
'undefined' != typeof EJS _gameName && ( config . gameName = EJS _gameName )
2022-01-04 21:06:17 +00:00
'undefined' != typeof EJS _pathtodata && ( config . dataPath = EJS _pathtodata )
2021-12-01 17:46:24 +00:00
'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 ) ;
} ;