From 575295e92eef45e3a2ce6cc9c280d14e60457e52 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 5 Nov 2015 16:47:07 +0100 Subject: [PATCH 1/6] Fixed: cURL static version needs to be linked against libidn under Linux too --- code/CMakeLists.txt | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 848403148..22686bba0 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -158,9 +158,9 @@ IF(WITH_NEL) IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) SET(CURL_STATIC ON) - ELSE((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) + ELSE() SET(CURL_STATIC OFF) - ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) + ENDIF() IF(CURL_STATIC) SET(CURL_DEFINITIONS -DCURL_STATICLIB) @@ -172,15 +172,23 @@ IF(WITH_NEL) SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) ENDIF(OPENSSL_FOUND) - # CURL Macports version depends on libidn, libintl and libiconv too - IF(APPLE) + IF(UNIX) + # CURL depends on libidn FIND_LIBRARY(IDN_LIBRARY idn) - FIND_LIBRARY(INTL_LIBRARY intl) - - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY}) - ENDIF(APPLE) - ENDIF(CURL_STATIC) - ENDIF(WITH_GUI) + IF(IDN_LIBRARY) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY}) + ENDIF() + + # CURL Macports version depends on libidn, libintl and libiconv too + IF(APPLE) + FIND_LIBRARY(INTL_LIBRARY intl) + IF(INTL_LIBRARY) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY}) + ENDIF() + ENDIF() + ENDIF() + ENDIF() + ENDIF() INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) From dc86aa8459f11942a542ebd7e6016cba53639b97 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 5 Nov 2015 16:48:07 +0100 Subject: [PATCH 2/6] Fixed: Unable to debug Ryzom while client is in fullscreen (bug with Windows 10?) --- code/nel/src/3d/driver/opengl/driver_opengl_window.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 943371fd9..55e94bb4f 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -1738,7 +1738,9 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle) } else if (windowStyle == EWSFullscreen) { +#ifndef _DEBUG dwNewStyle |= WS_POPUP; +#endif isVisible = true; } From 4f64daeee4de8b4393bbbb517dc458aa5468dcea Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 5 Nov 2015 17:16:55 +0100 Subject: [PATCH 3/6] Changed: Centralize version different formats --- code/ryzom/client/src/client.cpp | 3 -- code/ryzom/client/src/init.cpp | 9 +--- code/ryzom/client/src/init_main_loop.cpp | 1 - code/ryzom/client/src/main_loop.cpp | 1 - code/ryzom/client/src/main_loop_debug.cpp | 14 +----- code/ryzom/client/src/progress.cpp | 10 +--- code/ryzom/client/src/user_agent.cpp | 59 +++++++++++++++++++---- code/ryzom/client/src/user_agent.h | 4 ++ 8 files changed, 60 insertions(+), 41 deletions(-) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index d3bb5254e..70e5a36c4 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -49,9 +49,6 @@ #define FINAL_VERSION 1 #endif // TEST_CRASH_COUNTER -// game share -#include "game_share/ryzom_version.h" - // Client #include "resource.h" #include "init.h" diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index a3a5baddf..4f8314bbb 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -48,8 +48,6 @@ // Std. #include #include -// Game Share -#include "game_share/ryzom_version.h" // Client #include "init.h" #include "input.h" @@ -89,6 +87,7 @@ #include "interface_v3/add_on_manager.h" #include "bg_downloader_access.h" +#include "user_agent.h" #include "nel/misc/check_fpu.h" @@ -837,11 +836,7 @@ void prelogInit() displayCPUInfo(); // Display the client version. -#if FINAL_VERSION - nlinfo("RYZOM VERSION : FV %s ("__DATE__" "__TIME__")", RYZOM_VERSION); -#else - nlinfo("RYZOM VERSION : DEV %s ("__DATE__" "__TIME__")", RYZOM_VERSION); -#endif + nlinfo("RYZOM VERSION : %s", getDebugVersion().c_str()); FPU_CHECKER_ONCE diff --git a/code/ryzom/client/src/init_main_loop.cpp b/code/ryzom/client/src/init_main_loop.cpp index 390b82e15..48b970d11 100644 --- a/code/ryzom/client/src/init_main_loop.cpp +++ b/code/ryzom/client/src/init_main_loop.cpp @@ -97,7 +97,6 @@ // Sound #include "nel/sound/sound_anim_manager.h" // Game share -#include "game_share/ryzom_version.h" #include "game_share/light_cycle.h" #include "sound_manager.h" #include "precipitation_clip_grid.h" diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 9b39c53c9..8a900f381 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -50,7 +50,6 @@ #include "game_share/brick_types.h" #include "game_share/light_cycle.h" #include "game_share/time_weather_season/time_and_season.h" -#include "game_share/ryzom_version.h" #include "game_share/bot_chat_types.h" // PACS #include "nel/pacs/u_global_position.h" diff --git a/code/ryzom/client/src/main_loop_debug.cpp b/code/ryzom/client/src/main_loop_debug.cpp index a26d8e013..cc19ab478 100644 --- a/code/ryzom/client/src/main_loop_debug.cpp +++ b/code/ryzom/client/src/main_loop_debug.cpp @@ -20,8 +20,6 @@ #include #include -#include "game_share/ryzom_version.h" - #include "global.h" #include "client_cfg.h" #include "user_entity.h" @@ -44,7 +42,7 @@ #include "misc.h" #include "interface_v3/interface_manager.h" #include "actions_client.h" - +#include "user_agent.h" using namespace NLMISC; @@ -244,15 +242,7 @@ void displayDebug() //-----------// TextContext->setHotSpot(UTextContext::TopLeft); line = 1.f; - string str; -#if FINAL_VERSION - str = "FV"; -#else - str = "DEV"; -#endif - if(ClientCfg.ExtendedCommands) - str += "_E"; - str += " "RYZOM_VERSION; + string str = getDisplayVersion(); TextContext->printfAt(0.f, line, "Version %s", str.c_str()); // TOP MIDDLE // diff --git a/code/ryzom/client/src/progress.cpp b/code/ryzom/client/src/progress.cpp index 2631984e7..2766c60d2 100644 --- a/code/ryzom/client/src/progress.cpp +++ b/code/ryzom/client/src/progress.cpp @@ -21,7 +21,6 @@ #include "global.h" #include "nel/misc/events.h" #include "nel/3d/u_texture.h" -#include "game_share/ryzom_version.h" #include "nel/misc/i18n.h" #include "continent.h" #include "weather.h" @@ -31,6 +30,7 @@ #include "release.h" #include "net_manager.h" #include "client_cfg.h" +#include "user_agent.h" #include "bg_downloader_access.h" #include "nel/misc/system_utils.h" #include "nel/3d/stereo_hmd.h" @@ -277,13 +277,7 @@ void CProgress::internalProgress (float value) // Display the build version. TextContext->setFontSize((uint)(12.f * fontFactor)); TextContext->setHotSpot(UTextContext::TopRight); - string str; -#if FINAL_VERSION - str = "FV "; -#else - str = "DEV "; -#endif - str += RYZOM_VERSION; + string str = getDisplayVersion(); TextContext->printfAt(1.0f,1.0f, str.c_str()); // Display the tips of the day. diff --git a/code/ryzom/client/src/user_agent.cpp b/code/ryzom/client/src/user_agent.cpp index 1452aa584..e1c364eef 100644 --- a/code/ryzom/client/src/user_agent.cpp +++ b/code/ryzom/client/src/user_agent.cpp @@ -18,10 +18,11 @@ #include "stdpch.h" #include "user_agent.h" +#include "client_cfg.h" #include "game_share/ryzom_version.h" -#if defined(RYZOM_COMPATIBILITY_VERSION) && defined(HAVE_REVISION_H) +#ifdef HAVE_REVISION_H #include "revision.h" #endif @@ -60,17 +61,57 @@ std::string getUserAgentVersion() if (s_userAgent.empty()) { - char buffer[256]; - -#if defined(REVISION) && defined(RYZOM_COMPATIBILITY_VERSION) - // we don't need RYZOM_VERSION if we already have a numeric form a.b.c, we just need to append revision to it - sprintf(buffer, "%s.%s-%s-%s", RYZOM_COMPATIBILITY_VERSION, REVISION, RYZOM_SYSTEM, RYZOM_ARCH); +#ifdef REVISION + s_userAgent = NLMISC::toString("%s.%s-%s-%s", RYZOM_VERSION, REVISION, RYZOM_SYSTEM, RYZOM_ARCH); #else - sprintf(buffer, "%s-%s-%s", RYZOM_VERSION, RYZOM_SYSTEM, RYZOM_ARCH); + s_userAgent = NLMISC::toString("%s-%s-%s", RYZOM_VERSION, RYZOM_SYSTEM, RYZOM_ARCH); #endif - - s_userAgent = buffer; } return s_userAgent; } + +std::string getVersion() +{ + return RYZOM_VERSION; +} + +std::string getDisplayVersion() +{ + static std::string s_version; + + if (s_version.empty()) + { +#if FINAL_VERSION + s_version = "FV "; +#else + s_version = "DEV "; +#endif + if (ClientCfg.ExtendedCommands) s_version += "_E"; + + s_version += getVersion(); + +#ifdef REVISION + s_version += NLMISC::toString(".%s", REVISION); +#endif + } + + return s_version; +} + +std::string getDebugVersion() +{ + static std::string s_version; + + if (s_version.empty()) + { + s_version = getDisplayVersion(); +#ifdef BUILD_DATE + s_version += NLMISC::toString(" (%s)", BUILD_DATE); +#else + s_version += NLMISC::toString(" (%s %s)", __DATE__, __TIME__); +#endif + } + + return s_version; +} diff --git a/code/ryzom/client/src/user_agent.h b/code/ryzom/client/src/user_agent.h index bc508273d..a7c59af28 100644 --- a/code/ryzom/client/src/user_agent.h +++ b/code/ryzom/client/src/user_agent.h @@ -21,6 +21,10 @@ std::string getUserAgent(); std::string getUserAgentName(); std::string getUserAgentVersion(); +std::string getVersion(); +std::string getDisplayVersion(); +std::string getDebugVersion(); + #endif // CL_USER_AGENT_H /* End of user_agent.h */ From d0c869c64ffdb5817dc42a81f3d892f16fa34eea Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 5 Nov 2015 17:18:14 +0100 Subject: [PATCH 4/6] Fixed: Update also Depth and Frequency with default resolution --- code/ryzom/client/src/init.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 4f8314bbb..3a51b82a0 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -948,14 +948,28 @@ void prelogInit() return; } + // used to determine screen default resolution if (ClientCfg.Width < 800 || ClientCfg.Height < 600) { UDriver::CMode mode; + CConfigFile::CVar *varPtr = NULL; + if (!ClientCfg.Windowed && Driver->getCurrentScreenMode(mode)) { ClientCfg.Width = mode.Width; ClientCfg.Height = mode.Height; + ClientCfg.Depth = mode.Depth; + ClientCfg.Frequency = mode.Frequency; + + // update client.cfg with detected depth and frequency + varPtr = ClientCfg.ConfigFile.getVarPtr("Depth"); + if(varPtr) + varPtr->forceAsInt(ClientCfg.Depth); + + varPtr = ClientCfg.ConfigFile.getVarPtr("Frequency"); + if(varPtr) + varPtr->forceAsInt(ClientCfg.Frequency); } else { @@ -964,7 +978,7 @@ void prelogInit() } // update client.cfg with detected resolution - CConfigFile::CVar *varPtr = ClientCfg.ConfigFile.getVarPtr("Width"); + varPtr = ClientCfg.ConfigFile.getVarPtr("Width"); if(varPtr) varPtr->forceAsInt(ClientCfg.Width); From ceac8b3918e65eedb58260a73287cf9e6b9b97d1 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 5 Nov 2015 17:22:43 +0100 Subject: [PATCH 5/6] Fixed: Didn't initialize video modes frequencies --- .../src/interface_v3/action_handler_game.cpp | 21 ++++++++-- code/ryzom/client/src/login.cpp | 5 ++- code/ryzom/client/src/misc.cpp | 42 +++++++++++++++---- code/ryzom/client/src/misc.h | 2 +- 4 files changed, 57 insertions(+), 13 deletions(-) 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 b76bbce21..ca0860c11 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2990,12 +2990,15 @@ public: if (Driver == NULL) return; VideoModes.clear(); - vector stringModeList; + vector stringModeList, stringFreqList; + sint nFoundMode, nFoundFreq; - sint nFoundMode = getRyzomModes(VideoModes, stringModeList); + getRyzomModes(VideoModes, stringModeList, stringFreqList, nFoundMode, nFoundFreq); // Initialize interface combo box CInterfaceManager *pIM = CInterfaceManager::getInstance(); + + // resolutions CDBGroupComboBox *pCB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_VIDEO_MODES_COMBO )); if( pCB ) { @@ -3003,11 +3006,23 @@ public: for (sint j = 0; j < (sint)stringModeList.size(); j++) pCB->addText(ucstring(stringModeList[j])); } + + // frequencies + pCB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_VIDEO_FREQS_COMBO )); + if( pCB ) + { + pCB->resetTexts(); + for (sint j = 0; j < (sint)stringFreqList.size(); j++) + pCB->addText(ucstring(stringFreqList[j])); + } + // -1 is important to indicate we set this value in edit mode NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_MODE_DB )->setValue32(-1); - NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_FREQ_DB )->setValue32(-1); NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_MODE_DB )->setValue32(nFoundMode); + NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_FREQ_DB )->setValue32(-1); + NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_FREQ_DB )->setValue32(nFoundFreq); + CCtrlBaseButton *pBut = dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_VIDEO_FULLSCREEN_BUTTON )); if (pBut) { diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 091e24a80..8d98d9fb6 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -1945,7 +1945,10 @@ class CAHInitResLod : public IActionHandler VideoModes.clear(); StringModeList.clear(); - CurrentMode = getRyzomModes(VideoModes, StringModeList); + std::vector stringFreqList; + sint currentFreq; + + getRyzomModes(VideoModes, StringModeList, stringFreqList, CurrentMode, currentFreq); // getRyzomModes() expects empty list, so we need to insert 'Windowed' after mode list is filled StringModeList.insert(StringModeList.begin(), "uiConfigWindowed"); diff --git a/code/ryzom/client/src/misc.cpp b/code/ryzom/client/src/misc.cpp index 7e018a576..0deb4b518 100644 --- a/code/ryzom/client/src/misc.cpp +++ b/code/ryzom/client/src/misc.cpp @@ -1392,12 +1392,19 @@ bool isWindowMaximized() screenMode.Width == width && screenMode.Height == height); } -sint getRyzomModes(std::vector &videoModes, std::vector &stringModeList) +bool getRyzomModes(std::vector &videoModes, std::vector &stringModeList, std::vector &stringFreqList, sint &nFoundStringMode, sint &nFoundStringFreq) { + // default values + nFoundStringMode = -1; + nFoundStringFreq = -1; + + // mode index in original video modes + sint nFoundMode = -1; + // **** Init Video Modes Driver->getModes(videoModes); // Remove modes under 800x600 and get the unique strings - sint i, j, nFoundMode = -1; + sint i, j; for (i=0; i < (sint)videoModes.size(); ++i) { if ((videoModes[i].Width < 800) || (videoModes[i].Height < 600)) @@ -1408,10 +1415,10 @@ sint getRyzomModes(std::vector &videoModes, std::vector &videoModes, std::vector &videoModes, std::vector 0 && freq == ClientCfg.Frequency) + { + nFoundStringFreq = stringFreqList.size(); + } + + stringFreqList.push_back(toString(freq)); + } + } + } + + return nFoundStringMode > -1; } diff --git a/code/ryzom/client/src/misc.h b/code/ryzom/client/src/misc.h index 7fba7204c..d7b86755d 100644 --- a/code/ryzom/client/src/misc.h +++ b/code/ryzom/client/src/misc.h @@ -228,7 +228,7 @@ uint getCurrentColorDepth(); bool isWindowMaximized(); // get all supported video modes -sint getRyzomModes(std::vector &videoModes, std::vector &stringModeList); +bool getRyzomModes(std::vector &videoModes, std::vector &stringModeList, std::vector &stringFreqList, sint &nFoundMode, sint &nFoundFreq); #endif // CL_MISC_H From 28ae51085c31ae8f47f1aeebbeeb7754c7a4bc10 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 5 Nov 2015 17:26:45 +0100 Subject: [PATCH 6/6] Fixed: Wrong index for video modes comparison (nFoundMode was an index in strings not CMode list, now renamed to nFoundStringMode) --- code/ryzom/client/src/misc.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/misc.cpp b/code/ryzom/client/src/misc.cpp index 0deb4b518..fd58729e6 100644 --- a/code/ryzom/client/src/misc.cpp +++ b/code/ryzom/client/src/misc.cpp @@ -1430,15 +1430,19 @@ bool getRyzomModes(std::vector &videoModes, std::vector= videoModes[nFoundMode].Width) && (videoModes[i].Height >= videoModes[nFoundMode].Height)) - nFoundMode = j; + { + nFoundStringMode = j; + nFoundMode = i; + } } } }