From 1947eb98a4a7a62ff7d529de1d69a8572ad09239 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 3 May 2026 07:37:13 -0400 Subject: [PATCH] CROSS_TO_WASM build fixes --- src/files.c | 4 ++-- sys/libnh/libnhmain.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/files.c b/src/files.c index 5cb092340..1891ba604 100644 --- a/src/files.c +++ b/src/files.c @@ -2050,7 +2050,7 @@ problematic_savefile(int sfstatus, const char *savefilenm) /* ---------- BEGIN EXTERNAL CONVERSION HANDLING ----------- */ -static boolean cvtinit = FALSE; +/* static boolean cvtinit = FALSE; */ #ifndef SFCTOOL static char *unconverted_filename = 0, *converted_filename = 0; @@ -2171,7 +2171,7 @@ free_convert_filenames(void) free((genericptr_t) converted_filename), converted_filename = 0; if (unconverted_filename) free((genericptr_t) unconverted_filename), unconverted_filename = 0; - cvtinit = FALSE; +/* cvtinit = FALSE; */ } /* return TRUE if s contains a directory, not just a filespec */ diff --git a/sys/libnh/libnhmain.c b/sys/libnh/libnhmain.c index f974bc490..b0c3f5297 100644 --- a/sys/libnh/libnhmain.c +++ b/sys/libnh/libnhmain.c @@ -51,7 +51,7 @@ extern void init_linux_cons(void); static void wd_message(void); static struct passwd *get_unix_pw(void); -ATTRNORETURN static void opt_terminate(void) NORETURN; +/* ATTRNORETURN static void opt_terminate(void) NORETURN; */ #ifdef __EMSCRIPTEN__ /* if WebAssembly, export this API and don't optimize it out */ @@ -769,6 +769,8 @@ sys_random_seed(void) return seed; } +#if 0 +/* now found in earlyarg.c */ /* for command-line options that perform some immediate action and then terminate the program without starting play, like 'nethack --version' or 'nethack -s Zelda'; do some cleanup before that termination */ @@ -780,7 +782,6 @@ opt_terminate(void) nh_terminate(EXIT_SUCCESS); /*NOTREACHED*/ } - /* show the sysconf file name, playground directory, run-time configuration file name, dumplog file name if applicable, and some other things */ ATTRNORETURN void @@ -794,6 +795,31 @@ after_opt_showpaths(const char *dir) opt_terminate(); /*NOTREACHED*/ } +#endif + +void +get_nhuuid(void) +{ + unsigned char stmp[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + if (svn.nhuuid[0]) + return; + + /* FIXME: fill in a useful valid UUID somehow */ + Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", (char *) stmp); +} + +void +free_nhuuid(void) +{ + int i; + + for (i = 0; i < SIZE(svn.nhuuid); i++) { + svn.nhuuid[i] = 0; + } +} #ifdef __EMSCRIPTEN__ /***