Merge branch 'windows-makefile' into NetHack-3.7

This commit is contained in:
nhmall
2022-12-05 13:27:25 -05:00
13 changed files with 1345 additions and 934 deletions
+1 -1
View File
@@ -254,7 +254,7 @@ typedef uchar nhsym;
#endif #endif
#if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) \ #if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) \
|| defined(WIN32) || defined(MSWIN_GRAPHICS)
#ifndef NO_TILE_C #ifndef NO_TILE_C
#ifndef USE_TILES #ifndef USE_TILES
#define USE_TILES /* glyphmap[] with prefilled tile mappings will be available */ #define USE_TILES /* glyphmap[] with prefilled tile mappings will be available */
+1 -1
View File
@@ -561,7 +561,7 @@ static int optfn_##a(int, int, boolean, char *, char *);
#endif #endif
NHOPTC(statuslines, Status, 20, opt_in, set_in_game, NHOPTC(statuslines, Status, 20, opt_in, set_in_game,
No, Yes, No, No, NoAlias, "2 or 3 lines for status display") No, Yes, No, No, NoAlias, "2 or 3 lines for status display")
#ifdef WIN32 #ifdef WIN32CON
NHOPTC(subkeyvalue, Advanced, 7, opt_in, set_in_config, NHOPTC(subkeyvalue, Advanced, 7, opt_in, set_in_config,
No, Yes, Yes, No, NoAlias, "override keystroke value") No, Yes, Yes, No, NoAlias, "override keystroke value")
#endif #endif
+1 -1
View File
@@ -29,7 +29,7 @@
#define DUMPLOG_MSG_COUNT 50 #define DUMPLOG_MSG_COUNT 50
#define USER_SOUNDS #define USER_SOUNDS
#define TTY_SOUND_ESCCODES /* #define TTY_SOUND_ESCCODES */
/*#define CHANGE_COLOR*/ /* allow palette changes */ /*#define CHANGE_COLOR*/ /* allow palette changes */
+6
View File
@@ -12,6 +12,7 @@ Systos
SysBe SysBe
nethack nethack
*.o *.o
*.tag
tiles.bmp tiles.bmp
*.moc *.moc
*.lnk *.lnk
@@ -21,4 +22,9 @@ o
nhdat* nhdat*
date.nmk date.nmk
tilemappings.lst tilemappings.lst
objgui/*
objtty/*
objutil/*
objlua/*
objpdc/*
+1 -1
View File
@@ -426,7 +426,7 @@ moveloop_core(void)
gc.context.move = 1; gc.context.move = 1;
if (gm.multi >= 0 && go.occupation) { if (gm.multi >= 0 && go.occupation) {
#if defined(MICRO) || defined(WIN32) #if defined(MICRO) || defined(WIN32CON)
mvl_abort_lev = 0; mvl_abort_lev = 0;
if (kbhit()) { if (kbhit()) {
char ch; char ch;
+4 -4
View File
@@ -715,7 +715,7 @@ optfn_altkeyhandling(
if (req == do_set) { if (req == do_set) {
/* altkeyhandling:string */ /* altkeyhandling:string */
#if defined(WIN32) && defined(TTY_GRAPHICS) #if defined(WIN32CON) && defined(TTY_GRAPHICS)
if (op == empty_optstr || negated) if (op == empty_optstr || negated)
return optn_err; return optn_err;
set_altkeyhandling(op); set_altkeyhandling(op);
@@ -739,7 +739,7 @@ optfn_altkeyhandling(
#endif #endif
return optn_ok; return optn_ok;
} }
#ifdef WIN32 #ifdef WIN32CON
if (req == do_handler) { if (req == do_handler) {
return set_keyhandling_via_option(); return set_keyhandling_via_option();
} }
@@ -3399,7 +3399,7 @@ optfn_statuslines(int optidx, int req, boolean negated, char *opts, char *op)
return optn_ok; return optn_ok;
} }
#ifdef WIN32 #ifdef WIN32CON
static int static int
optfn_subkeyvalue(int optidx UNUSED, int req, boolean negated UNUSED, optfn_subkeyvalue(int optidx UNUSED, int req, boolean negated UNUSED,
char *opts, char *op UNUSED) char *opts, char *op UNUSED)
@@ -3423,7 +3423,7 @@ optfn_subkeyvalue(int optidx UNUSED, int req, boolean negated UNUSED,
} }
return optn_ok; return optn_ok;
} }
#endif /* WIN32 */ #endif /* WIN32CON */
static int static int
optfn_suppress_alert(int optidx, int req, boolean negated, optfn_suppress_alert(int optidx, int req, boolean negated,
+1252 -680
View File
File diff suppressed because it is too large Load Diff
-228
View File
@@ -1,228 +0,0 @@
/* NetHack 3.7 stubs.c $NHDT-Date: 1596498317 2020/08/03 23:45:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.31 $ */
/* Copyright (c) 2015 by Michael Allison */
/* NetHack may be freely redistributed. See license for details. */
#include "win32api.h"
#include "hack.h"
#ifdef GUISTUB
#ifdef TTYSTUB
#error You cannot compile this with both GUISTUB and TTYSTUB defined.
#endif
struct window_procs mswin_procs = { WPIDMINUS(guistubs) };
#ifdef QT_GRAPHICS
struct window_procs Qt_procs = { WPIDMINUS(guistubs) };
int qt_tilewidth, qt_tileheight, qt_fontsize, qt_compact_mode;
#endif
void
mswin_destroy_reg(void)
{
return;
}
void
mswin_raw_print_flush(void)
{
}
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
* so that it is out of sight for the gui linkage.
*/
#ifdef __MINGW32__
extern char default_window_sys[];
extern int mingw_main(int argc, char **argv);
int
main(int argc, char *argv[])
{
boolean resuming;
resuming = mingw_main(argc, argv);
nethack_exit(EXIT_SUCCESS);
/*NOTREACHED*/
return 0;
}
#endif
#endif /* GUISTUB */
/* =============================================== */
#ifdef TTYSTUB
HANDLE hConIn;
HANDLE hConOut;
struct window_procs tty_procs = { WPIDMINUS(ttystubs) };
#ifdef CURSES_GRAPHICS
char erase_char, kill_char;
#endif
void
win_tty_init(int dir)
{
return;
}
void
consoletty_open(int mode)
{
return;
}
int
xputc(int ch)
{
return 0;
}
void
xputs(const char *s)
{
return;
}
void
raw_clear_screen(void)
{
return;
}
void
clear_screen(void)
{
return;
}
void
backsp(void)
{
return;
}
#ifndef NO_MOUSE_ALLOWED
void
toggle_mouse_support(void)
{
return;
}
#endif
#ifdef PORT_DEBUG
void
win32con_debug_keystrokes(void)
{
return;
}
void
win32con_handler_info(void)
{
return;
}
#endif
void
map_subkeyvalue(char *op)
{
return;
}
/* this is used as a printf() replacement when the window
* system isn't initialized yet
*/
void msmsg
VA_DECL(const char *, fmt)
{
VA_START(fmt);
VA_INIT(fmt, const char *);
VA_END();
return;
}
/*VARARGS1*/
void consoletty_error
VA_DECL(const char *, s)
{
VA_START(s);
VA_INIT(s, const char *);
VA_END();
return;
}
#ifdef TTY_GRAPHICS
void
synch_cursor(void)
{
return;
}
#ifdef TTY_PERM_INVENT
boolean in_tty_perm_invent_toggled = FALSE;
void
tty_perm_invent_toggled(boolean negated)
{
}
#endif /* TTY_PERM_INVENT */
#endif /* TTY_GRAPHICS */
void
more(void)
{
return;
}
void
nethack_enter_consoletty(void)
{
return;
}
void
set_altkeyhandler(const char *inName)
{
return;
}
#if defined(USER_SOUNDS) && defined(TTY_SOUND_ESCCODES)
void
play_usersound_via_idx(int idx, int volume)
{
}
#endif /* USER_SOUNDS && TTY_SOUND_ESCCODES */
void
set_altkeyhandling(const char *inName)
{
}
int
set_keyhandling_via_option(void)
{
return 1;
}
#ifdef CURSES_GRAPHICS
struct window_procs curses_procs = {WPIDMINUS(curses)};
int curses_read_attrs(const char *attrs)
{
return 0;
}
char *
curses_fmt_attrs(char *outbuf)
{
int attr = iflags.wc2_petattr;
outbuf[0] = '\0';
Sprintf(outbuf, "+unknown [%d]", attr);
return &outbuf[1];
}
#endif
#endif /* TTYSTUBS */
+1 -4
View File
@@ -35,7 +35,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(WinWin32Dir);$(IncDir);$(SysWindDir);$(SysShareDir);$(WinShareDir);$(LuaDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32CON;NO_TILE_C;DLB;MSWIN_GRAPHICS;SAFEPROCS;_LIB;HAS_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32CON;NO_TILE_C;DLB;SAFEPROCS;_LIB;HAS_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;winmm.lib;Winmm.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;winmm.lib;Winmm.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -171,9 +171,6 @@
<ClCompile Include="$(SysShareDir)random.c" /> <ClCompile Include="$(SysShareDir)random.c" />
<ClCompile Include="$(SysWindDir)ntsound.c" /> <ClCompile Include="$(SysWindDir)ntsound.c" />
<ClCompile Include="$(SysWindDir)consoletty.c" /> <ClCompile Include="$(SysWindDir)consoletty.c" />
<ClCompile Include="$(SysWindDir)stubs.c">
<PreprocessorDefinitions>GUISTUB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="$(SysWindDir)windmain.c" /> <ClCompile Include="$(SysWindDir)windmain.c" />
<ClCompile Include="$(SysWindDir)windsys.c" /> <ClCompile Include="$(SysWindDir)windsys.c" />
<ClCompile Include="$(WinShareDir)safeproc.c" /> <ClCompile Include="$(WinShareDir)safeproc.c" />
+7 -4
View File
@@ -15,6 +15,12 @@
<PropertyGroup> <PropertyGroup>
<OutDir>$(BinDir)</OutDir> <OutDir>$(BinDir)</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<AdditionalOptions>/Gs /Oi- /w44774 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Gs /Oi- /w44774 %(AdditionalOptions)</AdditionalOptions>
@@ -167,9 +173,6 @@
<ClCompile Include="$(SysShareDir)cppregex.cpp" /> <ClCompile Include="$(SysShareDir)cppregex.cpp" />
<ClCompile Include="$(SysShareDir)random.c" /> <ClCompile Include="$(SysShareDir)random.c" />
<ClCompile Include="$(SysWindDir)ntsound.c" /> <ClCompile Include="$(SysWindDir)ntsound.c" />
<ClCompile Include="$(SysWindDir)stubs.c">
<PreprocessorDefinitions>TTYSTUB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="$(SysWindDir)windmain.c" /> <ClCompile Include="$(SysWindDir)windmain.c" />
<ClCompile Include="$(SysWindDir)windsys.c" /> <ClCompile Include="$(SysWindDir)windsys.c" />
<ClCompile Include="$(SysWindDir)win10.c" /> <ClCompile Include="$(SysWindDir)win10.c" />
@@ -311,4 +314,4 @@
<Target Name="AfterRebuild"> <Target Name="AfterRebuild">
<MSBuild Projects="$(vsDir)NetHack\afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" /> <MSBuild Projects="$(vsDir)NetHack\afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" />
</Target> </Target>
</Project> </Project>
+35 -3
View File
@@ -32,8 +32,10 @@ extern void nethack_exit(int) NORETURN;
extern void mswin_destroy_reg(void); extern void mswin_destroy_reg(void);
#endif #endif
#ifdef TTY_GRAPHICS #ifdef TTY_GRAPHICS
#ifdef WIN32CON
extern void backsp(void); extern void backsp(void);
#endif #endif
#endif
extern void clear_screen(void); extern void clear_screen(void);
#ifdef update_file #ifdef update_file
@@ -49,12 +51,14 @@ extern void (*cursesgraphics_mode_callback)(void);
extern void (*utf8graphics_mode_callback)(void); extern void (*utf8graphics_mode_callback)(void);
#endif #endif
#ifdef WIN32CON
#ifdef _MSC_VER #ifdef _MSC_VER
#ifdef kbhit #ifdef kbhit
#undef kbhit #undef kbhit
#endif #endif
#include <conio.h.> #include <conio.h.>
#endif #endif
#endif
#ifdef PC_LOCKING #ifdef PC_LOCKING
static int eraseoldlocks(void); static int eraseoldlocks(void);
@@ -65,9 +69,13 @@ int windows_nh_poskey(int *, int *, int *);
void windows_raw_print(const char *); void windows_raw_print(const char *);
char windows_yn_function(const char *, const char *, char); char windows_yn_function(const char *, const char *, char);
static void windows_getlin(const char *, char *); static void windows_getlin(const char *, char *);
#ifdef WIN32CON
extern int windows_console_custom_nhgetch(void); extern int windows_console_custom_nhgetch(void);
void safe_routines(void); void safe_routines(void);
int tty_self_recover_prompt(void); int tty_self_recover_prompt(void);
#endif
int other_self_recover_prompt(void); int other_self_recover_prompt(void);
char orgdir[PATHLEN]; char orgdir[PATHLEN];
@@ -78,8 +86,11 @@ int windows_startup_state = 0; /* we flag whether to continue with this */
extern int redirect_stdout; /* from sys/share/pcsys.c */ extern int redirect_stdout; /* from sys/share/pcsys.c */
extern int GUILaunched; extern int GUILaunched;
HANDLE hStdOut; HANDLE hStdOut;
char default_window_sys[] =
#if defined(MSWIN_GRAPHICS) #if defined(MSWIN_GRAPHICS)
char default_window_sys[] = "mswin"; "mswin";
#elif defined(TTY_GRAPHICS)
"tty";
#endif #endif
#ifdef WANT_GETHDATE #ifdef WANT_GETHDATE
static struct stat hbuf; static struct stat hbuf;
@@ -437,11 +448,14 @@ mingw_main(int argc, char *argv[])
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif #endif
#ifdef WIN32CON
/* /*
* Get a set of valid safe windowport function * Get a set of valid safe windowport function
* pointers during early startup initialization. * pointers during early startup initialization.
*/ */
safe_routines(); safe_routines();
#endif /* WIN32CON */
early_init(); early_init();
#ifdef _MSC_VER #ifdef _MSC_VER
#ifdef DEBUG #ifdef DEBUG
@@ -556,13 +570,17 @@ _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 WIN32CON
if (WINDOWPORT(tty)) if (WINDOWPORT(tty))
consoletty_open(1); consoletty_open(1);
#endif
init_nhwindows(&argc, argv); init_nhwindows(&argc, argv);
#ifdef WIN32CON
if (WINDOWPORT(tty)) if (WINDOWPORT(tty))
toggle_mouse_support(); toggle_mouse_support();
#endif
if (gs.symset[PRIMARYSET].handling if (gs.symset[PRIMARYSET].handling
&& !symset_is_compatible(gs.symset[PRIMARYSET].handling, && !symset_is_compatible(gs.symset[PRIMARYSET].handling,
@@ -760,12 +778,14 @@ process_options(int argc, char * argv[])
nethack_exit(EXIT_SUCCESS); nethack_exit(EXIT_SUCCESS);
} }
#ifdef MSWIN_GRAPHICS
if (GUILaunched) { if (GUILaunched) {
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 full 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();
@@ -902,6 +922,7 @@ nhusage(void)
#undef ADD_USAGE #undef ADD_USAGE
} }
#ifdef WIN32CON
void void
safe_routines(void) safe_routines(void)
{ {
@@ -914,6 +935,7 @@ safe_routines(void)
if (!GUILaunched) if (!GUILaunched)
windowprocs.win_nhgetch = windows_console_custom_nhgetch; windowprocs.win_nhgetch = windows_console_custom_nhgetch;
} }
#endif
#ifdef PORT_HELP #ifdef PORT_HELP
void void
@@ -937,8 +959,8 @@ authorize_wizard_mode(void)
#if defined(WIN32) && !defined(WIN32CON) #if defined(WIN32) && !defined(WIN32CON)
static char exenamebuf[PATHLEN]; static char exenamebuf[PATHLEN];
extern HANDLE hConIn; HANDLE hConIn;
extern HANDLE hConOut; HANDLE hConOut;
boolean has_fakeconsole; boolean has_fakeconsole;
char * char *
@@ -1166,7 +1188,9 @@ getlock(void)
const char *fq_lock; const char *fq_lock;
#define OOPS_BUFSZ 512 #define OOPS_BUFSZ 512
char oops[OOPS_BUFSZ]; char oops[OOPS_BUFSZ];
#ifdef WIN32CON
boolean istty = WINDOWPORT(tty); boolean istty = WINDOWPORT(tty);
#endif
/* we ignore QUIT and INT at this point */ /* we ignore QUIT and INT at this point */
if (!lock_file(HLOCK, LOCKPREFIX, 10)) { if (!lock_file(HLOCK, LOCKPREFIX, 10)) {
@@ -1197,9 +1221,11 @@ getlock(void)
(void) nhclose(fd); (void) nhclose(fd);
#ifdef WIN32CON
if (WINDOWPORT(tty)) if (WINDOWPORT(tty))
prompt_result = tty_self_recover_prompt(); prompt_result = tty_self_recover_prompt();
else else
#endif
prompt_result = other_self_recover_prompt(); prompt_result = other_self_recover_prompt();
/* /*
* prompt_result == 1 means recover old game. * prompt_result == 1 means recover old game.
@@ -1212,8 +1238,10 @@ getlock(void)
: (prompt_result == 1) : (prompt_result == 1)
? "recover the old game" ? "recover the old game"
: "not start a new game"); : "not start a new game");
#ifdef WIN32CON
if (istty) if (istty)
clear_screen(); clear_screen();
#endif
raw_printf("%s", oops); raw_printf("%s", oops);
if (prompt_result == 1) { /* recover */ if (prompt_result == 1) { /* recover */
if (recover_savefile()) { if (recover_savefile()) {
@@ -1231,8 +1259,10 @@ getlock(void)
} }
} else if (prompt_result < 0) { /* destroy old game */ } else if (prompt_result < 0) { /* destroy old game */
if (eraseoldlocks()) { if (eraseoldlocks()) {
#ifdef WIN32CON
if (istty) if (istty)
clear_screen(); /* display gets fouled up otherwise */ clear_screen(); /* display gets fouled up otherwise */
#endif
goto gotlock; goto gotlock;
} else { } else {
unlock_file(HLOCK); unlock_file(HLOCK);
@@ -1320,6 +1350,7 @@ file_newer(const char* a_path, const char* b_path)
return FALSE; return FALSE;
} }
#ifdef WIN32CON
/* /*
* returns: * returns:
* 1 if game should be recovered * 1 if game should be recovered
@@ -1391,6 +1422,7 @@ tty_self_recover_prompt(void)
} }
return retval; return retval;
} }
#endif
int int
other_self_recover_prompt(void) other_self_recover_prompt(void)
+30 -1
View File
@@ -48,6 +48,7 @@ extern int GUILaunched;
extern boolean getreturn_enabled; extern boolean getreturn_enabled;
int redirect_stdout; int redirect_stdout;
#ifdef WIN32CON
typedef HWND(WINAPI *GETCONSOLEWINDOW)(); typedef HWND(WINAPI *GETCONSOLEWINDOW)();
static HWND GetConsoleHandle(void); static HWND GetConsoleHandle(void);
static HWND GetConsoleHwnd(void); static HWND GetConsoleHwnd(void);
@@ -66,6 +67,21 @@ extern void safe_routines(void);
int def_kbhit(void); int def_kbhit(void);
int (*nt_kbhit)() = def_kbhit; int (*nt_kbhit)() = def_kbhit;
#endif /* WIN32CON */
#ifndef WIN32CON
/* this is used as a printf() replacement when the window
* system isn't initialized yet
*/
void msmsg
VA_DECL(const char *, fmt)
{
VA_START(fmt);
VA_INIT(fmt, const char *);
VA_END();
return;
}
#endif
char char
switchar(void) switchar(void)
@@ -187,8 +203,10 @@ return &szFullPath[0];
} }
#endif #endif
#ifdef MSWIN_GRAPHICS
extern void mswin_raw_print_flush(void); extern void mswin_raw_print_flush(void);
extern void mswin_raw_print(const char *); extern void mswin_raw_print(const char *);
#endif
/* fatal error */ /* fatal error */
/*VARARGS1*/ /*VARARGS1*/
@@ -211,8 +229,10 @@ VA_DECL(const char *, s)
Strcat(buf, "\n"); Strcat(buf, "\n");
raw_printf(buf); raw_printf(buf);
} }
#ifdef MSWIN_GRAPHICS
if (windowprocs.win_raw_print == mswin_raw_print) if (windowprocs.win_raw_print == mswin_raw_print)
mswin_raw_print_flush(); mswin_raw_print_flush();
#endif
VA_END(); VA_END();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@@ -233,8 +253,10 @@ win32_abort(void)
exit_nhwindows((char *) 0); exit_nhwindows((char *) 0);
iflags.window_inited = FALSE; iflags.window_inited = FALSE;
} }
#ifdef WIN32CON
if (!WINDOWPORT(mswin) && !WINDOWPORT(safestartup)) if (!WINDOWPORT(mswin) && !WINDOWPORT(safestartup))
safe_routines(); safe_routines();
#endif
if (wizard) { if (wizard) {
raw_print("Execute debug breakpoint wizard?"); raw_print("Execute debug breakpoint wizard?");
if ((c = nhgetch()) == 'y' || c == 'Y') if ((c = nhgetch()) == 'y' || c == 'Y')
@@ -368,6 +390,7 @@ void port_insert_pastebuf(char *buf)
return; return;
} }
#ifdef WIN32CON
static HWND static HWND
GetConsoleHandle(void) GetConsoleHandle(void)
{ {
@@ -405,7 +428,7 @@ GetConsoleHwnd(void)
/* printf("%d iterations\n", iterations); */ /* printf("%d iterations\n", iterations); */
return hwndFound; return hwndFound;
} }
#endif /* WIN32CON */
#endif #endif
#ifdef RUNTIME_PORT_ID #ifdef RUNTIME_PORT_ID
@@ -447,12 +470,14 @@ nethack_exit(int code)
*/ */
#ifdef WIN32CON
if (!GUILaunched) { if (!GUILaunched) {
windowprocs = *get_safe_procs(1); windowprocs = *get_safe_procs(1);
/* use our custom version which works /* use our custom version which works
a little cleaner than the stdio one */ a little cleaner than the stdio one */
windowprocs.win_nhgetch = windows_console_custom_nhgetch; windowprocs.win_nhgetch = windows_console_custom_nhgetch;
} }
#endif
if (getreturn_enabled) { if (getreturn_enabled) {
raw_print("\n"); raw_print("\n");
wait_synch(); wait_synch();
@@ -460,6 +485,7 @@ nethack_exit(int code)
exit(code); exit(code);
} }
#ifdef WIN32CON
#undef kbhit #undef kbhit
#include <conio.h> #include <conio.h>
@@ -488,13 +514,16 @@ getreturn(const char *str)
in_getreturn = FALSE; in_getreturn = FALSE;
return; return;
} }
#endif
/* nethack_enter_windows() is called from main immediately after /* nethack_enter_windows() is called from main immediately after
initializing the window port */ initializing the window port */
void nethack_enter_windows(void) void nethack_enter_windows(void)
{ {
#ifdef WIN32CON
if (WINDOWPORT(tty)) if (WINDOWPORT(tty))
nethack_enter_consoletty(); nethack_enter_consoletty();
#endif
} }
/* CP437 to Unicode mapping according to the Unicode Consortium */ /* CP437 to Unicode mapping according to the Unicode Consortium */
+6 -6
View File
@@ -106,7 +106,7 @@ struct window_procs tty_procs = {
#ifdef MSDOS #ifdef MSDOS
| WC_TILED_MAP | WC_ASCII_MAP | WC_TILED_MAP | WC_ASCII_MAP
#endif #endif
#if defined(WIN32) #if defined(WIN32CON)
| WC_MOUSE_SUPPORT | WC_MOUSE_SUPPORT
#endif #endif
| WC_COLOR | WC_HILITE_PET | WC_INVERSE | WC_EIGHT_BIT_IN), | WC_COLOR | WC_HILITE_PET | WC_INVERSE | WC_EIGHT_BIT_IN),
@@ -120,7 +120,7 @@ struct window_procs tty_procs = {
#endif #endif
| WC2_DARKGRAY | WC2_SUPPRESS_HIST | WC2_URGENT_MESG | WC2_STATUSLINES | WC2_DARKGRAY | WC2_SUPPRESS_HIST | WC2_URGENT_MESG | WC2_STATUSLINES
| WC2_U_UTF8STR | WC2_U_UTF8STR
#if !defined(NO_TERMS) || defined(WIN32) #if !defined(NO_TERMS) || defined(WIN32CON)
| WC2_U_24BITCOLOR | WC2_U_24BITCOLOR
#endif #endif
), ),
@@ -555,7 +555,7 @@ tty_preference_update(const char *pref)
new_status_window(); new_status_window();
} }
#if defined(WIN32) #if defined(WIN32CON)
consoletty_preference_update(pref); consoletty_preference_update(pref);
#else #else
genl_preference_update(pref); genl_preference_update(pref);
@@ -1531,7 +1531,7 @@ tty_exit_nhwindows(const char *str)
#ifndef NO_TERMS /*(until this gets added to the window interface)*/ #ifndef NO_TERMS /*(until this gets added to the window interface)*/
tty_shutdown(); /* cleanup termcap/terminfo/whatever */ tty_shutdown(); /* cleanup termcap/terminfo/whatever */
#endif #endif
#ifdef WIN32 #ifdef WIN32CON
consoletty_exit(); consoletty_exit();
#endif #endif
iflags.window_inited = 0; iflags.window_inited = 0;
@@ -4085,7 +4085,7 @@ end_glyphout(void)
#endif #endif
} }
#ifndef WIN32 #ifndef WIN32CON
void void
g_putch(int in_ch) g_putch(int in_ch)
{ {
@@ -4125,7 +4125,7 @@ g_putch(int in_ch)
return; return;
} }
#endif /* !WIN32 */ #endif /* !WIN32CON */
#if defined(ENHANCED_SYMBOLS) && defined(UNIX) #if defined(ENHANCED_SYMBOLS) && defined(UNIX)
void void