Index: ddraw/glDirectDraw.cpp |
— | — | @@ -95,44 +95,6 @@ |
96 | 96 | return false;
|
97 | 97 | }
|
98 | 98 |
|
99 | | -const int START_EXTRAMODESCOUNT = __LINE__;
|
100 | | -const int ExtraModes[] [3] =
|
101 | | -{
|
102 | | - {320,175,70},
|
103 | | - {320,200,70},
|
104 | | - {320,240,60},
|
105 | | - {320,400,70},
|
106 | | - {320,480,60},
|
107 | | - {360,200,70},
|
108 | | - {360,240,60},
|
109 | | - {360,400,70},
|
110 | | - {360,480,60},
|
111 | | - {400,300,60},
|
112 | | - {416,312,75},
|
113 | | - {512,384,60},
|
114 | | - {576,432,60},
|
115 | | - {640,200,70},
|
116 | | - {640,350,70},
|
117 | | - {640,400,70},
|
118 | | - {640,512,60},
|
119 | | - {680,384,60},
|
120 | | - {700,525,60},
|
121 | | - {720,350,70},
|
122 | | - {720,400,70},
|
123 | | - {720,450,60},
|
124 | | - {720,480,60},
|
125 | | - {800,512,60},
|
126 | | - {832,624,75},
|
127 | | - {840,525,60},
|
128 | | - {896,672,60},
|
129 | | - {928,696,60},
|
130 | | - {960,540,60},
|
131 | | - {960,600,60},
|
132 | | - {960,720,60}
|
133 | | -};
|
134 | | -const int END_EXTRAMODESCOUNT = __LINE__ - 4;
|
135 | | -const int numextramodes = END_EXTRAMODESCOUNT - START_EXTRAMODESCOUNT;
|
136 | | -
|
137 | 99 | const int START_LOWRESMODES = __LINE__;
|
138 | 100 | const int LowResModes[][3] =
|
139 | 101 | {
|
— | — | @@ -155,7 +117,7 @@ |
156 | 118 | { 400,300,60 }
|
157 | 119 | };
|
158 | 120 | const int END_UNCOMMONLOWRESMODES = __LINE__ - 4;
|
159 | | -const int NumUncommonLowResModes = END_LOWRESMODES - START_LOWRESMODES;
|
| 121 | +const int NumUncommonLowResModes = END_UNCOMMONLOWRESMODES - START_UNCOMMONLOWRESMODES;
|
160 | 122 |
|
161 | 123 | const int START_UNCOMMONSDMODES = __LINE__;
|
162 | 124 | const int UncommonSDModes[][3] =
|
— | — | @@ -223,7 +185,7 @@ |
224 | 186 | { 8192,4608,60 }
|
225 | 187 | };
|
226 | 188 | const int END_UHD2MODES = __LINE__ - 4;
|
227 | | -const int NumUHD2Modes = END_UHDMODES - START_UHDMODES;
|
| 189 | +const int NumUHD2Modes = END_UHD2MODES - START_UHD2MODES;
|
228 | 190 |
|
229 | 191 | const int START_UNCOMMONMODES = __LINE__;
|
230 | 192 | const int UncommonModes[][3] =
|
— | — | @@ -265,6 +227,7 @@ |
266 | 228 | {360,240,60,720,480},
|
267 | 229 | {360,400,70,720,400},
|
268 | 230 | {360,480,60,720,480},
|
| 231 | + {400,300,56,800,600},
|
269 | 232 | {400,300,60,800,600}
|
270 | 233 | };
|
271 | 234 | const int END_DOUBLEDMODESCOUNT = __LINE__ - 4;
|
— | — | @@ -290,21 +253,21 @@ |
291 | 254 | return false;
|
292 | 255 | }
|
293 | 256 |
|
294 | | -void AddExtraResolutions(DEVMODE **array, DWORD *count)
|
| 257 | +void AddExtraResolutions(DEVMODE **array, DWORD *count, const int (*modelist)[3], const int nummodes)
|
295 | 258 | {
|
296 | | - DEVMODE *array2 = (DEVMODE *)malloc(sizeof(DEVMODE)*5*numextramodes);
|
| 259 | + DEVMODE *array2 = (DEVMODE *)malloc(sizeof(DEVMODE) * 5 * nummodes);
|
297 | 260 | DEVMODE compmode = *array[0];
|
298 | 261 | DWORD newcount = 0;
|
299 | 262 | int i;
|
300 | | - if(ScanColorMode(*array,*count,8))
|
| 263 | + if (ScanColorMode(*array, *count, 8))
|
301 | 264 | {
|
302 | 265 | compmode.dmBitsPerPel = 8;
|
303 | | - for(i = 0; i < numextramodes; i++)
|
| 266 | + for (i = 0; i < nummodes; i++)
|
304 | 267 | {
|
305 | | - compmode.dmPelsWidth = ExtraModes[i][0];
|
306 | | - compmode.dmPelsHeight = ExtraModes[i][1];
|
307 | | - compmode.dmDisplayFrequency = ExtraModes[i][2];
|
308 | | - if(!ScanModeListNoRefresh(*array,compmode,*count))
|
| 268 | + compmode.dmPelsWidth = modelist[i][0];
|
| 269 | + compmode.dmPelsHeight = modelist[i][1];
|
| 270 | + compmode.dmDisplayFrequency = modelist[i][2];
|
| 271 | + if (!ScanModeListNoRefresh(*array, compmode, *count))
|
309 | 272 | {
|
310 | 273 | array2[newcount] = compmode;
|
311 | 274 | newcount++;
|
— | — | @@ -311,15 +274,15 @@ |
312 | 275 | }
|
313 | 276 | }
|
314 | 277 | }
|
315 | | - if(ScanColorMode(*array,*count,15))
|
| 278 | + if (ScanColorMode(*array, *count, 15))
|
316 | 279 | {
|
317 | 280 | compmode.dmBitsPerPel = 15;
|
318 | | - for(i = 0; i < numextramodes; i++)
|
| 281 | + for (i = 0; i < nummodes; i++)
|
319 | 282 | {
|
320 | | - compmode.dmPelsWidth = ExtraModes[i][0];
|
321 | | - compmode.dmPelsHeight = ExtraModes[i][1];
|
322 | | - compmode.dmDisplayFrequency = ExtraModes[i][2];
|
323 | | - if(!ScanModeListNoRefresh(*array,compmode,*count))
|
| 283 | + compmode.dmPelsWidth = modelist[i][0];
|
| 284 | + compmode.dmPelsHeight = modelist[i][1];
|
| 285 | + compmode.dmDisplayFrequency = modelist[i][2];
|
| 286 | + if (!ScanModeListNoRefresh(*array, compmode, *count))
|
324 | 287 | {
|
325 | 288 | array2[newcount] = compmode;
|
326 | 289 | newcount++;
|
— | — | @@ -326,15 +289,15 @@ |
327 | 290 | }
|
328 | 291 | }
|
329 | 292 | }
|
330 | | - if(ScanColorMode(*array,*count,16))
|
| 293 | + if (ScanColorMode(*array, *count, 16))
|
331 | 294 | {
|
332 | 295 | compmode.dmBitsPerPel = 16;
|
333 | | - for(i = 0; i < numextramodes; i++)
|
| 296 | + for (i = 0; i < nummodes; i++)
|
334 | 297 | {
|
335 | | - compmode.dmPelsWidth = ExtraModes[i][0];
|
336 | | - compmode.dmPelsHeight = ExtraModes[i][1];
|
337 | | - compmode.dmDisplayFrequency = ExtraModes[i][2];
|
338 | | - if(!ScanModeListNoRefresh(*array,compmode,*count))
|
| 298 | + compmode.dmPelsWidth = modelist[i][0];
|
| 299 | + compmode.dmPelsHeight = modelist[i][1];
|
| 300 | + compmode.dmDisplayFrequency = modelist[i][2];
|
| 301 | + if (!ScanModeListNoRefresh(*array, compmode, *count))
|
339 | 302 | {
|
340 | 303 | array2[newcount] = compmode;
|
341 | 304 | newcount++;
|
— | — | @@ -341,15 +304,15 @@ |
342 | 305 | }
|
343 | 306 | }
|
344 | 307 | }
|
345 | | - if(ScanColorMode(*array,*count,24))
|
| 308 | + if (ScanColorMode(*array, *count, 24))
|
346 | 309 | {
|
347 | 310 | compmode.dmBitsPerPel = 24;
|
348 | | - for(i = 0; i < numextramodes; i++)
|
| 311 | + for (i = 0; i < nummodes; i++)
|
349 | 312 | {
|
350 | | - compmode.dmPelsWidth = ExtraModes[i][0];
|
351 | | - compmode.dmPelsHeight = ExtraModes[i][1];
|
352 | | - compmode.dmDisplayFrequency = ExtraModes[i][2];
|
353 | | - if(!ScanModeListNoRefresh(*array,compmode,*count))
|
| 313 | + compmode.dmPelsWidth = modelist[i][0];
|
| 314 | + compmode.dmPelsHeight = modelist[i][1];
|
| 315 | + compmode.dmDisplayFrequency = modelist[i][2];
|
| 316 | + if (!ScanModeListNoRefresh(*array, compmode, *count))
|
354 | 317 | {
|
355 | 318 | array2[newcount] = compmode;
|
356 | 319 | newcount++;
|
— | — | @@ -356,15 +319,15 @@ |
357 | 320 | }
|
358 | 321 | }
|
359 | 322 | }
|
360 | | - if(ScanColorMode(*array,*count,32))
|
| 323 | + if (ScanColorMode(*array, *count, 32))
|
361 | 324 | {
|
362 | 325 | compmode.dmBitsPerPel = 32;
|
363 | | - for(i = 0; i < numextramodes; i++)
|
| 326 | + for (i = 0; i < nummodes; i++)
|
364 | 327 | {
|
365 | | - compmode.dmPelsWidth = ExtraModes[i][0];
|
366 | | - compmode.dmPelsHeight = ExtraModes[i][1];
|
367 | | - compmode.dmDisplayFrequency = ExtraModes[i][2];
|
368 | | - if(!ScanModeListNoRefresh(*array,compmode,*count))
|
| 328 | + compmode.dmPelsWidth = modelist[i][0];
|
| 329 | + compmode.dmPelsHeight = modelist[i][1];
|
| 330 | + compmode.dmDisplayFrequency = modelist[i][2];
|
| 331 | + if (!ScanModeListNoRefresh(*array, compmode, *count))
|
369 | 332 | {
|
370 | 333 | array2[newcount] = compmode;
|
371 | 334 | newcount++;
|
— | — | @@ -371,8 +334,8 @@ |
372 | 335 | }
|
373 | 336 | }
|
374 | 337 | }
|
375 | | - *array = (DEVMODE *)realloc(*array,(*count+newcount)*sizeof(DEVMODE));
|
376 | | - memcpy(&(*array)[*count-1],array2,newcount*sizeof(DEVMODE));
|
| 338 | + *array = (DEVMODE *)realloc(*array, (*count + newcount) * sizeof(DEVMODE));
|
| 339 | + memcpy(&(*array)[*count - 1], array2, newcount * sizeof(DEVMODE));
|
377 | 340 | free(array2);
|
378 | 341 | *count += newcount;
|
379 | 342 | }
|
— | — | @@ -636,12 +599,31 @@ |
637 | 600 | DiscardDuplicateModes(&modes,&modenum);
|
638 | 601 | if(dxglcfg.AddColorDepths) AddExtraColorModes(&modes,&modenum); // FIXME: Add color depths by bitmask
|
639 | 602 | DiscardDuplicateModes(&modes,&modenum);
|
640 | | - if(dxglcfg.AddModes && (dxglcfg.scaler != 0)) AddExtraResolutions(&modes,&modenum); // FIXME: Add modes by bitmask
|
| 603 | + if (dxglcfg.scaler != 0)
|
| 604 | + {
|
| 605 | + if (dxglcfg.AddModes & 1) //Common low resolutions and doubled modes
|
| 606 | + AddExtraResolutions(&modes, &modenum, LowResModes, NumLowResModes);
|
| 607 | + if (dxglcfg.AddModes & 2) //Uncommon low resolutions
|
| 608 | + AddExtraResolutions(&modes, &modenum, UncommonLowResModes, NumUncommonLowResModes);
|
| 609 | + if (dxglcfg.AddModes & 4) //Uncommon SD reosolutions
|
| 610 | + AddExtraResolutions(&modes, &modenum, UncommonSDModes, NumUncommonSDModes);
|
| 611 | + if (dxglcfg.AddModes & 8) //High definition resolutions
|
| 612 | + AddExtraResolutions(&modes, &modenum, HDModes, NumHDModes);
|
| 613 | + if (dxglcfg.AddModes & 16) //Ultra-HD resolutions
|
| 614 | + AddExtraResolutions(&modes, &modenum, UHDModes, NumUHDModes);
|
| 615 | + if (dxglcfg.AddModes & 32) //Ultra-HD resolutions above 4k
|
| 616 | + AddExtraResolutions(&modes, &modenum, UHD2Modes, NumUHD2Modes);
|
| 617 | + if (dxglcfg.AddModes & 64) //Very uncommon resolutions
|
| 618 | + AddExtraResolutions(&modes, &modenum, UncommonModes, NumUncommonModes);
|
| 619 | + }
|
641 | 620 | if (dxglcfg.AddModes && (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
|
642 | 621 | (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f)))
|
643 | 622 | {
|
644 | | - AddDoubledResolutions(&modes, &modenum);
|
645 | | - DiscardDuplicateModes(&modes, &modenum);
|
| 623 | + if (dxglcfg.AddModes & 1)
|
| 624 | + {
|
| 625 | + AddDoubledResolutions(&modes, &modenum);
|
| 626 | + DiscardDuplicateModes(&modes, &modenum);
|
| 627 | + }
|
646 | 628 | }
|
647 | 629 | modenum--;
|
648 | 630 | switch(dxglcfg.SortModes)
|
— | — | @@ -752,7 +734,32 @@ |
753 | 735 | }
|
754 | 736 | DiscardDuplicateModes(&modes,&modenum);
|
755 | 737 | if(dxglcfg.AddColorDepths) AddExtraColorModes(&modes,&modenum); // FIXME: Add color depths by bitmask
|
756 | | - if(dxglcfg.AddModes && (dxglcfg.scaler != 0)) AddExtraResolutions(&modes,&modenum); // FIXME: Add modes by bitmask
|
| 738 | + if (dxglcfg.scaler != 0)
|
| 739 | + {
|
| 740 | + if (dxglcfg.AddModes & 1) //Common low resolutions and doubled modes
|
| 741 | + AddExtraResolutions(&modes, &modenum, LowResModes, NumLowResModes);
|
| 742 | + if (dxglcfg.AddModes & 2) //Uncommon low resolutions
|
| 743 | + AddExtraResolutions(&modes, &modenum, UncommonLowResModes, NumUncommonLowResModes);
|
| 744 | + if (dxglcfg.AddModes & 4) //Uncommon SD reosolutions
|
| 745 | + AddExtraResolutions(&modes, &modenum, UncommonSDModes, NumUncommonSDModes);
|
| 746 | + if (dxglcfg.AddModes & 8) //High definition resolutions
|
| 747 | + AddExtraResolutions(&modes, &modenum, HDModes, NumHDModes);
|
| 748 | + if (dxglcfg.AddModes & 16) //Ultra-HD resolutions
|
| 749 | + AddExtraResolutions(&modes, &modenum, UHDModes, NumUHDModes);
|
| 750 | + if (dxglcfg.AddModes & 32) //Ultra-HD resolutions above 4k
|
| 751 | + AddExtraResolutions(&modes, &modenum, UHD2Modes, NumUHD2Modes);
|
| 752 | + if (dxglcfg.AddModes & 64) //Very uncommon resolutions
|
| 753 | + AddExtraResolutions(&modes, &modenum, UncommonModes, NumUncommonModes);
|
| 754 | + }
|
| 755 | + if (dxglcfg.AddModes && (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
|
| 756 | + (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f)))
|
| 757 | + {
|
| 758 | + if (dxglcfg.AddModes & 1)
|
| 759 | + {
|
| 760 | + AddDoubledResolutions(&modes, &modenum);
|
| 761 | + DiscardDuplicateModes(&modes, &modenum);
|
| 762 | + }
|
| 763 | + }
|
757 | 764 | modenum--;
|
758 | 765 | switch(dxglcfg.SortModes)
|
759 | 766 | {
|