Change Windows startup

remove the safeproc pseudo-windowport routines from
almost a decade ago.

A very early pass is made through the config file,
seeking out just the interface-related OPTIONS=windowport
and OPTIONS=soundlib and ignoring all other options in the
config file during that early pass, so the windowport
can be activated without the NetHack core initialization
in place that some of the other rcfile OPTIONS require.

Bundles the existing rcfile processing code into rcfile().

New functions to control which rcfile options will be
disregarded in the early config file pass, and which will be
processed:

    set_all_options_disregarded();
    set_all_options_heeded();
    disregard_this_option(opt_xx);
    heed_this_option(opt_xx);

Windows calls rcfile_interface_options(), which is
a bundling of a series of function calls to achieve
the desired result.

    void
    rcfile_interface_options(void)
    {
        allopt_array_init();
        set_all_options_disregarded();
        heed_this_option(opt_windowtype);
        heed_this_option(opt_soundlib);
        rcfile();
        set_all_options_heeded();
        disregard_this_option(opt_windowtype);
        disregard_this_option(opt_soundlib);
    }
This commit is contained in:
nhmall
2026-04-05 11:36:19 -04:00
parent 92340a6827
commit acb85b18cf
23 changed files with 450 additions and 959 deletions

View File

@@ -73,7 +73,6 @@ static HWND GetConsoleHwnd(void);
extern void backsp(void);
#endif
int windows_console_custom_nhgetch(void);
extern void safe_routines(void);
int windows_early_options(const char *window_opt);
unsigned long sys_random_seed(void);
#if 0
@@ -293,10 +292,6 @@ win32_abort(void)
exit_nhwindows((char *) 0);
iflags.window_inited = FALSE;
}
#ifdef WIN32CON
if (!WINDOWPORT(mswin) && !WINDOWPORT(safestartup))
safe_routines();
#endif
if (wizard) {
raw_print("Execute debug breakpoint wizard?");
if ((c = nhgetch()) == 'y' || c == 'Y')
@@ -522,15 +517,6 @@ nethack_exit(int code)
* GUILaunched is defined and set in consoletty.c.
*/
#ifdef WIN32CON
if (!GUILaunched) {
windowprocs = *get_safe_procs(1);
/* use our custom version which works
a little cleaner than the stdio one */
windowprocs.win_nhgetch = windows_console_custom_nhgetch;
} else
#endif
if (getreturn_enabled) {
raw_print("\n");
if (iflags.window_inited)
@@ -580,10 +566,6 @@ getreturn(const char *str)
initializing the window port */
void nethack_enter_windows(void)
{
#ifdef WIN32CON
if (WINDOWPORT(tty))
nethack_enter_consoletty();
#endif
}
/* CP437 to Unicode mapping according to the Unicode Consortium */