首页 技术 正文
技术 2022年11月9日
0 收藏 962 点赞 2,850 浏览 6738 个字

Hook GameUI function.

 #include <metahook.h> #include <IGameUI.h> IGameUI *g_pGameUI = ; void (__fastcall *g_pfnCGameUI_Initialize)(void *pthis, int edx, CreateInterfaceFn *factories, int count) = ;
void (__fastcall *g_pfnCGameUI_Start)(void *pthis, int edx, struct cl_enginefuncs_s *engineFuncs, int interfaceVersion, void *system) = ;
void (__fastcall *g_pfnCGameUI_Shutdown)(void *pthis, int edx) = ;
int (__fastcall *g_pfnCGameUI_ActivateGameUI)(void *pthis, int edx) = ;
int (__fastcall *g_pfnCGameUI_ActivateDemoUI)(void *pthis, int edx) = ;
int (__fastcall *g_pfnCGameUI_HasExclusiveInput)(void *pthis, int edx) = ;
void (__fastcall *g_pfnCGameUI_RunFrame)(void *pthis, int edx) = ;
void (__fastcall *g_pfnCGameUI_ConnectToServer)(void *pthis, int edx, const char *game, int IP, int port) = ;
void (__fastcall *g_pfnCGameUI_DisconnectFromServer)(void *pthis, int edx) = ;
void (__fastcall *g_pfnCGameUI_HideGameUI)(void *pthis, int edx) = ;
bool (__fastcall *g_pfnCGameUI_IsGameUIActive)(void *pthis, int edx) = ;
void (__fastcall *g_pfnCGameUI_LoadingStarted)(void *pthis, int edx, const char *resourceType, const char *resourceName) = ;
void (__fastcall *g_pfnCGameUI_LoadingFinished)(void *pthis, int edx, const char *resourceType, const char *resourceName) = ;
void (__fastcall *g_pfnCGameUI_StartProgressBar)(void *pthis, int edx, const char *progressType, int progressSteps) = ;
int (__fastcall *g_pfnCGameUI_ContinueProgressBar)(void *pthis, int edx, int progressPoint, float progressFraction) = ;
void (__fastcall *g_pfnCGameUI_StopProgressBar)(void *pthis, int edx, bool bError, const char *failureReason, const char *extendedReason) = ;
int (__fastcall *g_pfnCGameUI_SetProgressBarStatusText)(void *pthis, int edx, const char *statusText) = ;
void (__fastcall *g_pfnCGameUI_SetSecondaryProgressBar)(void *pthis, int edx, float progress) = ;
void (__fastcall *g_pfnCGameUI_SetSecondaryProgressBarText)(void *pthis, int edx, const char *statusText) = ; class CGameUI : public IGameUI
{
public:
void Initialize(CreateInterfaceFn *factories, int count);
void Start(struct cl_enginefuncs_s *engineFuncs, int interfaceVersion, void *system);
void Shutdown(void);
int ActivateGameUI(void);
int ActivateDemoUI(void);
int HasExclusiveInput(void);
void RunFrame(void);
void ConnectToServer(const char *game, int IP, int port);
void DisconnectFromServer(void);
void HideGameUI(void);
bool IsGameUIActive(void);
void LoadingStarted(const char *resourceType, const char *resourceName);
void LoadingFinished(const char *resourceType, const char *resourceName);
void StartProgressBar(const char *progressType, int progressSteps);
int ContinueProgressBar(int progressPoint, float progressFraction);
void StopProgressBar(bool bError, const char *failureReason, const char *extendedReason = NULL);
int SetProgressBarStatusText(const char *statusText);
void SetSecondaryProgressBar(float progress);
void SetSecondaryProgressBarText(const char *statusText);
}; void CGameUI::Initialize(CreateInterfaceFn *factories, int count)
{
return g_pfnCGameUI_Initialize(this, , factories, count);
} void CGameUI::Start(struct cl_enginefuncs_s *engineFuncs, int interfaceVersion, void *system)
{
return g_pfnCGameUI_Start(this, , engineFuncs, interfaceVersion, system);
} void CGameUI::Shutdown(void)
{
return g_pfnCGameUI_Shutdown(this, );
} int CGameUI::ActivateGameUI(void)
{
return g_pfnCGameUI_ActivateGameUI(this, );
} int CGameUI::ActivateDemoUI(void)
{
return g_pfnCGameUI_ActivateDemoUI(this, );
} int CGameUI::HasExclusiveInput(void)
{
return g_pfnCGameUI_HasExclusiveInput(this, );
} void CGameUI::RunFrame(void)
{
return g_pfnCGameUI_RunFrame(this, );
} void CGameUI::ConnectToServer(const char *game, int IP, int port)
{
return g_pfnCGameUI_ConnectToServer(this, , game, IP, port);
} void CGameUI::DisconnectFromServer(void)
{
return g_pfnCGameUI_DisconnectFromServer(this, );
} void CGameUI::HideGameUI(void)
{
return g_pfnCGameUI_HideGameUI(this, );
} bool CGameUI::IsGameUIActive(void)
{
return g_pfnCGameUI_IsGameUIActive(this, );
} void CGameUI::LoadingStarted(const char *resourceType, const char *resourceName)
{
return g_pfnCGameUI_LoadingStarted(this, , resourceType, resourceName);
} void CGameUI::LoadingFinished(const char *resourceType, const char *resourceName)
{
return g_pfnCGameUI_LoadingFinished(this, , resourceType, resourceName);
} void CGameUI::StartProgressBar(const char *progressType, int progressSteps)
{
return g_pfnCGameUI_StartProgressBar(this, , progressType, progressSteps);
} int CGameUI::ContinueProgressBar(int progressPoint, float progressFraction)
{
return g_pfnCGameUI_ContinueProgressBar(this, , progressPoint, progressFraction);
} void CGameUI::StopProgressBar(bool bError, const char *failureReason, const char *extendedReason)
{
return g_pfnCGameUI_StopProgressBar(this, , bError, failureReason, extendedReason);
} int CGameUI::SetProgressBarStatusText(const char *statusText)
{
return g_pfnCGameUI_SetProgressBarStatusText(this, , statusText);
} void CGameUI::SetSecondaryProgressBar(float progress)
{
return g_pfnCGameUI_SetSecondaryProgressBar(this, , progress);
} void CGameUI::SetSecondaryProgressBarText(const char *statusText)
{
return g_pfnCGameUI_SetSecondaryProgressBarText(this, , statusText);
} void GameUI_InstallHook(void)
{
CreateInterfaceFn GameUICreateInterface = Sys_GetFactory((HINTERFACEMODULE)GetModuleHandleA("GameUI.dll"));
g_pGameUI = (IGameUI *)GameUICreateInterface(GAMEUI_INTERFACE_VERSION, ); CGameUI GameUI;
DWORD *pVFTable = *(DWORD **)&GameUI; g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[ ], (void *&)g_pfnCGameUI_Initialize);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[ ], (void *&)g_pfnCGameUI_Start);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[ ], (void *&)g_pfnCGameUI_Shutdown);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[ ], (void *&)g_pfnCGameUI_ActivateGameUI);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[ ], (void *&)g_pfnCGameUI_ActivateDemoUI);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[ ], (void *&)g_pfnCGameUI_HasExclusiveInput);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[ ], (void *&)g_pfnCGameUI_RunFrame);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[ ], (void *&)g_pfnCGameUI_ConnectToServer);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[ ], (void *&)g_pfnCGameUI_DisconnectFromServer);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_HideGameUI);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_IsGameUIActive);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_LoadingStarted);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_LoadingFinished);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_StartProgressBar);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_ContinueProgressBar);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_StopProgressBar);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_SetProgressBarStatusText);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_SetSecondaryProgressBar);
g_pMetaHookAPI->VFTHook(g_pGameUI, , , (void *)pVFTable[], (void *&)g_pfnCGameUI_SetSecondaryProgressBarText);
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,500
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,914
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,747
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,504
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,142
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,306