Separate main emu function into separate file

This commit is contained in:
Ethan O'Brien 2022-01-12 16:50:40 -06:00 committed by GitHub
parent ef3200ef87
commit e3a85fd0b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5979 additions and 5965 deletions

5926
data/emu-main.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
var VERSION = '0.4.25'
var VERSION = '0.4.26'
fetch('https://raw.githack.com/ethanaobrien/emulatorjs/main/data/version.json').then(response => {
if (response.ok) {
response.text().then(body => {
@ -10,46 +10,58 @@ fetch('https://raw.githack.com/ethanaobrien/emulatorjs/main/data/version.json').
});
};
});
var emulatorjs = document.createElement('script')
var scriptTag = document.getElementsByTagName('script')[0]
emulatorjs.async = true
emulatorjs.src = function() {
if ('undefined' != typeof EJS_paths && typeof EJS_paths['emulator.js'] == 'string') {
return EJS_paths['emulator.js']
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']
} else if ('undefined' != typeof EJS_pathtodata) {
return EJS_pathtodata + 'emulator.js?v=' + VERSION
return EJS_pathtodata + 'emu-main.js?v=' + VERSION
} else {
return 'emulator.js?v=' + VERSION;
return 'emu-main.js?v=' + VERSION;
}
}()
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)
'undefined' != typeof EJS_AdUrl && (config.adUrl = EJS_AdUrl)
'undefined' != typeof EJS_paths && (config.paths = EJS_paths)
'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);
}();
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_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_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);
};
};

View file

@ -1 +1 @@
{ "current_version": "0.4.25"}
{ "current_version": "0.4.26" }