From 6aad062e9a3e751c7430a6134353f53e3c7eb399 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 4 Jul 2020 01:50:29 -0500 Subject: [PATCH 1/4] Add logging [skip ci] --- common/shareddb.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 789b739a8..6507eaebc 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -917,6 +917,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) { EQ::IPCMutex mutex("items"); mutex.Lock(); std::string file_name = Config->SharedMemDir + prefix + std::string("items"); + LogInfo("[Shared Memory] Attempting to load file [{}]", file_name); items_mmf = std::unique_ptr(new EQ::MemoryMappedFile(file_name)); items_hash = std::unique_ptr>(new EQ::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), items_mmf->Size())); mutex.Unlock(); @@ -1341,6 +1342,7 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) { EQ::IPCMutex mutex("faction"); mutex.Lock(); std::string file_name = Config->SharedMemDir + prefix + std::string("faction"); + LogInfo("[Shared Memory] Attempting to load file [{}]", file_name); faction_mmf = std::unique_ptr(new EQ::MemoryMappedFile(file_name)); faction_hash = std::unique_ptr>(new EQ::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), faction_mmf->Size())); mutex.Unlock(); @@ -1542,6 +1544,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) { EQ::IPCMutex mutex("skill_caps"); mutex.Lock(); std::string file_name = Config->SharedMemDir + prefix + std::string("skill_caps"); + LogInfo("[Shared Memory] Attempting to load file [{}]", file_name); skill_caps_mmf = std::unique_ptr(new EQ::MemoryMappedFile(file_name)); mutex.Unlock(); } catch(std::exception &ex) { @@ -1700,6 +1703,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const std::string file_name = Config->SharedMemDir + prefix + std::string("spells"); spells_mmf = std::unique_ptr(new EQ::MemoryMappedFile(file_name)); + LogInfo("[Shared Memory] Attempting to load file [{}]", file_name); *records = *reinterpret_cast(spells_mmf->Get()); *sp = reinterpret_cast((char*)spells_mmf->Get() + 4); mutex.Unlock(); From 8e96232690eaca15302be8b75b918b731012c1b5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 4 Jul 2020 01:58:02 -0500 Subject: [PATCH 2/4] Add explicit file extension to file check [skip ci] --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 1e1b4475e..6dd380975 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -12827,7 +12827,7 @@ void command_hotfix(Client *c, const Seperator *sep) #ifdef WIN32 shared_memory_path = "shared_memory"; - if (file_exists("bin/shared_memory")) { + if (file_exists("bin/shared_memory.exe")) { shared_memory_path = "bin/shared_memory"; } From 9e960b90bdea5a16b560d917d679c45556157cf6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 4 Jul 2020 02:01:35 -0500 Subject: [PATCH 3/4] Adjust path quote [skip ci] --- zone/command.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 6dd380975..58cf8e876 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -12832,10 +12832,10 @@ void command_hotfix(Client *c, const Seperator *sep) } if (hotfix_name.length() > 0) { - if (system(StringFormat("%s -hotfix=%s", shared_memory_path.c_str(), hotfix_name.c_str()).c_str())) {} + if (system(StringFormat("\"%s\" -hotfix=%s", shared_memory_path.c_str(), hotfix_name.c_str()).c_str())) {} } else { - if (system(StringFormat("%s", shared_memory_path.c_str()).c_str())) {} + if (system(StringFormat("\"%s\"", shared_memory_path.c_str()).c_str())) {} } #else shared_memory_path = "./shared_memory"; From 15a70c7aa9e3cb3c1b0ec7cc4cb89c2a0c6e572c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 4 Jul 2020 02:24:53 -0500 Subject: [PATCH 4/4] Fix for windows hotfix [skip ci] --- zone/command.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 58cf8e876..f60490b88 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -12828,15 +12828,19 @@ void command_hotfix(Client *c, const Seperator *sep) #ifdef WIN32 shared_memory_path = "shared_memory"; if (file_exists("bin/shared_memory.exe")) { - shared_memory_path = "bin/shared_memory"; + shared_memory_path = "bin\\shared_memory.exe"; } + std::string hotfix_command; if (hotfix_name.length() > 0) { - if (system(StringFormat("\"%s\" -hotfix=%s", shared_memory_path.c_str(), hotfix_name.c_str()).c_str())) {} + hotfix_command = fmt::format("\"{}\" -hotfix={}", shared_memory_path, hotfix_name); } else { - if (system(StringFormat("\"%s\"", shared_memory_path.c_str()).c_str())) {} + hotfix_command = fmt::format("\"{}\"", shared_memory_path, hotfix_name); } + + LogInfo("Running hotfix command [{}]", hotfix_command); + if (system(hotfix_command.c_str())) {} #else shared_memory_path = "./shared_memory"; if (file_exists("./bin/shared_memory")) {