diff --git a/configure.ac b/configure.ac index ae1320b..c711ca8 100644 --- a/configure.ac +++ b/configure.ac @@ -115,7 +115,7 @@ AS_IF([test "x$with_libpng" != xno], [ # TODO: We currently link everything against libraries that don't need it. # Use the specific library CFLAGS/LIBS variables instead of setting them here. -EMFLAGS="-gsource-map -s INVOKE_RUN=1 -s USE_SDL=2 -s USE_SDL_MIXER=2 -s LEGACY_GL_EMULATION=0 -s USE_SDL_NET=2 -s ASSERTIONS=0 -s WASM=1 -s ALLOW_MEMORY_GROWTH=0 -s FORCE_FILESYSTEM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=[['FS','ccall']] -s SAFE_HEAP=1 -s EXIT_RUNTIME=1 -s STACK_OVERFLOW_CHECK=1 -s PROXY_POSIX_SOCKETS=0 -s USE_PTHREADS=0 -s PROXY_TO_PTHREAD=0 -s TOTAL_MEMORY=64MB -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ASYNCIFY -O3 --source-map-base /" +EMFLAGS="-gsource-map -s INVOKE_RUN=1 -s USE_SDL=2 -s USE_SDL_MIXER=2 -s LEGACY_GL_EMULATION=0 -s USE_SDL_NET=2 -s ASSERTIONS=0 -s WASM=1 -s ALLOW_MEMORY_GROWTH=0 -s FORCE_FILESYSTEM=1 -s EXPORTED_RUNTIME_METHODS=['FS','ccall','callMain'] -s EXIT_RUNTIME=1 -s PROXY_POSIX_SOCKETS=0 -s USE_PTHREADS=0 -s PROXY_TO_PTHREAD=0 -s TOTAL_MEMORY=64MB -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ASYNCIFY -s STACK_SIZE=5MB -O3 -fno-strict-aliasing --source-map-base /" CFLAGS="$CFLAGS $SDL_CFLAGS ${SAMPLERATE_CFLAGS:-} ${PNG_CFLAGS:-} $EMFLAGS" LDFLAGS="$LDFLAGS $SDL_LIBS ${SAMPLERATE_LIBS:-} ${PNG_LIBS:-} $EMFLAGS -lwebsocket.js" diff --git a/src/doomtype.h b/src/doomtype.h index 9947a07..7a780ce 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -100,7 +100,7 @@ #include -#if defined(__cplusplus) || defined(__bool_true_false_are_defined) +#if defined(__cplusplus) // Use builtin bool type with C++. @@ -108,11 +108,16 @@ typedef bool boolean; #else -typedef enum -{ - false, - true -} boolean; +// Always int-sized in C. Emscripten's headers pull in stdbool.h in some files only, and a 1-byte boolean +// there against a 4-byte one elsewhere corrupts shared globals (netgame, playeringame[], view state). +// Doom also memsets booleans to -1 as a marker, which needs more than one byte. + +typedef int boolean; + +#if !defined(__bool_true_false_are_defined) && !(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) +#define false 0 +#define true 1 +#endif #endif