summaryrefslogtreecommitdiff
path: root/platform/javascript/javascript_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/javascript/javascript_main.cpp')
-rw-r--r--platform/javascript/javascript_main.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index 586ccc9b4e..94320d53c1 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -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");
}
}
@@ -159,8 +158,8 @@ int main(int argc, char *argv[]) {
char *args[]={"-test","gui","-v",NULL};
Error err = Main::setup("apk",3,args);
#else
-// char *args[]={"-v",NULL};//
-// Error err = Main::setup("",1,args);
+ //char *args[]={"-v",NULL};//
+ //Error err = Main::setup("",1,args);
Error err = Main::setup("",0,NULL);
#endif
@@ -178,26 +177,27 @@ int main(int argc, char *argv[]) {
glutDisplayFunc(_godot_draw);
//glutSpecialFunc(gears_special);
-
-
- //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);
-
- });
-
- );
+ //mount persistent file system
+ /* clang-format off */
+ 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) {
+
+ 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', []);
+ }
+ });
+ );
+ /* clang-format on */
glutMainLoop();