Some nttty.c clean-up.
This commit is contained in:
@@ -1620,6 +1620,7 @@ E int NDECL(tgetch);
|
|||||||
E int FDECL(ntposkey, (int *, int *, int *));
|
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);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ### o_init.c ### */
|
/* ### o_init.c ### */
|
||||||
@@ -2779,6 +2780,11 @@ E void NDECL(dump_close_log);
|
|||||||
E void FDECL(dump_redirect, (BOOLEAN_P));
|
E void FDECL(dump_redirect, (BOOLEAN_P));
|
||||||
E void FDECL(dump_forward_putstr, (winid, int, const char*, int));
|
E void FDECL(dump_forward_putstr, (winid, int, const char*, int));
|
||||||
|
|
||||||
|
/* ### winnt.c ### */
|
||||||
|
#ifdef WIN32
|
||||||
|
E void NDECL(nethack_enter_winnt);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ### wizard.c ### */
|
/* ### wizard.c ### */
|
||||||
|
|
||||||
E void NDECL(amulet);
|
E void NDECL(amulet);
|
||||||
|
|||||||
@@ -352,4 +352,10 @@ struct savefile_info {
|
|||||||
#define PANICTRACE_GDB
|
#define PANICTRACE_GDB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Supply nethack_enter macro if not supplied by port */
|
||||||
|
#ifndef nethack_enter
|
||||||
|
#define nethack_enter(argc, argv) ((void) 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* GLOBAL_H */
|
#endif /* GLOBAL_H */
|
||||||
|
|||||||
@@ -256,4 +256,6 @@ extern void FDECL(ntassert_failed, (const char * exp, const char * file,
|
|||||||
(ntassert_failed(#expression, __FILE__, __LINE__), 0))
|
(ntassert_failed(#expression, __FILE__, __LINE__), 0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define nethack_enter(argc, argv) nethack_enter_winnt()
|
||||||
|
|
||||||
#endif /* NTCONF_H */
|
#endif /* NTCONF_H */
|
||||||
|
|||||||
+10
-6
@@ -57,12 +57,14 @@ extern void FDECL(nethack_exit, (int));
|
|||||||
extern boolean getreturn_enabled; /* from sys/share/pcsys.c */
|
extern boolean getreturn_enabled; /* from sys/share/pcsys.c */
|
||||||
extern int redirect_stdout; /* from sys/share/pcsys.c */
|
extern int redirect_stdout; /* from sys/share/pcsys.c */
|
||||||
extern int GUILaunched;
|
extern int GUILaunched;
|
||||||
HANDLE hStdOut;
|
|
||||||
char *NDECL(exename);
|
char *NDECL(exename);
|
||||||
char default_window_sys[] = "mswin";
|
char default_window_sys[] = "mswin";
|
||||||
|
#ifndef WIN32CON
|
||||||
|
HANDLE hStdOut;
|
||||||
boolean NDECL(fakeconsole);
|
boolean NDECL(fakeconsole);
|
||||||
void NDECL(freefakeconsole);
|
void NDECL(freefakeconsole);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MSWIN_GRAPHICS)
|
#if defined(MSWIN_GRAPHICS)
|
||||||
extern void NDECL(mswin_destroy_reg);
|
extern void NDECL(mswin_destroy_reg);
|
||||||
@@ -93,6 +95,8 @@ char *argv[];
|
|||||||
{
|
{
|
||||||
boolean resuming;
|
boolean resuming;
|
||||||
|
|
||||||
|
nethack_enter(argc, argv);
|
||||||
|
|
||||||
sys_early_init();
|
sys_early_init();
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
Strcpy(default_window_sys, "tty");
|
Strcpy(default_window_sys, "tty");
|
||||||
@@ -358,7 +362,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
Strcpy(hackdir, dir);
|
Strcpy(hackdir, dir);
|
||||||
}
|
}
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
#if defined(WIN32)
|
#if defined(WIN32) && !defined(WIN32CON)
|
||||||
int sfd = 0;
|
int sfd = 0;
|
||||||
boolean tmpconsole = FALSE;
|
boolean tmpconsole = FALSE;
|
||||||
hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
@@ -368,7 +372,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
* may do a prscore().
|
* may do a prscore().
|
||||||
*/
|
*/
|
||||||
if (!strncmp(argv[1], "-s", 2)) {
|
if (!strncmp(argv[1], "-s", 2)) {
|
||||||
#if defined(WIN32)
|
#if defined(WIN32) && !defined(WIN32CON)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!hStdOut) {
|
if (!hStdOut) {
|
||||||
@@ -395,7 +399,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
initoptions();
|
initoptions();
|
||||||
#endif
|
#endif
|
||||||
prscore(argc, argv);
|
prscore(argc, argv);
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(WIN32CON)
|
||||||
if (tmpconsole) {
|
if (tmpconsole) {
|
||||||
getreturn("to exit");
|
getreturn("to exit");
|
||||||
freefakeconsole();
|
freefakeconsole();
|
||||||
@@ -421,7 +425,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
#endif
|
#endif
|
||||||
nhusage();
|
nhusage();
|
||||||
|
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(WIN32CON)
|
||||||
if (tmpconsole) {
|
if (tmpconsole) {
|
||||||
getreturn("to exit");
|
getreturn("to exit");
|
||||||
freefakeconsole();
|
freefakeconsole();
|
||||||
@@ -918,7 +922,7 @@ authorize_wizard_mode()
|
|||||||
#define PATH_SEPARATOR '\\'
|
#define PATH_SEPARATOR '\\'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && !defined(WIN32CON)
|
||||||
static char exenamebuf[PATHLEN];
|
static char exenamebuf[PATHLEN];
|
||||||
extern HANDLE hConIn;
|
extern HANDLE hConIn;
|
||||||
extern HANDLE hConOut;
|
extern HANDLE hConOut;
|
||||||
|
|||||||
+377
-451
File diff suppressed because it is too large
Load Diff
+11
-1
@@ -207,7 +207,7 @@ VA_DECL(const char *, s)
|
|||||||
/* error() may get called before tty is initialized */
|
/* error() may get called before tty is initialized */
|
||||||
if (iflags.window_inited)
|
if (iflags.window_inited)
|
||||||
end_screen();
|
end_screen();
|
||||||
if (!strncmpi(windowprocs.name, "tty", 3)) {
|
if (windowprocs.name != NULL && !strncmpi(windowprocs.name, "tty", 3)) {
|
||||||
buf[0] = '\n';
|
buf[0] = '\n';
|
||||||
(void) vsprintf(&buf[1], s, VA_ARGS);
|
(void) vsprintf(&buf[1], s, VA_ARGS);
|
||||||
Strcat(buf, "\n");
|
Strcat(buf, "\n");
|
||||||
@@ -473,9 +473,19 @@ void ntassert_failed(const char * exp, const char * file, int line)
|
|||||||
DebugBreak();
|
DebugBreak();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// strip off the newline
|
||||||
|
message[strlen(message) - 1] = '\0';
|
||||||
error(message);
|
error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* nethack_enter_winnt() is the first thing called from main */
|
||||||
|
void nethack_enter_winnt()
|
||||||
|
{
|
||||||
|
#ifdef WIN32CON
|
||||||
|
nethack_enter_nttty();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
/*winnt.c*/
|
/*winnt.c*/
|
||||||
|
|||||||
@@ -3398,10 +3398,6 @@ int dir;
|
|||||||
{
|
{
|
||||||
if (dir != WININIT)
|
if (dir != WININIT)
|
||||||
return;
|
return;
|
||||||
#if defined(WIN32CON)
|
|
||||||
if (!strncmpi(windowprocs.name, "tty", 3))
|
|
||||||
nttty_open(0);
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user