Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -1548,7 +1548,6 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
AsciiString selectedResolution = (*pref) ["Resolution"];
Int selectedXRes=800,selectedYRes=600;
Int selectedResIndex=-1;
Int defaultResIndex=0; //index of default video mode that should always exist
if (!selectedResolution.isEmpty())
{ //try to parse 2 integers out of string
if (sscanf(selectedResolution.str(),"%d%d", &selectedXRes, &selectedYRes) != 2)
Expand All @@ -1564,22 +1563,21 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
TheDisplay->getDisplayModeDescription(i,&xres,&yres,&bitDepth);
str.format(L"%d x %d",xres,yres);
GadgetComboBoxAddEntry( comboBoxResolution, str, color);
if (xres == 800 && yres == 600) //keep track of default mode in case we need it.
defaultResIndex=i;
if (xres == selectedXRes && yres == selectedYRes)
selectedResIndex=i;
}

if (selectedResIndex == -1) //check if saved mode no longer available
{ //pick default resolution
selectedXRes = 800;
selectedXRes = 600;
selectedResIndex = defaultResIndex;
{
// TheSuperHackers @bugfix xezon 08/06/2025 Now adds the current resolution instead of defaulting to 800 x 600.
// This avoids force changing the resolution when the user has set a custom resolution in the Option Preferences.
Int xres = TheDisplay->getWidth();
Int yres = TheDisplay->getHeight();
str.format(L"%d x %d",xres,yres);
GadgetComboBoxAddEntry( comboBoxResolution, str, color );
selectedResIndex = GadgetComboBoxGetLength( comboBoxResolution ) - 1;
}

TheWritableGlobalData->m_xResolution = selectedXRes;
TheWritableGlobalData->m_yResolution = selectedYRes;

GadgetComboBoxSetSelectedPos( comboBoxResolution, selectedResIndex );

// set the display detail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,6 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
AsciiString selectedResolution = (*pref) ["Resolution"];
Int selectedXRes=800,selectedYRes=600;
Int selectedResIndex=-1;
Int defaultResIndex=0; //index of default video mode that should always exist
if (!selectedResolution.isEmpty())
{ //try to parse 2 integers out of string
if (sscanf(selectedResolution.str(),"%d%d", &selectedXRes, &selectedYRes) != 2)
Expand All @@ -1630,22 +1629,21 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
TheDisplay->getDisplayModeDescription(i,&xres,&yres,&bitDepth);
str.format(L"%d x %d",xres,yres);
GadgetComboBoxAddEntry( comboBoxResolution, str, color);
if (xres == 800 && yres == 600) //keep track of default mode in case we need it.
defaultResIndex=i;
if (xres == selectedXRes && yres == selectedYRes)
selectedResIndex=i;
}

if (selectedResIndex == -1) //check if saved mode no longer available
{ //pick default resolution
selectedXRes = 800;
selectedXRes = 600;
selectedResIndex = defaultResIndex;
{
// TheSuperHackers @bugfix xezon 08/06/2025 Now adds the current resolution instead of defaulting to 800 x 600.
// This avoids force changing the resolution when the user has set a custom resolution in the Option Preferences.
Int xres = TheDisplay->getWidth();
Int yres = TheDisplay->getHeight();
str.format(L"%d x %d",xres,yres);
GadgetComboBoxAddEntry( comboBoxResolution, str, color );
selectedResIndex = GadgetComboBoxGetLength( comboBoxResolution ) - 1;
}

TheWritableGlobalData->m_xResolution = selectedXRes;
TheWritableGlobalData->m_yResolution = selectedYRes;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an additional sneaky bug. It changes the resolution to what the combo box default is without confirming any resolution change. This causes a notable bug when declining a resolution change. Afterwards the GlobalData resolution is incorrectly set and causes misbehavior in the Options Menu resolution combo box.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone goofed here.


GadgetComboBoxSetSelectedPos( comboBoxResolution, selectedResIndex );

// set the display detail
Expand Down
Loading