mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
Add EJS_softLoad
option
This commit is contained in:
parent
569db3dac7
commit
eac73e2fc8
3 changed files with 16 additions and 0 deletions
|
@ -81,7 +81,14 @@ class EJS_GameManager {
|
|||
this.FS.writeFile('/shader/'+shader, window.EJS_SHADERS[shader]);
|
||||
}
|
||||
}
|
||||
clearEJSResetTimer() {
|
||||
if (this.EJS.resetTimeout) {
|
||||
clearTimeout(this.EJS.resetTimeout);
|
||||
delete this.EJS.resetTimeout;
|
||||
}
|
||||
}
|
||||
restart() {
|
||||
this.clearEJSResetTimer();
|
||||
this.functions.restart();
|
||||
}
|
||||
getState() {
|
||||
|
@ -115,6 +122,7 @@ class EJS_GameManager {
|
|||
this.FS.unlink('game.state');
|
||||
} catch(e){}
|
||||
this.FS.writeFile('/game.state', state);
|
||||
this.clearEJSResetTimer();
|
||||
this.functions.loadState("game.state", 0);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
|
@ -141,6 +149,7 @@ class EJS_GameManager {
|
|||
if (!slot) slot = 1;
|
||||
(async () => {
|
||||
let name = slot + '-quick.state';
|
||||
this.clearEJSResetTimer();
|
||||
this.functions.loadState(name, 0);
|
||||
})();
|
||||
}
|
||||
|
@ -310,6 +319,7 @@ class EJS_GameManager {
|
|||
return (exists ? FS.readFile(this.getSaveFilePath()) : null);
|
||||
}
|
||||
loadSaveFiles() {
|
||||
this.clearEJSResetTimer();
|
||||
this.functions.loadSaveFiles();
|
||||
}
|
||||
setFastForwardRatio(ratio) {
|
||||
|
|
|
@ -1067,6 +1067,11 @@ class EmulatorJS {
|
|||
args.push('/'+this.fileName);
|
||||
if (this.debug) console.log(args);
|
||||
this.Module.callMain(args);
|
||||
if (typeof this.config.softLoad === "number" && this.config.softLoad > 0) {
|
||||
this.resetTimeout = setTimeout(() => {
|
||||
this.gameManager.restart();
|
||||
}, this.config.softLoad * 1000);
|
||||
}
|
||||
this.Module.resumeMainLoop();
|
||||
this.checkSupportedOpts();
|
||||
this.setupSettingsMenu();
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
config.threads = window.EJS_threads;
|
||||
config.disableCue = window.EJS_disableCue;
|
||||
config.startBtnName = window.EJS_startButtonName;
|
||||
config.softLoad = window.EJS_softLoad;
|
||||
|
||||
if (typeof window.EJS_language === "string" && window.EJS_language !== "en-US") {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue