Skip to content

Commit

Permalink
Emscripten fixes for about.c, misc. warning fixes for 3.1.47. (#386)
Browse files Browse the repository at this point in the history
* Added asyncify whitelist entries for `about_megazeux`.
* Fixed warnings for `-sFULL_ES2` and `-sENVIRONMENT` that were
  emitted for every compilation unit.
* Fixed unused variable warning in about.c.
* Update platform_matrix.html Emscripten entry for 2.93.
  • Loading branch information
AliceLR authored Oct 31, 2023
1 parent 13c3eb7 commit 7a0b2fe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 1 addition & 3 deletions arch/emscripten/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ ARCH_LDFLAGS += -s ALLOW_MEMORY_GROWTH=1
ARCH_LDFLAGS += -s MODULARIZE=1 -s 'EXTRA_EXPORTED_RUNTIME_METHODS=["FS"]'

ifeq (${BUILD_RENDER_GL_PROGRAM},1)
ARCH_CFLAGS += -s FULL_ES2=1
ARCH_LDFLAGS += -s FULL_ES2=1
ARCH_LDFLAGS += -s FULL_ES2=1
endif

ARCH_LDFLAGS += -s ASYNCIFY=1 -s ASYNCIFY_STACK_SIZE=1048576
# TODO: Removing the whitelist should allow the editor to work.
ARCH_LDFLAGS += -s ASYNCIFY_WHITELIST=@arch/emscripten/whitelist.json
ARCH_LDFLAGS += -s 'ASYNCIFY_IMPORTS=["emscripten_sleep"]'

ARCH_CFLAGS += -s ENVIRONMENT=web
ARCH_LDFLAGS += -s ENVIRONMENT=web

# Fix warnings caused by broken Emscripten macros.
Expand Down
6 changes: 6 additions & 0 deletions arch/emscripten/whitelist.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
"main_menu_callback",
"title_key",

"menu_key",
"menu_click",
"menu_activate",
"main_menu_activate",
"about_megazeux",

"load_world_title_selection",
"load_world_title",
"reload_world",
Expand Down
2 changes: 1 addition & 1 deletion docs/platform_matrix.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
description: "HTML5 (Emscripten)",
architecture: "JavaScript <br> WebAssembly",
endian: "Little",
toolchain: "clang 12.0.0 <br> (sdk 2.0.6)",
toolchain: "clang 18.0.0 <br> (sdk 3.1.47)",
packaged: ZIP,
stack_protector: _FAULTY(),
layer_rendering: yes,
Expand Down
5 changes: 2 additions & 3 deletions src/about.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,12 @@ static void load_license_list(char *names[MAX_FILES], char *files[MAX_FILES],
char *license = NULL;
char *license_3rd = NULL;
int num_files = 0;
int i = 0;

dir = vdir_open(license_dir);
if(dir)
{
// Pass 1: find LICENSE (or LICENSE.) and LICENCE.3rd.
for(i = 0; num_files < MAX_FILES; i++)
while(num_files < MAX_FILES)
{
if(!vdir_read(dir, buf, sizeof(buf), &type))
break;
Expand Down Expand Up @@ -253,7 +252,7 @@ static void load_license_list(char *names[MAX_FILES], char *files[MAX_FILES],

// Pass 2: add all other license files.
vdir_rewind(dir);
for(i = 0; num_files < MAX_FILES; i++)
while(num_files < MAX_FILES)
{
if(!vdir_read(dir, buf, sizeof(buf), &type))
break;
Expand Down

0 comments on commit 7a0b2fe

Please sign in to comment.