File tree Expand file tree Collapse file tree 2 files changed +44
-12
lines changed
Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient Expand file tree Collapse file tree 2 files changed +44
-12
lines changed Original file line number Diff line number Diff line change @@ -685,15 +685,31 @@ void W3DDisplay::init( void )
685
685
setBitDepth ( 16 );
686
686
break ;
687
687
case 2 :
688
+ {
688
689
// TheSuperHackers @bugfix xezon 11/06/2025 Now tries a safe default resolution
689
- // if the previous one did not succeed. This is unlikely to happen but is possible
690
- // if the user writes an unsupported resolution into to the Option Preferences.
691
- TheWritableGlobalData->m_xResolution = 800 ;
692
- TheWritableGlobalData->m_yResolution = 600 ;
693
- setWidth ( TheGlobalData->m_xResolution );
694
- setHeight ( TheGlobalData->m_yResolution );
690
+ // if the custom resolution did not succeed. This is unlikely to happen but is possible
691
+ // if the user writes an unsupported resolution into to the Option Preferences or if the
692
+ // graphics adapter does not support 800 x 600 to begin with.
693
+ const Int minW = 800 ;
694
+ const Int minH = 600 ;
695
+ Int xres = minW;
696
+ Int yres = minH;
697
+ Int bitDepth = 32 ;
698
+ Int displayModeCount = getDisplayModeCount ();
699
+ Int displayModeIndex = 0 ;
700
+ for (; displayModeIndex < displayModeCount; ++displayModeIndex)
701
+ {
702
+ getDisplayModeDescription (0 , &xres, &yres, &bitDepth);
703
+ if (xres * yres >= minW * minH)
704
+ break ; // Is good enough. Use it.
705
+ }
706
+ TheWritableGlobalData->m_xResolution = xres;
707
+ TheWritableGlobalData->m_yResolution = yres;
708
+ setWidth ( xres );
709
+ setHeight ( yres );
695
710
setBitDepth ( 32 );
696
711
break ;
712
+ }
697
713
case 3 :
698
714
setBitDepth ( 16 );
699
715
break ;
Original file line number Diff line number Diff line change @@ -752,15 +752,31 @@ void W3DDisplay::init( void )
752
752
setBitDepth ( 16 );
753
753
break ;
754
754
case 2 :
755
+ {
755
756
// TheSuperHackers @bugfix xezon 11/06/2025 Now tries a safe default resolution
756
- // if the previous one did not succeed. This is unlikely to happen but is possible
757
- // if the user writes an unsupported resolution into to the Option Preferences.
758
- TheWritableGlobalData->m_xResolution = 800 ;
759
- TheWritableGlobalData->m_yResolution = 600 ;
760
- setWidth ( TheGlobalData->m_xResolution );
761
- setHeight ( TheGlobalData->m_yResolution );
757
+ // if the custom resolution did not succeed. This is unlikely to happen but is possible
758
+ // if the user writes an unsupported resolution into to the Option Preferences or if the
759
+ // graphics adapter does not support 800 x 600 to begin with.
760
+ const Int minW = 800 ;
761
+ const Int minH = 600 ;
762
+ Int xres = minW;
763
+ Int yres = minH;
764
+ Int bitDepth = 32 ;
765
+ Int displayModeCount = getDisplayModeCount ();
766
+ Int displayModeIndex = 0 ;
767
+ for (; displayModeIndex < displayModeCount; ++displayModeIndex)
768
+ {
769
+ getDisplayModeDescription (0 , &xres, &yres, &bitDepth);
770
+ if (xres * yres >= minW * minH)
771
+ break ; // Is good enough. Use it.
772
+ }
773
+ TheWritableGlobalData->m_xResolution = xres;
774
+ TheWritableGlobalData->m_yResolution = yres;
775
+ setWidth ( xres );
776
+ setHeight ( yres );
762
777
setBitDepth ( 32 );
763
778
break ;
779
+ }
764
780
case 3 :
765
781
setBitDepth ( 16 );
766
782
break ;
You can’t perform that action at this time.
0 commit comments