diff options
author | Patric Stout <truebrain@openttd.org> | 2020-12-05 21:57:47 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2020-12-15 15:46:39 +0100 |
commit | d15dc9f40f5a20bff452547a2dcb15231f9f969d (patch) | |
tree | 7b8d88635c048d906cbb6358007fb26055e24410 /src/ini.cpp | |
parent | 2da07f76154d841bcfe9aaff4833144550186deb (diff) | |
download | openttd-d15dc9f40f5a20bff452547a2dcb15231f9f969d.tar.xz |
Add: support for emscripten (play-OpenTTD-in-the-browser)
Emscripten compiles to WASM, which can be loaded via
HTML / JavaScript. This allows you to play OpenTTD inside a
browser.
Co-authored-by: milek7 <me@milek7.pl>
Diffstat (limited to 'src/ini.cpp')
-rw-r--r-- | src/ini.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ini.cpp b/src/ini.cpp index 6948bc1ea..fc9b1e8fd 100644 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -13,6 +13,9 @@ #include "string_func.h" #include "fileio_func.h" #include <fstream> +#ifdef __EMSCRIPTEN__ +# include <emscripten.h> +#endif #if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 500) # include <unistd.h> @@ -115,6 +118,10 @@ bool IniFile::SaveToDisk(const char *filename) } #endif +#ifdef __EMSCRIPTEN__ + EM_ASM(if (window["openttd_syncfs"]) openttd_syncfs()); +#endif + return true; } |