2021-08-28 21:44:00 +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 ) ;
2021-11-25 23:22:00 +00:00
var usingVersion = '0.4.23-07' ;
2021-08-28 21:44:00 +00:00
if ( usingVersion != version . current _version ) {
2021-11-17 23:04:00 +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-28 21:44:00 +00:00
} ;
} ) ;
} ;
} ) ;
if ( ! window . EJS _pathtodata ) {
EJS _pathtodata = './'
}
var path2Send = EJS _pathtodata
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 = path2Send . split ( '/' )
var split1 = [ ]
for ( var i = 0 ; i < split3 . length ; i ++ ) {
if ( split3 [ i ] != '' ) {
split1 . push ( split3 [ i ] )
}
}
if ( ! path2Send . startsWith ( '/' ) && path2Send . split ( '://' ) . length == 1 && path2Send . split ( 'http:' ) . length == 1 && path2Send . split ( 'https:' ) . length == 1 ) {
for ( var w = 0 ; w < split2 . length ; w ++ ) {
if ( split2 [ w ] == '' || split2 [ w ] == '.' ) {
} else if ( split2 [ w ] == '..' ) {
if ( split1 . length > 0 ) {
var split1 = split1 . splice ( - 1 , 1 )
}
} else {
split1 . push ( split2 [ w ] )
}
}
var path2Send = split1 . join ( '/' )
if ( ! path2Send . startsWith ( '/' ) ) {
var path2Send = '/' + path2Send
}
path2Send = window . location . protocol + '//' + window . location . host + path2Send
EJS _pathtodata = path2Send
}
if ( EJS _pathtodata . startsWith ( '/' ) ) {
EJS _pathtodata = window . location . protocol + '//' + window . location . host + path2Send
}
if ( ! EJS _pathtodata . endsWith ( '/' ) ) {
EJS _pathtodata = EJS _pathtodata + '/'
}
console . log ( 'Path to data is set to ' + EJS _pathtodata )
2021-09-17 15:34:00 +00:00
window . getHeadGameInfo = function ( normalFunc , url ) {
if ( ! url . startsWith ( 'blob:' ) ) {
return normalFunc ( url , { } )
} else {
return async function ( ) {
//console.log('blob url')
var a = await fetch ( url )
var a = await a . blob ( )
return { headers : { 'content-length' : a . size , 'content-type' : 'text/plain' } }
} ( ) ;
}
}
window . readAsBufferrr = function ( fileBlob ) {
return new Promise ( function ( resolve , reject ) {
var reader = new FileReader ( )
reader . onload = function ( e ) {
resolve ( e . target . result )
}
reader . readAsArrayBuffer ( fileBlob )
} )
}
window . EJS _loadStateFromURL = async function ( ) {
if ( ! window . EJS _loadStateURL ) { return }
var a = await fetch ( EJS _loadStateURL )
var a = await a . blob ( )
var a = await readAsBufferrr ( a )
var a = new Uint8Array ( a )
EJS _loadState ( a )
}
2021-09-21 16:42:00 +00:00
var loader = function ( _0x3f3e4d ) {
var _0x33f0f1 = { } ;
2021-09-17 15:34:00 +00:00
2021-09-21 16:42:00 +00:00
function _0x268bfd ( _0x6631ec ) {
if ( _0x33f0f1 [ _0x6631ec ] ) return _0x33f0f1 [ _0x6631ec ] [ 'exports' ] ;
var _0x50c7e4 = _0x33f0f1 [ _0x6631ec ] = {
'i' : _0x6631ec ,
'l' : ! 0x1 ,
'exports' : { }
} ;
return _0x3f3e4d [ _0x6631ec ] [ 'call' ] ( _0x50c7e4 [ 'exports' ] , _0x50c7e4 , _0x50c7e4 [ 'exports' ] , _0x268bfd ) , _0x50c7e4 [ 'l' ] = ! 0x0 , _0x50c7e4 [ 'exports' ] ;
}
return _0x268bfd [ 'm' ] = _0x3f3e4d , _0x268bfd [ 'c' ] = _0x33f0f1 , _0x268bfd [ 'd' ] = function ( _0xf1024d , _0x55284e , _0x262414 ) {
_0x268bfd [ 'o' ] ( _0xf1024d , _0x55284e ) || Object [ 'defineProperty' ] ( _0xf1024d , _0x55284e , {
'enumerable' : ! 0x0 ,
'get' : _0x262414
} ) ;
} , _0x268bfd [ 'r' ] = function ( _0xa8a7e ) {
'undefined' != typeof Symbol && Symbol [ 'toStringTag' ] && Object [ 'defineProperty' ] ( _0xa8a7e , Symbol [ 'toStringTag' ] , {
'value' : 'Module'
} ) , Object [ 'defineProperty' ] ( _0xa8a7e , '__esModule' , {
'value' : ! 0x0
} ) ;
} , _0x268bfd [ 't' ] = function ( _0x5518c9 , _0x2d1bbc ) {
if ( 0x1 & _0x2d1bbc && ( _0x5518c9 = _0x268bfd ( _0x5518c9 ) ) , 0x8 & _0x2d1bbc ) return _0x5518c9 ;
if ( 0x4 & _0x2d1bbc && 'object' == typeof _0x5518c9 && _0x5518c9 && _0x5518c9 [ '__esModule' ] ) return _0x5518c9 ;
var _0x37347f = Object [ 'create' ] ( null ) ;
if ( _0x268bfd [ 'r' ] ( _0x37347f ) , Object [ 'defineProperty' ] ( _0x37347f , 'default' , {
'enumerable' : ! 0x0 ,
'value' : _0x5518c9
} ) , 0x2 & _0x2d1bbc && 'string' != typeof _0x5518c9 )
for ( var _0x2b2a4e in _0x5518c9 ) _0x268bfd [ 'd' ] ( _0x37347f , _0x2b2a4e , function ( _0x466464 ) {
return _0x5518c9 [ _0x466464 ] ;
} [ 'bind' ] ( null , _0x2b2a4e ) ) ;
return _0x37347f ;
} , _0x268bfd [ 'n' ] = function ( _0x25eece ) {
var _0x3f42e9 = _0x25eece && _0x25eece [ '__esModule' ] ? function ( ) {
return _0x25eece [ 'default' ] ;
} : function ( ) {
return _0x25eece ;
} ;
return _0x268bfd [ 'd' ] ( _0x3f42e9 , 'a' , _0x3f42e9 ) , _0x3f42e9 ;
} , _0x268bfd [ 'o' ] = function ( _0x5570d6 , _0x5eaf39 ) {
return Object [ 'prototype' ] [ 'hasOwnProperty' ] [ 'call' ] ( _0x5570d6 , _0x5eaf39 ) ;
} , _0x268bfd [ 'p' ] = '' , _0x268bfd ( _0x268bfd [ 's' ] = 0x18b ) ;
} ( {
395 : function ( _0x316d65 , _0x16e76b , _0x1f8b30 ) {
'use strict' ;
_0x1f8b30 [ 'r' ] ( _0x16e76b ) ;
var _0x2fbf67 , _0x59b8a1 , _0x3c68b9 , _0x44b634 , _0x2766bb , _0x46b578 = _0x1f8b30 ( 0x38 ) ;
window , _0x2fbf67 = document , _0x59b8a1 = 'script' , _0x3c68b9 = [ EJS _pathtodata + 'emulator.js?v=' , _0x46b578 [ 'a' ] ] [ 'join' ] ( '' ) , _0x44b634 = _0x2fbf67 [ 'createElement' ] ( _0x59b8a1 ) , _0x2766bb = _0x2fbf67 [ 'getElementsByTagName' ] ( _0x59b8a1 ) [ 0x0 ] , _0x44b634 [ 'async' ] = 0x1 , _0x44b634 [ 'src' ] = _0x3c68b9 , _0x2766bb [ 'parentNode' ] [ 'insertBefore' ] ( _0x44b634 , _0x2766bb ) , _0x44b634 [ 'onload' ] = function ( ) {
var _0x316d65 = { } ;
_0x316d65 [ 'gameUrl' ] = EJS _gameUrl , 'undefined' != typeof EJS _biosUrl && ( _0x316d65 [ 'biosUrl' ] = EJS _biosUrl ) , 'undefined' != typeof EJS _gameID && ( _0x316d65 [ 'gameId' ] = EJS _gameID ) , 'undefined' != typeof EJS _gameParentUrl && ( _0x316d65 [ 'gameParentUrl' ] = EJS _gameParentUrl ) , 'undefined' != typeof EJS _gamePatchUrl && ( _0x316d65 [ 'gamePatchUrl' ] = EJS _gamePatchUrl ) , _0x316d65 [ 'system' ] = EJS _core , _0x316d65 [ 'onsavestate' ] = null , _0x316d65 [ 'onloadstate' ] = null , 'undefined' != typeof EJS _onSaveState && ( _0x316d65 [ 'onsavestate' ] = EJS _onSaveState ) , 'undefined' != typeof EJS _onLoadState && ( _0x316d65 [ 'onloadstate' ] = EJS _onLoadState ) , 'undefined' != typeof EJS _lightgun && ( _0x316d65 [ 'lightgun' ] = EJS _lightgun ) , 'undefined' != typeof EJS _mouse && ( _0x316d65 [ 'mouse' ] = EJS _mouse ) , 'undefined' != typeof EJS _multitap && ( _0x316d65 [ 'multitap' ] = EJS _multitap ) , 'undefined' != typeof EJS _playerName && ( _0x316d65 [ 'playerName' ] = EJS _playerName ) , 'undefined' != typeof EJS _cheats && ( _0x316d65 [ 'cheats' ] = EJS _cheats ) , 'undefined' != typeof EJS _color && ( _0x316d65 [ 'color' ] = EJS _color ) , window [ 'EJS_emulator' ] = new EJS ( EJS _player , _0x316d65 ) , 'undefined' != typeof EJS _onGameStart && EJS _emulator [ 'on' ] ( 'start-game' , EJS _onGameStart ) ;
} ;
} ,
56 : function ( _0x258889 , _0x2c8954 , _0x2cdd3a ) {
'use strict' ;
_0x2c8954 [ 'a' ] = '0.4.23' ;
}
} ) [ 'default' ] ;