Hide unsupported options with coreVer 2. add minify javascript file

This commit is contained in:
Ethan O'Brien 2022-02-22 09:56:48 -06:00 committed by GitHub
parent fde44b095b
commit c8b702b343
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 111 additions and 77 deletions

View file

@ -1813,9 +1813,32 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)).innerHTML = 'Game Core ready';
var _0x17edbf = _0xa88a13.config.biosUrl,
_0x2c1832 = _0xa88a13;
_0xdcec2a.bindFunction.call(_0xa88a13), _0xdcec2a.setGamepadDialog.call(_0xa88a13), _0xdcec2a.setCacheDialog.call(_0xa88a13), _0xdcec2a.setLoadingDialog.call(_0xa88a13), _0xdcec2a.setNetplayDialog.call(_0xa88a13), _0xdcec2a.setCheatDialog.call(_0xa88a13), _0xdcec2a.initGamepad.call(_0xa88a13), _0xdcec2a.initKeyboard.call(_0xa88a13), _0xdcec2a.listeners.call(_0xa88a13), _0x4d7024._FS.createFolder('/', 'etc', true, true), _0x4d7024.FS.mkdir('/data'), _0x4d7024.FS.mkdir('/data/saves'), 'undefined' != typeof IDBFS ? _0x4d7024.FS.mount(IDBFS, {}, '/data/saves') : _0x4d7024.FS.mount(_0x4d7024.FS.filesystems.IDBFS, {}, '/data/saves'), _0x4d7024.FS.mkdir('/shader'), _0x4d7024.FS.syncfs(true, function(_0x1a8f12) {}), _0xdcec2a.initShaders();
_0xdcec2a.bindFunction.call(_0xa88a13);
_0xdcec2a.setGamepadDialog.call(_0xa88a13);
_0xdcec2a.setCacheDialog.call(_0xa88a13);
_0xdcec2a.setLoadingDialog.call(_0xa88a13);
_0xdcec2a.setNetplayDialog.call(_0xa88a13);
_0xdcec2a.setCheatDialog.call(_0xa88a13);
_0xdcec2a.initGamepad.call(_0xa88a13);
_0xdcec2a.initKeyboard.call(_0xa88a13);
_0xdcec2a.listeners.call(_0xa88a13);
_0x4d7024._FS.createFolder('/', 'etc', true, true);
_0x4d7024.FS.mkdir('/data');
_0x4d7024.FS.mkdir('/data/saves');
'undefined' != typeof IDBFS ? _0x4d7024.FS.mount(IDBFS, {}, '/data/saves') : _0x4d7024.FS.mount(_0x4d7024.FS.filesystems.IDBFS, {}, '/data/saves');
_0x4d7024.FS.mkdir('/shader');
_0x4d7024.FS.syncfs(true, function(_0x1a8f12) {});
_0xdcec2a.initShaders();
var _0x14d39f = '';
_0x14d39f += 'savefile_directory = /data/saves\n', _0x14d39f += 'video_vsync = true\n', _0x14d39f += 'screenshot_directory = /\n', _0x14d39f += 'video_shader = /shader/shader.glslp\n', _0x14d39f += 'video_shader_enable = true\n', _0x14d39f += 'video_font_enable = false\n', _0x14d39f += 'video_scale = 1.0\n', _0x14d39f += 'video_gpu_screenshot = false\n', _0x14d39f += 'audio_latency = 96\n';
_0x14d39f += 'savefile_directory = /data/saves\n';
_0x14d39f += 'video_vsync = true\n';
_0x14d39f += 'screenshot_directory = /\n';
_0x14d39f += 'video_shader = /shader/shader.glslp\n';
_0x14d39f += 'video_shader_enable = true\n';
_0x14d39f += 'video_font_enable = false\n';
_0x14d39f += 'video_scale = 1.0\n';
_0x14d39f += 'video_gpu_screenshot = false\n';
_0x14d39f += 'audio_latency = 96\n';
var _0x36edb7 = _0x2593da.defaultCoreOptionsValues.call(_0xa88a13);
_0x2c1832.lightgun && ('nes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p2 = "258"\n'), 'segaMS' !== _0xa88a13.system && 'segaMD' !== _0xa88a13.system && 'segaCD' !== _0xa88a13.system || (_0x36edb7.genesis_plus_gx_gun_cursor = 'yes', _0x36edb7.genesis_plus_gx_invert_mouse = 'yes', _0x36edb7.genesis_plus_gx_bram = 'per game', _0x14d39f += 'input_libretro_device_p2 = "260"\n'), 'snes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p2 = "260"\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(_0xa88a13.system) && (_0x14d39f += 'input_libretro_device_p2 = "260"\n')), _0x2c1832.mouse && ('snes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p1 = 2\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(_0xa88a13.system) && (_0x14d39f += 'input_libretro_device_p1 = 2\n')), _0x2c1832.multitap && ('snes' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p2 = 257\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(_0xa88a13.system) && (_0x14d39f += 'input_libretro_device_p2 = 257\n')), 'n64' === _0xa88a13.system && (_0x14d39f += 'input_libretro_device_p1 = 5\n'), _0x2c1832.system, _0x14d39f += 'fastforward_ratio = 1.0\n', _0x14d39f += 'video_smooth = false\n';
var _0x55117c = _0x5dc0c0(_0x36edb7, _0x2593da.storage.get('core-options') || {}),
@ -2093,6 +2116,19 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
} else _0x3641d6(_0x2458d5, _0x124167);
}) : _0x3641d6(_0x2458d5, _0x124167);
}
if (_0x2c1832.coreVer === 2) {
_0x1e2c68.element(_0x2c1832.elements.buttons.cheat) && _0x132da7(_0x2c1832.elements.buttons.cheat, true);
_0x1e2c68.element(_0x2c1832.elements.buttons.gamepad) && _0x132da7(_0x2c1832.elements.buttons.gamepad, true);
_0x1e2c68.element(_0x2c1832.elements.buttons.mute) && _0x132da7(_0x2c1832.elements.buttons.mute, true);
_0x1e2c68.element(_0x2c1832.elements.inputs.volume) && _0x132da7(_0x2c1832.elements.inputs.volume, true);
if (Array.isArray(_0x2c1832.elements.buttons.play)) {
for (var i=0; i<_0x2c1832.elements.buttons.play.length; i++) {
_0x1e2c68.element(_0x2c1832.elements.buttons.play[i]) && _0x132da7(_0x2c1832.elements.buttons.play[i], true);
}
} else {
_0x1e2c68.element(_0x2c1832.elements.buttons.play) && _0x132da7(_0x2c1832.elements.buttons.play, true);
}
}
_0x254bc2 || _0x1e2c68.element(_0x2c1832.elements.buttons.netplay) && _0x132da7(_0x2c1832.elements.buttons.netplay, true), _0x1e2c68.element(_0x2c1832.elements.buttons.saveState) && _0x132da7(_0x2c1832.elements.buttons.saveState, !_0x5b1dcd), _0x1e2c68.element(_0x2c1832.elements.buttons.loadState) && _0x132da7(_0x2c1832.elements.buttons.loadState, !_0x5b1dcd), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), !_0x5b1dcd), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), !_0x5b1dcd);
_0xc6823.setStatesSupported(_0x5b1dcd);
}).catch(function(_0x2d06a9) {
@ -6234,7 +6270,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
var a = function(_0x154660, _0x15626f) {
if (!(_0x154660 instanceof _0x15626f)) throw new TypeError('Cannot call a class as a function');
}(this, _0x6954aa);
this.version = '1.0';
this.version = '1.1.0';
this.system = '';
this.adUrl = null;
this.gameName = null;
@ -6332,8 +6368,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
_0x39ca5e.i18n = localJson.i18n;
_0x7f9f36.normalOptions = localJson.normalOptions;
} catch(e) {
console.error(e);
console.warn('error setting localization');
console.warn('error setting localization', e);
}
}
return function(engText) {

1
data/emu-min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,72 +1,70 @@
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 => {
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');
};
});
};
});
var scriptTag = document.getElementsByTagName('script')[0]
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 + 'emu-main.js?v=' + VERSION
} else {
return 'emu-main.js?v=' + VERSION;
(async function() {
var VERSION = 1.1;
if (window.location && ['localhost', '127.0.0.1'].includes(location.hostname)) {
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);
if (VERSION < version.current_version) {
console.log('Using emulatorjs version ' + usingVersion + ' but the newest version is ' + version.current_version + '\nopen https://github.com/ethanaobrien/emulatorjs to update');
}
})
}
})
}
}();
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)
'undefined' != typeof EJS_oldEJSNetplayServer && (config.oldNetplayServer = EJS_oldEJSNetplayServer)
'undefined' != typeof EJS_BETA && (config.useBeta = EJS_BETA)
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);
};
};
var scriptTag = document.getElementsByTagName('script')[0]
function loadScript(file) {
return new Promise(function (resolve, reject) {
var script = document.createElement('script');
script.src = function() {
if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] == 'string') {
return EJS_paths[file];
} else if ('undefined' != typeof EJS_pathtodata) {
return EJS_pathtodata+file+'?v='+VERSION;
} else {
return file+'?v='+VERSION;
}
}();
scriptTag.parentNode.insertBefore(script, scriptTag);
script.onload = function() {
resolve();
}
})
}
if ('undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX) {
await loadScript('emu-main.js');
await loadScript('emulator.js');
} else {
await loadScript('emu-min.js');
}
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);
'undefined' != typeof EJS_oldEJSNetplayServer && (config.oldNetplayServer = EJS_oldEJSNetplayServer);
'undefined' != typeof EJS_BETA && (config.useBeta = EJS_BETA);
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.26" }
{ "current_version": 1.1 }