| 910 | } |
| 911 | |
| 912 | bool SharedDatabase::LoadItems(const std::string &prefix) { |
| 913 | items_mmf.reset(nullptr); |
| 914 | |
| 915 | try { |
| 916 | const auto Config = EQEmuConfig::get(); |
| 917 | EQ::IPCMutex mutex("items"); |
| 918 | mutex.Lock(); |
| 919 | std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("items")); |
| 920 | items_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name); |
| 921 | items_hash = std::make_unique<EQ::FixedMemoryHashSet<EQ::ItemData>>(static_cast<uint8*>(items_mmf->Get()), items_mmf->Size()); |
| 922 | mutex.Unlock(); |
| 923 | |
| 924 | LogInfo("Loaded [{}] items via shared memory", Strings::Commify(m_shared_items_count)); |
| 925 | } catch(std::exception& ex) { |
| 926 | LogError("Error Loading Items: {}", ex.what()); |
| 927 | return false; |
| 928 | } |
| 929 | |
| 930 | return true; |
| 931 | } |
| 932 | |
| 933 | void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id) |
| 934 | { |