- include cleanup in Win32 folder.

This commit is contained in:
Christoph Oelckers 2020-04-11 13:12:45 +02:00
parent fdc14ca805
commit 2e258e8cdb
6 changed files with 43 additions and 22 deletions

View file

@ -1111,7 +1111,6 @@ set (PCH_SOURCES
scripting/zscript/ast.cpp
scripting/zscript/zcc_compile.cpp
scripting/zscript/zcc_parser.cpp
common/thirdparty/sfmt/SFMT.cpp
sound/music/i_music.cpp
sound/music/i_soundfont.cpp
sound/backend/i_sound.cpp
@ -1120,17 +1119,26 @@ set (PCH_SOURCES
rendering/swrenderer/textures/warptexture.cpp
rendering/swrenderer/textures/swcanvastexture.cpp
events.cpp
utility/palettecontainer.cpp
common/thirdparty/sfmt/SFMT.cpp
common/utility/engineerrors.cpp
common/utility/i_module.cpp
common/utility/m_alloc.cpp
common/utility/utf8.cpp
common/utility/palette.cpp
utility/palettecontainer.cpp
common/utility/files.cpp
common/utility/files_decompress.cpp
common/utility/memarena.cpp
common/utility/cmdlib.cpp
common/utility/configfile.cpp
common/utility/i_time.cpp
common/utility/m_argv.cpp
common/utility/s_playlist.cpp
common/utility/zstrformat.cpp
common/thirdparty/md5.cpp
common/thirdparty/superfasthash.cpp
utility/m_png.cpp
utility/m_random.cpp
common/utility/memarena.cpp
utility/nodebuilder/nodebuild.cpp
utility/nodebuilder/nodebuild_classify_nosse2.cpp
utility/nodebuilder/nodebuild_events.cpp
@ -1139,17 +1147,9 @@ set (PCH_SOURCES
utility/nodebuilder/nodebuild_utility.cpp
utility/sc_man.cpp
utility/stats.cpp
common/utility/cmdlib.cpp
common/utility/configfile.cpp
common/utility/i_time.cpp
common/utility/m_argv.cpp
utility/m_bbox.cpp
utility/name.cpp
common/utility/s_playlist.cpp
utility/v_collection.cpp
common/utility/zstrformat.cpp
common/thirdparty/md5.cpp
common/thirdparty/superfasthash.cpp
)
if( ${HAVE_VM_JIT} )

View file

@ -39,17 +39,14 @@
#include "gl_sysfb.h"
#include "hardware.h"
#include "x86.h"
#include "templates.h"
#include "version.h"
#include "c_console.h"
#include "v_video.h"
#include "i_input.h"
#include "i_system.h"
#include "doomstat.h"
#include "v_text.h"
#include "m_argv.h"
#include "engineerrors.h"
#include "base_sysfb.h"
#include "win32basevideo.h"
#include "c_dispatch.h"
@ -61,6 +58,7 @@ extern "C" {
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
void GetRefreshRate(HWND hWnd);
EXTERN_CVAR(Int, vid_defwidth)
EXTERN_CVAR(Int, vid_defheight)
@ -341,6 +339,7 @@ void SystemBaseFrameBuffer::PositionWindow(bool fullscreen, bool initialcall)
}
m_Fullscreen = fullscreen;
SetSize(GetClientWidth(), GetClientHeight());
GetRefreshRate(Window);
}
//==========================================================================

View file

@ -39,14 +39,12 @@
#include "gl_sysfb.h"
#include "hardware.h"
#include "x86.h"
#include "templates.h"
#include "version.h"
#include "c_console.h"
#include "v_video.h"
#include "i_input.h"
#include "i_system.h"
#include "doomstat.h"
#include "v_text.h"
#include "m_argv.h"
#include "engineerrors.h"

View file

@ -55,10 +55,14 @@
#include <uxtheme.h>
#include <shellapi.h>
#include "doomtype.h"
#include <stdint.h>
#include <stdio.h>
#include "resource.h"
#include "version.h"
#include "m_swap.h"
#include "basics.h"
#include "zstring.h"
#include "printf.h"
#include "cmdlib.h"
#include <time.h>
@ -801,8 +805,8 @@ static void AddToolHelp (HANDLE file)
pCreateToolhelp32Snapshot = (CREATESNAPSHOT)GetProcAddress (kernel, "CreateToolhelp32Snapshot");
pThread32First = (THREADWALK)GetProcAddress (kernel, "Thread32First");
pThread32Next = (THREADWALK)GetProcAddress (kernel, "Thread32Next");
pModule32First = (MODULEWALK)GetProcAddress (kernel, "Module32First");
pModule32Next = (MODULEWALK)GetProcAddress (kernel, "Module32Next");
pModule32First = (MODULEWALK)GetProcAddress (kernel, "Module32FirstW");
pModule32Next = (MODULEWALK)GetProcAddress (kernel, "Module32NextW");
if (!(pCreateToolhelp32Snapshot && pThread32First && pThread32Next &&
pModule32First && pModule32Next))
@ -847,12 +851,13 @@ static void AddToolHelp (HANDLE file)
{
do
{
auto amod = FString(module.szModule);
Writef (file, "%p - %p %c%s\r\n",
module.modBaseAddr, module.modBaseAddr + module.modBaseSize - 1,
module.modBaseAddr <= CrashPointers.ExceptionRecord->ExceptionAddress &&
module.modBaseAddr + module.modBaseSize > CrashPointers.ExceptionRecord->ExceptionAddress
? '*' : ' ',
module.szModule);
amod.GetChars());
} while (pModule32Next (snapshot, &module));
}

