MCPcopy Create free account
hub / github.com/crossuo/crossuo / LoadStringDictionary

Method LoadStringDictionary

xuocore/uodata.cpp:801–835  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

799static const char *g_strings[MAX_STRINGS];
800static std::vector<uint8_t> g_stringData;
801void CFileManager::LoadStringDictionary()
802{
803 if (m_StringDictionary.Start != nullptr)
804 {
805 auto block = g_FileManager.m_StringDictionary.GetAsset(Asset::Strings);
806 if (block != nullptr)
807 {
808 g_stringData = g_FileManager.m_StringDictionary.GetData(block);
809 CDataReader reader;
810 reader.SetData(&g_stringData[0], g_stringData.size());
811 auto header = (UopDictionary *)reader.Start;
812 Info(
813 Data,
814 "dictionary: 0x%08x 0x%08x ... 0x%08x - total: %u",
815 header->Unk1,
816 header->Unk2,
817 header->Unk3,
818 header->Count);
819 reader.Move(sizeof(UopDictionary));
820
821 assert(header->Count - 1 < MAX_STRINGS);
822 for (int i = 0; i < int(header->Count - 1) && i < MAX_STRINGS; ++i)
823 {
824 const auto len = reader.ReadInt16LE();
825 *(reader.Ptr - 2) = '\0';
826 g_strings[i + 1] = (const char *)reader.Ptr;
827 reader.Move(len);
828 }
829 //for (int i = 1; g_strings[i]; ++i)
830 //{
831 // fprintf(stdout, " %d: %s\n", i, g_strings[i]);
832 //}
833 }
834 }
835}
836
837bool CFileManager::UopLoadFile(CUopMappedFile &file, const char *uopFilename, bool dumpInfo)
838{

Callers

nothing calls this directly

Calls 6

GetAssetMethod · 0.80
GetDataMethod · 0.80
ReadInt16LEMethod · 0.80
SetDataMethod · 0.45
sizeMethod · 0.45
MoveMethod · 0.45

Tested by

no test coverage detected