Hey,
I’ve been trying to set up my server so that it can send custom patches through the server and to the client. After a short search I was able to find a guide written by StoneHarry and schlumpf who managed to get this working back in 2012. Because their guide is quite dated at present I was unable to apply the .diff patch that they supplied to enable the patching functionality. I did attempt to manually look through the .diff file and add in the core edits myself, but my lack of C++ knowledge and the fact that the .diff was made with code written two years ago which seems to have been updated quite a bit I was unable to successfully apply the core edits.
After giving up on editing the core myself I reached out to schlumpf to see if he would be able to fix up his old code so that it would work with newer versions of TrinityCore, he is quite busy at the moment so he is unable to do so. Schlumpf did mention that, as far as he remembers, TrinityCore does have patching implemented. When I found out that it was already implemented I did a quick search through AuthSocket.cpp and found quite a bit of code that, to me, seems as if it’s related to sending patches from server to client. When I stumbled across the (is it called a method in C++?) below I had the idea that I might be able to set up the patch by simply adding a folder named ‘patches’ to /server/bin/ and then creating an MPQ file using the information in StoneHarry/schlumpf’s tutorial. After doing that I restarted authserver and was greeted with the error which is also below.
Is there any way to get patching to work?
The method I stumbled upon:
// Calculate and store MD5 hash for a given patch file
void Patcher::LoadPatchMD5(char szFileName)
{
// Try to open the patch file
std::string path = “./patches/”;
path += szFileName;
FILE pPatch = fopen(path.c_str(), “rb”);
TC_LOG_DEBUG(“network”, “Loading patch info from %sn”, path.c_str());
if (!pPatch)
{
TC_LOG_ERROR("server.authserver", "Error loading patch %sn", path.c_str());
return;
}
// Calculate the MD5 hash
MD5_CTX ctx;
MD5_Init(&ctx);
uint8* buf = new uint8[512 * 1024];
while (!feof(pPatch))
{
size_t read = fread(buf, 1, 512 * 1024, pPatch);
MD5_Update(&ctx, buf, read);
}
delete [] buf;
fclose(pPatch);
// Store the result in the internal patch hash map
_patches[path] = new PATCH_INFO;
MD5_Final((uint8 *)&_patches[path]->md5, &ctx);
}
The error message:
/home/trinitycore/server/bin# ./authserver
Wrong Loggers configuration. Review your Logger config section.
Creating default loggers [root (Error), server (Info)] to console
I’ve checked the Logger section in authserver.conf & worldserver.conf, but I don’t see anything that would affect sending patches.
After deleting the MPQ file within the patches folder and restarting authserver, it starts up correctly.
The MPQ file contains a file called prepatch.lst and patch-5.mpq, the contents of prepatch.lst are:
delete patch-5.mpq
extract patch-5.mpq
Oh, one additional note. I already have a modified Wow.exe file which has all file protection removed, so there should be no problems there if I ever get this sending to the client somehow.
Thanks for any help.