65,210
社区成员
发帖
与我相关
我的任务
分享
int NewHookUserMsg(char *szMsgName, pfnUserMsgHook pfn)
{
printf("Success!");
return gEngfuncs.pfnHookUserMsg(szMsgName, pfn);
}
int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion)
{
memcpy(&gEngfuncs, pEnginefuncs, sizeof(gEngfuncs));
//pfnHookUserMsg是int型
pEnginefuncs->pfnHookUserMsg = &NewHookUserMsg;
return gExportfuncs.Initialize(pEnginefuncs, iVersion);
}
void NewHookSoundIndex(int SoundID, float volume)
{
//实际上这个函数不能被pEnginefuncs->pfnPlaySoundByIndex = &NewHookSoundIndex;调用到
printf("??????");
return gEngfuncs.pfnPlaySoundByIndex(SoundID, volume);
}
int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion)
{
memcpy(&gEngfuncs, pEnginefuncs, sizeof(gEngfuncs));
//pfnPlaySoundByIndex是typedef void型, 请问各位这里要怎么写才可以执行到void NewHookSoundIndex
pEnginefuncs->pfnPlaySoundByIndex = &NewHookSoundIndex;
return gExportfuncs.Initialize(pEnginefuncs, iVersion);
}
typedef int (*pfnEngSrc_pfnHookUserMsg_t ) ( char *szMsgName, pfnUserMsgHook pfn );
typedef void (*pfnEngSrc_pfnPlaySoundByIndex_t ) ( int iSound, float volume );
typedef struct cl_enginefuncs_s
{
pfnEngSrc_pfnHookUserMsg_t pfnHookUserMsg;
pfnEngSrc_pfnPlaySoundByIndex_t pfnPlaySoundByIndex;
}