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

Method LoadSpeech

src/Managers/SpeechManager.cpp:42–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42bool 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

Callers 1

InstallMethod · 0.80

Calls 15

str_lowerFunction · 0.85
str_to_intFunction · 0.85
CSpeechItemClass · 0.85
wstr_from_utf8Function · 0.85
c_strMethod · 0.80
GetAssetMethod · 0.80
GetDataMethod · 0.80
ReadWStringLEMethod · 0.80
lengthMethod · 0.80
ReadUInt16BEMethod · 0.80
ReadStringMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected