From b7c8011c5273e20a4a9beb80292263a91e8acc14 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Mon, 4 May 2020 22:38:59 +0530 Subject: [PATCH] Add shell --- CMakeLists.txt | 2 +- shell.html | 109 +++++++++++++++++++++++++++++++++++++++++++++ src/config.cpp | 1 + src/emscripten.cpp | 5 +++ 4 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 shell.html diff --git a/CMakeLists.txt b/CMakeLists.txt index 7295ce4..0d8977f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -461,7 +461,7 @@ SET(EMS_FLAGS " -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s USE_ZLIB=1 -s USE_OGG=1 -s US SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EMS_FLAGS} ${ERR_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EMS_FLAGS} ${ERR_FLAGS}") -SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMS_FLAGS} -s TOTAL_MEMORY=1073741824 -lopenal --preload-file game -s DISABLE_EXCEPTION_CATCHING=1 -s ASSERTIONS=0 -s SAFE_HEAP=0 -s MINIFY_HTML=0 -s 'ASYNCIFY_IMPORTS=[\"load_file_async_js\"]'") +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMS_FLAGS} -s TOTAL_MEMORY=1073741824 -lopenal --preload-file game -s DISABLE_EXCEPTION_CATCHING=1 -s ASSERTIONS=0 -s SAFE_HEAP=0 -s MINIFY_HTML=0 -s 'ASYNCIFY_IMPORTS=[\"load_file_async_js\"]' --shell-file shell.html") set_target_properties( ${PROJECT_NAME} diff --git a/shell.html b/shell.html new file mode 100644 index 0000000..36c801d --- /dev/null +++ b/shell.html @@ -0,0 +1,109 @@ + + + + + + MKXP + + + +
+
+
+ + + + + + {{{ SCRIPT }}} + + diff --git a/src/config.cpp b/src/config.cpp index e32da07..f5bf71a 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -197,6 +197,7 @@ void Config::read(int argc, char *argv[]) defScreenW = 640; defScreenH = 480; enableBlitting = false; + winResizable = false; #undef PO_DESC #undef PO_DESC_ALL diff --git a/src/emscripten.cpp b/src/emscripten.cpp index 030247b..0151bfe 100644 --- a/src/emscripten.cpp +++ b/src/emscripten.cpp @@ -4,6 +4,7 @@ EM_JS(void, load_file_async_js, (const char* fullPathC), { Asyncify.handleSleep(function(wakeUp) { + // Get argument const fullPath = UTF8ToString(fullPathC); // Make cache object @@ -12,6 +13,9 @@ EM_JS(void, load_file_async_js, (const char* fullPathC), { // Check if already loaded if (window.fileAsyncCache.hasOwnProperty(fullPath)) return wakeUp(); + // Show spinner + if (window.setBusy) window.setBusy(); + // Get full destination const file = "game/" + fullPath; @@ -28,6 +32,7 @@ EM_JS(void, load_file_async_js, (const char* fullPathC), { // Get the new file FS.createPreloadedFile(path, filename, iurl, true, true, function() { window.fileAsyncCache[fullPath] = 1; + if (window.setNotBusy) window.setNotBusy(); wakeUp(); }, console.error); });