#include "Hook.h" typedef enum { qfalse, qtrue } qboolean; typedef float vec_t; typedef vec_t vec3_t[3]; typedef int qhandle_t; typedef enum { RT_MODEL, RT_POLY, RT_SPRITE, RT_BEAM, RT_RAIL_CORE, RT_RAIL_RINGS, RT_LIGHTNING, RT_PORTALSURFACE, RT_MAX_REF_ENTITY_TYPE } refEntityType_t; typedef struct { refEntityType_t reType; int renderfx; qhandle_t hModel; vec3_t lightingOrigin; float shadowPlane; vec3_t axis[3]; qboolean nonNormalizedAxes; float origin[3]; int frame; float oldorigin[3]; int oldframe; float backlerp; int skinNum; qhandle_t customSkin; qhandle_t customShader; byte shaderRGBA[4]; float shaderTexCoord[2]; float shaderTime; float radius; float rotation; } refEntity_t; void (*orig_AddRefEntityToScene)( refEntity_t* refent ); void R_AddRefEntityToScene( refEntity_t* refent ) { refent->renderfx |= 0x8; orig_AddRefEntityToScene( refent ); } HMODULE (__stdcall *orig_LoadLibrary)( LPCSTR lpFileName ); HMODULE __stdcall LoadLibrary_Hook( LPCSTR lpFileName ) { HMODULE hModule = orig_LoadLibrary( lpFileName ); DWORD base = (DWORD)GetModuleHandleA( lpFileName ); if( strstr( lpFileName, "gfx_d3d_mp_x86_s.dll" ) ) { orig_AddRefEntityToScene = (void (__cdecl *)(refEntity_t *))DetourFunction((PBYTE)base + 0x23DB0, (PBYTE)R_AddRefEntityToScene ); } return hModule; } BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch ( fdwReason ) { case DLL_PROCESS_ATTACH: { orig_LoadLibrary = (HMODULE (__stdcall *)(LPCSTR))DetourFunction((PBYTE)LoadLibraryA, (PBYTE)LoadLibrary_Hook ); } } return TRUE; }