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:
@@ -156,7 +156,6 @@ static boolean check_font_widths(void);
|
||||
#endif
|
||||
static void set_known_good_console_font(void);
|
||||
static void restore_original_console_font(void);
|
||||
extern void safe_routines(void);
|
||||
void tty_ibmgraphics_fixup(void);
|
||||
#ifdef VIRTUAL_TERMINAL_SEQUENCES
|
||||
extern void (*ibmgraphics_mode_callback)(void); /* symbols.c */
|
||||
@@ -1189,8 +1188,6 @@ consoletty_open(int mode UNUSED)
|
||||
void
|
||||
consoletty_exit(void)
|
||||
{
|
||||
/* go back to using the safe routines */
|
||||
safe_routines();
|
||||
free_custom_colors();
|
||||
free((genericptr_t) console.front_buffer);
|
||||
free((genericptr_t) console.back_buffer);
|
||||
@@ -2546,9 +2543,13 @@ void early_raw_print(const char *s)
|
||||
|
||||
void nethack_enter_consoletty(void)
|
||||
{
|
||||
int width;
|
||||
#ifdef VIRTUAL_TERMINAL_SEQUENCES
|
||||
char buf[BUFSZ], *bp, *localestr;
|
||||
BOOL apisuccess;
|
||||
// DWORD unused;
|
||||
// int i = 0;
|
||||
|
||||
#endif /* VIRTUAL_TERMINAL_SEQUENCES */
|
||||
#if 0
|
||||
/* set up state needed by early_raw_print() */
|
||||
@@ -2562,13 +2563,38 @@ void nethack_enter_consoletty(void)
|
||||
GetWindowLong(console.hWnd, GWL_STYLE)
|
||||
& ~WS_MAXIMIZEBOX & ~WS_SIZEBOX);
|
||||
#endif
|
||||
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi)) {
|
||||
/* srWindow identifies the visible area; dwSize identifies the buffer
|
||||
*/
|
||||
width = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
||||
fprintf(stdout, "width = %d\n", width);
|
||||
}
|
||||
|
||||
console.hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
nhassert(console.hConOut != NULL); // NOTE: this assert will not print
|
||||
GetConsoleScreenBufferInfo(console.hConOut, &console.orig_csbi);
|
||||
//COORD screencheck = GetLargestConsoleWindowSize(console.hConOut);
|
||||
|
||||
GetConsoleMode(console.hConOut, &console.orig_out_cmode);
|
||||
console.out_cmode = console.orig_out_cmode;
|
||||
console.out_cmode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
SetConsoleMode(console.hConOut, console.out_cmode);
|
||||
#if 0
|
||||
/* tests */
|
||||
WriteConsoleA(console.hConOut, "\033[8;;133t",9, &unused, NULL);
|
||||
for (i = 0; i < 13; ++i) {
|
||||
WriteConsoleA(console.hConOut, "0123456789", 10, &unused, NULL);
|
||||
}
|
||||
WriteConsoleA(console.hConOut, "\033[3;133ftest", 12, &unused, NULL);
|
||||
GetConsoleScreenBufferInfo(console.hConOut, &console.orig_csbi);
|
||||
/* Testing of widths != COLNO has not turned up any problems. Need
|
||||
* to do a bit more testing and then we are likely to enable having
|
||||
* console width match window width.
|
||||
*/
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
console.width = console.orig_csbi.srWindow.Right -
|
||||
console.orig_csbi.srWindow.Left + 1;
|
||||
|
||||
Reference in New Issue
Block a user