diff --git a/.gitignore b/.gitignore index 45cd624a..5f06e6ce 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ mudclient.data mudclient.html mudclient.js mudclient.wasm +mudclient.wasm.js .idea options.ini rsc-c.3dsx diff --git a/Makefile.emscripten b/Makefile.emscripten index 7b0e07f7..ef40c10f 100644 --- a/Makefile.emscripten +++ b/Makefile.emscripten @@ -44,7 +44,7 @@ CFLAGS += -s DISABLE_EXCEPTION_THROWING=1 LDFLAGS += -s INITIAL_MEMORY=50MB -s ALLOW_MEMORY_GROWTH=1 -s USE_SDL=2 LDFLAGS += -s ASYNCIFY -s ASYNCIFY_STACK_SIZE=16384 -LDFLAGS += -s MIN_FIREFOX_VERSION=52 +LDFLAGS += -s MIN_FIREFOX_VERSION=68 LDFLAGS += --preload-file ./cache/ diff --git a/src/options.c b/src/options.c index 6e79dc9a..ced3911e 100644 --- a/src/options.c +++ b/src/options.c @@ -228,7 +228,8 @@ void options_save(Options *options) { return; } - char file_buffer[65536] = {0}; + int file_length = UINT16_MAX + 1; + char *file_buffer = calloc(1, file_length); sprintf(file_buffer, OPTIONS_INI_TEMPLATE, options->members, // @@ -306,7 +307,7 @@ void options_save(Options *options) { ); #ifdef ANDROID - if (SDL_RWwrite(ini_file, file_buffer, strlen(file_buffer) + 1, 1) < 1) { + if (SDL_RWwrite(ini_file, file_buffer, file_length, 1) < 1) { mud_error("failed to write options.ini file %s\n", SDL_GetError()); } @@ -314,9 +315,10 @@ void options_save(Options *options) { mud_error("failed to close options.ini file %s\n", SDL_GetError()); } #else - fwrite(file_buffer, strlen(file_buffer) + 1, 1, ini_file); + fwrite(file_buffer, file_length, 1, ini_file); fclose(ini_file); #endif + free(file_buffer); #ifdef OPTIONS_UNIX /* restrict access to potentially sensitive info */ diff --git a/src/surface.h b/src/surface.h index 03c83e5c..abfb4936 100644 --- a/src/surface.h +++ b/src/surface.h @@ -229,6 +229,8 @@ void surface_new(Surface *surface, int width, int height, int limit, mudclient *mud); #if defined(RENDER_GL) || defined(RENDER_3DS_GL) +void surface_gl_new(Surface *surface, int width, int height, int limit, + mudclient *mud); float surface_gl_translate_x(Surface *surface, int x); float surface_gl_translate_y(Surface *surface, int y); void surface_gl_reset_context(Surface *surface);