From a10cf4360c571cd5ad8ba99feff0fd6b306299e4 Mon Sep 17 00:00:00 2001 From: Koncord Date: Sat, 4 Mar 2017 13:23:26 +0800 Subject: [PATCH] [Client] Print all esm/esp files in load queue with idx & CRC32 checksum --- apps/openmw/mwmp/Main.cpp | 2 +- apps/openmw/mwmp/Networking.cpp | 21 ++++++++++++++++++++- apps/openmw/mwmp/Networking.hpp | 3 ++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmp/Main.cpp b/apps/openmw/mwmp/Main.cpp index f436b70e3..a7bde28f4 100644 --- a/apps/openmw/mwmp/Main.cpp +++ b/apps/openmw/mwmp/Main.cpp @@ -149,7 +149,7 @@ bool Main::init(std::vector &content, Files::Collections &collectio } get().mLocalPlayer->passw = passw; - pMain->mNetworking->connect(pMain->server, pMain->port); + pMain->mNetworking->connect(pMain->server, pMain->port, content, collections); RestoreMgr(mgr); return pMain->mNetworking->isConnected(); } diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 28efff72d..50b3a8199 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -23,6 +23,8 @@ #include "../mwstate/statemanagerimp.hpp" #include #include +#include +#include #include "DedicatedPlayer.hpp" #include "LocalPlayer.hpp" #include "GUIController.hpp" @@ -101,7 +103,7 @@ void Networking::update() } } -void Networking::connect(const std::string &ip, unsigned short port) +void Networking::connect(const std::string &ip, unsigned short port, std::vector &content, Files::Collections &collections) { RakNet::SystemAddress master; master.SetBinaryAddress(ip.c_str()); @@ -160,6 +162,23 @@ void Networking::connect(const std::string &ip, unsigned short port) } } + + vector::const_iterator it(content.begin()); + for (int idx = 0; it != content.end(); ++it, ++idx) + { + boost::filesystem::path filename(*it); + const Files::MultiDirCollection& col = collections.getCollection(filename.extension().string()); + if (col.doesExist(*it)) + { + unsigned int crc32 = Utils::crc32checksum(col.getPath(*it).string()); + printf("idx: %d\tchecksum: %x\tfile:%s\n", idx, crc32, col.getPath(*it).c_str()); + } + else + { + throw std::runtime_error("Plugin doesn't exists."); + } + } + if (!errmsg.empty()) { LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, errmsg.c_str()); diff --git a/apps/openmw/mwmp/Networking.hpp b/apps/openmw/mwmp/Networking.hpp index 13dffe96d..c522f1b8d 100644 --- a/apps/openmw/mwmp/Networking.hpp +++ b/apps/openmw/mwmp/Networking.hpp @@ -13,6 +13,7 @@ #include #include #include +#include namespace mwmp { @@ -23,7 +24,7 @@ namespace mwmp public: Networking(); ~Networking(); - void connect(const std::string& ip, unsigned short port); + void connect(const std::string& ip, unsigned short port, std::vector &content, Files::Collections &collections); void update(); PlayerPacket *getPlayerPacket(RakNet::MessageID id);