diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 7ea0bdadfae..bf176be093e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -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) @@ -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 diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 1984623f6b1..f8384ed56c1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -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) @@ -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; - GadgetComboBoxSetSelectedPos( comboBoxResolution, selectedResIndex ); // set the display detail