mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
Fixed DPI Scaling problems #616
This commit is contained in:
parent
41e354283e
commit
9b5919ab22
1 changed files with 42 additions and 2 deletions
|
@ -86,11 +86,48 @@ void Sys_GetExeLaunchMemoryStatus( sysMemoryStats_t& stats )
|
|||
|
||||
/*
|
||||
==================
|
||||
Sys_Sentry
|
||||
Sys_SetDPIAwareness #616
|
||||
|
||||
Code that tells windows we're High DPI aware so it doesn't scale our windows.
|
||||
Taken from Yamagi Quake II
|
||||
==================
|
||||
*/
|
||||
void Sys_Sentry()
|
||||
typedef enum D3_PROCESS_DPI_AWARENESS
|
||||
{
|
||||
D3_PROCESS_DPI_UNAWARE = 0,
|
||||
D3_PROCESS_SYSTEM_DPI_AWARE = 1,
|
||||
D3_PROCESS_PER_MONITOR_DPI_AWARE = 2
|
||||
} YQ2_PROCESS_DPI_AWARENESS;
|
||||
|
||||
void Sys_SetDPIAwareness()
|
||||
{
|
||||
// For Vista, Win7 and Win8
|
||||
BOOL( WINAPI * SetProcessDPIAware )( void ) = NULL;
|
||||
|
||||
/* Win8.1 and later */
|
||||
HRESULT( WINAPI * SetProcessDpiAwareness )( D3_PROCESS_DPI_AWARENESS dpiAwareness ) = NULL;
|
||||
|
||||
|
||||
HINSTANCE userDLL = LoadLibrary( "USER32.DLL" );
|
||||
if( userDLL )
|
||||
{
|
||||
SetProcessDPIAware = ( BOOL( WINAPI* )( void ) ) GetProcAddress( userDLL, "SetProcessDPIAware" );
|
||||
}
|
||||
|
||||
HINSTANCE shcoreDLL = LoadLibrary( "SHCORE.DLL" );
|
||||
if( shcoreDLL )
|
||||
{
|
||||
SetProcessDpiAwareness = ( HRESULT( WINAPI* )( YQ2_PROCESS_DPI_AWARENESS ) ) GetProcAddress( shcoreDLL, "SetProcessDpiAwareness" );
|
||||
}
|
||||
|
||||
if( SetProcessDpiAwareness )
|
||||
{
|
||||
SetProcessDpiAwareness( D3_PROCESS_PER_MONITOR_DPI_AWARE );
|
||||
}
|
||||
else if( SetProcessDPIAware )
|
||||
{
|
||||
SetProcessDPIAware();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1908,6 +1945,9 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
|
||||
Sys_GetCurrentMemoryStatus( exeLaunchMemoryStats );
|
||||
|
||||
// DG: tell Windows 8+ we're high dpi aware, otherwise display scaling screws up the game
|
||||
Sys_SetDPIAwareness();
|
||||
|
||||
#if 0
|
||||
DWORD handler = ( DWORD )_except_handler;
|
||||
__asm
|
||||
|
|
Loading…
Reference in a new issue