]> granicus.if.org Git - nethack/commitdiff
Report of no error msg deliverd by NetHackw.exe for some startup issues
authornhmall <nhmall@nethack.org>
Sun, 12 May 2019 01:55:27 +0000 (21:55 -0400)
committernhmall <nhmall@nethack.org>
Sun, 12 May 2019 01:55:27 +0000 (21:55 -0400)
include/ntconf.h
sys/winnt/stubs.c
sys/winnt/windmain.c
sys/winnt/winnt.c

index bcfe2e9ee94bb0a38594a812f93f1a19491fd5b3..234eefbcc3669cba0b37d7155dd17c944dc6001d 100644 (file)
@@ -282,4 +282,5 @@ extern void FDECL(nhassert_failed, (const char * exp, const char * file,
 
 #define nethack_enter(argc, argv) nethack_enter_winnt()
 extern void FDECL(nethack_exit, (int)) NORETURN;
+extern boolean FDECL(file_exists, (const char *));
 #endif /* NTCONF_H */
index ab6b52271304206f5e6bb0295a6bd7a11aa89de1..ea38e3a57dad09a51b5813225b8cbd2a7c7ed217 100644 (file)
@@ -22,6 +22,15 @@ mswin_destroy_reg()
 {
     return;
 }
+void
+mswin_raw_print_flush()
+{
+}
+
+void
+mswin_raw_print(const char *str)
+{
+}
 
 /* MINGW32 has trouble with both a main() and WinMain()
  * so we move main for the MINGW tty version into this stub
index 24fd33746aea3543be21ce6c41b4e0149574e3b9..b2bb18e7946f1746de9c48741c748cdaf847161b 100644 (file)
@@ -240,19 +240,28 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
 /*
  * It seems you really want to play.
  */
-
     if (argc >= 1
         && !strcmpi(default_window_sys, "mswin")
         && (strstri(argv[0], "nethackw.exe") || GUILaunched))
-            iflags.windowtype_locked = TRUE;
-
+        iflags.windowtype_locked = TRUE;
     windowtype = default_window_sys;
+
+    if (!dlb_init()) {
+        pline("%s\n%s\n%s\n%s\n\n",
+              copyright_banner_line(1), copyright_banner_line(2),
+              copyright_banner_line(3), copyright_banner_line(4));
+        pline("NetHack was unable to open the required file \"%s\"",DLBFILE);
+        if (file_exists(DLBFILE))
+            pline("\nAre you perhaps trying to run NetHack within a zip utility?");
+        error("dlb_init failure.");
+    }
+
     if (!iflags.windowtype_locked) {
 #if defined(TTY_GRAPHICS)
         Strcpy(default_window_sys, "tty");
 #else
 #if defined(CURSES_GRAPHICS)
-        Strcpy(default_window_sys, "curses");    
+        Strcpy(default_window_sys, "curses");
 #endif /* CURSES */
 #endif /* TTY */
         if (iflags.windowtype_deferred && chosen_windowtype[0])
@@ -260,16 +269,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
     }
     choose_windows(windowtype);
 
-    if (!dlb_init()) {
-        pline(
-            "%s\n%s\n%s\n%s\n\nNetHack was unable to open the required file "
-            "\"%s\".%s",
-            copyright_banner_line(1), copyright_banner_line(2),
-            copyright_banner_line(3), copyright_banner_line(4), DLBFILE,
-            "\nAre you perhaps trying to run NetHack within a zip utility?");
-        error("dlb_init failure.");
-    }
-
     u.uhp = 1; /* prevent RIP on early quits */
     u.ux = 0;  /* prevent flush_screen() */
 
@@ -931,4 +930,17 @@ gotlock:
 }
 #endif /* PC_LOCKING */
 
+boolean
+file_exists(path)
+const char *path;
+{
+    struct stat sb;
+
+    /* Just see if it's there */
+    if (stat(path, &sb)) {
+        return FALSE;
+    }
+    return TRUE;
+}
+
 /*windmain.c*/
index fc75071d84b35747c4662e494833f4622097bd2b..d583253b56f1e50a488a8aa109a31382eec63ef4 100644 (file)
@@ -212,6 +212,9 @@ return &szFullPath[0];
 }
 #endif
 
+extern void NDECL(mswin_raw_print_flush);
+extern void FDECL(mswin_raw_print, (const char *));
+
 /* fatal error */
 /*VARARGS1*/
 void error
@@ -233,6 +236,8 @@ VA_DECL(const char *, s)
         Strcat(buf, "\n");
         raw_printf(buf);
     }
+    if (windowprocs.win_raw_print == mswin_raw_print)
+        mswin_raw_print_flush();
     VA_END();
     exit(EXIT_FAILURE);
 }