Add some windows command line option hooks

This commit is contained in:
nhmall
2018-11-16 19:32:00 -05:00
parent dcac95b4b3
commit 96ec49213f
5 changed files with 52 additions and 2 deletions
+5 -1
View File
@@ -424,7 +424,11 @@ E struct plinemsg_type *plinemsg_types;
E const char *ARGV0; E const char *ARGV0;
#endif #endif
enum earlyarg {ARG_DEBUG, ARG_VERSION}; enum earlyarg {ARG_DEBUG, ARG_VERSION
#ifdef WIN32
,ARG_WINDOWS
#endif
};
struct early_opt { struct early_opt {
enum earlyarg e; enum earlyarg e;
+15
View File
@@ -755,8 +755,15 @@ const char *msg;
static struct early_opt earlyopts[] = { static struct early_opt earlyopts[] = {
{ARG_DEBUG, "debug", 5, TRUE}, {ARG_DEBUG, "debug", 5, TRUE},
{ARG_VERSION, "version", 4, TRUE}, {ARG_VERSION, "version", 4, TRUE},
#ifdef WIN32
{ARG_WINDOWS, "windows", 4, TRUE},
#endif
}; };
#ifdef WIN32
extern int FDECL(windows_early_options, (const char *));
#endif
/* /*
* Returns: * Returns:
* 0 = no match * 0 = no match
@@ -826,6 +833,14 @@ enum earlyarg e_arg;
early_version_info(insert_into_pastebuf); early_version_info(insert_into_pastebuf);
return 2; return 2;
} }
#ifdef WIN32
case ARG_WINDOWS: {
if (extended_opt) {
extended_opt++;
return windows_early_options(extended_opt);
}
}
#endif
default: default:
break; break;
} }
+7
View File
@@ -345,6 +345,13 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
argv++; argv++;
} }
#ifdef WIN32
if (argcheck(argc, argv, ARG_WINDOWS) == 1) {
argc--;
argv++;
}
#endif
if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') { if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
/* avoid matching "-dec" for DECgraphics; since the man page /* avoid matching "-dec" for DECgraphics; since the man page
* says -d directory, hope nobody's using -desomething_else * says -d directory, hope nobody's using -desomething_else
+23
View File
@@ -37,9 +37,13 @@
* *
*/ */
/* runtime cursor display control switch */
boolean win32_cursorblink;
/* globals required within here */ /* globals required within here */
HANDLE ffhandle = (HANDLE) 0; HANDLE ffhandle = (HANDLE) 0;
WIN32_FIND_DATA ffd; WIN32_FIND_DATA ffd;
typedef HWND(WINAPI *GETCONSOLEWINDOW)(); typedef HWND(WINAPI *GETCONSOLEWINDOW)();
static HWND GetConsoleHandle(void); static HWND GetConsoleHandle(void);
static HWND GetConsoleHwnd(void); static HWND GetConsoleHwnd(void);
@@ -581,6 +585,25 @@ BOOL winos_font_support_cp437(HFONT hFont)
return allFound; return allFound;
} }
int
windows_early_options(window_opt)
const char *window_opt;
{
/*
* If you return 2, the game will exit before it begins.
* Return 1, to say the option parsed okay.
* Return 0, to say the option was bad.
*/
if (match_optname(window_opt, "cursorblink", 5, FALSE)) {
win32_cursorblink = TRUE;
return 1;
} else {
raw_printf(
"-%swindows:cursorblink is the only supported option.\n");
}
return 0;
}
#endif /* WIN32 */ #endif /* WIN32 */
/*winnt.c*/ /*winnt.c*/
+1
View File
@@ -88,6 +88,7 @@ static void clearAll(PNHMapWindow data);
#if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2) #if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2)
static void nhglyph2charcolor(short glyph, uchar *ch, int *color); static void nhglyph2charcolor(short glyph, uchar *ch, int *color);
#endif #endif
extern boolean win32_cursorblink; /* from sys\winnt\winnt.c */
HWND HWND
mswin_init_map_window() mswin_init_map_window()