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:
@@ -15,10 +15,6 @@
|
||||
#include "mhmain.h"
|
||||
#include "mhmap.h"
|
||||
|
||||
#if !defined(SAFEPROCS)
|
||||
#error You must #define SAFEPROCS to build NetHackW.c
|
||||
#endif
|
||||
|
||||
/* Borland and MinGW redefine "boolean" in shlwapi.h,
|
||||
so just use the little bit we need */
|
||||
typedef struct _DLLVERSIONINFO {
|
||||
@@ -99,32 +95,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
UNREFERENCED_PARAMETER(nCmdShow);
|
||||
|
||||
/*
|
||||
* Get a set of valid safe windowport function
|
||||
* pointers during early startup initialization.
|
||||
*
|
||||
* When get_safe_procs is called with 0 as the param,
|
||||
* non-functional, but safe function pointers are set
|
||||
* for all windowport routines.
|
||||
*
|
||||
* When get_safe_procs is called with 1 as the param,
|
||||
* raw_print, raw_print_bold, and wait_synch, and nhgetch
|
||||
* are set to use C stdio routines via stdio_raw_print,
|
||||
* stdio_raw_print_bold, stdio_wait_synch, and
|
||||
* stdio_nhgetch.
|
||||
*/
|
||||
windowprocs = *get_safe_procs(0);
|
||||
|
||||
/*
|
||||
* Now we are going to override a couple
|
||||
* of the windowprocs functions so that
|
||||
* error messages are handled in a suitable
|
||||
* way for the graphical version.
|
||||
*/
|
||||
windowprocs.win_raw_print = mswin_raw_print;
|
||||
windowprocs.win_raw_print_bold = mswin_raw_print_bold;
|
||||
windowprocs.win_wait_synch = mswin_wait_synch;
|
||||
|
||||
win10_init();
|
||||
early_init(0, NULL); /* Change as needed to support CRASHREPORT */
|
||||
|
||||
|
||||
@@ -734,9 +734,6 @@ mswin_exit_nhwindows(const char *str)
|
||||
/* Write Window settings to the registry */
|
||||
mswin_write_reg();
|
||||
|
||||
/* set things back to failsafes */
|
||||
windowprocs = *get_safe_procs(0);
|
||||
|
||||
/* and make sure there is still a way to communicate something */
|
||||
windowprocs.win_raw_print = mswin_raw_print;
|
||||
windowprocs.win_raw_print_bold = mswin_raw_print_bold;
|
||||
|
||||
Reference in New Issue
Block a user