Loading save files done.
This commit is contained in:
@ -63,12 +63,16 @@
|
||||
}
|
||||
|
||||
EJS_defaultOptions = {
|
||||
|
||||
};
|
||||
|
||||
const emulatorInit = data => {
|
||||
EJS_gameUrl = `/api/v1/rom?id=${data.gameId}`;
|
||||
EJS_core = data.core;
|
||||
EJS_gameName = data.gameName;
|
||||
EJS_externalFiles = {
|
||||
'/homeplay/saves/': `/api/v1/save?id=${data.gameId}`
|
||||
}
|
||||
|
||||
scriptElement = document.createElement('script');
|
||||
scriptElement.src = 'https://cdn.emulatorjs.org/stable/data/loader.js';
|
||||
@ -103,6 +107,31 @@
|
||||
};
|
||||
|
||||
EJS_ready = () => {
|
||||
// Modify the EJS stuff
|
||||
const oldGetRetroArchCfg = window.EJS_GameManager.prototype.getRetroArchCfg;
|
||||
const oldMountFileSystems = window.EJS_GameManager.prototype.mountFileSystems;
|
||||
|
||||
EJS_GameManager.prototype.getRetroArchCfg = function() {
|
||||
const ejsConfig = oldGetRetroArchCfg.call(this);
|
||||
|
||||
// Parse back into key value pair
|
||||
const raConfig = ejsConfig.split('\n').reduce((acc, line) => {
|
||||
if(!line.length) return acc;
|
||||
const [key, value] = line.split('=');
|
||||
acc[key.trim()] = value.trim();
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// Add new options
|
||||
raConfig['savefiles_in_content_dir'] = false;
|
||||
raConfig['sort_savefiles_by_content_enable'] = false;
|
||||
raConfig['sort_savefiles_enable'] = false;
|
||||
raConfig['savefile_directory'] = '/homeplay/saves';
|
||||
|
||||
// Return back as RA config string
|
||||
return Object.entries(raConfig).map(([k, v]) => `${k} = ${v}`).join('\n');
|
||||
}
|
||||
|
||||
send({ message: 'ready' });
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user