View file

@ -89,6 +89,7 @@
#include "i_system.h"
#include "g_levellocals.h"
int32_t refreshfreq = -1;
// Compensate for w32api's lack
#ifndef GET_XBUTTON_WPARAM
@ -359,6 +360,22 @@ bool CallHook(FInputDevice *device, HWND hWnd, UINT message, WPARAM wParam, LPAR
return device->WndProcHook(hWnd, message, wParam, lParam, result);
}
void GetRefreshRate(HWND hWnd)
{
HMONITOR moni = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
MONITORINFOEXA moninf;
moninf.cbSize = sizeof(moninf);
if (GetMonitorInfoA(moni, (LPMONITORINFO)&moninf))
{
DEVMODEA dm;
dm.dmSize = sizeof(DEVMODEA);
if (EnumDisplaySettingsA(moninf.szDevice, ENUM_CURRENT_SETTINGS, &dm))
{
refreshfreq = dm.dmDisplayFrequency;
}
}
}
LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT result;
@ -488,6 +505,8 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_DISPLAYCHANGE:
GetRefreshRate(hWnd);
// fall through
case WM_STYLECHANGED:
return DefWindowProc(hWnd, message, wParam, lParam);
@ -581,7 +600,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
#ifdef _DEBUG
char foo[256];
mysnprintf (foo, countof(foo), "Session Change: %ld %d\n", lParam, wParam);
mysnprintf (foo, countof(foo), "Session Change: %ld %d\n", (long)lParam, (int)wParam);
OutputDebugStringA (foo);
#endif
}

View file

@ -800,7 +800,7 @@ static HCURSOR CreateAlphaCursor(FBitmap &source, int leftofs, int topofs)
// Find closest integer scale factor for the monitor DPI
HDC screenDC = GetDC(0);
int dpi = GetDeviceCaps(screenDC, LOGPIXELSX);
int scale = MAX((dpi + 96 / 2 - 1) / 96, 1);
int scale = std::max((dpi + 96 / 2 - 1) / 96, 1);
ReleaseDC(0, screenDC);
memset(&bi, 0, sizeof(bi));