1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

JS synchronous start, better persistent FS sync.

The engine now expects to emscripten FS to be setup and sync-ed before
main is called. This is exposed via `Module["initFS"]` which also allows
to setup multiple persistence paths (internal use only for now).

Additionally, FS syncing is done **once** for every loop if at least one
file in a persistent path was open for writing and closed, and if the FS
is not syncing already.

This should potentially fix issues reported by users where "autosave"
would not work on the web (never calling `syncfs` because of too many
writes).
This commit is contained in:
Fabio Alessandrelli
2020-09-18 19:15:53 +02:00
parent e7d00d08f5
commit 35fcc1835c
5 changed files with 103 additions and 66 deletions

View File

@@ -71,8 +71,7 @@ class OS_JavaScript : public OS_Unix {
bool swap_ok_cancel;
bool idb_available;
int64_t sync_wait_time;
int64_t last_sync_check_time;
bool idb_needs_sync;
static EM_BOOL fullscreen_change_callback(int p_event_type, const EmscriptenFullscreenChangeEvent *p_event, void *p_user_data);
@@ -110,6 +109,7 @@ protected:
public:
String canvas_id;
bool idb_is_syncing;
void finalize_async();
bool check_size_force_redraw();