diff --git a/src/gui/config_display.cpp b/src/gui/config_display.cpp index 2204d7abb..a0cfc9791 100644 --- a/src/gui/config_display.cpp +++ b/src/gui/config_display.cpp @@ -71,12 +71,20 @@ ConfigDisplay::ConfigDisplay() changeResolution(user_config->m_prev_width, user_config->m_prev_height,true); } + // if m_prev_windowed is true and m_fullscreen is true then a change to // fullscreen has been rejected - if (user_config->m_prev_windowed && user_config->m_fullscreen) + else if (user_config->m_prev_windowed && user_config->m_fullscreen) { drv_toggleFullscreen(); - user_config->m_prev_windowed = false; //reset flag + user_config->m_prev_windowed = false; //reset flags + user_config->m_crashed = false; + user_config->saveConfig(); + } + else + { + user_config->m_crashed = false; //if we are here we didn't crash + user_config->saveConfig(); } const bool SHOW_RECT = true; @@ -300,6 +308,13 @@ void ConfigDisplay::changeResolution(int width, int height, bool reverse) user_config->m_width = width; user_config->m_height = height; + // if returning to prev res, change m_crashed to false as we didn't crash and save config + if (reverse && user_config->m_fullscreen) + { + user_config->m_crashed = false; + user_config->saveConfig(); + } + if (!reverse && user_config->m_fullscreen) { // Store settings in user config file in case new video mode diff --git a/src/gui/game_mode.cpp b/src/gui/game_mode.cpp index fbce977f2..81f1b5ca1 100644 --- a/src/gui/game_mode.cpp +++ b/src/gui/game_mode.cpp @@ -71,10 +71,6 @@ GameMode::GameMode() widget_manager->layout(WGT_AREA_ALL); - // Set crashed flag to false, as if made it here after chaging res - // then can't have crashed or been killed - user_config->m_crashed = false; - user_config->saveConfig(); } //----------------------------------------------------------------------------- diff --git a/src/main.cpp b/src/main.cpp index 75e3cd749..cb2c83a92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -496,9 +496,7 @@ int main(int argc, char *argv[] ) } /* Program closing...*/ - // Set crashed flag to false - user_config->m_crashed = false; - + user_config->saveConfig(); drv_deinit(); diff --git a/src/sdldrv.cpp b/src/sdldrv.cpp index 4f9a8f1e3..84f136bc2 100755 --- a/src/sdldrv.cpp +++ b/src/sdldrv.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "input.hpp" #include "actionmap.hpp" @@ -85,10 +86,15 @@ void drv_init() user_config->m_crashed = false; //reset flag // set window mode as a precaution user_config->m_fullscreen = false; - // blacklist the res + // blacklist the res if not already done std::ostringstream o; o << user_config->m_width << "x" << user_config->m_height; - user_config->m_blacklist_res.push_back (o.str()); + std::string res = o.str(); + if (std::find(user_config->m_blacklist_res.begin(), + user_config->m_blacklist_res.end(),res) == user_config->m_blacklist_res.end()) + { + user_config->m_blacklist_res.push_back (o.str()); + } //use prev screen res settings if available if (user_config->m_width != user_config->m_prev_width || user_config->m_height != user_config->m_prev_height)