Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,14 @@ W3DDisplay::~W3DDisplay()

} // end ~W3DDisplay

// TheSuperHackers @tweak valeronm 20/03/2025 Only accept 24-bit modes with min width 800
inline Bool isResolutionSupported(const ResolutionDescClass &res)
{
static const Int minBitDepth = 24;

return res.Width >= MIN_DISPLAY_RESOLUTION_X && res.BitDepth >= minBitDepth;
}

/*Return number of screen modes supported by the current device*/
Int W3DDisplay::getDisplayModeCount(void)
{
Expand All @@ -455,8 +463,8 @@ Int W3DDisplay::getDisplayModeCount(void)
for (int res = 0; res < resolutions.Count (); res ++)
{
// Is this the resolution we are looking for?
if (resolutions[res].BitDepth >= 24 && resolutions[res].Width >= 800 && (fabs((Real)resolutions[res].Width/(Real)resolutions[res].Height - 1.3333f)) < 0.01f) //only accept 4:3 aspect ratio modes.
{
if (isResolutionSupported(resolutions[res]))
{
numResolutions++;
}
}
Expand All @@ -473,7 +481,7 @@ void W3DDisplay::getDisplayModeDescription(Int modeIndex, Int *xres, Int *yres,
for (int res = 0; res < resolutions.Count (); res ++)
{
// Is this the resolution we are looking for?
if (resolutions[res].BitDepth >= 24 && resolutions[res].Width >= 800 && (fabs((Real)resolutions[res].Width/(Real)resolutions[res].Height - 1.3333f)) < 0.01f) //only accept 4:3 aspect ratio modes.
if (isResolutionSupported(resolutions[res]))
{
if (numResolutions == modeIndex)
{ //found the mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,17 +481,13 @@ W3DDisplay::~W3DDisplay()

} // end ~W3DDisplay


Bool IS_FOUR_BY_THREE_ASPECT( Real x, Real y )
// TheSuperHackers @tweak valeronm 20/03/2025 Only accept 24-bit modes with min width 800
inline Bool isResolutionSupported(const ResolutionDescClass &res)
{
if ( y == 0 )
return FALSE;

Real aspectRatio = fabs( x / y );
return (( aspectRatio > 1.332f) && ( aspectRatio < 1.334f));

}
static const Int minBitDepth = 24;

return res.Width >= MIN_DISPLAY_RESOLUTION_X && res.BitDepth >= minBitDepth;
}

/*Return number of screen modes supported by the current device*/
Int W3DDisplay::getDisplayModeCount(void)
Expand All @@ -516,8 +512,7 @@ Int W3DDisplay::getDisplayModeCount(void)
for (int res = 0; res < resolutions.Count (); res ++)
{
// Is this the resolution we are looking for?
if (resolutions[res].BitDepth >= 24 && resolutions[res].Width >= MIN_DISPLAY_RESOLUTION_X
&& IS_FOUR_BY_THREE_ASPECT( (Real)resolutions[res].Width, (Real)resolutions[res].Height ) ) //only accept 4:3 aspect ratio modes.
if (isResolutionSupported(resolutions[res]))
{
numResolutions++;
}
Expand All @@ -535,8 +530,7 @@ void W3DDisplay::getDisplayModeDescription(Int modeIndex, Int *xres, Int *yres,
for (int res = 0; res < resolutions.Count (); res ++)
{
// Is this the resolution we are looking for?
if ( resolutions[res].BitDepth >= 24 && resolutions[res].Width >= MIN_DISPLAY_RESOLUTION_X
&& IS_FOUR_BY_THREE_ASPECT( (Real)resolutions[res].Width, (Real)resolutions[res].Height ) ) //only accept 4:3 aspect ratio modes.
if (isResolutionSupported(resolutions[res]))
{
if (numResolutions == modeIndex)
{ //found the mode
Expand Down
Loading