This commit is contained in:
nullifiedcat 2017-04-12 14:57:56 +03:00
parent c7bb08ed0d
commit e9c8395e01
8 changed files with 28 additions and 8 deletions

View File

@ -38,7 +38,6 @@ void EntityCache::Invalidate() {
void CachedEntity::Update(int idx) {
SEGV_BEGIN
m_IDX = idx;
if (!RAW_ENT(this)) return;
#if PROXY_ENTITY != true

View File

@ -171,6 +171,10 @@ void hack::Initialize() {
hooks::hkInput->Init((void*)g_IInput, 0);
hooks::hkInput->HookMethod((void*)GetUserCmd_hook, hooks::offGetUserCmd);
hooks::hkInput->Apply();
hooks::hkIVModelRender = new hooks::VMTHook();
hooks::hkIVModelRender->Init(g_IVModelRender, 0);
hooks::hkIVModelRender->HookMethod((void*)DrawModelExecute_hook, hooks::offDrawModelExecute);
hooks::hkIVModelRender->Apply();
if (TF2) g_GlowObjectManager = *reinterpret_cast<CGlowObjectManager**>(gSignatures.GetClientSignature("C1 E0 05 03 05") + 5);
InitStrings();
hacks::shared::killsay::Init();
@ -195,6 +199,7 @@ void hack::Shutdown() {
if (hooks::hkNetChannel) hooks::hkNetChannel->Kill();
if (hooks::hkStudioRender) hooks::hkStudioRender->Kill();
if (hooks::hkInput) hooks::hkInput->Kill();
if (hooks::hkIVModelRender) hooks::hkIVModelRender->Kill();
//if (hooks::hkCTFPlayer) hooks::hkCTFPlayer->Kill();
logging::Info("Unregistering convars..");
ConVar_Unregister();

View File

@ -81,3 +81,4 @@ hooks::VMTHook* hooks::hkNetChannel = 0;
hooks::VMTHook* hooks::hkClientDLL = 0;
hooks::VMTHook* hooks::hkMatSurface = 0;
hooks::VMTHook* hooks::hkStudioRender = 0;
hooks::VMTHook* hooks::hkIVModelRender = nullptr;

View File

@ -40,9 +40,11 @@ extern VMTHook* hkClientDLL;
extern VMTHook* hkMatSurface;
extern VMTHook* hkStudioRender;
extern VMTHook* hkInput;
extern VMTHook* hkIVModelRender;
constexpr unsigned int offGetUserCmd = 8;
constexpr unsigned int offShouldDraw = 136;
constexpr unsigned int offDrawModelExecute = 19;
extern unsigned int offHandleInputEvent;
extern unsigned int offPaintTraverse;
extern unsigned int offCreateMove;

View File

@ -8,13 +8,7 @@
#ifndef HOOKEDMETHODS_H_
#define HOOKEDMETHODS_H_
class IStudioRender;
class CUserCmd;
class INetMessage;
class bf_read;
class CViewSetup;
class IClientEntity;
class IInput;
#include "../common.h"
typedef bool(CreateMove_t)(void*, float, CUserCmd*);
typedef void(PaintTraverse_t)(void*, unsigned int, bool, bool);
@ -29,6 +23,7 @@ typedef void(LevelInit_t)(void*, const char*);
typedef void(LevelShutdown_t)(void*);
typedef void(BeginFrame_t)(IStudioRender*);
typedef bool(*CanInspect_t)(IClientEntity*);
typedef void(*DrawModelExecute_t)(IVModelRender*, const DrawModelState_t&, const ModelRenderInfo_t&, matrix3x4_t*);
typedef CUserCmd*(GetUserCmd_t)(IInput*, int);
//typedef void(*CInput__CreateMove_t)(void*, int, float, bool);
//void CInput__CreateMove_hook(void*, int sequence_number, float input_sample_frametime, bool active);
@ -36,6 +31,7 @@ bool CanInspect_hook(IClientEntity*);
const unsigned int offCanInspect = 512;
void BeginFrame_hook(IStudioRender*);
CUserCmd* GetUserCmd_hook(IInput*, int);
void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix);
#include "CreateMove.h"
#include "PaintTraverse.h"

View File

@ -10,6 +10,19 @@
#include "../hack.h"
#include "hookedmethods.h"
void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix) {
IClientUnknown* unknown = info.pRenderable->GetIClientUnknown();
if (unknown) {
IClientEntity* entity = unknown->GetIClientEntity();
if (entity && entity->entindex() != -1) {
if (entity->GetClientClass() == g_pClassID->C_Player) {
//CMatRenderContextPtr ptr();
}
}
}
((DrawModelExecute_t)(hooks::hkIVModelRender->GetMethod(hooks::offDrawModelExecute)))(_this, state, info, matrix);
}
bool CanPacket_hook(void* thisptr) {
SEGV_BEGIN;
return send_packets && ((CanPacket_t*)hooks::hkNetChannel->GetMethod(hooks::offCanPacket))(thisptr);

View File

@ -21,6 +21,7 @@
//class ISteamFriends002;
IVModelRender* g_IVModelRender = nullptr;
ISteamClient* g_ISteamClient = nullptr;
ISteamFriends* g_ISteamFriends = nullptr;
IVEngineClient013* g_IEngine = nullptr;
@ -83,6 +84,7 @@ void CreateInterfaces() {
g_IVDebugOverlay = BruteforceInterface<IVDebugOverlay>("VDebugOverlay", sharedobj::engine);
HSteamPipe sp = g_ISteamClient->CreateSteamPipe();
HSteamUser su = g_ISteamClient->ConnectToGlobalUser(sp);
g_IVModelRender = BruteforceInterface<IVModelRender>("VEngineModel", sharedobj::engine, 16);
g_ISteamFriends = g_ISteamClient->GetISteamFriends(su, sp, "SteamFriends002");
g_GlobalVars = **(reinterpret_cast<CGlobalVarsBase***>((uintptr_t)11 + gSignatures.GetClientSignature("55 89 E5 83 EC ? 8B 45 08 8B 15 ? ? ? ? F3 0F 10")));
g_IPrediction = BruteforceInterface<IPrediction>("VClientPrediction", sharedobj::client);

View File

@ -42,7 +42,9 @@ class IAchievementMgr;
class ISteamUserStats;
class IStudioRender;
class IVDebugOverlay;
class IVModelRender;
extern IVModelRender* g_IVModelRender;
extern ISteamClient* g_ISteamClient;
extern ISteamFriends* g_ISteamFriends;
extern IVEngineClient013* g_IEngine;