From fa36c62215c1915f7a8b563a35a58d4ffc920605 Mon Sep 17 00:00:00 2001 From: Petr Ohlidal Date: Fri, 30 Jun 2023 01:25:21 +0200 Subject: [PATCH] Startup: AppContext - show error info if loading ogre.cfg fails. I tested OGRE13 branch recently and my ogre.cfg was incompatible - that's how I noticed this error reporting problem. --- source/main/AppContext.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/source/main/AppContext.cpp b/source/main/AppContext.cpp index ed434d6fc1..d9dddb1bf4 100644 --- a/source/main/AppContext.cpp +++ b/source/main/AppContext.cpp @@ -253,21 +253,30 @@ bool AppContext::SetUpRendering() } catch (Ogre::Exception&) {} // Logged by OGRE } + } catch (Ogre::Exception& e) { - ErrorUtils::ShowError (_L("Startup error"), e.getFullDescription()); + ErrorUtils::ShowError (_L("Startup error"), e.getDescription()); return false; } - // Load renderer configuration - if (!m_ogre_root->restoreConfig()) + try { - const auto render_systems = App::GetAppContext()->GetOgreRoot()->getAvailableRenderers(); - if (!render_systems.empty()) - m_ogre_root->setRenderSystem(render_systems.front()); - else - ErrorUtils::ShowError (_L("Startup error"), _L("No render system plugin available. Check your plugins.cfg")); + // Load renderer configuration + if (!m_ogre_root->restoreConfig()) + { + const auto render_systems = App::GetAppContext()->GetOgreRoot()->getAvailableRenderers(); + if (!render_systems.empty()) + m_ogre_root->setRenderSystem(render_systems.front()); + else + ErrorUtils::ShowError (_L("Startup error"), _L("No render system plugin available. Check your plugins.cfg")); + } + } + catch (Ogre::Exception& e) + { + ErrorUtils::ShowError (_L("Error restoring settings from 'ogre.cfg'"), e.getDescription()); + return false; } const auto rs = m_ogre_root->getRenderSystemByName(App::app_rendersys_override->getStr());