From 6fa74cd5c2dfca0dfb5a7f0b74d77fd893ba12c5 Mon Sep 17 00:00:00 2001 From: Ulukyn Date: Thu, 9 Jul 2020 13:15:13 +0200 Subject: [PATCH] Added: Option to use ryzom_client_patcher as bnp unpacker and xdelta patcher --- code/ryzom/client/src/login_patch.h | 3 +- .../tools/client/client_patcher/main.cpp | 31 +++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/src/login_patch.h b/code/ryzom/client/src/login_patch.h index 27ffec901..7c0a68b2d 100644 --- a/code/ryzom/client/src/login_patch.h +++ b/code/ryzom/client/src/login_patch.h @@ -269,6 +269,7 @@ public: void setStartRyzomAtEnd(bool startAtEnd){ _StartRyzomAtEnd = startAtEnd; } // Forward message to installation software if needed void fatalError(const std::string& errorId, const std::string& param1, const std::string& param2); + bool bnpUnpack(const std::string &srcBigfile, const std::string &dstPath, std::vector &vFilenames); const std::string & getServerVersion () { return ServerVersion; } private: @@ -320,8 +321,6 @@ private: void getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn, bool forceCheckSumTest); - bool bnpUnpack(const std::string &srcBigfile, const std::string &dstPath, std::vector &vFilenames); - // stop the threads (called when knowing the thread ended) void stopCheckThread(); void stopPatchThread(); diff --git a/code/ryzom/tools/client/client_patcher/main.cpp b/code/ryzom/tools/client/client_patcher/main.cpp index e7d57a335..62937dd59 100644 --- a/code/ryzom/tools/client/client_patcher/main.cpp +++ b/code/ryzom/tools/client/client_patcher/main.cpp @@ -200,9 +200,38 @@ int main(int argc, char *argv[]) Args.setVersion(getDisplayVersion()); Args.setDescription("Ryzom client"); + Args.addArg("p", "patch", "patch", "Name of the file to use tp xdelta the source file"); + Args.addArg("s", "source", "source", "Name of source file to xdelta with patch file"); + Args.addArg("d", "destination", "destination", "Name of destination operation (patch or unpack)"); + Args.addArg("u", "unpack", "unpack", "Name of bnp file to unpack"); if (!Args.parse(argc, argv)) return 1; + if (Args.haveArg("p") && Args.haveArg("p") && Args.haveArg("p")) + { + string patchName = Args.getArg("p").front(); + string sourceName = Args.getArg("s").front(); + string destinationName = Args.getArg("d").front(); + + std::string errorMsg; + CXDeltaPatch::TApplyResult ar = CXDeltaPatch::apply(patchName, sourceName, destinationName, errorMsg); + nlinfo("%s", errorMsg.c_str()); + return ar; + } + + // initialize patch manager and set the ryzom full path, before it's used + CPatchManager *pPM = CPatchManager::getInstance(); + + if (Args.haveArg("u") && Args.haveArg("d")) + { + string bnpName = Args.getArg("u").front(); + string destinationName = Args.getArg("d").front(); + vector vFilenames; + if (pPM->bnpUnpack(bnpName, destinationName, vFilenames)) + return 0; + return 1; + } + // create logs in temporary directory createDebug(CPath::getTemporaryDirectory().c_str(), true, true); @@ -244,8 +273,6 @@ int main(int argc, char *argv[]) printf("\n"); printf("Checking %s files to patch...\n", convert(CI18N::get("TheSagaOfRyzom")).c_str()); - // initialize patch manager and set the ryzom full path, before it's used - CPatchManager *pPM = CPatchManager::getInstance(); // use PatchUrl vector patchURLs;