some early startup adjustments
This commit is contained in:
@@ -33,6 +33,7 @@ int FDECL(windows_nh_poskey, (int *, int *, int *));
|
|||||||
void FDECL(windows_raw_print, (const char *));
|
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);
|
||||||
|
|
||||||
char orgdir[PATHLEN];
|
char orgdir[PATHLEN];
|
||||||
boolean getreturn_enabled;
|
boolean getreturn_enabled;
|
||||||
@@ -72,6 +73,9 @@ char *argv[];
|
|||||||
*/
|
*/
|
||||||
if (!WINDOWPORT("safe-startup"))
|
if (!WINDOWPORT("safe-startup"))
|
||||||
windowprocs = *get_safe_procs(1);
|
windowprocs = *get_safe_procs(1);
|
||||||
|
if (!GUILaunched)
|
||||||
|
windowprocs.win_nhgetch = windows_console_custom_nhgetch;
|
||||||
|
|
||||||
sys_early_init();
|
sys_early_init();
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# ifdef DEBUG
|
# ifdef DEBUG
|
||||||
@@ -311,6 +315,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
/*
|
/*
|
||||||
* It seems you really want to play.
|
* It seems you really want to play.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* In 3.6.0, several ports process options before they init
|
/* In 3.6.0, several ports process options before they init
|
||||||
* the window port. This allows settings that impact window
|
* the window port. This allows settings that impact window
|
||||||
* ports to be specified or read from the sys or user config files.
|
* ports to be specified or read from the sys or user config files.
|
||||||
|
|||||||
+17
-3
@@ -53,6 +53,7 @@ static HWND GetConsoleHwnd(void);
|
|||||||
#if !defined(TTY_GRAPHICS)
|
#if !defined(TTY_GRAPHICS)
|
||||||
extern void NDECL(backsp);
|
extern void NDECL(backsp);
|
||||||
#endif
|
#endif
|
||||||
|
int NDECL(windows_console_custom_nhgetch);
|
||||||
|
|
||||||
/* The function pointer nt_kbhit contains a kbhit() equivalent
|
/* The function pointer nt_kbhit contains a kbhit() equivalent
|
||||||
* which varies depending on which window port is active.
|
* which varies depending on which window port is active.
|
||||||
@@ -508,15 +509,28 @@ int code;
|
|||||||
* GUILaunched is defined and set in nttty.c.
|
* GUILaunched is defined and set in nttty.c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GUILaunched)
|
|
||||||
getreturn_enabled = TRUE;
|
if (!GUILaunched) {
|
||||||
else
|
|
||||||
windowprocs = *get_safe_procs(1);
|
windowprocs = *get_safe_procs(1);
|
||||||
|
/* use our custom version which works
|
||||||
|
a little cleaner than the stdio one */
|
||||||
|
windowprocs.win_nhgetch = windows_console_custom_nhgetch;
|
||||||
|
}
|
||||||
if (getreturn_enabled)
|
if (getreturn_enabled)
|
||||||
wait_synch();
|
wait_synch();
|
||||||
exit(code);
|
exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef kbhit
|
||||||
|
#include <conio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
windows_console_custom_nhgetch(VOID_ARGS)
|
||||||
|
{
|
||||||
|
return _getch();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
getreturn(str)
|
getreturn(str)
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ stdio_wait_synch()
|
|||||||
|
|
||||||
fprintf(stdout, "--More--");
|
fprintf(stdout, "--More--");
|
||||||
(void) fflush(stdout);
|
(void) fflush(stdout);
|
||||||
while (!index(valid, stdio_nhgetch()))
|
while (!index(valid, nhgetch()))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user