Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/hzqst/MetaHookSv
Browse files Browse the repository at this point in the history
  • Loading branch information
hzqst committed Mar 2, 2024
2 parents 11ca5bc + 55d7227 commit 58ea888
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 3 deletions.
71 changes: 70 additions & 1 deletion Plugins/VGUI2Extension/Surface2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,76 @@ void CSurface2::SetAllowHTMLJavaScript(bool state)
}
return g_pSurface->SetAllowHTMLJavaScript(state);
}

void CSurface2::SetLanguage(const char* pchLang)
{
if (g_pSurface_HL25)
{
g_pSurface_HL25->SetLanguage(pchLang);
}
else
{
g_pSurface->SetLanguage(pchLang);
}
}
const char* CSurface2::GetLanguage()
{
if (g_pSurface_HL25)
{
return g_pSurface_HL25->GetLanguage();
}
return g_pSurface->GetLanguage();
}void CSurface2::DrawUpdateRegionTextureBGRA(int nTextureID, int x, int y, const unsigned char* pchData, int wide, int tall)
{
if (g_pSurface_HL25)
{
g_pSurface_HL25->DrawUpdateRegionTextureBGRA(nTextureID, x, y, pchData, wide, tall);
}
else
{
g_pSurface->DrawUpdateRegionTextureBGRA(nTextureID, x, y, pchData, wide, tall);
}
}
void CSurface2::DrawSetTextureBGRA(int id, const unsigned char* pchData, int wide, int tall)
{
if (g_pSurface_HL25)
{
g_pSurface_HL25->DrawSetTextureBGRA(id, pchData, wide, tall);
}
else
{
g_pSurface->DrawSetTextureBGRA(id, pchData, wide, tall);
}
}
void CSurface2::CreateBrowser(vgui::VPANEL panel, IHTMLResponses* pBrowser, bool bPopupWindow, const char* pchUserAgentIdentifier)
{
if (g_pSurface_HL25)
{
g_pSurface_HL25->CreateBrowser(panel, pBrowser, bPopupWindow, pchUserAgentIdentifier);
}
else
{
g_pSurface->CreateBrowser(panel, pBrowser, bPopupWindow, pchUserAgentIdentifier);
}
}
void CSurface2::RemoveBrowser(vgui::VPANEL panel, IHTMLResponses* pBrowser)
{
if (g_pSurface_HL25)
{
g_pSurface_HL25->RemoveBrowser(panel, pBrowser);
}
else
{
g_pSurface->RemoveBrowser(panel, pBrowser);
}
}
IHTMLChromeController* CSurface2::AccessChromeHTMLController()
{
if (g_pSurface_HL25)
{
return g_pSurface_HL25->AccessChromeHTMLController();
}
return g_pSurface->AccessChromeHTMLController();
}
// screen size changing
void CSurface2::OnScreenSizeChanged(int nOldWidth, int nOldHeight)
{
Expand Down
9 changes: 8 additions & 1 deletion Plugins/VGUI2Extension/Surface2.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,14 @@ class CSurface2 : public ISurface2
float DrawGetAlphaMultiplier( void );

// web browser
void SetAllowHTMLJavaScript( bool state );
virtual void SetAllowHTMLJavaScript(bool state);
virtual void SetLanguage(const char* pchLang);
virtual const char* GetLanguage();
virtual void DrawUpdateRegionTextureBGRA(int nTextureID, int x, int y, const unsigned char* pchData, int wide, int tall);
virtual void DrawSetTextureBGRA(int id, const unsigned char* pchData, int wide, int tall);
virtual void CreateBrowser(VPANEL panel, IHTMLResponses* pBrowser, bool bPopupWindow, const char* pchUserAgentIdentifier);
virtual void RemoveBrowser(VPANEL panel, IHTMLResponses* pBrowser);
virtual IHTMLChromeController* AccessChromeHTMLController();

// video mode changing
void OnScreenSizeChanged( int nOldWidth, int nOldHeight );
Expand Down
12 changes: 11 additions & 1 deletion include/Interface/VGUI/ISurface2.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include <mathlib/vector2d.h>
#include <Color.h>

class IHTMLResponses;
class IHTMLChromeController;

namespace vgui
{

Expand Down Expand Up @@ -248,10 +251,17 @@ class ISurface2 : public IBaseInterface
virtual double GetAbsoluteTime() const = 0;
virtual void SetForcingHDProportional(bool bForcingHDProportional) = 0;
virtual bool IsForcingHDProportional() const = 0;
virtual void SetLanguage(const char* pchLang) = 0;
virtual const char* GetLanguage() = 0;
virtual void DrawUpdateRegionTextureBGRA(int nTextureID, int x, int y, const unsigned char* pchData, int wide, int tall) = 0;
virtual void DrawSetTextureBGRA(int id, const unsigned char* pchData, int wide, int tall) = 0;
virtual void CreateBrowser(VPANEL panel, IHTMLResponses* pBrowser, bool bPopupWindow, const char* pchUserAgentIdentifier) = 0;
virtual void RemoveBrowser(VPANEL panel, IHTMLResponses* pBrowser) = 0;
virtual IHTMLChromeController* AccessChromeHTMLController() = 0;
};

}

#define VGUI_SURFACE2_INTERFACE_VERSION "VGUI_Surface2_003"
#define VGUI_SURFACE2_INTERFACE_VERSION "VGUI_Surface2_004"

#endif

0 comments on commit 58ea888

Please sign in to comment.