From 3eba279796bcc3e381d9b4fb75c1d25f350a99f9 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 8 Nov 2010 23:42:26 +0100 Subject: [PATCH] Changed: Fall back to windowed mode if we can't set a fullscreen mode --- code/ryzom/client/src/misc.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/code/ryzom/client/src/misc.cpp b/code/ryzom/client/src/misc.cpp index 0e6d42491..b093d22c5 100644 --- a/code/ryzom/client/src/misc.cpp +++ b/code/ryzom/client/src/misc.cpp @@ -1437,19 +1437,23 @@ void makeInstanceTransparent(UInstance &inst, uint8 opacity, bool disableZWrite) void setVideoMode(const UDriver::CMode &mode) { - UDriver::CMode oldMode; + UDriver::CMode oldMode, newMode = mode; oldMode.Windowed = true; // getCurrentScreenMode may fail if first init ... Driver->getCurrentScreenMode(oldMode); bool wasMaximized = isWindowMaximized(); - Driver->setMode(mode); + if (!Driver->setMode(newMode) && !newMode.Windowed) + { + // failed to switch to mode, fall back to windowed + newMode.Windowed = true; + } bool isMaximized = isWindowMaximized(); - if (oldMode.Windowed && !mode.Windowed) // going to fullscreen ? + if (oldMode.Windowed && !newMode.Windowed) // going to fullscreen ? { /*CInterfaceManager *pIM = CInterfaceManager::getInstance(); pIM->movePointerAbs((sint32) mode.Width / 2, (sint32) mode.Height / 2); Driver->setMousePos(0.5f, 0.5f);*/ } - else if ((!oldMode.Windowed || wasMaximized) && (mode.Windowed && !isMaximized)) // leaving fullscreen ? + else if ((!oldMode.Windowed || wasMaximized) && (newMode.Windowed && !isMaximized)) // leaving fullscreen ? { UDriver::CMode screenMode; @@ -1538,15 +1542,11 @@ sint getRyzomModes(std::vector &videoModes, std::vectorsystemMessageBox("No Video Modes available!\n" - "Minimum Video mode to play Ryzom is 800x600.\n", - "No Video Mode!", - NL3D::UDriver::okType, - NL3D::UDriver::exclamationIcon); - exit(EXIT_SUCCESS); + nlwarning("Mode %ux%u not found, fall back to windowed", (uint)ClientCfg.Width, (uint)ClientCfg.Height); + ClientCfg.Windowed = true; } return nFoundMode;