From 4d67f9a64f3e25aaba47b8401031bc2cdb8ef226 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 1 Dec 2015 15:58:45 +0100 Subject: [PATCH] Fixed: Only display VR page in game config if compiled with a VR SDK --- code/CMakeModules/FindLibOVR.cmake | 1 + code/CMakeModules/FindLibVR.cmake | 1 + code/config.h.cmake | 2 ++ .../src/interface_v3/action_handler_game.cpp | 25 +++++++++++++++++++ code/ryzom/client/src/user_agent.cpp | 9 +++++++ code/ryzom/client/src/user_agent.h | 2 ++ 6 files changed, 40 insertions(+) diff --git a/code/CMakeModules/FindLibOVR.cmake b/code/CMakeModules/FindLibOVR.cmake index 707949613..b182da00c 100644 --- a/code/CMakeModules/FindLibOVR.cmake +++ b/code/CMakeModules/FindLibOVR.cmake @@ -58,6 +58,7 @@ IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR) ENDIF(NOT LIBOVR_FIND_QUIETLY) SET(LIBOVR_FOUND "YES") SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR") + SET(NL_STEREO_AVAILABLE ON) IF(UNIX) SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread) ELSE(UNIX) diff --git a/code/CMakeModules/FindLibVR.cmake b/code/CMakeModules/FindLibVR.cmake index eba9c347e..e8bcf2fde 100644 --- a/code/CMakeModules/FindLibVR.cmake +++ b/code/CMakeModules/FindLibVR.cmake @@ -25,6 +25,7 @@ IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) ENDIF(NOT LIBVR_FIND_QUIETLY) SET(LIBVR_FOUND "YES") SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR") + SET(NL_STEREO_AVAILABLE ON) ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) IF(NOT LIBVR_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find LibVR!") diff --git a/code/config.h.cmake b/code/config.h.cmake index 2feb8ca7a..69171cf68 100644 --- a/code/config.h.cmake +++ b/code/config.h.cmake @@ -10,6 +10,8 @@ #cmakedefine NL_DSOUND_AVAILABLE ${NL_DSOUND_AVAILABLE} #cmakedefine NL_XAUDIO2_AVAILABLE ${NL_XAUDIO2_AVAILABLE} +#cmakedefine NL_STEREO_AVAILABLE ${NL_STEREO_AVAILABLE} + #cmakedefine NL_BIN_PREFIX "${NL_BIN_ABSOLUTE_PREFIX}" #cmakedefine NL_ETC_PREFIX "${NL_ETC_ABSOLUTE_PREFIX}" #cmakedefine NL_SHARE_PREFIX "${NL_SHARE_ABSOLUTE_PREFIX}" diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index ca0860c11..8457185e7 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -65,6 +65,7 @@ #include "../far_tp.h" #include "nel/gui/interface_link.h" #include "../npc_icon.h" +#include "user_agent.h" // Game Share #include "game_share/character_summary.h" @@ -2911,6 +2912,7 @@ REGISTER_ACTION_HANDLER (CHandlerToggleInventory, "toggle_inventory"); // *************************************************************************** #define GAME_CONFIG_DDX "ui:interface:game_config:content:all" +#define GAME_CONFIG_TREE_LIST "ui:interface:game_config:content:sbtree:tree_list" static vector VideoModes; #define GAME_CONFIG_VIDEO_MODES_COMBO "ui:interface:game_config:content:general:video_modes" @@ -3085,6 +3087,29 @@ public: } // **** Init Language : look in game_config.lua + + // display or not VR page + NLGUI::CGroupTree* configTree = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_TREE_LIST)); + + if (configTree) + { + CGroupTree::SNode *rootNode = configTree->getRootNode(); + + if (rootNode) + { + CGroupTree::SNode *graphNode = rootNode->getNodeFromId("graph"); + + if (graphNode) + { + CGroupTree::SNode *vrNode = graphNode->getNodeFromId("vr"); + + if (vrNode) + { + vrNode->setShow(isStereoAvailable()); + } + } + } + } } }; REGISTER_ACTION_HANDLER (CHandlerGameConfigInit, "game_config_init"); diff --git a/code/ryzom/client/src/user_agent.cpp b/code/ryzom/client/src/user_agent.cpp index e8d4f8708..424272c6d 100644 --- a/code/ryzom/client/src/user_agent.cpp +++ b/code/ryzom/client/src/user_agent.cpp @@ -105,3 +105,12 @@ std::string getDebugVersion() return s_version; } + +bool isStereoAvailable() +{ +#ifdef NL_STEREO_AVAILABLE + return true; +#else + return false; +#endif +} diff --git a/code/ryzom/client/src/user_agent.h b/code/ryzom/client/src/user_agent.h index a7c59af28..1f2c639c9 100644 --- a/code/ryzom/client/src/user_agent.h +++ b/code/ryzom/client/src/user_agent.h @@ -25,6 +25,8 @@ std::string getVersion(); std::string getDisplayVersion(); std::string getDebugVersion(); +bool isStereoAvailable(); + #endif // CL_USER_AGENT_H /* End of user_agent.h */