Продам прострел стен Warface 10к руб!
-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C:
typedef int(WINAPI* FnRayWorldIntersection)(IPhysicalWorld*, IPhysicalWorld::SRWIParams&, const char*, int);
FnRayWorldIntersection RayWorldIntersectionFn;
int WINAPI RayWorldIntersection(IPhysicalWorld* pPW, IPhysicalWorld::SRWIParams& rp, const char* pNameTag = 0, int iCaller = 4);
struct SRWIHook {
public:
void Initialize(int IsHook, IPhysicalWorld* pPW) {
if (m_PW && m_curr) {
*m_PW = m_orig;
delete[] m_curr;
}
m_PW = NULL, m_orig = NULL;
if (!m_PW) m_PW = (uintptr_t**)pPW;
if (!m_orig) m_orig = *m_PW;
uintptr_t dwVMTSize = 0;
for (; m_orig[dwVMTSize]; ++dwVMTSize) if (IsBadCodePtr((FARPROC)m_orig[dwVMTSize])) break;
m_curr = new uintptr_t[dwVMTSize];
CMCrt::memcpy(m_curr, m_orig, sizeof(uintptr_t) * dwVMTSize);
*m_PW = m_curr;
switch (IsHook)
{
case 1:
RayWorldIntersectionFn = (FnRayWorldIntersection)(m_orig[0x23]);
m_curr[0x23] = (uintptr_t)RayWorldIntersection;
break;
default:
m_curr[0x23] = m_orig[0x23];
break;
}
}
private:
uintptr_t** m_PW = NULL;
uintptr_t* m_orig = NULL;
uintptr_t* m_curr = NULL;
}; SRWIHook pRWI;
int WINAPI RayWorldIntersection(IPhysicalWorld* pPW, IPhysicalWorld::SRWIParams& rp, const char* pNameTag, int iCaller) {
if (rp.OnEvent != 0) return 0;
return RayWorldIntersectionFn(pPW, rp, pNameTag, iCaller);
}
EXEMPLE:
void YourFunction() {
//pMainDeterminative->pPhysicalWorld = if (!pPhysicalWorld) pPhysicalWorld = SSystemGlobalEnvironment::Singleton()->GetPhysicalWorld();
pRWI.Initialize(pWallshoot, pMainDeterminative->pPhysicalWorld);
}