emscripten: optimize fs sync; add source map output

This commit is contained in:
Roman Turchin
2025-01-18 10:54:04 -05:00
parent f06eb813e0
commit 75c5f777fd
3 changed files with 9 additions and 8 deletions
+1
View File
@@ -382,6 +382,7 @@ else()
target_link_options( ${EXECUTABLE_NAME} PRIVATE "-sEXPORTED_RUNTIME_METHODS=callMain,addRunDependency,removeRunDependency" )
target_link_options( ${EXECUTABLE_NAME} PRIVATE "-sEXPORT_ALL" )
target_link_options( ${EXECUTABLE_NAME} PRIVATE "-sEXPORT_NAME=fallout2ce" )
target_link_options( ${EXECUTABLE_NAME} PRIVATE "-gsource-map" )
endif()
target_link_libraries(${EXECUTABLE_NAME} ${ZLIB_LIBRARIES})
+4 -2
View File
@@ -4,8 +4,10 @@ set( CMAKE_C_COMPILER "emcc" )
set( CMAKE_CXX_COMPILER "em++" )
set( CMAKE_C_FLAGS "--use-port=sdl2 \
--use-port=sdl2_mixer \
--use-port=zlib" )
--use-port=zlib \
-gsource-map" )
set( CMAKE_CXX_FLAGS "--use-port=sdl2 \
--use-port=sdl2_mixer \
--use-port=zlib" )
--use-port=zlib \
-gsource-map" )
set( EXECUTABLE_NAME fallout2-ce.js )
+4 -6
View File
@@ -68,12 +68,10 @@ int xfileClose(XFile* stream)
EM_ASM(
// clang-format off
// The following code is not C++ code, but JavaScript code.
const handle = setInterval(() => {
if (FS.syncFSRequests === 0) {
clearInterval(handle);
FS.syncfs(err => err && console.warn(`FS.syncfs() error: ${err}`, err));
}
}, 0);
setTimeout(() => {
if (FS.syncFSRequests !== 0) return;
FS.syncfs(err => err && console.warn(`FS.syncfs() error: ${err}`, err));
}, 0)
// clang-format on
);
}