2024-04-05 16:26:18 +02:00
|
|
|
//===========================================================================//
|
|
|
|
//
|
|
|
|
// Purpose: Implements all the functions exported by the GameUI dll.
|
|
|
|
//
|
|
|
|
// $NoKeywords: $
|
|
|
|
//===========================================================================//
|
|
|
|
|
|
|
|
#include <core/stdafx.h>
|
|
|
|
#include <tier1/cvar.h>
|
|
|
|
#include <engine/sys_utils.h>
|
|
|
|
#include <vgui/vgui_controls/RichText.h>
|
|
|
|
#include <vguimatsurface/MatSystemSurface.h>
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2023-11-26 13:21:20 +01:00
|
|
|
void VVGUIRichText::Detour(const bool bAttach) const
|
2024-04-05 16:26:18 +02:00
|
|
|
{
|
2024-01-02 15:21:36 +01:00
|
|
|
DetourSetup(&vgui__RichText__SetText, &RichText_SetText, bAttach);
|
2024-04-05 16:26:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|