Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-12-29 12:37:27 -05:00
4 changed files with 33 additions and 7 deletions

View File

@@ -1640,6 +1640,7 @@ E int FDECL(ntposkey, (int *, int *, int *));
E void FDECL(set_output_mode, (int)); E void FDECL(set_output_mode, (int));
E void NDECL(synch_cursor); E void NDECL(synch_cursor);
E void NDECL(nethack_enter_nttty); E void NDECL(nethack_enter_nttty);
E void NDECL(nttty_exit);
#endif #endif
/* ### o_init.c ### */ /* ### o_init.c ### */

View File

@@ -83,6 +83,7 @@ static void NDECL(check_and_set_font);
static boolean NDECL(check_font_widths); static boolean NDECL(check_font_widths);
static void NDECL(set_known_good_console_font); static void NDECL(set_known_good_console_font);
static void NDECL(restore_original_console_font); static void NDECL(restore_original_console_font);
extern void NDECL(safe_routines);
/* Win32 Screen buffer,coordinate,console I/O information */ /* Win32 Screen buffer,coordinate,console I/O information */
COORD ntcoord; COORD ntcoord;
@@ -413,6 +414,13 @@ int mode; // unused
really_move_cursor(); really_move_cursor();
} }
void
nttty_exit()
{
/* go back to using the safe routines */
safe_routines();
}
int int
process_keystroke(ir, valid, numberpad, portdebug) process_keystroke(ir, valid, numberpad, portdebug)
INPUT_RECORD *ir; INPUT_RECORD *ir;
@@ -1701,6 +1709,7 @@ void set_cp_map()
} }
} }
#if 0
/* early_raw_print() is used during early game intialization prior to the /* early_raw_print() is used during early game intialization prior to the
* setting up of the windowing system. This allows early errors and panics * setting up of the windowing system. This allows early errors and panics
* to have there messages displayed. * to have there messages displayed.
@@ -1760,8 +1769,10 @@ void early_raw_print(const char *s)
SetConsoleCursorPosition(console.hConOut, console.cursor); SetConsoleCursorPosition(console.hConOut, console.cursor);
} }
#endif
/* nethack_enter_nttty() is the first thing that is called from main. /* nethack_enter_nttty() is the first thing that is called from main
* once the tty port is confirmed.
* *
* We initialize all console state to support rendering to the console * We initialize all console state to support rendering to the console
* through out flipping support at this time. This allows us to support * through out flipping support at this time. This allows us to support
@@ -1787,9 +1798,10 @@ void early_raw_print(const char *s)
void nethack_enter_nttty() void nethack_enter_nttty()
{ {
#if 0
/* set up state needed by early_raw_print() */ /* set up state needed by early_raw_print() */
windowprocs.win_raw_print = early_raw_print; windowprocs.win_raw_print = early_raw_print;
#endif
console.hConOut = GetStdHandle(STD_OUTPUT_HANDLE); console.hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
nhassert(console.hConOut != NULL); // NOTE: this assert will not print nhassert(console.hConOut != NULL); // NOTE: this assert will not print

View File

@@ -46,6 +46,7 @@ void FDECL(windows_raw_print, (const char *));
char FDECL(windows_yn_function, (const char *, const char *, CHAR_P)); char FDECL(windows_yn_function, (const char *, const char *, CHAR_P));
void FDECL(windows_getlin, (const char *, char *)); void FDECL(windows_getlin, (const char *, char *));
extern int NDECL(windows_console_custom_nhgetch); extern int NDECL(windows_console_custom_nhgetch);
void NDECL(safe_routines);
char orgdir[PATHLEN]; char orgdir[PATHLEN];
char *dir; char *dir;
@@ -92,11 +93,7 @@ char *argv[];
* Get a set of valid safe windowport function * Get a set of valid safe windowport function
* pointers during early startup initialization. * pointers during early startup initialization.
*/ */
if (!WINDOWPORT("safe-startup")) safe_routines();
windowprocs = *get_safe_procs(1);
if (!GUILaunched)
windowprocs.win_nhgetch = windows_console_custom_nhgetch;
early_init(); early_init();
#ifdef _MSC_VER #ifdef _MSC_VER
# ifdef DEBUG # ifdef DEBUG
@@ -569,6 +566,19 @@ nhusage()
#undef ADD_USAGE #undef ADD_USAGE
} }
void
safe_routines(VOID_ARGS)
{
/*
* Get a set of valid safe windowport function
* pointers during early startup initialization.
*/
if (!WINDOWPORT("safe-startup"))
windowprocs = *get_safe_procs(1);
if (!GUILaunched)
windowprocs.win_nhgetch = windows_console_custom_nhgetch;
}
#ifdef PORT_HELP #ifdef PORT_HELP
void void
port_help() port_help()

View File

@@ -1353,6 +1353,9 @@ const char *str;
#ifndef NO_TERMS /*(until this gets added to the window interface)*/ #ifndef NO_TERMS /*(until this gets added to the window interface)*/
tty_shutdown(); /* cleanup termcap/terminfo/whatever */ tty_shutdown(); /* cleanup termcap/terminfo/whatever */
#endif
#ifdef WIN32
nttty_exit();
#endif #endif
iflags.window_inited = 0; iflags.window_inited = 0;
} }