diff options
| author | Rémi Verschelde | 2017-01-15 00:30:52 +0100 |
|---|---|---|
| committer | GitHub | 2017-01-15 00:30:52 +0100 |
| commit | 07f65184f3886fc836f6d7f8de5052c64bda50bf (patch) | |
| tree | c22cfb4b2c1d8c086a934fadd660e81e2917a880 /platform/javascript/javascript_main.cpp | |
| parent | fe8459ac3badc0d2b2b36bf29670d2639825d644 (diff) | |
| parent | 1f7d4c4d0ee8eba0a1d8084019269a45dfa76be4 (diff) | |
| download | godot-07f65184f3886fc836f6d7f8de5052c64bda50bf.tar.gz godot-07f65184f3886fc836f6d7f8de5052c64bda50bf.tar.zst godot-07f65184f3886fc836f6d7f8de5052c64bda50bf.zip | |
Diffstat (limited to 'platform/javascript/javascript_main.cpp')
| -rw-r--r-- | platform/javascript/javascript_main.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 6ec7f1ec3..dc4d80df7 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -140,10 +140,9 @@ static void _godot_draw(void) { extern "C" { -void main_after_fs_sync(int value) { +void main_after_fs_sync() { start_step=1; - printf("FS SYNCHED!\n"); } } @@ -178,26 +177,25 @@ int main(int argc, char *argv[]) { glutDisplayFunc(_godot_draw); //glutSpecialFunc(gears_special); + //mount persistent file system + EM_ASM( + FS.mkdir('/userfs'); + FS.mount(IDBFS, {}, '/userfs'); + // sync from persistent state into memory and then + // run the 'main_after_fs_sync' function + FS.syncfs(true, function(err) { - //mount persistent filesystem - EM_ASM( - FS.mkdir('/userfs'); - FS.mount(IDBFS, {}, '/userfs'); - - - - // sync from persisted state into memory and then - // run the 'test' function - FS.syncfs(true, function (err) { - assert(!err); - console.log("done syncinc!"); - _after_sync_cb = Module.cwrap('main_after_fs_sync', 'void',['number']); - _after_sync_cb(0); - - }); - - ); + if (err) { + Module.setStatus('Failed to load persistent data\nPlease allow (third-party) cookies'); + Module.printErr('Failed to populate IDB file system: ' + err.message); + Module.exit(); + } else { + Module.print('Successfully populated IDB file system'); + ccall('main_after_fs_sync', 'void', []); + } + }); + ); glutMainLoop(); |
