summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/graphicsmanager.cpp30
-rw-r--r--src/gui/setup_video.cpp2
2 files changed, 25 insertions, 7 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 5abd85297..655040aab 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -277,14 +277,30 @@ void GraphicsManager::setVideoMode()
getAllVideoModes(videoModes);
if (!videoModes.empty())
{
- std::string str = videoModes[0];
- std::vector<int> res;
- splitToIntVector(res, videoModes[0], 'x');
- if (res.size() == 2)
+ bool found(false);
+ std::string str = strprintf("%dx%d", width, height);
+ for (StringVectCIter it = videoModes.begin(), it_end = videoModes.end();
+ it != it_end; ++ it)
{
- width = res[0];
- height = res[1];
- logger->log("Autoselect mode %dx%d", width, height);
+ if (str == *it)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ logger->log("Current resolution %s is incorrect.", str.c_str());
+ str = videoModes[0];
+ std::vector<int> res;
+ splitToIntVector(res, videoModes[0], 'x');
+ if (res.size() == 2)
+ {
+ width = res[0];
+ height = res[1];
+ logger->log("Autoselect mode %dx%d", width, height);
+ }
}
}
#endif
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 0188eb6b7..cb3514459 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -133,6 +133,7 @@ static bool modeSorter(std::string mode1, std::string mode2)
ModeListModel::ModeListModel()
{
graphicsManager.getAllVideoModes(mVideoModes);
+#ifndef ANDROID
addCustomMode("640x480");
addCustomMode("800x600");
addCustomMode("1024x768");
@@ -144,6 +145,7 @@ ModeListModel::ModeListModel()
std::sort(mVideoModes.begin(), mVideoModes.end(), modeSorter);
mVideoModes.push_back("custom");
+#endif
}
void ModeListModel::addCustomMode(std::string mode)