Graphics card profiles: Difference between revisions

Jump to navigation Jump to search
m
Line 154: Line 154:
{{WIP}}
{{WIP}}


<syntaxhighlight lang="diff">
<syntaxhighlight lang="diff">diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx
index b7fea20..615d0a9 100644
--- a/src/Main/fg_init.cxx
+++ b/src/Main/fg_init.cxx
@@ -469,7 +469,24 @@ int fgInitConfig ( int argc, char **argv, bool reinit )
      SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences");
      fgLoadProps("preferences.xml", globals->get_props());
      SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
-       
+   
+      // Next, try to load defaults for /sim/rendering
+      SGPropertyNode* fgroot = globals->get_props();
+      try {
+      SGPropertyNode* rendering = fgroot->getNode("/sim/rendering");
+ std::string path = "Profiles/graphics.xml";
+ if(rendering) {
+ SG_LOG(SG_INPUT, SG_INFO, "Loading graphics profiles from:" <<path);
+      fgLoadProps(path.c_str(), rendering);
+ }
+ else SG_LOG(SG_INPUT, SG_ALERT, "Could not acquire handle to /sim/rendering for loading graphics profile from "<<path);
+      }
+      catch (const std::exception& e) {
+                SG_LOG(SG_INPUT, SG_INFO, "caught std::exception trying to read graphics profile");
+            } catch (...) {
+                SG_LOG(SG_INPUT, SG_INFO, "caught generic exception trying to read graphics profile");
+            }
+
      // do not load user settings when reset to default is requested, or if
      // told to explicitly ignore
      if (options->isOptionSet("restore-defaults") || options->isOptionSet("ignore-autosave"))
 
</syntaxhighlight>
</syntaxhighlight>

Navigation menu