From d130a7f8260a5c46e11b783c9810357a96ec8bf9 Mon Sep 17 00:00:00 2001 From: Riasan Date: Wed, 3 Jun 2020 12:38:33 +0200 Subject: [PATCH 1/7] Changed: fix client crash from opengl changes + fix compiling error because of moved client_default.cfg --- code/CMakeLists.txt | 13 ++++++++++--- .../3d/driver/opengl/driver_opengl_extension.cpp | 6 ++++++ .../src/3d/driver/opengl/driver_opengl_window.cpp | 3 +++ code/ryzom/client/CMakeLists.txt | 2 +- code/ryzom/client/src/CMakeLists.txt | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4c962537c..3225dc1b8 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -177,9 +177,16 @@ IF(WITH_STATIC) ENDIF() # under Linux and OS X, recent libxml2 versions are linked against libicu - FIND_PACKAGE(Icu) - IF(ICU_LIBRARIES) - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_LIBRARIES} ${ICU_DATA_LIBRARIES}) + # FIND_PACKAGE(Icu) + FIND_LIBRARY(ICU_LIBRARY icuuc) + IF(ICU_LIBRARY) + FIND_LIBRARY(ICU_DATA_LIBRARY icudata) + IF(ICU_LIBRARY) + MESSAGE(STATUS "ICU UC was found: ${ICU_LIBRARY}") + ELSE() + MESSAGE(STATUS "ICU UC was NOT found") + ENDIF() + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_DATA_LIBRARY} ${ICU_LIBRARY}) ENDIF() ENDIF() diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index c81ab9e1e..f7c0bf496 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -1583,6 +1583,12 @@ static bool setupATIMeminfo(const char *glext) void registerGlExtensions(CGlExtensions &ext) { H_AUTO_OGL(registerGlExtensions); + + CGLContextObj ctx = CGLGetCurrentContext(); + if (ctx == NULL) + { + nlerror("No OpenGL context set"); + } // OpenGL 1.2 ?? const char *nglVersion = (const char *)glGetString (GL_VERSION); 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 293cb28bb..6537c289f 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -1072,6 +1072,9 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re [_ctx flushBuffer]; [_glView display]; + // Set context as thread context + CGLSetCurrentContext((CGLContextObj)[_ctx CGLContextObj]); + _EventEmitter.init(this, _glView, _DestroyWindow); #elif defined(NL_OS_UNIX) diff --git a/code/ryzom/client/CMakeLists.txt b/code/ryzom/client/CMakeLists.txt index 7a6cf7424..2e17c230e 100644 --- a/code/ryzom/client/CMakeLists.txt +++ b/code/ryzom/client/CMakeLists.txt @@ -8,7 +8,7 @@ IF(WITH_RYZOM_CLIENT) ADD_SUBDIRECTORY(unix) ENDIF() - INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX}) + #INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX}) IF(WITH_RYZOM_PATCH) IF(APPLE) diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 99b9a6773..7e1f89348 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -82,7 +82,7 @@ IF(WITH_RYZOM_CLIENT) ADD_CUSTOM_COMMAND(TARGET ryzom_client PRE_BUILD COMMAND mkdir -p ${RYZOM_RESOURCES_DIR}) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/PkgInfo ${RYZOM_CONTENTS_DIR}) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/ryzom.icns ${RYZOM_RESOURCES_DIR}) - ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR}) + #ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR}) # remove any present installscript_osx.vdf before signing ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND rm -f ${RYZOM_OUTPUT_DIR}/installscript_osx.vdf) From 421de3fa913c88be5737980b42a50eec3e6b772c Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 12 Jun 2020 14:07:17 +0200 Subject: [PATCH 2/7] Changed: fixed issue with rumors --- code/ryzom/client/src/game_context_menu.cpp | 7 +- .../client/src/interface_v3/chat_window.cpp | 107 ++++++++++-------- .../client/src/interface_v3/people_list.cpp | 37 +++--- 3 files changed, 87 insertions(+), 64 deletions(-) diff --git a/code/ryzom/client/src/game_context_menu.cpp b/code/ryzom/client/src/game_context_menu.cpp index c19ea62ac..78e58c4b5 100644 --- a/code/ryzom/client/src/game_context_menu.cpp +++ b/code/ryzom/client/src/game_context_menu.cpp @@ -451,18 +451,19 @@ void CGameContextMenu::update() else if (continent == "lepaysmalade.continent") fameIndex = CStaticFames::getInstance().getFactionIndex("zorai"); - + if (fameIndex != CStaticFames::INVALID_FACTION_INDEX) { CCDBNodeLeaf *pLeafFame = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:FAME:PLAYER%d:VALUE", fameIndex), false); if (pLeafFame != NULL) fameValue = pLeafFame->getValue8(); } + if (_TextNews) - _TextNews->setActive(selection && !canAttack() && selection->isNPC() && fameValue >= -30); + _TextNews->setActive(!UserEntity->isFighting() && !UserEntity->isRiding() && selection && !canAttack() && selection->isNPC() && fameValue >= -30); if (_TextNewsAgressive) - _TextNewsAgressive->setActive(selection && !canAttack() && selection->isNPC() && fameValue < -30); + _TextNewsAgressive->setActive(!UserEntity->isFighting() && !UserEntity->isRiding() && selection && !canAttack() && selection->isNPC() && fameValue < -30); if (_TextDuel && _TextUnDuel) diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 1537e7b8b..13f7bc66d 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -215,29 +215,34 @@ void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGr CChatTextManager &ctm = getChatTextMngr(); gl = dynamic_cast(_Chat->getGroup("cb:text_list")); - if (gl) gl->addChild(ctm.createMsgText(msg, col)); - // if the group is closed, make it blink - if (!_Chat->isOpen()) + CViewBase *child = ctm.createMsgText(msg, col); + if (child) { - if (numBlinks) _Chat->enableBlink(numBlinks); - } - if (_ParentBlink) - { - CGroupContainer *father = dynamic_cast(_Chat->getParent()); - if (father && !father->isOpen()) + if (gl) gl->addChild(child); + + // if the group is closed, make it blink + if (!_Chat->isOpen()) { - father->enableBlink(numBlinks); + if (numBlinks) _Chat->enableBlink(numBlinks); } + if (_ParentBlink) + { + CGroupContainer *father = dynamic_cast(_Chat->getParent()); + if (father && !father->isOpen()) + { + father->enableBlink(numBlinks); + } + } + if (windowVisible != NULL) + { + *windowVisible = isVisible(); + } + /*for(std::vector::iterator it = _Observers.begin(); it != _Observers.end(); ++it) + { + (*it)->displayMessage(this, msg, col, numBlinks); + }*/ } - if (windowVisible != NULL) - { - *windowVisible = isVisible(); - } - /*for(std::vector::iterator it = _Observers.begin(); it != _Observers.end(); ++it) - { - (*it)->displayMessage(this, msg, col, numBlinks); - }*/ } //================================================================================= @@ -563,12 +568,17 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC ucstring newmsg = msg; ucstring prefix; + CViewBase *child = NULL; if (gl != NULL) { - gl->addChild(ctm.createMsgText(newmsg, col)); - if (!gl->getParent()->getActive()) - if (tab != NULL) - tab->setTextColorNormal(newMsgColor); + child = ctm.createMsgText(newmsg, col); + if (child) + { + gl->addChild(child); + if (!gl->getParent()->getActive()) + if (tab != NULL) + tab->setTextColorNormal(newMsgColor); + } } // *** Display the message in the UserChat (special case) @@ -590,7 +600,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC case CChatGroup::guild: if (ci.Guild.isListeningWindow(cw)) gl = gl2; break; case CChatGroup::system: if (ci.SystemInfo.isListeningWindow(cw)) gl = gl2; break; case CChatGroup::universe: if (ci.Universe.isListeningWindow(cw)) gl = gl2; break; - case CChatGroup::dyn_chat: + case CChatGroup::dyn_chat: if (ci.DynamicChat[dynamicChatDbIndex].isListeningWindow(cw)) { gl = gl2; @@ -608,7 +618,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC pos = newmsg.find(ucstring("}")); prefix += " "; } - + if (pos == ucstring::npos) newmsg = prefix + newmsg; else @@ -635,31 +645,37 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC if (gl != NULL) { - gl->addChild(ctm.createMsgText(newmsg, col)); - if (!gl->getParent()->getActive()) - if (tab != NULL) - tab->setTextColorNormal(newMsgColor); + child = ctm.createMsgText(newmsg, col); + if (child) + { + gl->addChild(child); + if (!gl->getParent()->getActive()) + if (tab != NULL) + tab->setTextColorNormal(newMsgColor); + } } } - - // *** Blink and visibility event - // if the group is closed, make it blink - if (!_Chat->isOpen()) - { - if (numBlinks) _Chat->enableBlink(numBlinks); - } - if (_ParentBlink) + if (child) { - CGroupContainer *father = dynamic_cast(_Chat->getParent()); - if (father && !father->isOpen()) + // *** Blink and visibility event + // if the group is closed, make it blink + if (!_Chat->isOpen()) { - father->enableBlink(numBlinks); + if (numBlinks) _Chat->enableBlink(numBlinks); + } + if (_ParentBlink) + { + CGroupContainer *father = dynamic_cast(_Chat->getParent()); + if (father && !father->isOpen()) + { + father->enableBlink(numBlinks); + } + } + if (windowVisible != NULL) + { + *windowVisible = isVisible(); } - } - if (windowVisible != NULL) - { - *windowVisible = isVisible(); } } @@ -685,8 +701,9 @@ void CChatGroupWindow::displayTellMessage(const ucstring &msg, NLMISC::CRGBA col nlwarning(" can't get text_list."); return; } - - gl->addChild(getChatTextMngr().createMsgText(msg, col)); + CViewBase *child = getChatTextMngr().createMsgText(msg, col); + if (child) + gl->addChild(child); } //================================================================================= diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 6be310d94..92601ed32 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -199,7 +199,7 @@ bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b) { ucstring name_a = toUpper(a.getName()); ucstring name_b = toUpper(b.getName()); - + return (name_a < name_b); } @@ -208,7 +208,7 @@ bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b) { ucstring name_a = toUpper(a.getName()); ucstring name_b = toUpper(b.getName()); - + // We want order: online/alpha, offworld/alpha, offline/alpha if (a.Online == b.Online) { @@ -249,7 +249,7 @@ void CPeopleList::sortEx(TSortOrder order) { _BaseContainer->detachContainer(_Peoples[k].Container); } - + switch (order) { default: @@ -480,17 +480,21 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c ucstring s = CI18N::get("youTellPlayer"); strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); - gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); - CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); - - // if the group is closed, make it blink - if (!gc->isOpen()) + CViewBase *child = getChatTextMngr().createMsgText(finalMsg, prop.getRGBA()); + if (child) { - if (numBlinks) gc->enableBlink(numBlinks); - } - if (_BaseContainer && !_BaseContainer->isOpen()) - { - _BaseContainer->enableBlink(numBlinks); + gl->addChild(child); + CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); + + // if the group is closed, make it blink + if (!gc->isOpen()) + { + if (numBlinks) gc->enableBlink(numBlinks); + } + if (_BaseContainer && !_BaseContainer->isOpen()) + { + _BaseContainer->enableBlink(numBlinks); + } } } @@ -539,8 +543,9 @@ void CPeopleList::displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA nlwarning(" can't get text_list."); return; } - - gl->addChild(getChatTextMngr().createMsgText(msg, col)); + CViewBase *child = getChatTextMngr().createMsgText(msg, col); + if (child) + gl->addChild(child); } @@ -777,7 +782,7 @@ void CPeopleList::setOnline(uint index, TCharConnectionState online) CCtrlBase *chatButton = hc->getCtrl("chat_button"); if (chatButton != NULL) chatButton->setActive(online != ccs_offline); - + CCtrlBase *inviteButton = hc->getCtrl("invite_button"); if (inviteButton != NULL) inviteButton->setActive(online != ccs_offline); From 9e2872d15ec7f93040a62ba473d24785a532659c Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 12 Jun 2020 14:09:29 +0200 Subject: [PATCH 3/7] Added: Add a language icon when client receive a translated message --- .../src/interface_v3/chat_text_manager.cpp | 26 +++++++++++++++++-- .../interface_v3/group_in_scene_bubble.cpp | 10 ++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp index 3b11d17a5..b3a673ffe 100644 --- a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -422,6 +422,29 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C return para; } + ucstring::size_type pos = 0; + + // Manage Translations + string::size_type startTr = msg.find(ucstring("{:")); + string::size_type endOfOriginal = msg.find(ucstring("}@{")); + + // Original/Translated case, example: {:enHello the world!}@{ Bonjour le monde ! + if (startTr != string::npos && endOfOriginal != string::npos) + { + CViewBase *vt = createMsgTextSimple(msg.substr(0, startTr), col, justified, NULL); + para->addChild(vt); + + string texture = "flag-"+toLower(msg.substr(startTr+2, 2)).toString()+".tga"; + ucstring original = msg.substr(startTr+5, endOfOriginal-startTr-5); + pos = endOfOriginal+3; + CCtrlButton *ctrlButton = new CCtrlButton(CViewBase::TCtorParam()); + ctrlButton->setTexture(texture); + ctrlButton->setTextureOver(texture); + ctrlButton->setTexturePushed(texture); + ctrlButton->setDefaultContextHelp(original); + ctrlButton->setId("tr"); + para->addChild(ctrlButton); + } // quickly check if text has links or not bool hasUrl; @@ -430,8 +453,7 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C hasUrl = (s.find(ucstring("http://")) || s.find(ucstring("https://"))); } - ucstring::size_type pos = 0; - for (ucstring::size_type i = 0; i< textSize;) + for (ucstring::size_type i = pos; i< textSize;) { if (hasUrl && isUrlTag(msg, i, textSize)) { diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp index d79861b58..460a095fc 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -843,6 +843,14 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, if (pChar == NULL || nUID==CLFECOMMON::INVALID_CLIENT_DATASET_INDEX) return; if (bubbleTimer == 0) bubbleTimer = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32(); + + + // Clean bubble from translation system + ucstring::size_type pos = 0; + string::size_type endOfOriginal = ucsText.find(ucstring("}@{")); + if (endOfOriginal != string::npos) + pos = endOfOriginal+4; + // Output the message in a bubble bool show = false; @@ -862,7 +870,7 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, return; // Get a bubble - CGroupInSceneBubble *bubble = newBubble (ucsText); + CGroupInSceneBubble *bubble = newBubble (ucsText.substr(pos)); if (bubble) { // Link the bubble From 17e539132bcecd1dbfc430c0b5d28faacade9352 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 12 Jun 2020 14:11:01 +0200 Subject: [PATCH 4/7] Added: very basic anti-spam system (prevent duplication of same message) --- code/ryzom/client/src/net_manager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 7ce27c4d5..60a996954 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -147,6 +147,7 @@ extern bool CharNameValidArrived; extern bool CharNameValid; bool IsInRingSession = false; TSessionId HighestMainlandSessionId; // highest in the position stack +ucstring lastUniversMessage; extern const char *CDBBankNames[INVALID_CDB_BANK+1]; @@ -770,7 +771,11 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } else if (mode == CChatGroup::universe) { - PeopleInterraction.ChatInput.Universe.displayMessage(finalString, col, 2, &windowVisible); + if (lastUniversMessage != finalString) + { + PeopleInterraction.ChatInput.Universe.displayMessage(finalString, col, 2, &windowVisible); + lastUniversMessage = finalString; + } } else if (mode == CChatGroup::dyn_chat) { From 80a6bf72a9e4e2a477864e4cc3a49a5c6e32879e Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 12 Jun 2020 14:11:26 +0200 Subject: [PATCH 5/7] Changed: renamed creatures are now name in ucfirst --- code/ryzom/client/src/string_manager_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index ddc41d0d1..a10be8114 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -750,7 +750,7 @@ restartLoop: // if the string contains a special rename of creature, remove it if (str.size() > 2 && str[0] == '<' && str[1] == '#') { - str = str.substr(2); + str = toUpper(str[2])+str.substr(3); } // append this string From a87b0f4c973b9c10afa3ebec0a7b94aa86cde759 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 26 Jun 2020 15:18:54 +0200 Subject: [PATCH 6/7] Changed: When ryzom patch fails try to download lzma file (this last may never fail) --- code/ryzom/client/src/login_patch.cpp | 133 +++++++++++++++++++++----- code/ryzom/client/src/login_patch.h | 2 +- 2 files changed, 108 insertions(+), 27 deletions(-) diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 926ed61b1..0a6b912dd 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -245,7 +245,7 @@ void CPatchManager::init(const std::vector& patchURIs, const std::s #endif // App name matches Domain on the SQL server - std::string appName = cf->getVarPtr("Application") + std::string appName = cf->getVarPtr("Application") ? cf->getVar("Application").asString(0) : "default"; @@ -1354,7 +1354,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const { //nlwarning("EXCEPTION CATCH: getServerFile() failed - try to find an alternative: %i: %s",UsedServer,PatchServers[UsedServer].DisplayedServerPath.c_str()); - nlwarning("EXCEPTION CATCH: getServerFile() failed - try to find an alternative :"); + nlwarning("EXCEPTION CATCH: getServerFile() failed - try to find an alternative : %s", (serverPath+srcName).c_str()); nlwarning("%i", UsedServer); if (UsedServer >= 0 && UsedServer < (int) PatchServers.size()) { @@ -2676,6 +2676,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) string OutFilename; bool usePatchFile = true; + bool haveAllreadyTryiedDownloadingOfFile = false; // compute the total size of patch to download uint32 totalPatchSize = 0; @@ -2743,6 +2744,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) { // can not load the 7zip file, use normal patching usePatchFile = true; + haveAllreadyTryiedDownloadingOfFile = true; break; } @@ -2754,6 +2756,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) { // fallback to standard patch method usePatchFile = true; + haveAllreadyTryiedDownloadingOfFile = true; break; } } @@ -2766,6 +2769,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) nlwarning("Failed to unpack lzma file %s", (pPM->ClientPatchPath+lzmaFile).c_str()); // fallback to standard patch method usePatchFile = true; + haveAllreadyTryiedDownloadingOfFile = true; break; } @@ -2874,32 +2878,108 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) sTranslate = CI18N::get("uiApplyingDelta") + " " + CFile::getFilename(PatchName); pPM->setState(true, sTranslate); - xDeltaPatch(PatchName, SourceNameXD, OutFilename); + bool deltaPatchResult = xDeltaPatch(PatchName, SourceNameXD, OutFilename); - if (rFTP.LocalFileExists) - pPM->deleteFile(SourceName); - pPM->deleteFile(PatchName); - - if (j > 0) + if (!deltaPatchResult && !haveAllreadyTryiedDownloadingOfFile) // Patch failed, try to download and apply lzma { - pPM->deleteFile(SourceNameXD, false, false); // File can exists if bad BNP loading - } - tmpSourceName = OutFilename; - PatchSizeProgress += rFTP.PatcheSizes[j]; - currentPatchedSize += rFTP.PatcheSizes[j]; - } + breakable + { + // compute the seven zip filename + string lzmaFile = rFTP.FileName+".lzma"; - if (tmpSourceName != DestinationName) - { - pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading - if (!_CommitPatch) - { - // let the patch in the unpack directory - pPM->renameFile(tmpSourceName, pPM->ClientPatchPath + rFTP.FileName + ".tmp"); + // download the 7zip file + try + { + // first, try in the file version subfolfer + try + { + progress.Scale = 1.f; + progress.Bias = 0.f; + if (!rFTP.Patches.empty()) + { + pPM->getServerFile(toString("%05u/", rFTP.Patches.back())+lzmaFile, false, "", &progress); + } + // else -> file comes from a previous download (with .tmp extension, and is up to date) + // the remaining code will just rename it with good name and exit + } + catch (const NLMISC::EWriteError &) + { + // this is a local error, rethrow ... + throw; + } + catch(...) + { + // failed with version subfolder, try in the root patch directory + pPM->getServerFile(lzmaFile, false, "", &progress); + } + } + catch (const NLMISC::EWriteError &) + { + // this is a local error, rethrow ... + throw; + } + catch (...) + { + break; + } + + OutFilename = pPM->ClientPatchPath + NLMISC::CFile::getFilename(rFTP.FileName); + // try to unpack the file + try + { + if (!unpackLZMA(pPM->ClientPatchPath+lzmaFile, OutFilename+".tmp")) + { + break; + } + } + catch (const NLMISC::EWriteError&) + { + throw; + } + catch (...) + { + nlwarning("Failed to unpack lzma file %s", (pPM->ClientPatchPath+lzmaFile).c_str()); + break; + } + + if (rFTP.LocalFileExists) + pPM->deleteFile(SourceName); + + pPM->deleteFile(pPM->ClientPatchPath+lzmaFile); // delete the archive file + pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading + if (_CommitPatch) + { + pPM->renameFile(OutFilename+".tmp", DestinationName); + } + } } else { - pPM->renameFile(tmpSourceName, DestinationName); + if (rFTP.LocalFileExists) + pPM->deleteFile(SourceName); + pPM->deleteFile(PatchName); + + if (j > 0) + { + pPM->deleteFile(SourceNameXD, false, false); // File can exists if bad BNP loading + } + tmpSourceName = OutFilename; + PatchSizeProgress += rFTP.PatcheSizes[j]; + currentPatchedSize += rFTP.PatcheSizes[j]; + } + + if (tmpSourceName != DestinationName) + { + pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading + if (!_CommitPatch) + { + // let the patch in the unpack directory + pPM->renameFile(tmpSourceName, pPM->ClientPatchPath + rFTP.FileName + ".tmp"); + } + else + { + pPM->renameFile(tmpSourceName, DestinationName); + } } } } @@ -2915,7 +2995,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) } // **************************************************************************** -void CPatchThread::xDeltaPatch(const string &patch, const string &src, const string &out) +bool CPatchThread::xDeltaPatch(const string &patch, const string &src, const string &out) { // Internal xdelta @@ -2941,12 +3021,13 @@ void CPatchThread::xDeltaPatch(const string &patch, const string &src, const str break; default: { - std::string str = toString("Error applying %s to %s giving %s", patch.c_str(), src.c_str(), out.c_str()); - throw Exception (str); + nlinfo("Error applying %s to %s giving %s", patch.c_str(), src.c_str(), out.c_str()); + return false; } break; } - } + } else + return true; // Launching xdelta diff --git a/code/ryzom/client/src/login_patch.h b/code/ryzom/client/src/login_patch.h index 2b108994d..27ffec901 100644 --- a/code/ryzom/client/src/login_patch.h +++ b/code/ryzom/client/src/login_patch.h @@ -547,7 +547,7 @@ private: void run(); void processFile (CPatchManager::SFileToPatch &rFTP); - void xDeltaPatch(const std::string &patch, const std::string &src, const std::string &out); + bool xDeltaPatch(const std::string &patch, const std::string &src, const std::string &out); }; /** From 107dbc1987b64041aa7532b7f4156f4e897fe954 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Fri, 26 Jun 2020 19:44:54 +0200 Subject: [PATCH 7/7] Changed: Fixed non-Mac compilation --- .../src/3d/driver/opengl/driver_opengl_extension.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index f7c0bf496..4bdd7ca97 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -1275,7 +1275,7 @@ static bool setupNVFragmentProgram2(const char *glext) { H_AUTO_OGL(setupNVFragmentProgram2); CHECK_EXT("GL_NV_fragment_program2"); - + return true; } @@ -1284,7 +1284,7 @@ static bool setupARBFragmentShader(const char *glext) { H_AUTO_OGL(setupNVFragmentProgram2); CHECK_EXT("GL_ARB_fragment_shader"); - + return true; } @@ -1583,12 +1583,14 @@ static bool setupATIMeminfo(const char *glext) void registerGlExtensions(CGlExtensions &ext) { H_AUTO_OGL(registerGlExtensions); - + +#ifdef NL_OS_MAC CGLContextObj ctx = CGLGetCurrentContext(); if (ctx == NULL) { nlerror("No OpenGL context set"); } +#endif // OpenGL 1.2 ?? const char *nglVersion = (const char *)glGetString (GL_VERSION); @@ -1697,12 +1699,12 @@ void registerGlExtensions(CGlExtensions &ext) ext.EXTVertexShader = false; ext.ARBVertexProgram = false; } - + // Check pixel program // Disable feature ??? if (!ext.DisableHardwarePixelProgram) { - ext.ARBFragmentProgram = setupARBFragmentProgram(glext); + ext.ARBFragmentProgram = setupARBFragmentProgram(glext); ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext); ext.ARBFragmentShader = setupARBFragmentShader(glext); }