//===========================================================================// // // Purpose: Implements all the functions exported by the GameUI dll. // // $NoKeywords: $ //===========================================================================// #include #include #include #include #include void RichText_SetText(vgui::RichText* thisptr, const char* text) { thisptr->SetText(text); } void vgui::RichText::SetText(const char* text) { // Originally 4096, increased to 8192 WCHAR unicode[VGUI_RICHTEXT_MAX_LEN]; if (text && *text) { if (text[0] == '#') { this->__vftable->ResolveLocalizedTextAndVariables(this, text, unicode, sizeof(unicode)); this->__vftable->SetText(this, unicode); } else { unicode[0] = 0; MultiByteToWideChar(CP_UTF8, 0, text, -1, unicode, VGUI_RICHTEXT_MAX_LEN); unicode[VGUI_RICHTEXT_MAX_LEN - 1] = 0; this->__vftable->SetText(this, unicode); } } else { this->__vftable->SetText(this, NULL); } } /////////////////////////////////////////////////////////////////////////////// void VVGUIRichText::Attach() const { DetourAttach((LPVOID*)&vgui_RichText_SetText, &RichText_SetText); } void VVGUIRichText::Detach() const { DetourDetach((LPVOID*)&vgui_RichText_SetText, &RichText_SetText); } ///////////////////////////////////////////////////////////////////////////////