more startup tweaking for Windows
This commit is contained in:
@@ -241,16 +241,20 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
Strcpy(hackdir, dir);
|
Strcpy(hackdir, dir);
|
||||||
}
|
}
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
#if 0
|
||||||
#if !defined(TTY_GRAPHICS)
|
#if !defined(TTY_GRAPHICS)
|
||||||
int sfd = 0;
|
int sfd = 0;
|
||||||
boolean tmpconsole = FALSE;
|
boolean tmpconsole = FALSE;
|
||||||
hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now we know the directory containing 'record' and
|
* Now we know the directory containing 'record' and
|
||||||
* may do a prscore().
|
* may do a prscore().
|
||||||
*/
|
*/
|
||||||
if (!strncmp(argv[1], "-s", 2)) {
|
if (!strncmp(argv[1], "-s", 2)) {
|
||||||
|
#if 0
|
||||||
#if !defined(TTY_GRAPHICS)
|
#if !defined(TTY_GRAPHICS)
|
||||||
/*
|
/*
|
||||||
* Check to see if we're redirecting to a file.
|
* Check to see if we're redirecting to a file.
|
||||||
@@ -264,11 +268,13 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
nethack_exit(EXIT_SUCCESS);
|
nethack_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* 0 */
|
||||||
#ifdef SYSCF
|
#ifdef SYSCF
|
||||||
initoptions();
|
initoptions();
|
||||||
#endif
|
#endif
|
||||||
prscore(argc, argv);
|
prscore(argc, argv);
|
||||||
|
|
||||||
|
#if 0
|
||||||
#if !defined(TTY_GRAPHICS)
|
#if !defined(TTY_GRAPHICS)
|
||||||
if (tmpconsole) {
|
if (tmpconsole) {
|
||||||
getreturn("to exit");
|
getreturn("to exit");
|
||||||
@@ -276,25 +282,26 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
tmpconsole = FALSE;
|
tmpconsole = FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* 0 */
|
||||||
nethack_exit(EXIT_SUCCESS);
|
nethack_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
if (GUILaunched) {
|
||||||
#if defined(MSWIN_GRAPHICS)
|
if (!strncmpi(argv[1], "-clearreg", 6)) { /* clear registry */
|
||||||
if (!strncmpi(argv[1], "-clearreg", 6)) { /* clear registry */
|
mswin_destroy_reg();
|
||||||
mswin_destroy_reg();
|
nethack_exit(EXIT_SUCCESS);
|
||||||
nethack_exit(EXIT_SUCCESS);
|
}
|
||||||
}
|
}
|
||||||
#endif
|
/* Don't initialize the full window system just to print usage */
|
||||||
/* Don't initialize the window system just to print usage */
|
|
||||||
if (!strncmp(argv[1], "-?", 2) || !strncmp(argv[1], "/?", 2)) {
|
if (!strncmp(argv[1], "-?", 2) || !strncmp(argv[1], "/?", 2)) {
|
||||||
nhusage();
|
nhusage();
|
||||||
|
#if 0
|
||||||
#if !defined(TTY_GRAPHICS)
|
#if !defined(TTY_GRAPHICS)
|
||||||
if (tmpconsole) {
|
if (tmpconsole) {
|
||||||
getreturn("to exit");
|
getreturn("to exit");
|
||||||
freefakeconsole();
|
freefakeconsole();
|
||||||
tmpconsole = FALSE;
|
tmpconsole = FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
nethack_exit(EXIT_SUCCESS);
|
nethack_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -313,18 +320,19 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
|
|
||||||
if (argc >= 1
|
if (argc >= 1
|
||||||
&& !strcmpi(default_window_sys, "mswin")
|
&& !strcmpi(default_window_sys, "mswin")
|
||||||
&& strstri(argv[0], "nethackw.exe"))
|
&& (strstri(argv[0], "nethackw.exe") || GUILaunched))
|
||||||
iflags.windowtype_locked = TRUE;
|
iflags.windowtype_locked = TRUE;
|
||||||
|
|
||||||
|
if (!iflags.windowtype_locked) {
|
||||||
#if defined(TTY_GRAPHICS)
|
#if defined(TTY_GRAPHICS)
|
||||||
if (!iflags.windowtype_locked)
|
|
||||||
Strcpy(default_window_sys, "tty");
|
Strcpy(default_window_sys, "tty");
|
||||||
#else
|
#else
|
||||||
#if defined(CURSES_GRAPHICS)
|
#if defined(CURSES_GRAPHICS)
|
||||||
if (!iflags.windowtype_locked)
|
|
||||||
Strcpy(default_window_sys, "curses");
|
Strcpy(default_window_sys, "curses");
|
||||||
#endif
|
#endif /* CURSES */
|
||||||
#endif
|
#endif /* TTY */
|
||||||
|
}
|
||||||
|
|
||||||
choose_windows(default_window_sys);
|
choose_windows(default_window_sys);
|
||||||
if (!dlb_init()) {
|
if (!dlb_init()) {
|
||||||
pline(
|
pline(
|
||||||
|
|||||||
@@ -495,12 +495,12 @@ void nhassert_failed(const char * exp, const char * file, int line)
|
|||||||
error(message);
|
error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nethack_enter_winnt() is the first thing called from main */
|
/* nethack_enter_winnt() is called from main immediately after
|
||||||
|
initializing the window port */
|
||||||
void nethack_enter_winnt()
|
void nethack_enter_winnt()
|
||||||
{
|
{
|
||||||
#ifdef TTY_GRAPHICS
|
if (WINDOWPORT("tty"))
|
||||||
nethack_enter_nttty();
|
nethack_enter_nttty();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CP437 to Unicode mapping according to the Unicode Consortium */
|
/* CP437 to Unicode mapping according to the Unicode Consortium */
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ _nhapply_image_transparent(HDC hDC, int x, int y, int width, int height,
|
|||||||
|
|
||||||
// Global Variables:
|
// Global Variables:
|
||||||
NHWinApp _nethack_app;
|
NHWinApp _nethack_app;
|
||||||
|
extern int GUILaunched; /* We tell shared startup code in windmain.c
|
||||||
|
that the GUI was launched via this */
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#define _stricmp(s1, s2) stricmp(s1, s2)
|
#define _stricmp(s1, s2) stricmp(s1, s2)
|
||||||
@@ -233,7 +235,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||||||
}
|
}
|
||||||
free(savefile);
|
free(savefile);
|
||||||
}
|
}
|
||||||
|
GUILaunched = 1;
|
||||||
/* let main do the argument processing */
|
/* let main do the argument processing */
|
||||||
(void) main(argc, argv);
|
(void) main(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user