| 799 | static const char *g_strings[MAX_STRINGS]; |
| 800 | static std::vector<uint8_t> g_stringData; |
| 801 | void 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 | |
| 837 | bool CFileManager::UopLoadFile(CUopMappedFile &file, const char *uopFilename, bool dumpInfo) |
| 838 | { |