This commit is contained in:
nhmall
2018-11-11 10:29:52 -05:00
parent e486d941ed
commit a0b53ee391
43 changed files with 832 additions and 280 deletions

View File

@@ -5,3 +5,6 @@ sysconf NHSUBST
*.rc NHSUBST
*.bat NHSUBST
*.def NH_header=no
* NH_filestag=(file%s_for_Windows_7/8.x/10_version)
..files NH_filegenerated=nethack.ico
nethack.ico NH_filesgentag=(file%s_generated_by_uudecode_at_compile_time)

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();