From 211178d0843393f80249a245005532184411e661 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 30 Nov 2024 21:06:16 -0500 Subject: [PATCH] fixes3-7-0.txt entry: WASM pull request 1331 The pull request was: https://github.com/NetHack/NetHack/pull/1331 by @guillaumebrunerie The text by @guillaumebrunerie that accompanied the pull request was: I have been working on a browser/mobile port of NetHack 3.7 using cross-compilation to WebAssembly (it is very playable already, you can try it at https://guillaumebrunerie.github.io/nethack/). [screen shot] The existing code for compiling to WebAssembly was a great help, although it wasn't fully up to date and was missing a number of things in order to be able to create a proper window port (for instance there was no way to set 'iflags.window_inited' to true, 'print_glyph' was not working properly as its signature changed, and various other things). This pull request contains various fixes and additions that I found were needed/helpful. Changes: * export more constants/pointers/globals. * fix various types that are incorrect. * disable compression of save files, as it uses fork which isn't supported in WebAssembly. * include 'genl_player_setup' when 'SHIM_GRAPHICS' is defined, in order to make it possible to reuse the existing player selection code. * move initialization of JavaScript global constants up, as I was running in some issue when 'raw_print' was being called before initialization. * change various compilation options for Emscripten, in particular it now generates an ES6 module (easier to use in a modern Javascript project) and exports more methods from Emscripten (for instance to be able to use the virtual file system when saving). * simplify the implementation of the main loop to avoid 'setTimeout' which can be pretty slow in the browser when called many times. * change the way pointer arguments are being sent to JavaScript in 'getArg' (they were being sent as a pointer to the pointer itself on the stack, which doesn't really make sense, now the pointer itself is sent). --- doc/fixes3-7-0.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 0538b7750..1a60a914a 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -2922,6 +2922,8 @@ split "cannot_push" on moverock_done() into a separate function (pr #1282 by argrath) split making pits on do_earthquake() into a separate function and eliminate some gotos on do_earthquake() (pr #1287 by argrath) +update the WASM cross-compile to work with the current + code (pr #1331 by guillaumebrunerie) Code Cleanup and Reorganization