From c4b768833bb66edaa31b13b484562c316f0cb352 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 21 Feb 2016 13:22:22 +0100 Subject: [PATCH] Merge with develop --- code/CMakeLists.txt | 5 - code/nel/src/misc/CMakeLists.txt | 1 + code/nel/tools/CMakeLists.txt | 20 +-- code/ryzom/client/src/login_patch.cpp | 122 +++++++++--------- .../world_editor_classes.xml | 76 +++++------ 5 files changed, 113 insertions(+), 111 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 84654584a..e0ab811a4 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -257,11 +257,6 @@ IF(WITH_QT5) FIND_PACKAGE(Qt5LinguistTools) FIND_PACKAGE(Qt5Network) - IF(WIN32) - # Please add option to switch off - # FIND_PACKAGE(Qt5WinExtras) - ENDIF() - IF(QT_STATIC) ADD_DEFINITIONS(-DQT_STATICPLUGIN) diff --git a/code/nel/src/misc/CMakeLists.txt b/code/nel/src/misc/CMakeLists.txt index c5fb2080e..fb6752982 100644 --- a/code/nel/src/misc/CMakeLists.txt +++ b/code/nel/src/misc/CMakeLists.txt @@ -152,6 +152,7 @@ FILE(GLOB NLMISC_BITMAP FILE(GLOB NLMISC_CRYPT md5.cpp ../../include/nel/misc/md5.h sha1.cpp ../../include/nel/misc/sha1.h + ../../include/nel/misc/wang_hash.h ) SOURCE_GROUP("" FILES ${SRC} ${HEADERS}) diff --git a/code/nel/tools/CMakeLists.txt b/code/nel/tools/CMakeLists.txt index cb3e2b577..8734bf103 100644 --- a/code/nel/tools/CMakeLists.txt +++ b/code/nel/tools/CMakeLists.txt @@ -3,7 +3,7 @@ ADD_SUBDIRECTORY(misc) IF(WITH_NEL_TOOLS) ADD_SUBDIRECTORY(memory) -ENDIF(WITH_NEL_TOOLS) +ENDIF() # Max plugins are under the 3d directory as well. # Allow to compile only max plugins without other tools. @@ -15,21 +15,21 @@ ENDIF() IF(WITH_NEL_TOOLS) IF(WITH_PACS) ADD_SUBDIRECTORY(pacs) - ENDIF(WITH_PACS) + ENDIF() IF(WITH_LOGIC) ADD_SUBDIRECTORY(logic) - ENDIF(WITH_LOGIC) + ENDIF() IF(WITH_GEORGES) ADD_SUBDIRECTORY(georges) - ENDIF(WITH_GEORGES) + ENDIF() IF(WITH_SOUND) ADD_SUBDIRECTORY(sound) - ENDIF(WITH_SOUND) - - IF(WITH_NEL_TESTS) - ADD_SUBDIRECTORY(nel_unit_test) - ENDIF(WITH_NEL_TESTS) -ENDIF(WITH_NEL_TOOLS) + ENDIF() +ENDIF() + +IF(WITH_NEL_TESTS) + ADD_SUBDIRECTORY(nel_unit_test) +ENDIF() diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 3d73635f9..4dd5e5561 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -739,34 +739,28 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool const CBNPCategorySet &rDescCats = descFile.getCategories(); OptionalCat.clear(); - string SrcPath = ClientPatchPath; - string DstPath = ClientRootPath; - -#ifdef NL_OS_WINDOWS - // only fix backslashes for .bat - string batchSrcPath = CPath::standardizeDosPath(SrcPath); - string batchDstPath = CPath::standardizeDosPath(DstPath); -#else - string batchSrcPath = SrcPath; - string batchDstPath = DstPath; -#endif - for (uint32 i = 0; i < rDescCats.categoryCount(); ++i) { // For all optional categories check if there is a 'file to patch' in it const CBNPCategory &rCat = rDescCats.getCategory(i); - nlwarning("Category = %s", rCat.getName().c_str()); + + nlinfo("Category = %s", rCat.getName().c_str()); + if (!rCat.getUnpackTo().empty()) for (uint32 j = 0; j < rCat.fileCount(); ++j) { - string rFilename = SrcPath + rCat.getFile(j); - nlwarning("\tFileName = %s", rFilename.c_str()); + string rFilename = ClientPatchPath + rCat.getFile(j); + + nlinfo("\tFileName = %s", rFilename.c_str()); + // Extract to patch vector vFilenames; + bool result = false; + try { - result = bnpUnpack(rFilename, SrcPath, vFilenames); + result = bnpUnpack(rFilename, ClientPatchPath, vFilenames); } catch(...) { @@ -798,7 +792,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool CFile::deleteFile(fullDstPath + FileName); // try to move it, if fails move it later in a script - if (CFile::moveFile(fullDstPath + FileName, SrcPath + FileName)) + if (CFile::moveFile(fullDstPath + FileName, ClientPatchPath + FileName)) succeeded = true; } @@ -807,23 +801,23 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool { string batchRelativeDstPath; - if (fullDstPath.compare(0, DstPath.length(), DstPath) == 0) + // should be always true + if (fullDstPath.compare(0, ClientRootPath.length(), ClientRootPath) == 0) { - batchRelativeDstPath = fullDstPath.substr(DstPath.length()) + FileName; + batchRelativeDstPath = fullDstPath.substr(ClientRootPath.length()) + FileName; } else { batchRelativeDstPath = fullDstPath + FileName; } + #ifdef NL_OS_WINDOWS // only fix backslashes for .bat batchRelativeDstPath = CPath::standardizeDosPath(batchRelativeDstPath); -#endif - // write windows .bat format else write sh format -#ifdef NL_OS_WINDOWS - string realDstPath = toString("\"%%DSTPATH%%\\%s\"", batchRelativeDstPath.c_str()); - string realSrcPath = toString("\"%%SRCPATH%%\\%s\"", FileName.c_str()); + // use DSTPATH and SRCPATH variables and append filenames + string realDstPath = toString("\"%%ROOTPATH%%\\%s\"", batchRelativeDstPath.c_str()); + string realSrcPath = toString("\"%%UNPACKPATH%%\\%s\"", FileName.c_str()); content += toString(":loop%u\n", nblab); content += toString("attrib -r -a -s -h %s\n", realDstPath.c_str()); @@ -831,8 +825,11 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool content += toString("if exist %s goto loop%u\n", realDstPath.c_str(), nblab); content += toString("move %s %s\n", realSrcPath.c_str(), realDstPath.c_str()); #else + // use DSTPATH and SRCPATH variables and append filenames + string realDstPath = toString("\"$ROOTPATH\\%s\"", batchRelativeDstPath.c_str()); + string realSrcPath = toString("\"$UNPACKPATH\\%s\"", FileName.c_str()); + content += toString("rm -rf %s\n", realDstPath.c_str()); - // TODO: add test of returned $? content += toString("mv %s %s\n", realSrcPath.c_str(), realDstPath.c_str()); #endif @@ -845,7 +842,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool } } - std::string patchDirectory = CPath::standardizeDosPath(ClientRootPath + "patch"); + std::string patchDirectory = CPath::standardizePath(ClientRootPath + "patch"); // Finalize batch file if (NLMISC::CFile::isExists(patchDirectory) && NLMISC::CFile::isDirectory(patchDirectory)) @@ -869,9 +866,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool if (!succeeded) { #ifdef NL_OS_WINDOWS - patchContent += toString("del \"%s\"\n", CPath::standardizeDosPath(vFileList[i]).c_str()); + patchContent += toString("del \"%%ROOTPATH%%\\patch\\%s\"\n", vFileList[i].c_str()); #else - patchContent += toString("rm -f \"%s\"\n", CPath::standardizePath(vFileList[i]).c_str()); + patchContent += toString("rm -f \"$ROOTPATH/patch/%s\"\n", vFileList[i].c_str()); #endif } } @@ -879,14 +876,14 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool if (!patchContent.empty()) { #ifdef NL_OS_WINDOWS - content += toString(":looppatch\n"); + content += ":looppatch\n"; content += patchContent; - content += toString("rd /Q /S \"%s\"\n", patchDirectory.c_str()); - content += toString("if exist \"%s\" goto looppatch\n", patchDirectory.c_str()); + content += "rd /Q /S \"%%ROOTPATH%%\\patch\"\n"; + content += "if exist \"%%ROOTPATH%%\\patch\" goto looppatch\n"; #else - content += toString("rm -rf \"%s\"\n", patchDirectory.c_str()); + content += "rm -rf \"$ROOTPATH/patch\"\n"); #endif } else @@ -899,8 +896,10 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool { deleteBatchFile(); + // batch full path std::string batchFilename = ClientRootPath + UpdateBatchFilename; + // write windows .bat format else write sh format FILE *fp = nlfopen (batchFilename, "wt"); if (fp == NULL) @@ -914,30 +913,29 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool //use bat if windows if not use sh #ifdef NL_OS_WINDOWS contentPrefix += "@echo off\n"; - contentPrefix += "set RYZOM_CLIENT=%1\n"; - contentPrefix += "set SRCPATH=%2\n"; - contentPrefix += "set DSTPATH=%3\n"; + contentPrefix += "set RYZOM_CLIENT=\"%1\"\n"; + contentPrefix += "set UNPACKPATH=\"%2\"\n"; + contentPrefix += "set ROOTPATH=\"%3\"\n"; contentPrefix += "set LOGIN=%4\n"; contentPrefix += "set PASSWORD=%5\n"; contentPrefix += "set SHARDID=%6\n"; - contentPrefix += toString("set UPGRADE_FILE=%%DSTPATH%%\\%s\n", UpgradeBatchFilename.c_str()); + contentPrefix += toString("set UPGRADE_FILE=\"%%ROOTPATH%%\\%s\"\n", UpgradeBatchFilename.c_str()); #else contentPrefix += "#!/bin/sh\n"; - contentPrefix += "RYZOM_CLIENT=$1\n"; - contentPrefix += "SRCPATH=$2\n"; - contentPrefix += "DSTPATH=$3\n"; + contentPrefix += "RYZOM_CLIENT=\"$1\"\n"; + contentPrefix += "UNPACKPATH=\"$2\"\n"; + contentPrefix += "ROOTPATH=\"$3\"\n"; contentPrefix += "LOGIN=$4\n"; contentPrefix += "PASSWORD=$5\n"; contentPrefix += "SHARDID=$6\n"; - contentPrefix += toString("UPGRADE_FILE=$DSTPATH\\%s\n", UpgradeBatchFilename.c_str()); + contentPrefix += toString("UPGRADE_FILE=\"$ROOTPATH\\%s\"\n", UpgradeBatchFilename.c_str()); #endif contentPrefix += "\n"; - // append content of script - fputs(contentPrefix.c_str(), fp); - fputs(content.c_str(), fp); + string contentSuffix; + // if we need to restart Ryzom, we need to launch it in batch std::string additionalParams; if (Args.haveLongArg("profile")) @@ -945,35 +943,42 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool additionalParams = "--profile " + Args.getLongArg("profile").front(); } +#ifdef NL_OS_WINDOWS + // launch upgrade script if present (it'll execute additional steps like moving or deleting files) + contentSuffix += "if exist \"%UPGRADE_FILE%\" call \"%UPGRADE_FILE%\"\n"; + if (wantRyzomRestart) { - string contentSuffix; - -#ifdef NL_OS_WINDOWS - // launch upgrade script if present (it'll execute additional steps like moving or deleting files) - contentSuffix += "if exist \"%UPGRADE_FILE%\" call \"%UPGRADE_FILE%\"\n"; - // client shouldn't be in memory anymore else it couldn't be overwritten - contentSuffix += toString("start \"\" /D \"%%DSTPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str()); + contentSuffix += toString("start \"\" /D \"%%ROOTPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str()); + } #else + if (wantRyzomRestart) + { // wait until client not in memory anymore contentSuffix += toString("until ! pgrep %s > /dev/null; do sleep 1; done\n", CFile::getFilename(RyzomFilename).c_str()); + } - // launch upgrade script if present (it'll execute additional steps like moving or deleting files) - contentSuffix += "if [ -e \"$UPGRADE_FILE\" ]; then chmod +x \"$UPGRADE_FILE\" && \"$UPGRADE_FILE\"; fi\n"; + // launch upgrade script if present (it'll execute additional steps like moving or deleting files) + contentSuffix += "if [ -e \"$UPGRADE_FILE\" ]; then chmod +x \"$UPGRADE_FILE\" && \"$UPGRADE_FILE\"; fi\n"; - // be sure file is executable - contentSuffix += "chmod +x \"$RYZOM_CLIENT\"\n"); + // be sure file is executable + contentSuffix += "chmod +x \"$RYZOM_CLIENT\"\n"; + if (wantRyzomRestart) + { // change to previous client directory - contentSuffix += "cd \"$DSTPATH\"\n"); + contentSuffix += "cd \"$ROOTPATH\"\n"; // launch new client contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str()); + } #endif - fputs(contentSuffix.c_str(), fp); - } + // append content of script + fputs(contentPrefix.c_str(), fp); + fputs(content.c_str(), fp); + fputs(contentSuffix.c_str(), fp); bool writeError = ferror(fp) != 0; bool diskFull = ferror(fp) && errno == 28 /* ENOSPC */; @@ -3157,7 +3162,8 @@ bool CPatchManager::extract(const std::string& patchPath, fprintf(fp, "@echo off\n"); fprintf(fp, "ping 127.0.0.1 -n 7 -w 1000 > nul\n"); // wait #else - // TODO: for Linux and OS X + fprintf(fp, "#!/bin/sh\n"); + fprintf(fp, "sleep 7\n"); // wait #endif // Unpack files with category ExtractPath non empty diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml index d9aae794a..6e24cafe3 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml @@ -98,7 +98,7 @@ - + @@ -128,7 +128,7 @@ @@ -147,7 +147,7 @@ - + @@ -159,7 +159,7 @@ - + @@ -175,7 +175,7 @@ - + @@ -2100,7 +2100,7 @@ - + @@ -2140,7 +2140,7 @@ - + @@ -2155,7 +2155,7 @@ - + @@ -2169,7 +2169,7 @@ - + @@ -2185,7 +2185,7 @@ - + @@ -2513,10 +2513,10 @@ --> - + - + @@ -2720,10 +2720,10 @@ --> - + - + @@ -2761,10 +2761,10 @@ --> - + - + @@ -2802,10 +2802,10 @@ --> - + - + @@ -2828,10 +2828,10 @@ - + - + @@ -2869,7 +2869,7 @@ - + @@ -2888,7 +2888,7 @@ - + @@ -2907,7 +2907,7 @@ - + @@ -2924,7 +2924,7 @@ - + @@ -3662,7 +3662,7 @@ - + @@ -3751,7 +3751,7 @@ - + @@ -3765,7 +3765,7 @@ - + @@ -3866,7 +3866,7 @@ --> - + @@ -3991,7 +3991,7 @@ --> - + - + - + @@ -4052,7 +4052,7 @@ --> - + @@ -4098,7 +4098,7 @@ - + @@ -4493,7 +4493,7 @@ --> - + @@ -4635,7 +4635,7 @@ - + @@ -4670,7 +4670,7 @@ - + @@ -4704,7 +4704,7 @@ --> - + @@ -4738,7 +4738,7 @@ --> - +