Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Dec 5, 2023
1 parent 77182a7 commit 07c632f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ if(${PLAYER_BUILD_EXECUTABLE} AND (${PLAYER_TARGET_PLATFORM} STREQUAL "SDL2" OR
set(PLAYER_JS_POSTJS "${CMAKE_CURRENT_SOURCE_DIR}/resources/emscripten/emscripten-post.js")
set(PLAYER_JS_SHELL "${CMAKE_CURRENT_SOURCE_DIR}/resources/emscripten/emscripten-shell.html")

set_property(TARGET ${EXE_NAME} PROPERTY LINK_FLAGS "-s ALLOW_MEMORY_GROWTH -s MINIFY_HTML=0 -s MODULARIZE -s EXIT_RUNTIME -s EXPORT_NAME='createEasyRpgPlayer' --bind --pre-js ${PLAYER_JS_PREJS} --post-js ${PLAYER_JS_POSTJS} -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['$autoResumeAudioContext','$dynCall']")
set_property(TARGET ${EXE_NAME} PROPERTY LINK_FLAGS "-s ALLOW_MEMORY_GROWTH -s MINIFY_HTML=0 -s MODULARIZE -s EXPORT_NAME=createEasyRpgPlayer -s EXIT_RUNTIME --bind --pre-js ${PLAYER_JS_PREJS} --post-js ${PLAYER_JS_POSTJS} -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['$autoResumeAudioContext','$dynCall']")
set_source_files_properties("src/platform/sdl/main.cpp" PROPERTIES
OBJECT_DEPENDS "${PLAYER_JS_PREJS};${PLAYER_JS_POSTJS};${PLAYER_JS_SHELL}")

Expand Down
2 changes: 1 addition & 1 deletion resources/emscripten/emscripten-pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Module = { ...Module,
Module.totalDependencies = Math.max(Module.totalDependencies, left);
Module.setStatus(left ? `Preparing... (${Module.totalDependencies - left}/${Module.totalDependencies})` : 'Downloading game data...');
}
});
};

/**
* Parses the current location query to setup a specific game
Expand Down
1 change: 1 addition & 0 deletions src/platform/emscripten/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ EMSCRIPTEN_BINDINGS(player_interface) {
.class_function("downloadSavegame", &Emscripten_Interface::DownloadSavegame)
.class_function("uploadSavegame", &Emscripten_Interface::UploadSavegame)
.class_function("refreshScene", &Emscripten_Interface::RefreshScene)
.class_function("downloadScreenshot", &Emscripten_Interface::DownloadScreenshot)
;

emscripten::class_<Emscripten_Interface_Private>("api_private")
Expand Down
4 changes: 2 additions & 2 deletions src/platform/emscripten/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
extern "C" int main(int argc, char* argv[]) {
// Yield on start to ensure async operations (e.g. "mounting" of filesystems) can finish
// 10ms appears to work already but to be on the safe side better use 100ms
emscripten_sleep(100);
//emscripten_sleep(100);

std::vector<std::string> args;
args.assign(argv, argv + argc);
Expand All @@ -40,7 +40,7 @@ extern "C" int main(int argc, char* argv[]) {
Player::Run();

// Yield on shutdown to ensure async operations (e.g. IDBFS saving) can finish
emscripten_sleep(100);
//emscripten_sleep(100);

return EXIT_SUCCESS;
}

0 comments on commit 07c632f

Please sign in to comment.