some further Windows startup tweaking

This commit is contained in:
nhmall
2026-04-09 14:04:28 -04:00
parent 699c31459b
commit 335cd65d5a
2 changed files with 26 additions and 12 deletions

View File

@@ -198,6 +198,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
#endif #endif
gh.hname = "NetHack"; /* used for syntax messages */ gh.hname = "NetHack"; /* used for syntax messages */
set_emergency_io();
#ifndef MSWIN_GRAPHICS #ifndef MSWIN_GRAPHICS
early_init(argc, argv); /* already in WinMain for MSWIN_GRAPHICS */ early_init(argc, argv); /* already in WinMain for MSWIN_GRAPHICS */
#endif #endif
@@ -219,7 +220,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
nethack_enter_consoletty(); nethack_enter_consoletty();
consoletty_open(1); consoletty_open(1);
#endif #endif
set_emergency_io();
#ifdef EARLY_CONFIGFILE_PASS #ifdef EARLY_CONFIGFILE_PASS
rcfile_interface_options(); rcfile_interface_options();
@@ -237,10 +237,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
choose_windows( choose_windows(
windowtype); /* sets all the window port function pointers */ windowtype); /* sets all the window port function pointers */
init_nhwindows(&argc, argv);
/* if (GUILaunched || IsDebuggerPresent()) */
getreturn_enabled = TRUE;
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
/* Save current directory and make sure it gets restored when /* Save current directory and make sure it gets restored when
* the game is exited. * the game is exited.
@@ -252,19 +248,19 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
set_default_prefix_locations( set_default_prefix_locations(
argv[0]); /* must be re-done after initoptions_init() argv[0]); /* must be re-done after initoptions_init()
* which clears out gp.fqn_prefix[] */ * which clears out gp.fqn_prefix[] */
iflags.windowtype_deferred = TRUE; // iflags.windowtype_deferred = TRUE;
program_state.early_options = 1; program_state.early_options = 1;
early_options(&argc, &argv, &dir); early_options(&argc, &argv, &dir);
program_state.early_options = 0; program_state.early_options = 0;
initoptions(); /* if (GUILaunched || IsDebuggerPresent()) */
getreturn_enabled = TRUE;
initoptions();
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdir(gf.fqn_prefix[HACKPREFIX]); chdir(gf.fqn_prefix[HACKPREFIX]);
#endif #endif
check_recordfile((char *) 0); check_recordfile((char *) 0);
/* did something earlier flag a need to exit without starting a game? */ /* did something earlier flag a need to exit without starting a game? */
if (windows_startup_state > 0) { if (windows_startup_state > 0) {
@@ -292,7 +288,21 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
&& (strstri(argv[0], "nethackw.exe") || GUILaunched)) && (strstri(argv[0], "nethackw.exe") || GUILaunched))
iflags.windowtype_locked = TRUE; iflags.windowtype_locked = TRUE;
#endif #endif
#ifdef WINCHAIN
commit_windowchain();
#endif
init_nhwindows(&argc, argv);
#ifdef TTY_GRAPHICS
if WINDOWPORT(tty) {
int i;
for (i = 0; i < 20; ++i) {
nh_delay_output();
}
/* wait_synch(); */
}
#endif
#ifdef DLB #ifdef DLB
if (!dlb_init()) { if (!dlb_init()) {
pline("%s\n%s\n%s\n%s\n\n", copyright_banner_line(1), pline("%s\n%s\n%s\n%s\n\n", copyright_banner_line(1),
@@ -318,9 +328,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
iflags.use_background_glyph = FALSE; iflags.use_background_glyph = FALSE;
if (WINDOWPORT(mswin)) if (WINDOWPORT(mswin))
iflags.use_background_glyph = TRUE; iflags.use_background_glyph = TRUE;
#ifdef WINCHAIN
commit_windowchain();
#endif
// init_nhwindows(&argc, argv); // init_nhwindows(&argc, argv);

View File

@@ -211,6 +211,13 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
free(savefile); free(savefile);
} }
GUILaunched = 1; GUILaunched = 1;
/* emergency IO */
windowprocs.win_raw_print = mswin_raw_print;
windowprocs.win_raw_print_bold = mswin_raw_print_bold;
mswin_nh_input_init();
windowprocs.win_nhgetch = mswin_nhgetch;
windowprocs.win_wait_synch = mswin_wait_synch;
/* let nethackw_main do the argument processing */ /* let nethackw_main do the argument processing */
nethackw_main(argc, argv); nethackw_main(argc, argv);
/* not reached */ /* not reached */