Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-11-11 10:35:08 -05:00
13 changed files with 162 additions and 63 deletions

View File

@@ -501,15 +501,6 @@ int code;
exit(code);
}
#ifdef WIN32
#ifndef TTY_GRAPHICS
void
synch_cursor()
{
}
#endif
#endif
/* Chdir back to original directory
*/
#ifdef TOS

42
sys/winnt/win10.c Normal file
View File

@@ -0,0 +1,42 @@
/* NetHack 3.6 win10.c $NHDT-Date: 1432512810 2015/05/25 00:13:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
/* Copyright (C) 2018 by Bart House */
/* NetHack may be freely redistributed. See license for details. */
#include <process.h>
#include "winMS.h"
#include "hack.h"
#include "win10.h"
#include <VersionHelpers.h>
Win10 gWin10 = { 0 };
void win10_init()
{
if (IsWindows10OrGreater())
{
HINSTANCE hUser32 = LoadLibraryA("user32.dll");
if (hUser32 == NULL)
panic("Unable to load user32.dll");
gWin10.GetThreadDpiAwarenessContext = (GetThreadDpiAwarenessContextProc) GetProcAddress(hUser32, "GetThreadDpiAwarenessContext");
if (gWin10.GetThreadDpiAwarenessContext == NULL)
panic("Unable to get address of GetThreadDpiAwarenessContext()");
gWin10.AreDpiAwarenessContextsEqual = (AreDpiAwarenessContextsEqualProc) GetProcAddress(hUser32, "AreDpiAwarenessContextsEqual");
if (gWin10.AreDpiAwarenessContextsEqual == NULL)
panic("Unable to get address of AreDpiAwarenessContextsEqual");
FreeLibrary(hUser32);
gWin10.Valid = TRUE;
}
if (gWin10.Valid) {
if (!gWin10.AreDpiAwarenessContextsEqual(
gWin10.GetThreadDpiAwarenessContext(),
DPI_AWARENESS_CONTEXT_UNAWARE))
panic("Unexpected DpiAwareness state");
}
}

17
sys/winnt/win10.h Normal file
View File

@@ -0,0 +1,17 @@
/* NetHack 3.6 win10.h $NHDT-Date: 1432512810 2015/05/25 00:13:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
/* Copyright (C) 2018 by Bart House */
/* NetHack may be freely redistributed. See license for details. */
typedef DPI_AWARENESS_CONTEXT(WINAPI * GetThreadDpiAwarenessContextProc)(VOID);
typedef BOOL (WINAPI *AreDpiAwarenessContextsEqualProc)(DPI_AWARENESS_CONTEXT dpiContextA, DPI_AWARENESS_CONTEXT dpiContextB);
typedef struct {
BOOL Valid;
GetThreadDpiAwarenessContextProc GetThreadDpiAwarenessContext;
AreDpiAwarenessContextsEqualProc AreDpiAwarenessContextsEqual;
} Win10;
extern Win10 gWin10;
void win10_init();

View File

@@ -4,6 +4,8 @@
/*
* WIN32 system functions.
*
* Included in both console and window based clients on the windows platform.
*
* Initial Creation: Michael Allison - January 31/93
*
@@ -229,15 +231,6 @@ Delay(int ms)
(void) Sleep(ms);
}
#ifdef TTY_GRAPHICS
extern void NDECL(backsp);
#else
void
backsp()
{
}
#endif
void
win32_abort()
{
@@ -250,9 +243,13 @@ win32_abort()
msmsg("Execute debug breakpoint wizard?");
while ((ci = nhgetch()) != '\n') {
if (ct > 0) {
#ifdef TTY_GRAPHICS
backsp(); /* \b is visible on NT */
#endif
(void) putchar(' ');
#ifdef TTY_GRAPHICS
backsp();
#endif
ct = 0;
c = 'n';
}