From bc102c8716daceeea9f384cee05c3eb9472dad53 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien Date: Tue, 6 Feb 2024 13:45:47 -0600 Subject: [PATCH] Save state 2.0 --- data/GameManager.js | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/data/GameManager.js b/data/GameManager.js index 02d7d29..01c1abf 100644 --- a/data/GameManager.js +++ b/data/GameManager.js @@ -5,7 +5,6 @@ class EJS_GameManager { this.FS = this.Module.FS; this.functions = { restart: this.Module.cwrap('system_restart', '', []), - getStateInfo: this.Module.cwrap('get_state_info', 'string', []), //these names are dumb saveStateInfo: this.Module.cwrap('save_state_info', 'null', []), loadState: this.Module.cwrap('load_state', 'number', ['string', 'number']), screenshot: this.Module.cwrap('cmd_take_screenshot', '', []), @@ -136,30 +135,10 @@ class EJS_GameManager { } getState() { return new Promise(async (resolve, reject) => { - const stateInfo = (await this.getStateInfo()).split('|') - let state; - let size = stateInfo[0] >> 0; - if (size > 0) { - state = new Uint8Array(size); - let start = stateInfo[1] >> 0; - for (let i=0; i { - let a; - let b = setInterval(() => { - a = this.functions.getStateInfo(); - if (a) { - clearInterval(b); - resolve(a); - } - }, 50) - }); - } loadState(state) { try { this.FS.unlink('game.state');