DXGL r792 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r791‎ | r792 | r793 >
Date:16:00, 10 March 2018
Author:admin
Status:new
Tags:
Comment:
Add specific color depths defined in DXGL Config instead of only all at once.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -449,27 +449,25 @@
450450 case 15:
451451 compmode = (*array)[i];
452452 compmode.dmBitsPerPel = 16;
453 - if(!ScanModeList(*array,compmode,*count))
 453+ if(!ScanModeList(*array,compmode,*count) && (dxglcfg.AddColorDepths & 4))
454454 {
455455 array2[count2] = compmode;
456456 count2++;
457457 }
458458 break;
459 -#ifdef _DEBUG //FIXME: Temporarily removed in release builds for compatibility.
460459 case 16:
461460 compmode = (*array)[i];
462461 compmode.dmBitsPerPel = 15;
463 - if(!ScanModeList(*array,compmode,*count))
 462+ if(!ScanModeList(*array,compmode,*count) && (dxglcfg.AddColorDepths & 2))
464463 {
465464 array2[count2] = compmode;
466465 count2++;
467466 }
468467 break;
469 -#endif
470468 case 24:
471469 compmode = (*array)[i];
472470 compmode.dmBitsPerPel = 32;
473 - if(!ScanModeList(*array,compmode,*count))
 471+ if(!ScanModeList(*array,compmode,*count) && (dxglcfg.AddColorDepths & 16))
474472 {
475473 array2[count2] = compmode;
476474 count2++;
@@ -478,7 +476,7 @@
479477 case 32:
480478 compmode = (*array)[i];
481479 compmode.dmBitsPerPel = 24;
482 - if(!ScanModeList(*array,compmode,*count))
 480+ if(!ScanModeList(*array,compmode,*count) && (dxglcfg.AddColorDepths & 8))
483481 {
484482 array2[count2] = compmode;
485483 count2++;
@@ -485,23 +483,21 @@
486484 }
487485 compmode = (*array)[i];
488486 compmode.dmBitsPerPel = 16;
489 - if(!ScanModeList(*array,compmode,*count))
 487+ if(!ScanModeList(*array,compmode,*count) && (dxglcfg.AddColorDepths & 4))
490488 {
491489 array2[count2] = compmode;
492490 count2++;
493491 }
494492 compmode = (*array)[i];
495 -#ifdef _DEBUG //FIXME: Temporarily removed in release builds for compatibility.
496493 compmode.dmBitsPerPel = 15;
497 - if(!ScanModeList(*array,compmode,*count))
 494+ if(!ScanModeList(*array,compmode,*count) && (dxglcfg.AddColorDepths & 2))
498495 {
499496 array2[count2] = compmode;
500497 count2++;
501498 }
502499 compmode = (*array)[i];
503 -#endif
504500 compmode.dmBitsPerPel = 8;
505 - if(!ScanModeList(*array,compmode,*count))
 501+ if(!ScanModeList(*array,compmode,*count) && (dxglcfg.AddColorDepths & 1))
506502 {
507503 array2[count2] = compmode;
508504 count2++;
@@ -515,6 +511,13 @@
516512 memcpy(&(*array)[*count-1],array2,count2*sizeof(DEVMODE));
517513 free(array2);
518514 *count += count2;
 515+ if ((dxglcfg.AddColorDepths & 2) && !(dxglcfg.AddColorDepths & 4))
 516+ {
 517+ for (DWORD x = 0; x < (*count); x++)
 518+ {
 519+ if ((*array)[x].dmBitsPerPel == 15) (*array)[x].dmBitsPerPel = 16;
 520+ }
 521+ }
519522 }
520523
521524 int SortDepth(const DEVMODE *mode1, const DEVMODE *mode2)
@@ -1910,6 +1913,8 @@
19111914 LONG error;
19121915 DWORD flags;
19131916 int stretchmode;
 1917+ if ((dxglcfg.AddColorDepths & 2) && !(dxglcfg.AddColorDepths & 4) && (dwBPP == 16))
 1918+ dwBPP = 15;
19141919 if(!oldmode.dmSize)
19151920 {
19161921 oldmode.dmSize = sizeof(DEVMODE);