mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 02:00:41 +00:00
emscripten: add hack to prevent ERRNO_CODES from being optimized away
This commit is contained in:
parent
05fecc4e15
commit
618da66073
@ -42,7 +42,8 @@ LIBS := -s USE_ZLIB=1
|
||||
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s NO_EXIT_RUNTIME=0 -s FULL_ES2=1 \
|
||||
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \
|
||||
--js-library emscripten/library_rwebaudio.js \
|
||||
--js-library emscripten/library_rwebcam.js
|
||||
--js-library emscripten/library_rwebcam.js \
|
||||
--js-library emscripten/library_errno_codes.js
|
||||
ifneq ($(PTHREAD), 0)
|
||||
LDFLAGS += -s USE_PTHREADS=$(PTHREAD) -s PTHREAD_POOL_SIZE=2
|
||||
endif
|
||||
|
15
emscripten/library_errno_codes.js
Normal file
15
emscripten/library_errno_codes.js
Normal file
@ -0,0 +1,15 @@
|
||||
//"use strict";
|
||||
|
||||
// HACK: This is a dummy library that forces ERRNO_CODES to be used, so it's not optimized away.
|
||||
// Needed for BrowserFS.
|
||||
|
||||
var LibraryErrnoCodes = {
|
||||
dummyErrnoCodes__deps: ['$ERRNO_CODES'],
|
||||
dummyErrnoCodes: function() {
|
||||
if (!ERRNO_CODES) {
|
||||
console.error("ERRNO_CODES not imported!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
mergeInto(LibraryManager.library, LibraryErrnoCodes);
|
@ -47,6 +47,7 @@
|
||||
#include "../../file_path_special.h"
|
||||
|
||||
void RWebAudioRecalibrateTime(void);
|
||||
void dummyErrnoCodes(void);
|
||||
|
||||
static unsigned emscripten_fullscreen_reinit;
|
||||
static unsigned emscripten_frame_count = 0;
|
||||
@ -226,6 +227,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
EMSCRIPTEN_RESULT r;
|
||||
|
||||
dummyErrnoCodes();
|
||||
|
||||
emscripten_set_canvas_element_size("#canvas", 800, 600);
|
||||
emscripten_set_element_css_size("#canvas", 800.0, 600.0);
|
||||
emscripten_set_main_loop(emscripten_mainloop, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user