@@ -1031,56 +1031,6 @@ static void saveOptions( void )
1031
1031
(*pref)[" StaticGameLOD" ] = TheGameLODManager->getStaticGameLODLevelName (TheGameLODManager->getStaticLODLevel ());
1032
1032
}
1033
1033
1034
- // -------------------------------------------------------------------------------------------------
1035
- // Resolution
1036
- GadgetComboBoxGetSelectedPos ( comboBoxResolution, &index );
1037
- Int xres, yres, bitDepth;
1038
-
1039
- oldDispSettings.xRes = TheDisplay->getWidth ();
1040
- oldDispSettings.yRes = TheDisplay->getHeight ();
1041
- oldDispSettings.bitDepth = TheDisplay->getBitDepth ();
1042
- oldDispSettings.windowed = TheDisplay->getWindowed ();
1043
-
1044
- if (comboBoxResolution && comboBoxResolution->winGetEnabled () && index < TheDisplay->getDisplayModeCount () && index >= 0 )
1045
- {
1046
- TheDisplay->getDisplayModeDescription (index,&xres,&yres,&bitDepth);
1047
- if (TheGlobalData->m_xResolution != xres || TheGlobalData->m_yResolution != yres)
1048
- {
1049
- if (TheDisplay->setDisplayMode (xres,yres,bitDepth,TheDisplay->getWindowed ()))
1050
- {
1051
- dispChanged = TRUE ;
1052
- TheWritableGlobalData->m_xResolution = xres;
1053
- TheWritableGlobalData->m_yResolution = yres;
1054
-
1055
- TheHeaderTemplateManager->headerNotifyResolutionChange ();
1056
- TheMouse->mouseNotifyResolutionChange ();
1057
-
1058
- // Save new settings for a dialog box confirmation after options are accepted
1059
- newDispSettings.xRes = xres;
1060
- newDispSettings.yRes = yres;
1061
- newDispSettings.bitDepth = bitDepth;
1062
- newDispSettings.windowed = TheDisplay->getWindowed ();
1063
-
1064
- AsciiString prefString;
1065
- prefString.format (" %d %d" , xres, yres );
1066
- (*pref)[" Resolution" ] = prefString;
1067
-
1068
- // delete the shell
1069
- delete TheShell;
1070
- TheShell = NULL ;
1071
-
1072
- // create the shell
1073
- TheShell = MSGNEW (" GameClientSubsystem" ) Shell;
1074
- if ( TheShell )
1075
- TheShell->init ();
1076
-
1077
- TheInGameUI->recreateControlBar ();
1078
-
1079
- TheShell->push ( AsciiString (" Menus/MainMenu.wnd" ) );
1080
- }
1081
- }
1082
- }
1083
-
1084
1034
// -------------------------------------------------------------------------------------------------
1085
1035
// IP address
1086
1036
if (comboBoxLANIP && comboBoxLANIP->winGetEnabled ())
@@ -1252,6 +1202,62 @@ static void saveOptions( void )
1252
1202
}
1253
1203
}
1254
1204
1205
+ // -------------------------------------------------------------------------------------------------
1206
+ // Resolution
1207
+ //
1208
+ // TheSuperHackers @bugfix xezon 12/06/2025 Now performs the resolution change at the very end of
1209
+ // processing all the options. This is necessary, because recreating the Shell will destroy the
1210
+ // Options Menu and therefore prevent any further ui gadget interactions afterwards.
1211
+
1212
+ GadgetComboBoxGetSelectedPos ( comboBoxResolution, &index );
1213
+ Int xres, yres, bitDepth;
1214
+
1215
+ oldDispSettings.xRes = TheDisplay->getWidth ();
1216
+ oldDispSettings.yRes = TheDisplay->getHeight ();
1217
+ oldDispSettings.bitDepth = TheDisplay->getBitDepth ();
1218
+ oldDispSettings.windowed = TheDisplay->getWindowed ();
1219
+
1220
+ if (comboBoxResolution && comboBoxResolution->winGetEnabled () && index < TheDisplay->getDisplayModeCount () && index >= 0 )
1221
+ {
1222
+ TheDisplay->getDisplayModeDescription (index,&xres,&yres,&bitDepth);
1223
+ if (TheGlobalData->m_xResolution != xres || TheGlobalData->m_yResolution != yres)
1224
+ {
1225
+ if (TheDisplay->setDisplayMode (xres,yres,bitDepth,TheDisplay->getWindowed ()))
1226
+ {
1227
+ dispChanged = TRUE ;
1228
+ TheWritableGlobalData->m_xResolution = xres;
1229
+ TheWritableGlobalData->m_yResolution = yres;
1230
+
1231
+ TheHeaderTemplateManager->headerNotifyResolutionChange ();
1232
+ TheMouse->mouseNotifyResolutionChange ();
1233
+
1234
+ // Save new settings for a dialog box confirmation after options are accepted
1235
+ newDispSettings.xRes = xres;
1236
+ newDispSettings.yRes = yres;
1237
+ newDispSettings.bitDepth = bitDepth;
1238
+ newDispSettings.windowed = TheDisplay->getWindowed ();
1239
+
1240
+ AsciiString prefString;
1241
+ prefString.format (" %d %d" , xres, yres );
1242
+ (*pref)[" Resolution" ] = prefString;
1243
+
1244
+ // delete the shell
1245
+ delete TheShell;
1246
+ TheShell = NULL ;
1247
+
1248
+ // create the shell
1249
+ TheShell = MSGNEW (" GameClientSubsystem" ) Shell;
1250
+ if ( TheShell )
1251
+ TheShell->init ();
1252
+
1253
+ TheInGameUI->recreateControlBar ();
1254
+
1255
+ TheShell->push ( AsciiString (" Menus/MainMenu.wnd" ) );
1256
+ }
1257
+ }
1258
+ }
1259
+
1260
+ // MUST NEVER ADD ANOTHER OPTION HERE AT THE END !
1255
1261
}
1256
1262
1257
1263
static void DestroyOptionsLayout () {
0 commit comments