| 40 | } |
| 41 | |
| 42 | bool CSpeechManager::LoadSpeech() |
| 43 | { |
| 44 | LoadLangCodes(); |
| 45 | |
| 46 | for (int i = 0; i < (int)m_LangCodes.size(); i++) |
| 47 | { |
| 48 | if (m_LangCodes[i].Abbreviature == g_Language) |
| 49 | { |
| 50 | CurrentLanguage = &m_LangCodes[i]; |
| 51 | break; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | if (CurrentLanguage == nullptr) |
| 56 | { |
| 57 | CurrentLanguage = &m_LangCodes[0]; |
| 58 | g_Language = str_lower(m_LangCodes[0].Abbreviature); |
| 59 | } |
| 60 | Info(Client, "selected language: %s", g_Language.c_str()); |
| 61 | |
| 62 | CDataReader reader; |
| 63 | std::vector<uint8_t> tempData; |
| 64 | bool isUOP = false; |
| 65 | if (g_FileManager.m_MainMisc.Start != nullptr) |
| 66 | { |
| 67 | auto block = g_FileManager.m_MainMisc.GetAsset(Asset::CommandsTranslate); |
| 68 | //0x0891F809004D8081); // FIXME: find the string for this hash |
| 69 | if (block != nullptr) |
| 70 | { |
| 71 | tempData = g_FileManager.m_MainMisc.GetData(block); |
| 72 | reader.SetData(&tempData[0], tempData.size()); |
| 73 | isUOP = true; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | if (reader.Start == nullptr) |
| 78 | { |
| 79 | reader.SetData(g_FileManager.m_SpeechMul.Start, g_FileManager.m_SpeechMul.Size); |
| 80 | } |
| 81 | |
| 82 | if (isUOP) |
| 83 | { |
| 84 | Info(Client, "loading speech from UOP"); |
| 85 | reader.Move(2); |
| 86 | auto mainData = reader.ReadWStringLE(reader.Size - 2); |
| 87 | std::vector<wstr_t> list; |
| 88 | wstr_t temp; |
| 89 | for (const auto &c : mainData) |
| 90 | { |
| 91 | if (c == 0x000D || c == 0x000A) |
| 92 | { |
| 93 | if (temp.length() != 0u) |
| 94 | { |
| 95 | list.push_back(temp); |
| 96 | temp = {}; |
| 97 | } |
| 98 | } |
| 99 | else |
no test coverage detected