From 98709e55dbb40c0e0ac764174cc1533857b844f1 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 18 Apr 2020 10:50:20 +0300 Subject: [PATCH 1/8] Fixed: Crash on switching chars, logout --- ryzom/client/src/interface_v3/dbctrl_sheet.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 063ffdfad..ba13c135e 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -564,6 +564,11 @@ CDBCtrlSheet::~CDBCtrlSheet() Driver->deleteTextureFile(_GuildSymb); _GuildSymb = NULL; } + if (_RegenText) + { + delete _RegenText; + _RegenText = NULL; + } // ensure erase static if(this==_CurrMenuSheet) _CurrMenuSheet = NULL; From 4ebca98559c3f3b5bc98fb024e2474f63d544456 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 17 Apr 2020 11:49:21 +0300 Subject: [PATCH 2/8] Fixed: Audio decoder getMusicInfo/getSongTitle needs to be thread safe --- nel/include/nel/sound/driver/sound_driver.h | 2 +- nel/src/sound/audio_decoder.cpp | 11 ++++----- .../sound/driver/fmod/sound_driver_fmod.cpp | 24 ++++--------------- nel/src/sound/driver/fmod/sound_driver_fmod.h | 2 +- 4 files changed, 11 insertions(+), 28 deletions(-) diff --git a/nel/include/nel/sound/driver/sound_driver.h b/nel/include/nel/sound/driver/sound_driver.h index 1fba9c887..9c758487a 100644 --- a/nel/include/nel/sound/driver/sound_driver.h +++ b/nel/include/nel/sound/driver/sound_driver.h @@ -191,7 +191,7 @@ public: /// Create a native music channel, only supported by the FMod driver. virtual IMusicChannel *createMusicChannel() { return NULL; } /** Get music info. Returns false if the song is not found or the function is not implemented. - * \param filepath path to file, CPath::lookup done by driver + * \param filepath full path to file * \param artist returns the song artist (empty if not available) * \param title returns the title (empty if not available) */ diff --git a/nel/src/sound/audio_decoder.cpp b/nel/src/sound/audio_decoder.cpp index a282942c4..db87bd990 100644 --- a/nel/src/sound/audio_decoder.cpp +++ b/nel/src/sound/audio_decoder.cpp @@ -110,10 +110,9 @@ IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &type, NLMISC bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, std::string &title, float &length) { - std::string lookup = CPath::lookup(filepath, false); - if (lookup.empty()) + if (filepath.empty() || !CFile::fileExists(filepath)) { - nlwarning("Music file %s does not exist!", filepath.c_str()); + nlwarning("Music file '%s' does not exist!", filepath.c_str()); return false; } @@ -121,7 +120,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st CIFile ifile; ifile.setCacheFileOnOpen(false); ifile.allowBNPCacheFileOnOpen(false); - if (ifile.open(lookup)) + if (ifile.open(filepath)) return CAudioDecoderFfmpeg::getInfo(&ifile, artist, title, length); #else std::string type = CFile::getExtension(filepath); @@ -132,7 +131,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st CIFile ifile; ifile.setCacheFileOnOpen(false); ifile.allowBNPCacheFileOnOpen(false); - if (ifile.open(lookup)) + if (ifile.open(filepath)) return CAudioDecoderVorbis::getInfo(&ifile, artist, title, length); nlwarning("Unable to open: '%s'", filepath.c_str()); @@ -143,7 +142,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st CIFile ifile; ifile.setCacheFileOnOpen(false); ifile.allowBNPCacheFileOnOpen(false); - if (ifile.open(lookup)) + if (ifile.open(filepath)) return CAudioDecoderMP3::getInfo(&ifile, artist, title, length); nlwarning("Unable to open: '%s'", filepath.c_str()); diff --git a/nel/src/sound/driver/fmod/sound_driver_fmod.cpp b/nel/src/sound/driver/fmod/sound_driver_fmod.cpp index d98aa600f..2b250a1d3 100644 --- a/nel/src/sound/driver/fmod/sound_driver_fmod.cpp +++ b/nel/src/sound/driver/fmod/sound_driver_fmod.cpp @@ -496,36 +496,20 @@ bool getTag (std::string &result, const char *tag, FSOUND_STREAM *stream) } /** Get music info. Returns false if the song is not found or the function is not implemented. - * \param filepath path to file, CPath::lookup done by driver + * \param filepath full path to file * \param artist returns the song artist (empty if not available) * \param title returns the title (empty if not available) */ bool CSoundDriverFMod::getMusicInfo(const std::string &filepath, std::string &artist, std::string &title, float &length) { - /* Open a stream, get the tag if it exists, close the stream */ - string pathName = CPath::lookup(filepath, false); - uint32 fileOffset = 0, fileSize = 0; - if (pathName.empty()) + if (filepath.empty() || !CFile::fileExists(filepath)) { nlwarning("NLSOUND FMod Driver: Music file %s not found!", filepath.c_str()); return false; } - // if the file is in a bnp - if (pathName.find('@') != string::npos) - { - if (CBigFile::getInstance().getFileInfo(pathName, fileSize, fileOffset)) - { - // set pathname to bnp - pathName = pathName.substr(0, pathName.find('@')); - } - else - { - nlwarning("NLSOUND FMod Driver: BNP BROKEN"); - return false; - } - } - FSOUND_STREAM *stream = FSOUND_Stream_Open((const char *)CPath::lookup(filepath, false).c_str(), FSOUND_2D, (sint)fileOffset, (sint)fileSize); + uint32 fileOffset = 0, fileSize = 0; + FSOUND_STREAM *stream = FSOUND_Stream_Open(filepath.c_str(), FSOUND_2D, (sint)fileOffset, (sint)fileSize); if (stream) { getTag(artist, "ARTIST", stream); diff --git a/nel/src/sound/driver/fmod/sound_driver_fmod.h b/nel/src/sound/driver/fmod/sound_driver_fmod.h index db82cde6e..73d3b8673 100644 --- a/nel/src/sound/driver/fmod/sound_driver_fmod.h +++ b/nel/src/sound/driver/fmod/sound_driver_fmod.h @@ -112,7 +112,7 @@ public: virtual IMusicChannel *createMusicChannel(); /** Get music info. Returns false if the song is not found or the function is not implemented. - * \param filepath path to file, CPath::lookup done by driver + * \param filepath full path to file * \param artist returns the song artist (empty if not available) * \param title returns the title (empty if not available) */ From da890311bb02133c10cf40ceb85c4924f876eb71 Mon Sep 17 00:00:00 2001 From: karu Date: Mon, 6 Jan 2020 19:55:08 +0200 Subject: [PATCH 3/8] Added: Show disabled until timer on icon --- .../client/src/interface_v3/dbctrl_sheet.cpp | 39 +++++++++++++++++++ ryzom/client/src/interface_v3/dbctrl_sheet.h | 3 ++ 2 files changed, 42 insertions(+) diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index ba13c135e..e0e5f2e74 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -540,6 +540,9 @@ CCtrlDraggable(param) _SapBuffIcon = "ico_sap.tga"; _StaBuffIcon = "ico_stamina.tga"; _FocusBuffIcon = "ico_focus.tga"; + + _RegenText = NULL; + _RegenTextValue = 0; } // ---------------------------------------------------------------------------- @@ -2050,6 +2053,12 @@ void CDBCtrlSheet::draw() if (!_LastSheetId) { _RegenTickRange = CTickRange(); + if (_RegenText) + { + delete _RegenText; + _RegenText = NULL; + _RegenTextValue = 0; + } } else { @@ -2076,6 +2085,36 @@ void CDBCtrlSheet::draw() { rVR.drawQuad(_RenderLayer + 1, regenTris[tri], backTex, CRGBA::White, false); } + + if (!_RegenText) { + _RegenText = new CViewText(CViewBase::TCtorParam()); + _RegenText->setId(getId() + ":regen"); + _RegenText->setParent(_Parent); + _RegenText->setOverflowText(ucstring("")); + _RegenText->setModulateGlobalColor(false); + _RegenText->setMultiLine(false); + _RegenText->setTextMode(CViewText::ClipWord); + _RegenText->setFontSizing("0", "0"); + // TODO: font size / color hardcoded. + _RegenText->setFontSize(8); + _RegenText->setColor(CRGBA::White); + _RegenText->setShadow(true); + _RegenText->setActive(true); + _RegenText->updateTextContext(); + } + + // TODO: ticks in second hardcoded + uint32 nextValue = _RegenTickRange.EndTick > LastGameCycle ? (_RegenTickRange.EndTick - LastGameCycle) / 10 : 0; + if (_RegenTextValue != nextValue) + { + _RegenTextValue = nextValue; + _RegenText->setText(toString("%d", _RegenTextValue)); + _RegenText->updateTextContext(); + } + _RegenText->setXReal(_XReal+1); + _RegenText->setYReal(_YReal+2); + _RegenText->setRenderLayer(_RenderLayer+2); + _RegenText->draw(); } } diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.h b/ryzom/client/src/interface_v3/dbctrl_sheet.h index 8b89a91ed..e6ed7587b 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -56,6 +56,7 @@ class COutpostBuildingSheet; namespace NLGUI { class CViewRenderer; + class CViewText; } class CDBCtrlSheet; @@ -736,6 +737,8 @@ protected: sint8 _ArmourColorIndex; CTickRange _RegenTickRange; + NLGUI::CViewText *_RegenText; + uint32 _RegenTextValue; /// D'n'd sint32 _DragX, _DragY; From 4fd3f59b9a0e9a408928f8af1cc5c99d28c35045 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 13 Jun 2020 20:37:43 +0300 Subject: [PATCH 4/8] Fixed: Releasing curl handle when not connected. --- nel/src/web/http_client_curl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nel/src/web/http_client_curl.cpp b/nel/src/web/http_client_curl.cpp index e61baa89f..10bb0776c 100644 --- a/nel/src/web/http_client_curl.cpp +++ b/nel/src/web/http_client_curl.cpp @@ -191,8 +191,11 @@ bool CCurlHttpClient::receive(string &res, bool verbose) // *************************************************************************** void CCurlHttpClient::disconnect() { - curl_easy_cleanup(_Curl); - _CurlStruct = NULL; + if (_CurlStruct) + { + curl_easy_cleanup(_Curl); + _CurlStruct = NULL; + } curl_global_cleanup(); } From 5e3cd0321a08917003a3366468008df30b17295c Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 13 Jun 2020 20:30:37 +0300 Subject: [PATCH 5/8] Fixed: Delay CDecal init as it depends on Scene object --- ryzom/client/src/decal.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ryzom/client/src/decal.cpp b/ryzom/client/src/decal.cpp index e270a7c29..a16cb93bf 100644 --- a/ryzom/client/src/decal.cpp +++ b/ryzom/client/src/decal.cpp @@ -162,7 +162,9 @@ CDecal::CDecal() { DecalAttenuationVertexProgram = new CVertexProgramDecalAttenuation(); } - _ShadowMap = new CShadowMap(&(((CSceneUser *) Scene)->getScene().getRenderTrav().getShadowMapManager())); + + // initialized in render() as depends on scene + _ShadowMap = NULL; _Material.initUnlit(); _Diffuse = CRGBA::White; _Emissive = CRGBA::Black; @@ -251,7 +253,11 @@ CRGBA CDecal::getDiffuse() const // **************************************************************************** CDecal::~CDecal() { - delete _ShadowMap; + if (_ShadowMap) + { + delete _ShadowMap; + _ShadowMap = NULL; + } } // **************************************************************************** @@ -527,7 +533,12 @@ void CDecal::render(NL3D::UDriver &/* drv */, // float tileNear = Landscape->getTileNear(); // - nlassert(_ShadowMap); + if (!_ShadowMap) + { + _ShadowMap = new CShadowMap(&(((CSceneUser *) Scene)->getScene().getRenderTrav().getShadowMapManager())); + nlassert(_ShadowMap); + } + _ShadowMap->LocalClipPlanes.resize(4); CVector corners[4] = { From d367e32a400dba41a394e7e69b6d10a419dd487c Mon Sep 17 00:00:00 2001 From: Nimetu Date: Wed, 24 Jun 2020 13:59:39 +0300 Subject: [PATCH 6/8] Fixed: set_desktop handler only worked with keypress event --- .../src/interface_v3/action_handler_game.cpp | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index 58c00421b..5af8485d6 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2822,24 +2822,6 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &Params) { - /* // Previous version (multiple pressed on a desktop change a central window - uint desktop; - fromString(Params, desktop); - if (desktop getDbProp(dbNames[desktop], false); - if (pNL != NULL) - sValue = NLMISC::toString((sint32)pNL->getValue64()); - vector vecStr; - vecStr.push_back(procNames[desktop]); - vecStr.push_back(sValue); - CWidgetManager::getInstance()->runProcedure(procNames[desktop], NULL, vecStr); - }*/ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:gestion_windows")); if (pGC == NULL) @@ -2850,11 +2832,14 @@ public: CInterfaceElement *pIE = CWidgetManager::getInstance()->getElementFromId("ui:interface:gestion_windows:close"); if (pIE != NULL) pIE->setActive(false); + bool switchDesktop = false; + CActionsManager *pAM = &Actions; if (!pAM->valide(CAction::CName("set_desktop",Params.c_str()))) { pGC->setActive(false); _FirstTime = true; + switchDesktop = true; } else // Key is down { @@ -2862,11 +2847,7 @@ public: if (_FirstTime) { _FirstTime = false; - - vector vecStr; - vecStr.push_back("tb_setdesktop"); - vecStr.push_back(Params); - CWidgetManager::getInstance()->runProcedure("tb_setdesktop", NULL, vecStr); + switchDesktop = true; } else // Not the first time { @@ -2876,6 +2857,13 @@ public: CWidgetManager::getInstance()->setTopWindow(pGC); } } + if (switchDesktop) + { + vector vecStr; + vecStr.push_back("tb_setdesktop"); + vecStr.push_back(Params); + CWidgetManager::getInstance()->runProcedure("tb_setdesktop", NULL, vecStr); + } } private: bool _FirstTime; From 720f6da8b9c1d986357139895032d0cee8bdb036 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 26 Sep 2020 17:27:00 +0300 Subject: [PATCH 7/8] Fixed: Remove unused include (fixes #618) --- nel/src/misc/system_info.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/nel/src/misc/system_info.cpp b/nel/src/misc/system_info.cpp index 1f5039de5..5dc70182c 100644 --- a/nel/src/misc/system_info.cpp +++ b/nel/src/misc/system_info.cpp @@ -179,7 +179,6 @@ #else # include # include -# include # include # include # include From b4901bf267af685e9253fc1412a6060208f49838 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 17 Oct 2020 12:32:59 +0300 Subject: [PATCH 8/8] Fixed: Ingame map search and search result tooltips for UTF8 strings --- ryzom/client/src/interface_v3/group_map.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index 24e1d14cc..17e75486a 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -2471,7 +2471,8 @@ void CGroupMap::updateMatchedLandmarks() std::vector > params; params.clear(); params.push_back(std::pair("id", toString("lm%d", k))); - params.push_back(std::pair("tooltip", _MatchedLandmarks[k].Title.toUtf8())); + // ctrl base expects utf8 string to start with "u:" + params.push_back(std::pair("tooltip", "u:" + _MatchedLandmarks[k].Title.toUtf8())); params.push_back(std::pair("index", toString(k))); CInterfaceGroup *g = CWidgetManager::getInstance()->getParser()->createGroupInstance("lm_search_result", pL->getId(), params); @@ -2675,7 +2676,7 @@ void CGroupMap::setLandmarkFilter(const std::string &s) if (!s.empty()) { ucstring ucs; ucs.fromUtf8(s); - splitUCString(toLower(s), ucstring(" "), _LandmarkFilter); + splitUCString(toLower(ucs), ucstring(" "), _LandmarkFilter); } // recreate landmarks