Index: cfgmgr/cfgmgr.c |
— | — | @@ -1109,6 +1109,9 @@ |
1110 | 1110 | BOOL DPIAwarePM = FALSE;
|
1111 | 1111 | HMODULE hSHCore = NULL;
|
1112 | 1112 | HMODULE hUser32 = NULL;
|
| 1113 | + HRESULT(WINAPI *_SetProcessDpiAwareness)(DWORD value);
|
| 1114 | + BOOL(WINAPI *_SetProcessDpiAwarenessContext)(HANDLE value);
|
| 1115 | + BOOL(WINAPI *_SetProcessDPIAware)();
|
1113 | 1116 | GetModuleFileName(NULL, filename, MAX_PATH);
|
1114 | 1117 | _tcscpy(regkey, regkeybase);
|
1115 | 1118 | _tcscat(regkey, _T("Profiles\\"));
|
— | — | @@ -1163,13 +1166,14 @@ |
1164 | 1167 | else DelCompatFlag(_T("HIGHDPIAWARE"),initial);
|
1165 | 1168 | if (initial)
|
1166 | 1169 | {
|
1167 | | - if (cfg->DPIScale == 1)
|
| 1170 | + switch(cfg->DPIScale)
|
1168 | 1171 | {
|
| 1172 | + case 1: // Per-monitor DPI Aware V1
|
1169 | 1173 | hSHCore = LoadLibrary(_T("SHCore.dll"));
|
1170 | 1174 | if (hSHCore)
|
1171 | 1175 | {
|
1172 | | - HRESULT(WINAPI *_SetProcessDpiAwareness)(DWORD value)
|
1173 | | - = (HRESULT(WINAPI*)(DWORD))GetProcAddress(hSHCore, "SetProcessDpiAwareness");
|
| 1176 | + _SetProcessDpiAwareness =
|
| 1177 | + (HRESULT(WINAPI*)(DWORD))GetProcAddress(hSHCore, "SetProcessDpiAwareness");
|
1174 | 1178 | if (_SetProcessDpiAwareness)
|
1175 | 1179 | {
|
1176 | 1180 | DPIAwarePM = TRUE;
|
— | — | @@ -1181,13 +1185,76 @@ |
1182 | 1186 | hUser32 = LoadLibrary(_T("User32.dll"));
|
1183 | 1187 | if (hUser32)
|
1184 | 1188 | {
|
1185 | | - BOOL(WINAPI *_SetProcessDPIAware)()
|
1186 | | - = (BOOL(WINAPI*)())GetProcAddress(hUser32, "SetProcessDPIAware");
|
| 1189 | + _SetProcessDPIAware =
|
| 1190 | + (BOOL(WINAPI*)())GetProcAddress(hUser32, "SetProcessDPIAware");
|
1187 | 1191 | if (_SetProcessDPIAware) _SetProcessDPIAware();
|
1188 | 1192 | }
|
1189 | 1193 | }
|
1190 | 1194 | if (hSHCore) FreeLibrary(hSHCore);
|
1191 | 1195 | if (hUser32) FreeLibrary(hUser32);
|
| 1196 | + break;
|
| 1197 | + case 3: // System DPI Aware
|
| 1198 | + hSHCore = LoadLibrary(_T("SHCore.dll"));
|
| 1199 | + if (hSHCore)
|
| 1200 | + {
|
| 1201 | + _SetProcessDpiAwareness =
|
| 1202 | + (HRESULT(WINAPI*)(DWORD))GetProcAddress(hSHCore, "SetProcessDpiAwareness");
|
| 1203 | + if (_SetProcessDpiAwareness)
|
| 1204 | + {
|
| 1205 | + DPIAwarePM = TRUE;
|
| 1206 | + _SetProcessDpiAwareness(1);
|
| 1207 | + }
|
| 1208 | + }
|
| 1209 | + if (!DPIAwarePM)
|
| 1210 | + {
|
| 1211 | + hUser32 = LoadLibrary(_T("User32.dll"));
|
| 1212 | + if (hUser32)
|
| 1213 | + {
|
| 1214 | + _SetProcessDPIAware =
|
| 1215 | + (BOOL(WINAPI*)())GetProcAddress(hUser32, "SetProcessDPIAware");
|
| 1216 | + if (_SetProcessDPIAware) _SetProcessDPIAware();
|
| 1217 | + }
|
| 1218 | + }
|
| 1219 | + if (hSHCore) FreeLibrary(hSHCore);
|
| 1220 | + if (hUser32) FreeLibrary(hUser32);
|
| 1221 | + break;
|
| 1222 | + case 4: // Per-monitor DPI Aware V2
|
| 1223 | + hUser32 = LoadLibrary(_T("User32.dll"));
|
| 1224 | + if (hUser32)
|
| 1225 | + {
|
| 1226 | + _SetProcessDpiAwarenessContext =
|
| 1227 | + (BOOL(WINAPI*)(HANDLE))GetProcAddress(hUser32, "SetProcessDpiAwarenessContext");
|
| 1228 | + if (_SetProcessDpiAwarenessContext) _SetProcessDpiAwarenessContext(-4);
|
| 1229 | + }
|
| 1230 | + if (!_SetProcessDpiAwarenessContext)
|
| 1231 | + {
|
| 1232 | + hSHCore = LoadLibrary(_T("SHCore.dll"));
|
| 1233 | + if (hSHCore)
|
| 1234 | + {
|
| 1235 | + _SetProcessDpiAwareness =
|
| 1236 | + (HRESULT(WINAPI*)(DWORD))GetProcAddress(hSHCore, "SetProcessDpiAwareness");
|
| 1237 | + if (_SetProcessDpiAwareness)
|
| 1238 | + {
|
| 1239 | + DPIAwarePM = TRUE;
|
| 1240 | + _SetProcessDpiAwareness(2);
|
| 1241 | + }
|
| 1242 | + }
|
| 1243 | + if (!DPIAwarePM)
|
| 1244 | + {
|
| 1245 | + if (!hUser32) hUser32 = LoadLibrary(_T("User32.dll"));
|
| 1246 | + if (hUser32)
|
| 1247 | + {
|
| 1248 | + _SetProcessDPIAware =
|
| 1249 | + (BOOL(WINAPI*)())GetProcAddress(hUser32, "SetProcessDPIAware");
|
| 1250 | + if (_SetProcessDPIAware) _SetProcessDPIAware();
|
| 1251 | + }
|
| 1252 | + }
|
| 1253 | + }
|
| 1254 | + if (hSHCore) FreeLibrary(hSHCore);
|
| 1255 | + if (hUser32) FreeLibrary(hUser32);
|
| 1256 | + break;
|
| 1257 | + default:
|
| 1258 | + break;
|
1192 | 1259 | }
|
1193 | 1260 | }
|
1194 | 1261 | //if(!cfg->colormode) DelCompatFlag(_T("DWM8And16BitMitigation"), initial); // Windows 10 compatibility issues; not needed?
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -133,6 +133,125 @@ |
134 | 134 | const int END_EXTRAMODESCOUNT = __LINE__ - 4;
|
135 | 135 | const int numextramodes = END_EXTRAMODESCOUNT - START_EXTRAMODESCOUNT;
|
136 | 136 |
|
| 137 | +const int START_LOWRESMODES = __LINE__;
|
| 138 | +const int LowResModes[][3] =
|
| 139 | +{
|
| 140 | + { 320,200,70 },
|
| 141 | + { 320,240,60 },
|
| 142 | + { 320,400,70 },
|
| 143 | + { 320,480,60 },
|
| 144 | + { 640,400,70 }
|
| 145 | +};
|
| 146 | +const int END_LOWRESMODES = __LINE__ - 4;
|
| 147 | +const int NumLowResModes = END_LOWRESMODES - START_LOWRESMODES;
|
| 148 | +
|
| 149 | +const int START_UNCOMMONLOWRESMODES = __LINE__;
|
| 150 | +const int UncommonLowResModes[][3] =
|
| 151 | +{
|
| 152 | + { 360,200,70 },
|
| 153 | + { 360,240,60 },
|
| 154 | + { 360,400,70 },
|
| 155 | + { 360,480,60 },
|
| 156 | + { 400,300,60 }
|
| 157 | +};
|
| 158 | +const int END_UNCOMMONLOWRESMODES = __LINE__ - 4;
|
| 159 | +const int NumUncommonLowResModes = END_LOWRESMODES - START_LOWRESMODES;
|
| 160 | +
|
| 161 | +const int START_UNCOMMONSDMODES = __LINE__;
|
| 162 | +const int UncommonSDModes[][3] =
|
| 163 | +{
|
| 164 | + { 512,384,60 },
|
| 165 | + { 640,350,70 },
|
| 166 | + { 640,360,60 },
|
| 167 | + { 720,400,70 },
|
| 168 | + { 720,480,60 },
|
| 169 | + { 960,540,60 },
|
| 170 | + { 960,600,60 },
|
| 171 | + { 960,720,60 },
|
| 172 | + { 1024,600,60 }
|
| 173 | +};
|
| 174 | +const int END_UNCOMMONSDMODES = __LINE__ - 4;
|
| 175 | +const int NumUncommonSDModes = END_UNCOMMONSDMODES - START_UNCOMMONSDMODES;
|
| 176 | +
|
| 177 | +const int START_HDMODES = __LINE__;
|
| 178 | +const int HDModes[][3] =
|
| 179 | +{
|
| 180 | + { 1024,800,60 },
|
| 181 | + { 1280,720,60 },
|
| 182 | + { 1280,800,60 },
|
| 183 | + { 1360,768,60 },
|
| 184 | + { 1366,768,60 },
|
| 185 | + { 1400,1050,60 },
|
| 186 | + { 1440,900,60 },
|
| 187 | + { 1600,800,60 },
|
| 188 | + { 1680,1050,60 },
|
| 189 | + { 1920,1080,60 },
|
| 190 | + { 1920,1200,60 },
|
| 191 | + { 2048,1080,60 }
|
| 192 | +};
|
| 193 | +const int END_HDMODES = __LINE__ - 4;
|
| 194 | +const int NumHDModes = END_HDMODES - START_HDMODES;
|
| 195 | +
|
| 196 | +const int START_UHDMODES = __LINE__;
|
| 197 | +const int UHDModes[][3] =
|
| 198 | +{
|
| 199 | + { 2560,1080,60 },
|
| 200 | + { 2560,1440,60 },
|
| 201 | + { 2560,1600,60 },
|
| 202 | + { 2560,1920,60 },
|
| 203 | + { 2560,2048,60 },
|
| 204 | + { 2800,2100,60 },
|
| 205 | + { 3200,1800,60 },
|
| 206 | + { 3200,2048,60 },
|
| 207 | + { 3840,2160,60 },
|
| 208 | + { 3840,2400,60 },
|
| 209 | + { 4096,2304,60 },
|
| 210 | + { 4096,3072,60 }
|
| 211 | +};
|
| 212 | +const int END_UHDMODES = __LINE__ - 4;
|
| 213 | +const int NumUHDModes = END_UHDMODES - START_UHDMODES;
|
| 214 | +
|
| 215 | +const int START_UHD2MODES = __LINE__;
|
| 216 | +const int UHD2Modes[][3] =
|
| 217 | +{
|
| 218 | + { 5120,2880,60 },
|
| 219 | + { 5120,3200,60 },
|
| 220 | + { 5120,4096,60 },
|
| 221 | + { 6400,4800,60 },
|
| 222 | + { 7680,4320,60 },
|
| 223 | + { 7680,4800,60 },
|
| 224 | + { 8192,4608,60 }
|
| 225 | +};
|
| 226 | +const int END_UHD2MODES = __LINE__ - 4;
|
| 227 | +const int NumUHD2Modes = END_UHDMODES - START_UHDMODES;
|
| 228 | +
|
| 229 | +const int START_UNCOMMONMODES = __LINE__;
|
| 230 | +const int UncommonModes[][3] =
|
| 231 | +{
|
| 232 | + { 240,160,60 },
|
| 233 | + { 256,224,60 },
|
| 234 | + { 256,240,60 },
|
| 235 | + { 320,175,60 },
|
| 236 | + { 320,224,60 },
|
| 237 | + { 400,240,60 },
|
| 238 | + { 416,312,75 },
|
| 239 | + { 512,448,60 },
|
| 240 | + { 512,480,60 },
|
| 241 | + { 576,432,60 },
|
| 242 | + { 640,200,60 },
|
| 243 | + { 640,512,60 },
|
| 244 | + { 700,525,60 },
|
| 245 | + { 720,350,70 },
|
| 246 | + { 720,450,60 },
|
| 247 | + { 800,512,60 },
|
| 248 | + { 832,624,75 },
|
| 249 | + { 840,525,60 },
|
| 250 | + { 896,672,60 },
|
| 251 | + { 928,696,60 },
|
| 252 | +};
|
| 253 | +const int END_UNCOMMONMODES = __LINE__ - 4;
|
| 254 | +const int NumUncommonModes = END_UNCOMMONMODES - START_UNCOMMONMODES;
|
| 255 | +
|
137 | 256 | const int START_DOUBLEDMODESCOUNT = __LINE__;
|
138 | 257 | const int DoubledModes[] [5] =
|
139 | 258 | {
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -1811,6 +1811,16 @@ |
1812 | 1812 | */
|
1813 | 1813 | void glRenderer_Delete(glRenderer *This)
|
1814 | 1814 | {
|
| 1815 | + switch (dxglcfg.fullmode)
|
| 1816 | + {
|
| 1817 | + case 2:
|
| 1818 | + case 3:
|
| 1819 | + case 4:
|
| 1820 | + SaveWindowSettings(&dxglcfg);
|
| 1821 | + break;
|
| 1822 | + default:
|
| 1823 | + break;
|
| 1824 | + }
|
1815 | 1825 | EnterCriticalSection(&This->cs);
|
1816 | 1826 | This->opcode = OP_DELETE;
|
1817 | 1827 | SetEvent(This->start);
|
Index: dxglcfg/xp.manifest |
— | — | @@ -28,9 +28,4 @@ |
29 | 29 | <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
30 | 30 | </application>
|
31 | 31 | </compatibility>
|
32 | | - <asmv3:application>
|
33 | | - <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
34 | | - <dpiAware>true/pm</dpiAware>
|
35 | | - </asmv3:windowsSettings>
|
36 | | - </asmv3:application>
|
37 | 32 | </assembly> |
\ No newline at end of file |