remove interfaces::
This commit is contained in:
parent
3609381a24
commit
1a8ef5978e
@ -60,7 +60,7 @@ public:
|
||||
|
||||
void SaveDump()
|
||||
{
|
||||
ClientClass *pList = interfaces::baseClient->GetAllClasses();
|
||||
ClientClass *pList = g_IBaseClient->GetAllClasses();
|
||||
//logging::Info("iterating...");
|
||||
while(pList)
|
||||
{
|
||||
|
@ -20,12 +20,12 @@ ChatStack::~ChatStack() {
|
||||
|
||||
void ChatStack::OnCreateMove() {
|
||||
if (m_nStackDepth <= 0) return;
|
||||
if (m_fLastSay > interfaces::gvars->curtime) m_fLastSay = 0;
|
||||
if (interfaces::gvars->curtime - CHATSTACK_INTERVAL <= m_fLastSay) return;
|
||||
if (m_fLastSay > g_GlobalVars->curtime) m_fLastSay = 0;
|
||||
if (g_GlobalVars->curtime - CHATSTACK_INTERVAL <= m_fLastSay) return;
|
||||
const char* msg = Pop();
|
||||
const char* cmd = strfmt("say \"%s\"", msg);
|
||||
interfaces::engineClient->ServerCmd(cmd);
|
||||
m_fLastSay = interfaces::gvars->curtime;
|
||||
g_IEngine->ServerCmd(cmd);
|
||||
m_fLastSay = g_GlobalVars->curtime;
|
||||
delete [] cmd;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
void netvar_tree::init()
|
||||
{
|
||||
const auto *client_class = interfaces::baseClient->GetAllClasses();
|
||||
const auto *client_class = g_IBaseClient->GetAllClasses();
|
||||
while(client_class != nullptr)
|
||||
{
|
||||
const auto class_info = std::make_shared<node>(0, nullptr);
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <link.h>
|
||||
|
||||
bool RandomCrits() {
|
||||
static ConVar* tf_weapon_criticals = interfaces::cvar->FindVar("tf_weapon_criticals");
|
||||
static ConVar* tf_weapon_criticals = g_ICvar->FindVar("tf_weapon_criticals");
|
||||
return tf_weapon_criticals->GetBool();
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ void CatCommand::Register() {
|
||||
if (callback) cmd = new ConCommand(name_c, callback, help_c);
|
||||
else if (callback_void) cmd = new ConCommand(name_c, callback_void, help_c);
|
||||
else throw std::logic_error("no callback in CatCommand");
|
||||
interfaces::cvar->RegisterConCommand(cmd);
|
||||
g_ICvar->RegisterConCommand(cmd);
|
||||
// name_c and help_c are not freed because ConCommandBase doesn't copy them
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ int colors::Transparent(int base, float mod /*= 0.5f*/) {
|
||||
}
|
||||
|
||||
int colors::RainbowCurrent() {
|
||||
return colors::FromHSL(fabs(sin(interfaces::gvars->curtime / 2.0f)) * 360.0f, 0.85f, 0.9f);
|
||||
return colors::FromHSL(fabs(sin(g_GlobalVars->curtime / 2.0f)) * 360.0f, 0.85f, 0.9f);
|
||||
}
|
||||
|
||||
int colors::FromHSL(float h, float s, float v) {
|
||||
@ -256,8 +256,8 @@ int colors::Health(int health, int max) {
|
||||
}
|
||||
|
||||
void draw::DrawRect(int x, int y, int w, int h, int color) {
|
||||
interfaces::surface->DrawSetColor(*reinterpret_cast<Color*>(&color));
|
||||
interfaces::surface->DrawFilledRect(x, y, x + w, y + h);
|
||||
g_ISurface->DrawSetColor(*reinterpret_cast<Color*>(&color));
|
||||
g_ISurface->DrawFilledRect(x, y, x + w, y + h);
|
||||
}
|
||||
|
||||
ESPStringCompound::ESPStringCompound() {
|
||||
@ -267,22 +267,22 @@ ESPStringCompound::ESPStringCompound() {
|
||||
}
|
||||
|
||||
void draw::Initialize() {
|
||||
fonts::ESP = interfaces::surface->CreateFont();
|
||||
fonts::MENU = interfaces::surface->CreateFont();
|
||||
fonts::MENU_BIG = interfaces::surface->CreateFont();
|
||||
fonts::ESP = g_ISurface->CreateFont();
|
||||
fonts::MENU = g_ISurface->CreateFont();
|
||||
fonts::MENU_BIG = g_ISurface->CreateFont();
|
||||
|
||||
if (!draw::width || !draw::height) {
|
||||
interfaces::engineClient->GetScreenSize(draw::width, draw::height);
|
||||
g_IEngine->GetScreenSize(draw::width, draw::height);
|
||||
}
|
||||
|
||||
interfaces::surface->SetFontGlyphSet(fonts::ESP, "TF2 Build", fonts::ESP_HEIGHT, 0, 0, 0, interfaces::surface->FONTFLAG_DROPSHADOW); // or Ubuntu Mono Bold
|
||||
interfaces::surface->SetFontGlyphSet(fonts::MENU, "Verdana", fonts::MENU_HEIGHT, 0, 0, 0, interfaces::surface->FONTFLAG_DROPSHADOW);
|
||||
interfaces::surface->SetFontGlyphSet(fonts::MENU_BIG, "Verdana Bold", fonts::MENU_BIG_HEIGHT, 0, 0, 0, 0x0);
|
||||
g_ISurface->SetFontGlyphSet(fonts::ESP, "TF2 Build", fonts::ESP_HEIGHT, 0, 0, 0, g_ISurface->FONTFLAG_DROPSHADOW); // or Ubuntu Mono Bold
|
||||
g_ISurface->SetFontGlyphSet(fonts::MENU, "Verdana", fonts::MENU_HEIGHT, 0, 0, 0, g_ISurface->FONTFLAG_DROPSHADOW);
|
||||
g_ISurface->SetFontGlyphSet(fonts::MENU_BIG, "Verdana Bold", fonts::MENU_BIG_HEIGHT, 0, 0, 0, 0x0);
|
||||
}
|
||||
|
||||
void draw::DrawLine(int x, int y, int dx, int dy, int color) {
|
||||
interfaces::surface->DrawSetColor(*reinterpret_cast<Color*>(&color));
|
||||
interfaces::surface->DrawLine(x, y, x + dx, y + dy);
|
||||
g_ISurface->DrawSetColor(*reinterpret_cast<Color*>(&color));
|
||||
g_ISurface->DrawLine(x, y, x + dx, y + dy);
|
||||
}
|
||||
|
||||
bool draw::EntityCenterToScreen(CachedEntity* entity, Vector& out) {
|
||||
@ -299,7 +299,7 @@ bool draw::EntityCenterToScreen(CachedEntity* entity, Vector& out) {
|
||||
}
|
||||
|
||||
bool draw::WorldToScreen(Vector& origin, Vector& screen) {
|
||||
VMatrix wts = interfaces::engineClient->WorldToScreenMatrix();
|
||||
VMatrix wts = g_IEngine->WorldToScreenMatrix();
|
||||
screen.z = 0;
|
||||
float w = wts[3][0] * origin[0] + wts[3][1] * origin[1] + wts[3][2] * origin[2] + wts[3][3];
|
||||
if (w > 0.001) {
|
||||
@ -312,14 +312,14 @@ bool draw::WorldToScreen(Vector& origin, Vector& screen) {
|
||||
}
|
||||
|
||||
void draw::OutlineRect(int x, int y, int w, int h, int color) {
|
||||
interfaces::surface->DrawSetColor(*reinterpret_cast<Color*>(&color));
|
||||
interfaces::surface->DrawOutlinedRect(x, y, x + w, y + h);
|
||||
g_ISurface->DrawSetColor(*reinterpret_cast<Color*>(&color));
|
||||
g_ISurface->DrawOutlinedRect(x, y, x + w, y + h);
|
||||
}
|
||||
|
||||
void draw::GetStringLength(unsigned long font, char* string, int& length, int& height) {
|
||||
wchar_t buf[1024] = {'\0'};
|
||||
mbstowcs(buf, string, strlen(string));
|
||||
interfaces::surface->GetTextSize(font, buf, length, height);
|
||||
g_ISurface->GetTextSize(font, buf, length, height);
|
||||
}
|
||||
|
||||
void draw::String (unsigned long font, int x, int y, int color, int shadow, const char* text) {
|
||||
@ -341,7 +341,7 @@ void draw::String (unsigned long font, int x, int y, int color, int shadow, cons
|
||||
}
|
||||
char* col = new char[4];
|
||||
*(int*)col = color;
|
||||
interfaces::matsurface->DrawColoredText(font, x, y, col[0], col[1], col[2], col[3], "%s", text);
|
||||
matsurface->DrawColoredText(font, x, y, col[0], col[1], col[2], col[3], "%s", text);
|
||||
*/bool newlined = false;
|
||||
for (int i = 0; i < strlen(text); i++) {
|
||||
if (text[i] == '\n') {
|
||||
@ -392,10 +392,10 @@ void draw::WString(unsigned long font, int x, int y, int color, int shadow, cons
|
||||
draw::WString(font, x - 1, y, black_t, false, text);
|
||||
}*/
|
||||
}
|
||||
interfaces::surface->DrawSetTextPos(x, y);
|
||||
interfaces::surface->DrawSetTextColor(*reinterpret_cast<Color*>(&color));
|
||||
interfaces::surface->DrawSetTextFont(font);
|
||||
interfaces::surface->DrawUnicodeString(text);
|
||||
g_ISurface->DrawSetTextPos(x, y);
|
||||
g_ISurface->DrawSetTextColor(*reinterpret_cast<Color*>(&color));
|
||||
g_ISurface->DrawSetTextFont(font);
|
||||
g_ISurface->DrawUnicodeString(text);
|
||||
}
|
||||
|
||||
void draw::FString(unsigned long font, int x, int y, int color, int shadow, const char* text, ...) {
|
||||
|
@ -43,7 +43,7 @@ void CachedEntity::Update(int idx) {
|
||||
m_ESPOrigin.Zero();
|
||||
|
||||
m_IDX = idx;
|
||||
m_pEntity = interfaces::entityList->GetClientEntity(idx);
|
||||
m_pEntity = g_IEntityList->GetClientEntity(idx);
|
||||
if (!m_pEntity) {
|
||||
return;
|
||||
}
|
||||
@ -51,19 +51,19 @@ void CachedEntity::Update(int idx) {
|
||||
|
||||
Vector origin = m_pEntity->GetAbsOrigin();
|
||||
//if (TF2 && EstimateAbsVelocity) EstimateAbsVelocity(m_pEntity, m_vecVelocity);
|
||||
/*if ((interfaces::gvars->realtime - m_fLastUpdate) >= 0.05f) {
|
||||
//if (interfaces::gvars->tickcount - m_nLastTick > 1) {
|
||||
//logging::Info("Running %i ticks behind!", interfaces::gvars->tickcount - m_nLastTick);
|
||||
/*if ((gvars->realtime - m_fLastUpdate) >= 0.05f) {
|
||||
//if (gvars->tickcount - m_nLastTick > 1) {
|
||||
//logging::Info("Running %i ticks behind!", gvars->tickcount - m_nLastTick);
|
||||
//}
|
||||
//Vector velnew = (origin - m_vecVOrigin) * (0.05f / (m_fLastUpdate - interfaces::gvars->realtime)) * 20;
|
||||
//Vector velnew = (origin - m_vecVOrigin) * (0.05f / (m_fLastUpdate - gvars->realtime)) * 20;
|
||||
Vector velnew;
|
||||
if (EstimateAbsVelocity)
|
||||
EstimateAbsVelocity(m_pEntity, velnew);
|
||||
m_vecAcceleration = (velnew - m_vecVelocity);
|
||||
m_vecVelocity = (m_vecVelocity + velnew) / 2;
|
||||
//logging::Info("Multiplier for %i: %f", m_IDX, (0.1f / (m_fLastUpdate - interfaces::gvars->realtime)));
|
||||
//logging::Info("Multiplier for %i: %f", m_IDX, (0.1f / (m_fLastUpdate - gvars->realtime)));
|
||||
m_vecVOrigin = origin;
|
||||
m_fLastUpdate = interfaces::gvars->realtime;
|
||||
m_fLastUpdate = gvars->realtime;
|
||||
}*/
|
||||
m_vecOrigin = origin;
|
||||
|
||||
@ -138,7 +138,7 @@ void CachedEntity::Update(int idx) {
|
||||
m_pPlayerInfo = 0;
|
||||
}
|
||||
m_pPlayerInfo = new player_info_s;
|
||||
interfaces::engineClient->GetPlayerInfo(m_IDX, m_pPlayerInfo);
|
||||
g_IEngine->GetPlayerInfo(m_IDX, m_pPlayerInfo);
|
||||
m_iTeam = CE_INT(this, netvar.iTeamNum); // TODO
|
||||
m_bEnemy = (m_iTeam != g_pLocalPlayer->team);
|
||||
m_iHealth = CE_INT(this, netvar.iHealth);
|
||||
@ -226,7 +226,7 @@ ESPStringCompound& CachedEntity::GetESPString(int idx) {
|
||||
|
||||
matrix3x4_t* CachedEntity::GetBones() {
|
||||
if (!m_bBonesSetup) {
|
||||
m_bBonesSetup = m_pEntity->SetupBones(m_Bones, MAXSTUDIOBONES, 0x100, 0); // interfaces::gvars->curtime
|
||||
m_bBonesSetup = m_pEntity->SetupBones(m_Bones, MAXSTUDIOBONES, 0x100, 0); // gvars->curtime
|
||||
}
|
||||
return m_Bones;
|
||||
}
|
||||
@ -248,7 +248,7 @@ void EntityCache::PruneStrings() {
|
||||
}
|
||||
|
||||
void EntityCache::Update() {
|
||||
m_nMax = interfaces::entityList->GetHighestEntityIndex();
|
||||
m_nMax = g_IEntityList->GetHighestEntityIndex();
|
||||
for (int i = 0; i < m_nMax && i < MAX_ENTITIES; i++) {
|
||||
//logging::Info("Updating %i", i);
|
||||
m_pArray[i].Update(i);
|
||||
|
@ -52,7 +52,7 @@ void EntityHitboxCache::Init() {
|
||||
SAFE_CALL(model = (model_t*)RAW_ENT(m_pParentEntity)->GetModel());
|
||||
if (!model) return;
|
||||
if (!m_bModelSet || model != m_pLastModel) {
|
||||
studiohdr_t* shdr = interfaces::model->GetStudiomodel(model);
|
||||
studiohdr_t* shdr = g_IModelInfo->GetStudiomodel(model);
|
||||
if (!shdr) return;
|
||||
mstudiohitboxset_t* set = shdr->pHitboxSet(CE_INT(m_pParentEntity, netvar.iHitboxSet));
|
||||
if (!dynamic_cast<mstudiohitboxset_t*>(set)) return;
|
||||
|
@ -35,7 +35,7 @@ void CKeyInput::Draw(int x, int y) {
|
||||
key = "< CLICK >";
|
||||
}
|
||||
} else {
|
||||
key = interfaces::input->ButtonCodeToString(Value());
|
||||
key = g_IInputSystem->ButtonCodeToString(Value());
|
||||
}
|
||||
}
|
||||
auto size = GetSize();
|
||||
|
@ -14,13 +14,13 @@
|
||||
#include "../sdk.h"
|
||||
|
||||
void GUIVisibleCallback(IConVar* var, const char* pOldValue, float flOldValue) {
|
||||
interfaces::input->SetCursorPosition(draw::width / 2, draw::height / 2);
|
||||
interfaces::surface->SetCursor(vgui::CursorCode::dc_none);
|
||||
interfaces::matsurface->SetCursorAlwaysVisible(false);
|
||||
g_IInputSystem->SetCursorPosition(draw::width / 2, draw::height / 2);
|
||||
g_ISurface->SetCursor(vgui::CursorCode::dc_none);
|
||||
g_IMatSystemSurface->SetCursorAlwaysVisible(false);
|
||||
if (gui_visible) {
|
||||
interfaces::matsurface->UnlockCursor();
|
||||
g_IMatSystemSurface->UnlockCursor();
|
||||
} else {
|
||||
interfaces::matsurface->LockCursor();
|
||||
g_IMatSystemSurface->LockCursor();
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,9 +57,9 @@ void CatGUI::ShowTooltip(std::string text) {
|
||||
void CatGUI::Update() {
|
||||
m_bShowTooltip = false;
|
||||
for (int i = 0; i < ButtonCode_t::BUTTON_CODE_COUNT; i++) {
|
||||
bool down = interfaces::input->IsButtonDown((ButtonCode_t)(i));
|
||||
bool down = g_IInputSystem->IsButtonDown((ButtonCode_t)(i));
|
||||
bool changed = m_bPressedState[i] != down;
|
||||
if (changed && down) m_iPressedFrame[i] = interfaces::gvars->framecount;
|
||||
if (changed && down) m_iPressedFrame[i] = g_GlobalVars->framecount;
|
||||
m_bPressedState[i] = down;
|
||||
if (m_bKeysInit) {
|
||||
if (changed) {
|
||||
@ -76,7 +76,7 @@ void CatGUI::Update() {
|
||||
}
|
||||
} else {
|
||||
if (down) {
|
||||
int frame = interfaces::gvars->framecount - m_iPressedFrame[i];
|
||||
int frame = g_GlobalVars->framecount - m_iPressedFrame[i];
|
||||
bool shouldrepeat = false;
|
||||
if (frame) {
|
||||
if (frame > 150) {
|
||||
@ -94,8 +94,8 @@ void CatGUI::Update() {
|
||||
}
|
||||
|
||||
|
||||
m_iMouseX = interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_X);
|
||||
m_iMouseY = interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_Y);
|
||||
m_iMouseX = g_IInputSystem->GetAnalogValue(AnalogCode_t::MOUSE_X);
|
||||
m_iMouseY = g_IInputSystem->GetAnalogValue(AnalogCode_t::MOUSE_Y);
|
||||
|
||||
if (!m_bKeysInit) m_bKeysInit = 1;
|
||||
if (gui_visible) {
|
||||
|
@ -75,7 +75,7 @@ void RootWindow::Setup() {
|
||||
sl->Setup(10.0f, 150.0f);
|
||||
sl->SetValue(13.37f);
|
||||
sl->SetCallback([](CSlider* slider, float oldv, float newv) {
|
||||
interfaces::cvar->FindVar(slider->Props()->GetString("cvar"))->SetValue(newv);
|
||||
cvar->FindVar(slider->Props()->GetString("cvar"))->SetValue(newv);
|
||||
});*/
|
||||
/*sc1->AddChild(ccb1);
|
||||
//sc1->AddChild(new CTextLabel(sc1, "tl3", "wow"));
|
||||
|
28
src/hack.cpp
28
src/hack.cpp
@ -77,17 +77,17 @@ void hack::InitHacks() {
|
||||
ConCommand* hack::c_Cat = 0;
|
||||
|
||||
void hack::CC_Cat(const CCommand& args) {
|
||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "cathook");
|
||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), " by ");
|
||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "d4rkc4t\n");
|
||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), "build: " CATHOOK_BUILD_NUMBER " \"" CATHOOK_BUILD_NAME "\"\n");
|
||||
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "cathook");
|
||||
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), " by ");
|
||||
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::blu), "d4rkc4t\n");
|
||||
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::white), "build: " CATHOOK_BUILD_NUMBER " \"" CATHOOK_BUILD_NAME "\"\n");
|
||||
#if _DEVELOPER
|
||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "[DEVELOPER BUILD]\n");
|
||||
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "[DEVELOPER BUILD]\n");
|
||||
#else
|
||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build for user " __DRM_NAME " (Early Access)\n");
|
||||
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build for user " __DRM_NAME " (Early Access)\n");
|
||||
#endif
|
||||
#ifdef __DRM_NOTES
|
||||
interfaces::cvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build notes: " __DRM_NOTES "\n");
|
||||
g_ICvar->ConsoleColorPrintf(*reinterpret_cast<Color*>(&colors::red), "Build notes: " __DRM_NOTES "\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -101,10 +101,10 @@ void hack::Initialize() {
|
||||
prctl(PR_SET_DUMPABLE,0,42,42,42);
|
||||
sharedobj::LoadAllSharedObjects();
|
||||
g_pszTFPath = tf_path_from_maps();
|
||||
interfaces::CreateInterfaces();
|
||||
CreateInterfaces();
|
||||
CDumper dumper;
|
||||
dumper.SaveDump();
|
||||
ClientClass* cc = interfaces::baseClient->GetAllClasses();
|
||||
ClientClass* cc = g_IBaseClient->GetAllClasses();
|
||||
FILE* cd = fopen("/tmp/cathook-classdump.txt", "w");
|
||||
while (cc) {
|
||||
fprintf(cd, "[%d] %s\n", cc->m_ClassID, cc->GetName());
|
||||
@ -143,17 +143,17 @@ void hack::Initialize() {
|
||||
g_pLocalPlayer = new LocalPlayer();
|
||||
g_pPlayerResource = new TFPlayerResource();
|
||||
hooks::hkPanel = new hooks::VMTHook();
|
||||
hooks::hkPanel->Init(interfaces::panel, 0);
|
||||
hooks::hkPanel->Init(g_IPanel, 0);
|
||||
//hooks::hkPanel->HookMethod((void*)&hack::Hk_PaintTraverse, hooks::offPaintTraverse);
|
||||
hooks::hkPanel->HookMethod((void*)PaintTraverse_hook, hooks::offPaintTraverse);
|
||||
hooks::hkPanel->Apply();
|
||||
hooks::hkClientMode = new hooks::VMTHook();
|
||||
uintptr_t* clientMode = 0;
|
||||
while(!(clientMode = **(uintptr_t***)((uintptr_t)((*(void***)interfaces::baseClient)[10]) + 1))) {
|
||||
while(!(clientMode = **(uintptr_t***)((uintptr_t)((*(void***)g_IBaseClient)[10]) + 1))) {
|
||||
sleep(1);
|
||||
}
|
||||
//hooks::hkMatSurface = new hooks::VMTHook();
|
||||
//hooks::hkMatSurface->Init((void*)interfaces::matsurface, 0);
|
||||
//hooks::hkMatSurface->Init((void*)matsurface, 0);
|
||||
//hooks::hkMatSurface->HookMethod((void*)test_handleevent, 1);
|
||||
hooks::hkClientMode->Init((void*)clientMode, 0);
|
||||
//hooks::hkClientMode->HookMethod((void*)&hack::Hk_CreateMove, hooks::offCreateMove);
|
||||
@ -163,11 +163,11 @@ void hack::Initialize() {
|
||||
hooks::hkClientMode->HookMethod((void*)LevelShutdown_hook, hooks::offLevelShutdown);
|
||||
hooks::hkClientMode->Apply();
|
||||
hooks::hkStudioRender = new hooks::VMTHook();
|
||||
hooks::hkStudioRender->Init((void*)interfaces::render, 0);
|
||||
hooks::hkStudioRender->Init((void*)g_IStudioRender, 0);
|
||||
hooks::hkStudioRender->HookMethod((void*)BeginFrame_hook, hooks::offBeginFrame);
|
||||
hooks::hkStudioRender->Apply();
|
||||
hooks::hkClient = new hooks::VMTHook();
|
||||
hooks::hkClient->Init((void*)interfaces::baseClient, 0);
|
||||
hooks::hkClient->Init((void*)g_IBaseClient, 0);
|
||||
hooks::hkClient->HookMethod((void*)FrameStageNotify_hook, hooks::offFrameStageNotify);
|
||||
hooks::hkClient->HookMethod((void*)DispatchUserMessage_hook, hooks::offFrameStageNotify + 1);
|
||||
hooks::hkClient->HookMethod((void*)IN_KeyEvent_hook, hooks::offKeyEvent);
|
||||
|
@ -18,12 +18,12 @@ void Lock() {
|
||||
ConColorMsg({ 255, 0, 0, 255}, "Switch " CON_PREFIX "achievement_safety to 0 before using any achievement commands!\n");
|
||||
return;
|
||||
}
|
||||
interfaces::stats->RequestCurrentStats();
|
||||
for (int i = 0; i < interfaces::achievements->GetAchievementCount(); i++) {
|
||||
interfaces::stats->ClearAchievement(interfaces::achievements->GetAchievementByIndex(i)->GetName());
|
||||
g_ISteamUserStats->RequestCurrentStats();
|
||||
for (int i = 0; i < g_IAchievementMgr->GetAchievementCount(); i++) {
|
||||
g_ISteamUserStats->ClearAchievement(g_IAchievementMgr->GetAchievementByIndex(i)->GetName());
|
||||
}
|
||||
interfaces::stats->StoreStats();
|
||||
interfaces::stats->RequestCurrentStats();
|
||||
g_ISteamUserStats->StoreStats();
|
||||
g_ISteamUserStats->RequestCurrentStats();
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
@ -31,8 +31,8 @@ void Unlock() {
|
||||
ConColorMsg({ 255, 0, 0, 255}, "Switch " CON_PREFIX "achievement_safety to 0 before using any achievement commands!\n");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < interfaces::achievements->GetAchievementCount(); i++) {
|
||||
interfaces::achievements->AwardAchievement(interfaces::achievements->GetAchievementByIndex(i)->GetAchievementID());
|
||||
for (int i = 0; i < g_IAchievementMgr->GetAchievementCount(); i++) {
|
||||
g_IAchievementMgr->AwardAchievement(g_IAchievementMgr->GetAchievementByIndex(i)->GetAchievementID());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ Aimbot::Aimbot() {
|
||||
|
||||
bool Aimbot::ShouldAim(CUserCmd* cmd) {
|
||||
if (this->v_kAimKey->GetBool() && this->v_eAimKeyMode->GetBool()) {
|
||||
bool key_down = interfaces::input->IsButtonDown((ButtonCode_t)this->v_kAimKey->GetInt());
|
||||
bool key_down = g_IInputSystem->IsButtonDown((ButtonCode_t)this->v_kAimKey->GetInt());
|
||||
switch (this->v_eAimKeyMode->GetInt()) {
|
||||
case AimKeyMode_t::PRESS_TO_ENABLE:
|
||||
if (key_down) break;
|
||||
@ -144,7 +144,7 @@ bool Aimbot::ShouldAim(CUserCmd* cmd) {
|
||||
}
|
||||
|
||||
if (IsAmbassador(g_pLocalPlayer->weapon())) { // TODO AmbassadorCanHeadshot()
|
||||
if ((interfaces::gvars->curtime - CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flLastFireTime)) <= 1.0) {
|
||||
if ((g_GlobalVars->curtime - CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flLastFireTime)) <= 1.0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -269,7 +269,7 @@ void Aimbot::ProcessUserCmd(CUserCmd* cmd) {
|
||||
float begincharge = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flChargeBeginTime);
|
||||
float charge = 0;
|
||||
if (begincharge != 0) {
|
||||
charge = interfaces::gvars->curtime - begincharge;
|
||||
charge = g_GlobalVars->curtime - begincharge;
|
||||
if (charge > 1.0f) charge = 1.0f;
|
||||
m_bSilentHuntsman = true;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace hacks { namespace shared { namespace airstuck {
|
||||
CatVar stuck(CV_SWITCH, "airstuck", "0", "Airstuck active");
|
||||
|
||||
void SendNOP() {
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
||||
NET_NOP packet;
|
||||
packet.SetNetChannel(ch);
|
||||
packet.SetReliable(false);
|
||||
@ -26,7 +26,7 @@ void SendNOP() {
|
||||
|
||||
void CreateMove() {
|
||||
if (stuck) {
|
||||
if (interfaces::gvars->tickcount % 60 == 0) {
|
||||
if (g_GlobalVars->tickcount % 60 == 0) {
|
||||
SendNOP();
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ bool AutoHeal::CanHeal(int idx) {
|
||||
CachedEntity* ent = ENTITY(idx);
|
||||
if (!ent) return false;
|
||||
if (ent->m_Type != ENTITY_PLAYER) return false;
|
||||
if (interfaces::engineClient->GetLocalPlayer() == idx) return false;
|
||||
if (g_IEngine->GetLocalPlayer() == idx) return false;
|
||||
if (!ent->m_bAlivePlayer) return false;
|
||||
if (ent->m_bEnemy) return false;
|
||||
if (ent->m_flDistance > 420) return false;
|
||||
@ -87,6 +87,6 @@ void AutoHeal::ProcessUserCmd(CUserCmd* cmd) {
|
||||
GetHitbox(target, 7, out);
|
||||
AimAt(g_pLocalPlayer->v_Eye, out, cmd);
|
||||
if (v_bSilent->GetBool()) g_pLocalPlayer->bUseSilentAngles = true;
|
||||
if (!m_iNewTarget && (interfaces::gvars->tickcount % 60)) cmd->buttons |= IN_ATTACK;
|
||||
if (!m_iNewTarget && (g_GlobalVars->tickcount % 60)) cmd->buttons |= IN_ATTACK;
|
||||
return;
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ void ESP::ProcessEntityPT(CachedEntity* ent) {
|
||||
if (!this->v_bEnabled->GetBool()) return;
|
||||
if (!this->v_bBox->GetBool()) return;
|
||||
if (CE_BAD(ent)) return;
|
||||
if (!(this->v_bSeeLocal->GetBool() && interfaces::iinput->CAM_IsThirdPerson()) &&
|
||||
ent->m_IDX == interfaces::engineClient->GetLocalPlayer()) return;
|
||||
if (!(this->v_bSeeLocal->GetBool() && g_IInput->CAM_IsThirdPerson()) &&
|
||||
ent->m_IDX == g_IEngine->GetLocalPlayer()) return;
|
||||
int fg = ent->m_ESPColorFG;
|
||||
switch (ent->m_Type) {
|
||||
case ENTITY_PLAYER: {
|
||||
@ -168,7 +168,7 @@ void ESP::ProcessEntity(CachedEntity* ent) {
|
||||
//ent->AddESPString("Type: %i", ent->m_Type);
|
||||
if (v_bModelName->GetBool()) {
|
||||
const model_t* model = RAW_ENT(ent)->GetModel();
|
||||
if (model) ent->AddESPString("%s", interfaces::model->GetModelName(model));
|
||||
if (model) ent->AddESPString("%s", g_IModelInfo->GetModelName(model));
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,11 +298,11 @@ void ESP::ProcessEntity(CachedEntity* ent) {
|
||||
}
|
||||
return;
|
||||
} else if (ent->m_Type == ENTITY_PLAYER && ent->m_bAlivePlayer) {
|
||||
if (!(this->v_bSeeLocal->GetBool() && interfaces::iinput->CAM_IsThirdPerson()) &&
|
||||
ent->m_IDX == interfaces::engineClient->GetLocalPlayer()) return;
|
||||
if (!(this->v_bSeeLocal->GetBool() && g_IInput->CAM_IsThirdPerson()) &&
|
||||
ent->m_IDX == g_IEngine->GetLocalPlayer()) return;
|
||||
int pclass = CE_INT(ent, netvar.iClass);
|
||||
player_info_t info;
|
||||
if (!interfaces::engineClient->GetPlayerInfo(ent->m_IDX, &info)) return;
|
||||
if (!g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) return;
|
||||
powerup_type power = GetPowerupOnPlayer(ent);
|
||||
// If target is enemy, always show powerups, if player is teammate, show powerups
|
||||
// only if bTeammatePowerup or bTeammates is true
|
||||
|
@ -47,10 +47,10 @@ public:
|
||||
void FireGameEvent(IGameEvent* pEvent) {
|
||||
if (!g_phFollowBot->v_bEnabled->GetBool()) return;
|
||||
if (strcmp("player_calledformedic", pEvent->GetName())) return;
|
||||
int id = interfaces::engineClient->GetPlayerForUserID(pEvent->GetInt("userid", -1));
|
||||
int id = engineClient->GetPlayerForUserID(pEvent->GetInt("userid", -1));
|
||||
logging::Info("%i called for medic");
|
||||
player_info_s info;
|
||||
interfaces::engineClient->GetPlayerInfo(id, &info);
|
||||
engineClient->GetPlayerInfo(id, &info);
|
||||
if (info.friendsID == g_phFollowBot->m_nOwnerID) {
|
||||
g_phFollowBot->m_iShouldUbercharge = 1;
|
||||
}
|
||||
@ -126,12 +126,12 @@ void FollowBot::Tick(CUserCmd* cmd) {
|
||||
case botpackage::BOT_MEDIC: {
|
||||
cmd->buttons |= IN_ATTACK;
|
||||
if ((g_nTick % 100) == 0) {
|
||||
interfaces::engineClient->ExecuteClientCmd("slot2");
|
||||
engineClient->ExecuteClientCmd("slot2");
|
||||
cmd->buttons &= ~IN_ATTACK;
|
||||
}
|
||||
if (this->m_iShouldUbercharge && this->m_iShouldUbercharge < 30) {
|
||||
cmd->buttons |= IN_ATTACK2;
|
||||
interfaces::engineClient->ExecuteClientCmd("voicemenu 2 1");
|
||||
engineClient->ExecuteClientCmd("voicemenu 2 1");
|
||||
this->m_iShouldUbercharge++;
|
||||
} else {
|
||||
this->m_iShouldUbercharge = 0;
|
||||
@ -177,18 +177,18 @@ void FollowBot::Tick(CUserCmd* cmd) {
|
||||
static bool forward = false;
|
||||
static bool jump = false;
|
||||
if (!jump && CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(10.0f) && !g_pLocalPlayer->bZoomed) {
|
||||
interfaces::engineClient->ExecuteClientCmd("+jump");
|
||||
engineClient->ExecuteClientCmd("+jump");
|
||||
jump = true;
|
||||
} else if (jump) {
|
||||
interfaces::engineClient->ExecuteClientCmd("-jump");
|
||||
engineClient->ExecuteClientCmd("-jump");
|
||||
jump = false;
|
||||
}
|
||||
|
||||
if (forward && DistToSqr(owner_entity) < (60 * 60)) {
|
||||
interfaces::engineClient->ExecuteClientCmd("-forward");
|
||||
engineClient->ExecuteClientCmd("-forward");
|
||||
forward = false;
|
||||
} else if (!forward) {
|
||||
interfaces::engineClient->ExecuteClientCmd("+forward");
|
||||
engineClient->ExecuteClientCmd("+forward");
|
||||
forward = true;
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,7 @@ void FollowBot::ActuallyCreateMove(CUserCmd* cmd) {
|
||||
g_pLocalPlayer->bUseSilentAngles = true;
|
||||
}
|
||||
}
|
||||
interfaces::engineClient->SetViewAngles(angles);
|
||||
engineClient->SetViewAngles(angles);
|
||||
}
|
||||
|
||||
// TODO optimize, cache or something
|
||||
@ -380,7 +380,7 @@ FollowBot::FollowBot() {
|
||||
|
||||
cmd_Status = CreateConCommand(CON_PREFIX "bot_status", CC_BotStatus, "Status");
|
||||
g_pListener = new MedicCallListener();
|
||||
interfaces::eventManager->AddListener(g_pListener, "player_calledformedic", false);
|
||||
eventManager->AddListener(g_pListener, "player_calledformedic", false);
|
||||
|
||||
logging::Info("Creating shared memory for bot");
|
||||
m_pIPC = new ipcctl();
|
||||
@ -393,7 +393,7 @@ FollowBot::FollowBot() {
|
||||
}
|
||||
|
||||
FollowBot::~FollowBot() {
|
||||
interfaces::eventManager->RemoveListener(g_pListener);
|
||||
eventManager->RemoveListener(g_pListener);
|
||||
m_pIPC->Detach();
|
||||
}
|
||||
|
||||
|
@ -47,16 +47,16 @@ const char* KillSay::ComposeKillSay(IGameEvent* event) {
|
||||
int vid = event->GetInt("userid");
|
||||
int kid = event->GetInt("attacker");
|
||||
if (kid == vid) return 0;
|
||||
if (interfaces::engineClient->GetPlayerForUserID(kid) != interfaces::engineClient->GetLocalPlayer()) return 0;
|
||||
if (g_IEngine->GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) return 0;
|
||||
char* msg = strfmt("%s", m_TextFile->GetLine(rand() % m_TextFile->GetLineCount()));
|
||||
player_info_s info;
|
||||
interfaces::engineClient->GetPlayerInfo(interfaces::engineClient->GetPlayerForUserID(vid), &info);
|
||||
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(vid), &info);
|
||||
ReplaceString(msg, "%name%", info.name);
|
||||
CachedEntity* ent = ENTITY(interfaces::engineClient->GetPlayerForUserID(vid));
|
||||
CachedEntity* ent = ENTITY(g_IEngine->GetPlayerForUserID(vid));
|
||||
int clz = g_pPlayerResource->GetClass(ent);
|
||||
ReplaceString(msg, "%class%", (char*)tf_classes_killsay[clz]);
|
||||
player_info_s infok;
|
||||
interfaces::engineClient->GetPlayerInfo(interfaces::engineClient->GetPlayerForUserID(kid), &infok);
|
||||
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(kid), &infok);
|
||||
ReplaceString(msg, "%killer%", (char*)infok.name);
|
||||
ReplaceString(msg, "%team%", (char*)tf_teams_killsay[ent->m_iTeam - 2]);
|
||||
ReplaceString(msg, "%myteam%", (char*)tf_teams_killsay[LOCAL_E->m_iTeam - 2]);
|
||||
@ -70,11 +70,11 @@ KillSay::KillSay() {
|
||||
v_sFileName = new CatVar(CV_STRING, "killsay_file", "killsays.txt", "Killsay file (~/.cathook/)", NULL, "Killsay file name. Should be located in ~/.cathook folder.");
|
||||
CreateConCommand("cat_killsay_reload", CC_KillSay_ReloadFile, "Reload KillSay");
|
||||
m_TextFile = new TextFile(256, 1024);
|
||||
interfaces::eventManager->AddListener(&m_Listener, "player_death", false);
|
||||
g_IEventManager2->AddListener(&m_Listener, "player_death", false);
|
||||
}
|
||||
|
||||
KillSay::~KillSay() {
|
||||
interfaces::eventManager->RemoveListener(&m_Listener);
|
||||
g_IEventManager2->RemoveListener(&m_Listener);
|
||||
}
|
||||
|
||||
void KillSay::Reload() {
|
||||
|
@ -33,7 +33,7 @@ void CC_SayLines(const CCommand& args) {
|
||||
for (int i = 0; i < strlen(cmd); i++) {
|
||||
if (cmd[i] == '^') cmd[i] = '\n';
|
||||
}
|
||||
interfaces::engineClient->ServerCmd(cmd);
|
||||
g_IEngine->ServerCmd(cmd);
|
||||
}
|
||||
|
||||
void CC_Shutdown(const CCommand& args) {
|
||||
@ -108,13 +108,13 @@ void CC_ResetLists(const CCommand& args) {
|
||||
void CC_DumpPlayers(const CCommand& args) {
|
||||
for (int i = 0; i < 33 && i < HIGHEST_ENTITY; i++) {
|
||||
player_info_s* pi = new player_info_s;
|
||||
interfaces::engineClient->GetPlayerInfo(i, pi);
|
||||
g_IEngine->GetPlayerInfo(i, pi);
|
||||
logging::Info("[%i] FriendID: %lu ; Name: %s", i, pi->friendsID, pi->name);
|
||||
}
|
||||
}
|
||||
|
||||
void LockConCommand(const char* name, bool lock) {
|
||||
ConCommandBase* cmd = interfaces::cvar->FindCommandBase(name);
|
||||
ConCommandBase* cmd = g_ICvar->FindCommandBase(name);
|
||||
if (lock) {
|
||||
// TODO LockConCommand FIX!
|
||||
cmd->m_nFlags |= FCVAR_CHEAT;
|
||||
@ -151,7 +151,7 @@ void CC_SaveConVars(const CCommand& args) {
|
||||
|
||||
void CC_Unrestricted(const CCommand& args) {
|
||||
logging::Info("executing '%s'", args.ArgS());
|
||||
interfaces::engineClient->ClientCmd_Unrestricted(args.ArgS());
|
||||
g_IEngine->ClientCmd_Unrestricted(args.ArgS());
|
||||
}
|
||||
|
||||
void LockConCommands(bool lock) {
|
||||
@ -179,7 +179,7 @@ void CC_SetName(const CCommand& args) {
|
||||
}
|
||||
NET_SetConVar setname("name", (const char*)name);
|
||||
//logging::Info("Created!");
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
||||
if (ch) {
|
||||
setname.SetNetChannel(ch);
|
||||
setname.SetReliable(false);
|
||||
@ -193,7 +193,7 @@ void CC_Lockee(const CCommand& args) {
|
||||
if (args.ArgC() > 1) {
|
||||
LockConCommands(atoi(args.Arg(1)));
|
||||
}
|
||||
ConVar* name = interfaces::cvar->FindVar("name");
|
||||
ConVar* name = g_ICvar->FindVar("name");
|
||||
/*name->m_fnChangeCallback = 0;
|
||||
logging::Info("callback: 0x%08x", name->m_fnChangeCallback);
|
||||
name->SetValue(g_phMisc->v_strName->GetString());
|
||||
@ -206,7 +206,7 @@ void CC_Lockee(const CCommand& args) {
|
||||
void CC_Teamname(const CCommand& args) {
|
||||
if (!teamname) {
|
||||
logging::Info("searching");
|
||||
teamname = interfaces::cvar->FindCommandBase("tournament_teamname");
|
||||
teamname = g_ICvar->FindCommandBase("tournament_teamname");
|
||||
}
|
||||
logging::Info("Teamname 0x%08x", teamname);
|
||||
if (!teamname) return;
|
||||
@ -224,15 +224,15 @@ void CC_Teamname(const CCommand& args) {
|
||||
void CC_SayInfo(const CCommand& args) {
|
||||
int id = atoi(args.Arg(1));
|
||||
player_info_t info;
|
||||
if (!interfaces::engineClient->GetPlayerInfo(id, &info)) return;
|
||||
if (!g_IEngine->GetPlayerInfo(id, &info)) return;
|
||||
//char* buf = new char[256];
|
||||
|
||||
}
|
||||
|
||||
void CC_Disconnect(const CCommand& args) {
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
//logging::Info("userid %i rate %i", interfaces::client->GetUserID(), interfaces::client->GetRate());
|
||||
//INetChannel* ch = interfaces::client->GetNetChannel();
|
||||
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
||||
//logging::Info("userid %i rate %i", client->GetUserID(), client->GetRate());
|
||||
//INetChannel* ch = client->GetNetChannel();
|
||||
if (!ch) {
|
||||
logging::Info("No net channel!");
|
||||
return;
|
||||
@ -242,7 +242,7 @@ void CC_Disconnect(const CCommand& args) {
|
||||
}
|
||||
|
||||
void CC_Misc_Disconnect_VAC(const CCommand& args) {
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
||||
if (!ch) {
|
||||
logging::Info("No net channel!");
|
||||
return;
|
||||
@ -262,7 +262,7 @@ void CC_DumpAttribs(const CCommand& args) {
|
||||
|
||||
void CC_SetValue(const CCommand& args) {
|
||||
if (args.ArgC() < 2) return;
|
||||
ConVar* var = interfaces::cvar->FindVar(args.Arg(1));
|
||||
ConVar* var = g_ICvar->FindVar(args.Arg(1));
|
||||
if (!var) return;
|
||||
char* value = new char[256];
|
||||
snprintf(value, 256, "%s", args.Arg(2));
|
||||
@ -356,7 +356,7 @@ Misc::Misc() {
|
||||
if (TF) v_bDebugCrits = new CatVar(CV_SWITCH, "debug_crits", "0", "???", NULL, "???");
|
||||
if (TF) v_bSuppressCrits = new CatVar(CV_SWITCH, "suppress_crits", "1", "Suppress non-forced crits", NULL, "Helps to save the crit bucket");
|
||||
//if (TF2) v_bHookInspect = new CatVar(CV_SWITCH, "hook_inspect", "0", "Hook CanInspect", NULL, "Once enabled, can't be turned off. cathook can't be unloaded after enabling it");
|
||||
//interfaces::eventManager->AddListener(&listener, "player_death", false);
|
||||
//eventManager->AddListener(&listener, "player_death", false);
|
||||
}
|
||||
|
||||
int sa_switch = 0;
|
||||
@ -443,11 +443,11 @@ void Misc::ProcessUserCmd(CUserCmd* cmd) {
|
||||
}
|
||||
/*if (v_bDebugCrits->GetBool()) {
|
||||
static float last = 0.0f;
|
||||
if (interfaces::gvars->curtime - last >= 1.0f) {
|
||||
if (gvars->curtime - last >= 1.0f) {
|
||||
RandomSeed(cmd->random_seed);
|
||||
float chance = 0.02f * RemapValClampedNC( CE_INT(LOCAL_E, netvar.iCritMult), 0, 255, 1.0, 6 );
|
||||
s_bCrits = (RandomInt(0, 10000) < chance * 10000);
|
||||
last = interfaces::gvars->curtime;
|
||||
last = gvars->curtime;
|
||||
RandomSeed(cmd->random_seed);
|
||||
}
|
||||
}*/
|
||||
@ -456,7 +456,7 @@ void Misc::ProcessUserCmd(CUserCmd* cmd) {
|
||||
//logging::Info("Name: %s", v_strName->GetString());
|
||||
NET_SetConVar setname("name", v_strName->GetString());
|
||||
//logging::Info("Created!");
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
INetChannel* ch = (INetChannel*)engineClient->GetNetChannelInfo();
|
||||
setname.SetNetChannel(ch);
|
||||
setname.SetReliable(false);
|
||||
//logging::Info("Sending!");
|
||||
@ -466,7 +466,7 @@ void Misc::ProcessUserCmd(CUserCmd* cmd) {
|
||||
//setname.WriteToBuffer(0);
|
||||
}*/
|
||||
if (v_bFastCrouch->GetBool()) {
|
||||
if (interfaces::gvars->tickcount % 4 == 0) {
|
||||
if (g_GlobalVars->tickcount % 4 == 0) {
|
||||
cmd->buttons &= ~IN_DUCK;
|
||||
}
|
||||
}
|
||||
@ -487,7 +487,7 @@ void Misc::ProcessUserCmd(CUserCmd* cmd) {
|
||||
//logging::Info("Making string for %i", curindex);
|
||||
const char* str = MakeInfoString(ent);
|
||||
if (str) {
|
||||
interfaces::engineClient->ServerCmd(strfmt("say %s", str));
|
||||
engineClient->ServerCmd(strfmt("say %s", str));
|
||||
lastsay = 1;
|
||||
}*/
|
||||
}
|
||||
@ -513,10 +513,10 @@ void Misc::Draw() {
|
||||
|
||||
|
||||
if (!v_bDebugInfo->GetBool())return;
|
||||
/*if (!interfaces::input->IsButtonDown(ButtonCode_t::KEY_F)) {
|
||||
interfaces::baseClient->IN_ActivateMouse();
|
||||
/*if (!input->IsButtonDown(ButtonCode_t::KEY_F)) {
|
||||
baseClient->IN_ActivateMouse();
|
||||
} else {
|
||||
interfaces::baseClient->IN_DeactivateMouse();
|
||||
baseClient->IN_DeactivateMouse();
|
||||
}*/
|
||||
|
||||
if (CE_GOOD(g_pLocalPlayer->weapon())) {
|
||||
@ -536,19 +536,19 @@ void Misc::Draw() {
|
||||
}
|
||||
AddSideString(colors::white, "Weapon: %s [%i]", RAW_ENT(g_pLocalPlayer->weapon())->GetClientClass()->GetName(), g_pLocalPlayer->weapon()->m_iClassID);
|
||||
//AddSideString(colors::white, "flNextPrimaryAttack: %f", CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack));
|
||||
//AddSideString(colors::white, "nTickBase: %f", (float)(CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) * interfaces::gvars->interval_per_tick);
|
||||
//AddSideString(colors::white, "nTickBase: %f", (float)(CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) * gvars->interval_per_tick);
|
||||
AddSideString(colors::white, "CanShoot: %i", CanShoot());
|
||||
//AddSideString(colors::white, "Damage: %f", CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flChargedDamage));
|
||||
if (TF2) AddSideString(colors::white, "DefIndex: %i", CE_INT(g_pLocalPlayer->weapon(), netvar.iItemDefinitionIndex));
|
||||
//AddSideString(colors::white, "GlobalVars: 0x%08x", interfaces::gvars);
|
||||
//AddSideString(colors::white, "realtime: %f", interfaces::gvars->realtime);
|
||||
//AddSideString(colors::white, "interval_per_tick: %f", interfaces::gvars->interval_per_tick);
|
||||
//if (TF2) AddSideString(colors::white, "ambassador_can_headshot: %i", (interfaces::gvars->curtime - CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flLastFireTime)) > 0.95);
|
||||
//AddSideString(colors::white, "GlobalVars: 0x%08x", gvars);
|
||||
//AddSideString(colors::white, "realtime: %f", gvars->realtime);
|
||||
//AddSideString(colors::white, "interval_per_tick: %f", gvars->interval_per_tick);
|
||||
//if (TF2) AddSideString(colors::white, "ambassador_can_headshot: %i", (gvars->curtime - CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flLastFireTime)) > 0.95);
|
||||
AddSideString(colors::white, "WeaponMode: %i", GetWeaponMode(g_pLocalPlayer->entity));
|
||||
AddSideString(colors::white, "ToGround: %f", DistanceToGround(g_pLocalPlayer->v_Origin));
|
||||
AddSideString(colors::white, "ServerTime: %f", CE_FLOAT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick);
|
||||
AddSideString(colors::white, "CurTime: %f", interfaces::gvars->curtime);
|
||||
AddSideString(colors::white, "FrameCount: %i", interfaces::gvars->framecount);
|
||||
AddSideString(colors::white, "ServerTime: %f", CE_FLOAT(g_pLocalPlayer->entity, netvar.nTickBase) * g_GlobalVars->interval_per_tick);
|
||||
AddSideString(colors::white, "CurTime: %f", g_GlobalVars->curtime);
|
||||
AddSideString(colors::white, "FrameCount: %i", g_GlobalVars->framecount);
|
||||
float speed, gravity;
|
||||
GetProjectileData(g_pLocalPlayer->weapon(), speed, gravity);
|
||||
AddSideString(colors::white, "ALT: %i", g_pLocalPlayer->bAttackLastTick);
|
||||
@ -561,7 +561,7 @@ void Misc::Draw() {
|
||||
//if (TF2C) AddSideString(colors::white, "Seed: %i", *(int*)(sharedobj::client->lmap->l_addr + 0x00D53F68ul));
|
||||
//AddSideString(colors::white, "IsZoomed: %i", g_pLocalPlayer->bZoomed);
|
||||
//AddSideString(colors::white, "CanHeadshot: %i", CanHeadshot());
|
||||
//AddSideString(colors::white, "IsThirdPerson: %i", interfaces::iinput->CAM_IsThirdPerson());
|
||||
//AddSideString(colors::white, "IsThirdPerson: %i", iinput->CAM_IsThirdPerson());
|
||||
//if (TF2C) AddSideString(colors::white, "Crits: %i", s_bCrits);
|
||||
//if (TF2C) AddSideString(colors::white, "CritMult: %i", RemapValClampedNC( CE_INT(LOCAL_E, netvar.iCritMult), 0, 255, 1.0, 6 ));
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
@ -576,6 +576,6 @@ void Misc::Draw() {
|
||||
//AddSideString(draw::white, draw::black, "VecPunchAngle: %f %f %f", pa.x, pa.y, pa.z);
|
||||
//draw::DrawString(10, y, draw::white, draw::black, false, "VecPunchAngleVel: %f %f %f", pav.x, pav.y, pav.z);
|
||||
//y += 14;
|
||||
//AddCenterString(draw::font_handle, interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_X), interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_Y), draw::white, L"S\u0FD5");
|
||||
//AddCenterString(draw::font_handle, input->GetAnalogValue(AnalogCode_t::MOUSE_X), input->GetAnalogValue(AnalogCode_t::MOUSE_Y), draw::white, L"S\u0FD5");
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ void Noisemaker::ProcessUserCmd(CUserCmd*) {
|
||||
//logging::Info("%s", kv->GetName());
|
||||
//static KeyValues* kv = new KeyValues("use_action_slot_item_server");
|
||||
logging::Info("Sending!");
|
||||
//interfaces::engineClient->ServerCmdKeyValues(kv);
|
||||
//engineClient->ServerCmdKeyValues(kv);
|
||||
typedef void(Send)(unsigned, KeyValues*);
|
||||
logging::Info("Calling 0x%08x 0x%08x", engine, kv);
|
||||
(*reinterpret_cast<Send*>(engine + 512u))(engine, kv);
|
||||
|
@ -24,8 +24,8 @@ Spam::Spam() {
|
||||
|
||||
void Spam::ProcessUserCmd(CUserCmd*) {
|
||||
if (!v_bSpam->GetBool()) return;
|
||||
if (interfaces::gvars->curtime - m_fLastSpam < 0.8f) return;
|
||||
if (interfaces::gvars->curtime < m_fLastSpam) m_fLastSpam = 0.0f;
|
||||
if (g_GlobalVars->curtime - m_fLastSpam < 0.8f) return;
|
||||
if (g_GlobalVars->curtime < m_fLastSpam) m_fLastSpam = 0.0f;
|
||||
if (m_TextFile->GetLineCount() == 0) return;
|
||||
if (m_iCurrentIndex >= m_TextFile->GetLineCount() || m_iCurrentIndex < 0) m_iCurrentIndex = 0;
|
||||
char* spam = 0;
|
||||
@ -38,7 +38,7 @@ void Spam::ProcessUserCmd(CUserCmd*) {
|
||||
g_pChatStack->Push(spam);
|
||||
delete [] spam;
|
||||
m_iCurrentIndex++;
|
||||
m_fLastSpam = interfaces::gvars->curtime;
|
||||
m_fLastSpam = g_GlobalVars->curtime;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -39,13 +39,13 @@ Triggerbot::Triggerbot() {
|
||||
void Triggerbot::ProcessUserCmd(CUserCmd* cmd) {
|
||||
if (!this->v_bEnabled->GetBool()) return;
|
||||
if (g_pLocalPlayer->life_state) return;
|
||||
/*IClientEntity* local = ENTITY(interfaces::engineClient->GetLocalPlayer());
|
||||
/*IClientEntity* local = ENTITY(engineClient->GetLocalPlayer());
|
||||
if (!local) return;
|
||||
if (NET_BYTE(local, entityvars.iLifeState)) return;*/
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) != weapon_hitscan) return;
|
||||
if (v_bAmbassadorCharge->GetBool()) {
|
||||
if (IsAmbassador(g_pLocalPlayer->weapon())) {
|
||||
if ((interfaces::gvars->curtime - CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flLastFireTime)) <= 1.0) {
|
||||
if ((g_GlobalVars->curtime - CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flLastFireTime)) <= 1.0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -66,7 +66,7 @@ void Triggerbot::ProcessUserCmd(CUserCmd* cmd) {
|
||||
forward.z = -sp;
|
||||
forward = forward * 8192.0f + eye;
|
||||
ray.Init(eye, forward);
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, filter, enemy_trace);
|
||||
g_ITrace->TraceRay(ray, 0x4200400B, filter, enemy_trace);
|
||||
|
||||
IClientEntity* raw_entity = (IClientEntity*)(enemy_trace->m_pEnt);
|
||||
if (!raw_entity) return;
|
||||
@ -119,7 +119,7 @@ void Triggerbot::ProcessUserCmd(CUserCmd* cmd) {
|
||||
!((g_pLocalPlayer->bZoomed) && CanHeadshot())) {
|
||||
return;
|
||||
}
|
||||
//interfaces::debug->AddBoxOverlay(enemy_trace->endpos, Vector(-1.0f, -1.0f, -1.0f), Vector(1.0f, 1.0f, 1.0f), QAngle(0, 0, 0), 255, 0, 0, 255, 2.0f);
|
||||
//debug->AddBoxOverlay(enemy_trace->endpos, Vector(-1.0f, -1.0f, -1.0f), Vector(1.0f, 1.0f, 1.0f), QAngle(0, 0, 0), 255, 0, 0, 255, 2.0f);
|
||||
//IClientEntity* weapon;
|
||||
CachedHitbox* hb = entity->m_pHitboxCache->GetHitbox(enemy_trace->hitbox);
|
||||
//logging::Info("hitbox: %i 0x%08x", enemy_trace->hitbox, hb);
|
||||
@ -129,15 +129,15 @@ void Triggerbot::ProcessUserCmd(CUserCmd* cmd) {
|
||||
Vector siz = hb->max - hb->min;
|
||||
Vector mns = hb->min + siz * 0.2f;
|
||||
Vector mxs = hb->max - siz * 0.2f;
|
||||
interfaces::debug->AddLineOverlay(enemy_trace->startpos, forward, 0, 0, 255, true, -1.0f);
|
||||
g_IVDebugOverlay->AddLineOverlay(enemy_trace->startpos, forward, 0, 0, 255, true, -1.0f);
|
||||
if (LineIntersectsBox(mns, mxs, enemy_trace->startpos, forward)) {
|
||||
interfaces::debug->AddBoxOverlay(mns, Vector(0, 0, 0), mxs - mns, QAngle(0, 0, 0), 0, 255, 0, 255, 1.0f);
|
||||
interfaces::debug->AddLineOverlay(enemy_trace->startpos, forward, 255, 0, 0, true, 1.0f);
|
||||
g_IVDebugOverlay->AddBoxOverlay(mns, Vector(0, 0, 0), mxs - mns, QAngle(0, 0, 0), 0, 255, 0, 255, 1.0f);
|
||||
g_IVDebugOverlay->AddLineOverlay(enemy_trace->startpos, forward, 255, 0, 0, true, 1.0f);
|
||||
//logging::Info("%.2f %.2f %.2f", hb->center.DistToSqr(enemy_trace->endpos), SQR(hb->min.DistToSqr(hb->min)), SQR(hb->min.DistToSqr(hb->min) * 0.9f));
|
||||
|
||||
} else {
|
||||
interfaces::debug->AddBoxOverlay(hb->min, Vector(0, 0, 0), hb->max - hb->min, QAngle(0, 0, 0), 0, 255, 255, 255, -1.0f);
|
||||
interfaces::debug->AddBoxOverlay(mns, Vector(0, 0, 0), mxs - mns, QAngle(0, 0, 0), 255, 255, 0, 255, 0.5f);
|
||||
g_IVDebugOverlay->AddBoxOverlay(hb->min, Vector(0, 0, 0), hb->max - hb->min, QAngle(0, 0, 0), 0, 255, 255, 255, -1.0f);
|
||||
g_IVDebugOverlay->AddBoxOverlay(mns, Vector(0, 0, 0), mxs - mns, QAngle(0, 0, 0), 255, 255, 0, 255, 0.5f);
|
||||
return;
|
||||
}
|
||||
} else return;
|
||||
|
@ -30,7 +30,7 @@ void BeginConVars() {
|
||||
fclose(hMatchexec);
|
||||
} else fclose(hMatchexec);
|
||||
fprintf(hConVarsFile, "// THIS FILE IS AUTO-GENERATED BY CATHOOK\n// DO NOT EDIT IT, ALL CHANGES WILL BE UNDONE!\n// If you want to change default settings, add changed convars to cat_autoexec.cfg\n");
|
||||
SetCVarInterface(interfaces::cvar);
|
||||
SetCVarInterface(g_ICvar);
|
||||
}
|
||||
|
||||
void EndConVars() {
|
||||
@ -91,14 +91,14 @@ ConVar* CreateConVar(std::string name, std::string value, std::string help) {
|
||||
ConVar* ret = new ConVar((const char*)namec, (const char*)valuec, 0, (const char*)helpc);
|
||||
if (hConVarsFile)
|
||||
fprintf(hConVarsFile, "%s \"%s\"\n", name.c_str(), value.c_str());
|
||||
interfaces::cvar->RegisterConCommand(ret);
|
||||
g_ICvar->RegisterConCommand(ret);
|
||||
g_ConVars.push_back(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ConCommand* CreateConCommand(const char* name, FnCommandCallback_t callback, const char* help) {
|
||||
ConCommand* ret = new ConCommand(name, callback, help);
|
||||
interfaces::cvar->RegisterConCommand(ret);
|
||||
g_ICvar->RegisterConCommand(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -250,8 +250,8 @@ char GetUpperChar(ButtonCode_t button) {
|
||||
case KEY_EQUAL:
|
||||
return '+';
|
||||
default:
|
||||
if (strlen(interfaces::input->ButtonCodeToString(button)) != 1) return 0;
|
||||
return toupper(*interfaces::input->ButtonCodeToString(button));
|
||||
if (strlen(g_IInputSystem->ButtonCodeToString(button)) != 1) return 0;
|
||||
return toupper(*g_IInputSystem->ButtonCodeToString(button));
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,8 +271,8 @@ char GetChar(ButtonCode_t button) {
|
||||
if (button >= KEY_PAD_0 && button <= KEY_PAD_9) {
|
||||
return button - KEY_PAD_0 + '0';
|
||||
}
|
||||
if (strlen(interfaces::input->ButtonCodeToString(button)) != 1) return 0;
|
||||
return *interfaces::input->ButtonCodeToString(button);
|
||||
if (strlen(g_IInputSystem->ButtonCodeToString(button)) != 1) return 0;
|
||||
return *g_IInputSystem->ButtonCodeToString(button);
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ bool IsEntityVectorVisible(CachedEntity* entity, Vector endpos) {
|
||||
ray.Init(g_pLocalPlayer->v_Eye, endpos);
|
||||
{
|
||||
PROF_SECTION(IEVV_TraceRay);
|
||||
interfaces::trace->TraceRay(ray, MASK_SHOT, trace::g_pFilterDefault, &trace_object);
|
||||
g_ITrace->TraceRay(ray, MASK_SHOT, trace::g_pFilterDefault, &trace_object);
|
||||
}
|
||||
return (trace_object.fraction >= 0.99f || (((IClientEntity*)trace_object.m_pEnt)) == RAW_ENT(entity));
|
||||
}
|
||||
@ -536,7 +536,7 @@ bool Developer(CachedEntity* ent) {
|
||||
/*const char* MakeInfoString(IClientEntity* player) {
|
||||
char* buf = new char[256]();
|
||||
player_info_t info;
|
||||
if (!interfaces::engineClient->GetPlayerInfo(player->entindex(), &info)) return (const char*)0;
|
||||
if (!engineClient->GetPlayerInfo(player->entindex(), &info)) return (const char*)0;
|
||||
logging::Info("a");
|
||||
int hWeapon = NET_INT(player, netvar.hActiveWeapon);
|
||||
if (NET_BYTE(player, netvar.iLifeState)) {
|
||||
@ -563,7 +563,7 @@ bool IsVectorVisible(Vector origin, Vector target) {
|
||||
Ray_t ray;
|
||||
vec_filter->SetSelf(RAW_ENT(g_pLocalPlayer->entity));
|
||||
ray.Init(origin, target);
|
||||
interfaces::trace->TraceRay(ray, MASK_SHOT_HULL, vec_filter, &trace_visible);
|
||||
g_ITrace->TraceRay(ray, MASK_SHOT_HULL, vec_filter, &trace_visible);
|
||||
float dist2 = origin.DistToSqr(trace_visible.endpos);
|
||||
float dist1 = origin.DistToSqr(target);
|
||||
//logging::Info("Target: %.1f, %.1f, %.1f; ENDPOS: %.1f, %.1f, %.1f", target.x, target.y, target.z, trace_visible.endpos.x, trace_visible.endpos.y, trace_visible.endpos.z);
|
||||
@ -582,8 +582,8 @@ bool IsVectorVisible(Vector origin, Vector target) {
|
||||
int flags = NET_INT(target, eoffsets.iFlags);
|
||||
bool ground = (flags & (1 << 0));
|
||||
float distance = origin.DistTo(res1);
|
||||
float latency = interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
float latency = engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
if (speed == 0) return false;
|
||||
float time = distance / speed + latency;
|
||||
if (!ground) {
|
||||
@ -660,11 +660,11 @@ float GetFov(Vector angle, Vector src, Vector dst)
|
||||
}
|
||||
|
||||
bool CanHeadshot() {
|
||||
return (g_pLocalPlayer->flZoomBegin > 0.0f && (interfaces::gvars->curtime - g_pLocalPlayer->flZoomBegin > 0.2f));
|
||||
return (g_pLocalPlayer->flZoomBegin > 0.0f && (g_GlobalVars->curtime - g_pLocalPlayer->flZoomBegin > 0.2f));
|
||||
}
|
||||
|
||||
bool CanShoot() {
|
||||
float tickbase = (float)(CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) * interfaces::gvars->interval_per_tick;
|
||||
float tickbase = (float)(CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) * g_GlobalVars->interval_per_tick;
|
||||
float nextattack = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack);
|
||||
return nextattack <= tickbase;
|
||||
}
|
||||
@ -705,13 +705,13 @@ bool IsEntityVisiblePenetration(CachedEntity* entity, int hb) {
|
||||
return false;
|
||||
}
|
||||
ray.Init(g_pLocalPlayer->v_Origin + g_pLocalPlayer->v_ViewOffset, hit);
|
||||
interfaces::trace->TraceRay(ray, MASK_SHOT_HULL, trace::g_pFilterPenetration, &trace_visible);
|
||||
g_ITrace->TraceRay(ray, MASK_SHOT_HULL, trace::g_pFilterPenetration, &trace_visible);
|
||||
bool s = false;
|
||||
if (trace_visible.m_pEnt) {
|
||||
s = ((IClientEntity*)trace_visible.m_pEnt) == RAW_ENT(entity);
|
||||
}
|
||||
if (!s) return false;
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, trace::g_pFilterDefault, &trace_visible);
|
||||
g_ITrace->TraceRay(ray, 0x4200400B, trace::g_pFilterDefault, &trace_visible);
|
||||
if (trace_visible.m_pEnt) {
|
||||
IClientEntity* ent = (IClientEntity*)trace_visible.m_pEnt;
|
||||
if (ent) {
|
||||
@ -742,14 +742,14 @@ class CMoveData;
|
||||
typedef void(*FinishTrackPredictionErrorsFn)(IClientEntity *);
|
||||
|
||||
// get the vtable
|
||||
void **predictionVtable = *(void ***)interfaces::prediction;
|
||||
void **predictionVtable = *(void ***)prediction;
|
||||
logging::Info("predictionVtable 0x%08x", predictionVtable);
|
||||
// get the functions
|
||||
SetupMoveFn oSetupMove = (SetupMoveFn) predictionVtable[19];
|
||||
FinishMoveFn oFinishMove = (FinishMoveFn) predictionVtable[20];
|
||||
|
||||
// get the vtable
|
||||
void **gameMovementVtable = *(void ***)interfaces::gamemovement;
|
||||
void **gameMovementVtable = *(void ***)gamemovement;
|
||||
logging::Info("gameMovementVtable 0x%08x", gameMovementVtable);
|
||||
// get the functions
|
||||
ProcessMovementFn oProcessMovement = (ProcessMovementFn) gameMovementVtable[2];
|
||||
@ -762,8 +762,8 @@ class CMoveData;
|
||||
logging::Info("pMoveData 0x%08x", pMoveData);
|
||||
|
||||
// back up globals
|
||||
float frameTime = interfaces::gvars->frametime;
|
||||
float curTime = interfaces::gvars->curtime;
|
||||
float frameTime = gvars->frametime;
|
||||
float curTime = gvars->curtime;
|
||||
|
||||
CUserCmd defaultCmd;
|
||||
if(ucmd == NULL)
|
||||
@ -775,8 +775,8 @@ class CMoveData;
|
||||
NET_VAR(ent, 0x105C, void*) = ucmd;
|
||||
|
||||
// set up the globals
|
||||
interfaces::gvars->curtime = interfaces::gvars->interval_per_tick * NET_INT(ent, netvar.nTickBase);
|
||||
interfaces::gvars->frametime = interfaces::gvars->interval_per_tick;
|
||||
gvars->curtime = gvars->interval_per_tick * NET_INT(ent, netvar.nTickBase);
|
||||
gvars->frametime = gvars->interval_per_tick;
|
||||
|
||||
oStartTrackPredictionErrors(ent);
|
||||
|
||||
@ -794,8 +794,8 @@ class CMoveData;
|
||||
NET_VAR(ent, 0x105C, void *) = 0;
|
||||
|
||||
// restore globals
|
||||
interfaces::gvars->frametime = frameTime;
|
||||
interfaces::gvars->curtime = curTime;
|
||||
gvars->frametime = frameTime;
|
||||
gvars->curtime = curTime;
|
||||
|
||||
return;
|
||||
}
|
||||
@ -804,16 +804,16 @@ float oldCurtime;
|
||||
float oldFrametime;
|
||||
|
||||
void StartPrediction(CUserCmd* cmd) {
|
||||
oldCurtime = interfaces::gvars->curtime;
|
||||
oldFrametime = interfaces::gvars->frametime;
|
||||
interfaces::gvars->curtime = NET_INT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick;
|
||||
interfaces::gvars->frametime = interfaces::gvars->interval_per_tick;
|
||||
//interfaces::gamemovement->
|
||||
oldCurtime = gvars->curtime;
|
||||
oldFrametime = gvars->frametime;
|
||||
gvars->curtime = NET_INT(g_pLocalPlayer->entity, netvar.nTickBase) * gvars->interval_per_tick;
|
||||
gvars->frametime = gvars->interval_per_tick;
|
||||
//gamemovement->
|
||||
}
|
||||
|
||||
void EndPrediction() {
|
||||
interfaces::gvars->curtime = oldCurtime;
|
||||
interfaces::gvars->frametime = oldFrametime;
|
||||
gvars->curtime = oldCurtime;
|
||||
gvars->frametime = oldFrametime;
|
||||
}*/
|
||||
|
||||
char* strfmt(const char* fmt, ...) {
|
||||
|
@ -54,14 +54,14 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!interfaces::engineClient->IsInGame()) {
|
||||
if (!g_IEngine->IsInGame()) {
|
||||
g_Settings.bInvalid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// PROF_BEGIN();
|
||||
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
||||
if (ch && !hooks::IsHooked((void*)((uintptr_t)ch))) {
|
||||
hooks::hkNetChannel = new hooks::VMTHook();
|
||||
hooks::hkNetChannel->Init(ch, 0);
|
||||
@ -74,10 +74,10 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
//if (!cmd) return ret;
|
||||
|
||||
bool time_replaced = false;
|
||||
float curtime_old = interfaces::gvars->curtime;;
|
||||
float curtime_old = g_GlobalVars->curtime;;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
float servertime = (float)CE_INT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick;
|
||||
interfaces::gvars->curtime = servertime;
|
||||
float servertime = (float)CE_INT(g_pLocalPlayer->entity, netvar.nTickBase) * g_GlobalVars->interval_per_tick;
|
||||
g_GlobalVars->curtime = servertime;
|
||||
time_replaced = true;
|
||||
}
|
||||
if (g_Settings.bInvalid) {
|
||||
@ -115,7 +115,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
SAFE_CALL(HACK_PROCESS_USERCMD(KillSay, cmd));
|
||||
SAFE_CALL(HACK_PROCESS_USERCMD(Spam, cmd));
|
||||
// PROF_END("Hacks processing");
|
||||
if (time_replaced) interfaces::gvars->curtime = curtime_old;
|
||||
if (time_replaced) g_GlobalVars->curtime = curtime_old;
|
||||
}
|
||||
/*for (IHack* i_hack : hack::hacks) {
|
||||
if (!i_hack->CreateMove(thisptr, inputSample, cmd)) {
|
||||
|
@ -34,7 +34,7 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
if (cathook && panel_scope && no_zoom && vp == panel_scope) call_default = false;
|
||||
if (cathook) {
|
||||
bool vis = gui_visible;
|
||||
interfaces::surface->SetCursorAlwaysVisible(vis);
|
||||
g_ISurface->SetCursorAlwaysVisible(vis);
|
||||
}
|
||||
|
||||
|
||||
@ -46,14 +46,14 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
|
||||
static bool autoexec_done = false;
|
||||
if (!autoexec_done) {
|
||||
interfaces::engineClient->ExecuteClientCmd("exec cat_autoexec");
|
||||
interfaces::engineClient->ExecuteClientCmd("cat_killsay_reload");
|
||||
interfaces::engineClient->ExecuteClientCmd("cat_spam_reload");
|
||||
g_IEngine->ExecuteClientCmd("exec cat_autoexec");
|
||||
g_IEngine->ExecuteClientCmd("cat_killsay_reload");
|
||||
g_IEngine->ExecuteClientCmd("cat_spam_reload");
|
||||
autoexec_done = true;
|
||||
}
|
||||
|
||||
if (!panel_top) {
|
||||
const char* name = interfaces::panel->GetName(vp);
|
||||
const char* name = g_IPanel->GetName(vp);
|
||||
if (strlen(name) > 4) {
|
||||
if (name[0] == 'M' && name[3] == 'S') {
|
||||
panel_top = vp;
|
||||
@ -64,16 +64,16 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
}
|
||||
}
|
||||
if (!panel_scope) {
|
||||
if (!strcmp(interfaces::panel->GetName(vp), "HudScope")) {
|
||||
if (!strcmp(g_IPanel->GetName(vp), "HudScope")) {
|
||||
panel_scope = vp;
|
||||
}
|
||||
}
|
||||
if (!interfaces::engineClient->IsInGame()) {
|
||||
if (!g_IEngine->IsInGame()) {
|
||||
g_Settings.bInvalid = true;
|
||||
}
|
||||
|
||||
if (disable_visuals) return;
|
||||
if (clean_screenshots && interfaces::engineClient->IsTakingScreenshot()) return;
|
||||
if (clean_screenshots && g_IEngine->IsTakingScreenshot()) return;
|
||||
|
||||
ResetStrings();
|
||||
|
||||
|
@ -62,7 +62,7 @@ void FrameStageNotify_hook(void* thisptr, int stage) {
|
||||
SEGV_BEGIN;
|
||||
//logging::Info("FrameStageNotify %i", stage);
|
||||
// Ambassador to festive ambassador changer. simple.
|
||||
if (!interfaces::engineClient->IsInGame()) g_Settings.bInvalid = true;
|
||||
if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true;
|
||||
//logging::Info("fsi begin");// TODO dbg
|
||||
SVDBG("FSN %i", __LINE__);
|
||||
// TODO hack FSN hook
|
||||
@ -73,7 +73,7 @@ void FrameStageNotify_hook(void* thisptr, int stage) {
|
||||
CE_INT(g_pLocalPlayer->entity, netvar.nForceTauntCam) = 1;
|
||||
}
|
||||
SVDBG("FSN %i", __LINE__);
|
||||
if (stage == 5 && g_Settings.bShowAntiAim->GetBool() && interfaces::iinput->CAM_IsThirdPerson()) {
|
||||
if (stage == 5 && g_Settings.bShowAntiAim->GetBool() && g_IInput->CAM_IsThirdPerson()) {
|
||||
SVDBG("FSN %i", __LINE__);
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 4) = g_Settings.last_angles.x;
|
||||
@ -129,7 +129,7 @@ bool DispatchUserMessage_hook(void* thisptr, int type, bf_read& buf) {
|
||||
|
||||
void LevelInit_hook(void* thisptr, const char* newmap) {
|
||||
((LevelInit_t*) hooks::hkClientMode->GetMethod(hooks::offLevelInit))(thisptr, newmap);
|
||||
interfaces::engineClient->ExecuteClientCmd("exec cat_matchexec");
|
||||
g_IEngine->ExecuteClientCmd("exec cat_matchexec");
|
||||
LEVEL_INIT(Aimbot);
|
||||
hacks::shared::airstuck::Reset();
|
||||
if (TF) LEVEL_INIT(AntiDisguise);
|
||||
|
@ -10,68 +10,86 @@
|
||||
#include "copypasted/CSignature.h"
|
||||
#include "sdk.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "beforecheaders.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "aftercheaders.h"
|
||||
|
||||
#include <steam/isteamclient.h>
|
||||
|
||||
//class ISteamFriends002;
|
||||
|
||||
ISteamClient* interfaces::steamClient = 0;
|
||||
ISteamFriends* interfaces::steamFriends = 0;
|
||||
IVEngineClient013* interfaces::engineClient = 0;
|
||||
vgui::ISurface* interfaces::surface = 0;
|
||||
vgui::IPanel* interfaces::panel = 0;
|
||||
IClientEntityList* interfaces::entityList = 0;
|
||||
ICenterPrint* interfaces::centerPrint = 0;
|
||||
IGameEventManager2* interfaces::eventManager = 0;
|
||||
IBaseClientDLL* interfaces::baseClient = 0;
|
||||
IEngineTrace* interfaces::trace = 0;
|
||||
IVModelInfoClient* interfaces::model = 0;
|
||||
IInputSystem* interfaces::input = 0;
|
||||
ICvar* interfaces::cvar = 0;
|
||||
CGlobalVarsBase* interfaces::gvars = 0;
|
||||
IPrediction* interfaces::prediction = 0;
|
||||
IGameMovement* interfaces::gamemovement = 0;
|
||||
IInput* interfaces::iinput = 0;
|
||||
IMatSystemSurface* interfaces::matsurface = 0;
|
||||
ISteamUser* interfaces::user = 0;
|
||||
IAchievementMgr* interfaces::achievements = 0;
|
||||
ISteamUserStats* interfaces::stats = 0;
|
||||
IStudioRender* interfaces::render = 0;
|
||||
IVDebugOverlay* interfaces::debug = 0;
|
||||
ISteamClient* g_ISteamClient = nullptr;
|
||||
ISteamFriends* g_ISteamFriends = nullptr;
|
||||
IVEngineClient013* g_IEngine = nullptr;
|
||||
vgui::ISurface* g_ISurface = nullptr;
|
||||
vgui::IPanel* g_IPanel = nullptr;
|
||||
IClientEntityList* g_IEntityList = nullptr;
|
||||
ICenterPrint* g_ICenterPrint = nullptr;
|
||||
ICvar* g_ICvar = nullptr;
|
||||
IGameEventManager2* g_IEventManager2 = nullptr;
|
||||
IBaseClientDLL* g_IBaseClient = nullptr;
|
||||
IEngineTrace* g_ITrace = nullptr;
|
||||
IVModelInfoClient* g_IModelInfo = nullptr;
|
||||
IInputSystem* g_IInputSystem = nullptr;
|
||||
CGlobalVarsBase* g_GlobalVars = nullptr;
|
||||
IPrediction* g_IPrediction = nullptr;
|
||||
IGameMovement* g_IGameMovement = nullptr;
|
||||
IInput* g_IInput = nullptr;
|
||||
IMatSystemSurface* g_IMatSystemSurface = nullptr;
|
||||
ISteamUser* g_ISteamUser = nullptr;
|
||||
IAchievementMgr* g_IAchievementMgr = nullptr;
|
||||
ISteamUserStats* g_ISteamUserStats = nullptr;
|
||||
IStudioRender* g_IStudioRender = nullptr;
|
||||
IVDebugOverlay* g_IVDebugOverlay = nullptr;
|
||||
|
||||
void interfaces::CreateInterfaces() {
|
||||
interfaces::centerPrint = reinterpret_cast<ICenterPrint*>(sharedobj::client->fptr("VCENTERPRINT002", nullptr));
|
||||
interfaces::cvar = reinterpret_cast<ICvar*>(sharedobj::vstdlib->CreateInterface("VEngineCvar004"));
|
||||
interfaces::engineClient = reinterpret_cast<IVEngineClient013*>(sharedobj::engine->CreateInterface("VEngineClient013"));
|
||||
g_AppID = interfaces::engineClient->GetAppID();
|
||||
interfaces::entityList = reinterpret_cast<IClientEntityList*>(sharedobj::client->CreateInterface("VClientEntityList003"));
|
||||
interfaces::panel = reinterpret_cast<vgui::IPanel*>(sharedobj::vgui2->CreateInterface("VGUI_Panel009"));
|
||||
interfaces::steamClient = reinterpret_cast<ISteamClient*>(sharedobj::steamclient->CreateInterface("SteamClient017"));
|
||||
interfaces::surface = reinterpret_cast<vgui::ISurface*>(sharedobj::vguimatsurface->CreateInterface("VGUI_Surface030"));
|
||||
interfaces::eventManager = reinterpret_cast<IGameEventManager2*>(sharedobj::engine->CreateInterface("GAMEEVENTSMANAGER002"));
|
||||
interfaces::baseClient = reinterpret_cast<IBaseClientDLL*>(sharedobj::client->CreateInterface("VClient017"));
|
||||
interfaces::trace = reinterpret_cast<IEngineTrace*>(sharedobj::engine->CreateInterface("EngineTraceClient003"));
|
||||
interfaces::model = reinterpret_cast<IVModelInfoClient*>(sharedobj::engine->CreateInterface("VModelInfoClient006"));
|
||||
interfaces::input = reinterpret_cast<IInputSystem*>(sharedobj::inputsystem->CreateInterface("InputSystemVersion001"));
|
||||
interfaces::render = reinterpret_cast<IStudioRender*>(sharedobj::studiorender->CreateInterface("VStudioRender025"));
|
||||
interfaces::debug = reinterpret_cast<IVDebugOverlay*>(sharedobj::engine->CreateInterface("VDebugOverlay003"));
|
||||
//interfaces::client = reinterpret_cast<IClient*>(sharedobj::client->CreateInterface("VClient017"));
|
||||
HSteamPipe sp = interfaces::steamClient->CreateSteamPipe();
|
||||
HSteamUser su = interfaces::steamClient->ConnectToGlobalUser(sp);
|
||||
interfaces::steamFriends = interfaces::steamClient->GetISteamFriends(su, sp, "SteamFriends002");
|
||||
//uintptr_t hudupdate = (uintptr_t)hooks::GetVMT(interfaces::baseClient, 0)[11];
|
||||
//interfaces::gvars = *reinterpret_cast<CGlobalVarsBase**>(gSignatures.GetClientSignature("55 89 E5 53 83 EC ? A1 ? ? ? ? 0F B6 5D 0C F3 0F 10 40 10") + 8);
|
||||
interfaces::gvars = **(reinterpret_cast<CGlobalVarsBase***>((uintptr_t)11 + gSignatures.GetClientSignature("55 89 E5 83 EC ? 8B 45 08 8B 15 ? ? ? ? F3 0F 10")));
|
||||
//interfaces::gvars = *reinterpret_cast<CGlobalVarsBase**>(hudupdate + 13 + *reinterpret_cast<uint32_t*>(hudupdate + 13 + 3) + 7);
|
||||
interfaces::prediction = reinterpret_cast<IPrediction*>(sharedobj::client->CreateInterface("VClientPrediction001"));
|
||||
interfaces::gamemovement = reinterpret_cast<IGameMovement*>(sharedobj::client->CreateInterface("GameMovement001"));
|
||||
if (TF2) interfaces::iinput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 B4 00 00 00 A1 ? ? ? ? 8B 10")));
|
||||
else if (TF2C) interfaces::iinput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 A8 00 00 00 A1 ? ? ? ? 8B 10")));
|
||||
else if (HL2DM) interfaces::iinput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? 8B 10 89 04 24 FF 52 78 A1 ? ? ? ? 8B 10")));
|
||||
if (TF2 || HL2DM)
|
||||
interfaces::matsurface = **reinterpret_cast<IMatSystemSurface***>((uintptr_t)19 + gSignatures.GetClientSignature("FF 92 94 02 00 00 8B 8D C4 FE FF FF 89 85 B0 FE FF FF A1 ? ? ? ? 8B 10 89 4C 24 0C"));
|
||||
else if (TF2C)
|
||||
interfaces::matsurface = **reinterpret_cast<IMatSystemSurface***>((uintptr_t)53 + gSignatures.GetClientSignature("C7 44 24 1C FF 00 00 00 C7 44 24 18 FF 00 00 00 C7 44 24 14 FF 00 00 00 C7 44 24 10 00 00 00 00 89 74 24 08 8B 83 D0 E1 00 00 89 95 A4 FE FF FF 89 44 24 04 A1 ? ? ? ? 89 04 24 FF 91 88 02 00 00 8B 95 A4 FE FF FF A1 ? ? ? ? 29 FA 8B 08 89 54 24 0C"));
|
||||
interfaces::user = interfaces::steamClient->GetISteamUser(su, sp, "SteamUser018");
|
||||
interfaces::achievements = interfaces::engineClient->GetAchievementMgr();
|
||||
interfaces::stats = interfaces::steamClient->GetISteamUserStats(su, sp, "STEAMUSERSTATS_INTERFACE_VERSION011");
|
||||
template<typename T>
|
||||
T* BruteforceInterface(std::string name, sharedobj::SharedObject* object) {
|
||||
T* result = nullptr;
|
||||
std::stringstream stream;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
stream.str(name);
|
||||
for (int j = 0; j < i % 10; j++) stream << '0';
|
||||
result = reinterpret_cast<T*>(object->CreateInterface(stream.str()));
|
||||
if (result) return result;
|
||||
}
|
||||
logging::Info("RIP Software: can't create interface %s!", name.c_str());
|
||||
exit(0);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CreateInterfaces() {
|
||||
g_ICenterPrint = BruteforceInterface<ICenterPrint>("VCENTERPRINT", sharedobj::client);
|
||||
g_ICvar = BruteforceInterface<ICvar>("VEngineCvar", sharedobj::vstdlib);
|
||||
g_IEngine = BruteforceInterface<IVEngineClient013>("VEngineClient", sharedobj::engine);
|
||||
g_AppID = g_IEngine->GetAppID();
|
||||
g_IEntityList = BruteforceInterface<IClientEntityList>("VClientEntityList", sharedobj::client);
|
||||
g_IPanel = BruteforceInterface<vgui::IPanel>("VGUI_Panel", sharedobj::vgui2);
|
||||
g_ISteamClient = BruteforceInterface<ISteamClient>("SteamClient", sharedobj::steamclient);
|
||||
g_ISurface = BruteforceInterface<vgui::ISurface>("VGUI_Surface", sharedobj::vguimatsurface);
|
||||
g_IEventManager2 = BruteforceInterface<IGameEventManager2>("GAMEEVENTSMANAGER", sharedobj::engine);
|
||||
g_IBaseClient = BruteforceInterface<IBaseClientDLL>("VClient", sharedobj::client);
|
||||
g_ITrace = BruteforceInterface<IEngineTrace>("EngineTraceClient", sharedobj::engine);
|
||||
g_IModelInfo = BruteforceInterface<IVModelInfoClient>("VModelInfoClient", sharedobj::engine);
|
||||
g_IInputSystem = BruteforceInterface<IInputSystem>("InputSystemVersion", sharedobj::inputsystem);
|
||||
g_IStudioRender = BruteforceInterface<IStudioRender>("VStudioRender", sharedobj::studiorender);
|
||||
g_IVDebugOverlay = BruteforceInterface<IVDebugOverlay>("VDebugOverlay", sharedobj::engine);
|
||||
HSteamPipe sp = g_ISteamClient->CreateSteamPipe();
|
||||
HSteamUser su = g_ISteamClient->ConnectToGlobalUser(sp);
|
||||
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);
|
||||
g_IGameMovement = BruteforceInterface<IGameMovement>("GameMovement", sharedobj::client);
|
||||
if (TF2) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 B4 00 00 00 A1 ? ? ? ? 8B 10")));
|
||||
else if (TF2C) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 A8 00 00 00 A1 ? ? ? ? 8B 10")));
|
||||
else if (HL2DM) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? 8B 10 89 04 24 FF 52 78 A1 ? ? ? ? 8B 10")));
|
||||
if (TF2 || HL2DM)
|
||||
g_pMatSystemSurface = **reinterpret_cast<IMatSystemSurface***>((uintptr_t)19 + gSignatures.GetClientSignature("FF 92 94 02 00 00 8B 8D C4 FE FF FF 89 85 B0 FE FF FF A1 ? ? ? ? 8B 10 89 4C 24 0C"));
|
||||
else if (TF2C)
|
||||
g_pMatSystemSurface = **reinterpret_cast<IMatSystemSurface***>((uintptr_t)53 + gSignatures.GetClientSignature("C7 44 24 1C FF 00 00 00 C7 44 24 18 FF 00 00 00 C7 44 24 14 FF 00 00 00 C7 44 24 10 00 00 00 00 89 74 24 08 8B 83 D0 E1 00 00 89 95 A4 FE FF FF 89 44 24 04 A1 ? ? ? ? 89 04 24 FF 91 88 02 00 00 8B 95 A4 FE FF FF A1 ? ? ? ? 29 FA 8B 08 89 54 24 0C"));
|
||||
g_ISteamUser = g_ISteamClient->GetISteamUser(su, sp, "SteamUser018");
|
||||
g_IAchievementMgr = g_IEngine->GetAchievementMgr();
|
||||
g_ISteamUserStats = g_ISteamClient->GetISteamUserStats(su, sp, "STEAMUSERSTATS_INTERFACE_VERSION011");
|
||||
}
|
||||
|
@ -8,6 +8,12 @@
|
||||
#ifndef INTERFACES_H_
|
||||
#define INTERFACES_H_
|
||||
|
||||
#include "beforecheaders.h"
|
||||
#include <string>
|
||||
#include "aftercheaders.h"
|
||||
|
||||
#include "sharedobj.h"
|
||||
|
||||
namespace vgui {
|
||||
class ISurface;
|
||||
class IPanel;
|
||||
@ -37,34 +43,33 @@ class ISteamUserStats;
|
||||
class IStudioRender;
|
||||
class IVDebugOverlay;
|
||||
|
||||
namespace interfaces {
|
||||
extern ISteamClient* g_ISteamClient;
|
||||
extern ISteamFriends* g_ISteamFriends;
|
||||
extern IVEngineClient013* g_IEngine;
|
||||
extern vgui::ISurface* g_ISurface;
|
||||
extern vgui::IPanel* g_IPanel;
|
||||
extern IClientEntityList* g_IEntityList;
|
||||
extern ICenterPrint* g_ICenterPrint;
|
||||
extern ICvar* g_ICvar;
|
||||
extern IGameEventManager2* g_IEventManager2;
|
||||
extern IBaseClientDLL* g_IBaseClient;
|
||||
extern IEngineTrace* g_ITrace;
|
||||
extern IVModelInfoClient* g_IModelInfo;
|
||||
extern IInputSystem* g_IInputSystem;
|
||||
extern CGlobalVarsBase* g_GlobalVars;
|
||||
extern IPrediction* g_IPrediction;
|
||||
extern IGameMovement* g_IGameMovement;
|
||||
extern IInput* g_IInput;
|
||||
extern IMatSystemSurface* g_IMatSystemSurface;
|
||||
extern ISteamUser* g_ISteamUser;
|
||||
extern IAchievementMgr* g_IAchievementMgr;
|
||||
extern ISteamUserStats* g_ISteamUserStats;
|
||||
extern IStudioRender* g_IStudioRender;
|
||||
extern IVDebugOverlay* g_IVDebugOverlay;
|
||||
|
||||
extern ISteamClient* steamClient;
|
||||
extern ISteamFriends* steamFriends;
|
||||
extern IVEngineClient013* engineClient;
|
||||
extern vgui::ISurface* surface;
|
||||
extern vgui::IPanel* panel;
|
||||
extern IClientEntityList* entityList;
|
||||
extern ICenterPrint* centerPrint;
|
||||
extern ICvar* cvar;
|
||||
extern IGameEventManager2* eventManager;
|
||||
extern IBaseClientDLL* baseClient;
|
||||
extern IEngineTrace* trace;
|
||||
extern IVModelInfoClient* model;
|
||||
extern IInputSystem* input;
|
||||
extern CGlobalVarsBase* gvars;
|
||||
extern IPrediction* prediction;
|
||||
extern IGameMovement* gamemovement;
|
||||
extern IInput* iinput;
|
||||
extern IMatSystemSurface* matsurface;
|
||||
extern ISteamUser* user;
|
||||
extern IAchievementMgr* achievements;
|
||||
extern ISteamUserStats* stats;
|
||||
extern IStudioRender* render;
|
||||
extern IVDebugOverlay* debug;
|
||||
template<typename T>
|
||||
T* BruteforceInterface(std::string name, sharedobj::SharedObject* object);
|
||||
|
||||
void CreateInterfaces();
|
||||
|
||||
}
|
||||
|
||||
#endif /* INTERFACES_H_ */
|
||||
|
@ -38,7 +38,7 @@ bool ipcctl::Init() {
|
||||
mem->segments[client_id].initialized = true;
|
||||
mem->segments[client_id].owner_pid = getpid();
|
||||
mem->segments[client_id].command_number = 0;
|
||||
memcpy(mem->segments[client_id].name, interfaces::steamFriends->GetPersonaName(), 32);
|
||||
memcpy(mem->segments[client_id].name, g_ISteamFriends->GetPersonaName(), 32);
|
||||
if (client_id == -1) return false;
|
||||
broken = false;
|
||||
return true;
|
||||
@ -91,7 +91,7 @@ ipc_client_seg* ipcctl::GetClientSegment(int client) {
|
||||
mem->segments[client].initialized = true;
|
||||
mem->segments[client].owner_pid = getpid();
|
||||
mem->segments[client].command_number = 0;
|
||||
memcpy(mem->segments[client].name, interfaces::steamFriends->GetPersonaName(), 32);
|
||||
memcpy(mem->segments[client].name, g_ISteamFriends->GetPersonaName(), 32);
|
||||
return 0;
|
||||
}
|
||||
mem->segments[client].last_access_time = time(0);
|
||||
|
@ -182,7 +182,7 @@ k_EItemType ItemModelMapper::GetItemType(CachedEntity* entity) {
|
||||
for (const auto& it : map) {
|
||||
if (it.first == model) return it.second;
|
||||
}
|
||||
std::string path(interfaces::model->GetModelName((const model_t*)model));
|
||||
std::string path(g_IModelInfo->GetModelName((const model_t*)model));
|
||||
bool set = false;
|
||||
for (const auto& it : models) {
|
||||
//logging::Info("comparing [%s] to [%s]", path.c_str(), it.first.c_str());
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "sdk.h"
|
||||
|
||||
void LocalPlayer::Update() {
|
||||
entity_idx = interfaces::engineClient->GetLocalPlayer();
|
||||
entity_idx = g_IEngine->GetLocalPlayer();
|
||||
entity = ENTITY(entity_idx);
|
||||
if (CE_BAD(entity)) {
|
||||
return;
|
||||
@ -24,7 +24,7 @@ void LocalPlayer::Update() {
|
||||
this->bUseSilentAngles = false;
|
||||
bZoomed = CE_INT(entity, netvar.iFOV) == 20; //!= NET_INT(entity, netvar.iDefaultFOV);
|
||||
if (bZoomed) {
|
||||
if (flZoomBegin == 0.0f) flZoomBegin = interfaces::gvars->curtime;
|
||||
if (flZoomBegin == 0.0f) flZoomBegin = g_GlobalVars->curtime;
|
||||
} else {
|
||||
flZoomBegin = 0.0f;
|
||||
}
|
||||
|
@ -32,9 +32,9 @@ void logging::Info(const char* fmt, ...) {
|
||||
sprintf(result, "[CAT] %s\n", buffer);
|
||||
fprintf(logging::handle, "%s", result);
|
||||
fflush(logging::handle);
|
||||
if (interfaces::cvar) {
|
||||
if (g_ICvar) {
|
||||
if (g_Settings.bDebugLog && g_Settings.bDebugLog->convar_parent && g_Settings.bDebugLog->GetBool())
|
||||
interfaces::cvar->ConsolePrintf("%s", result);
|
||||
g_ICvar->ConsolePrintf("%s", result);
|
||||
}
|
||||
delete [] buffer;
|
||||
delete [] result;
|
||||
|
@ -30,8 +30,8 @@ Vector SimpleLatencyPrediction(CachedEntity* ent, int hb) {
|
||||
if (!ent) return Vector();
|
||||
Vector result;
|
||||
GetHitbox(ent, hb, result);
|
||||
float latency = interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
float latency = g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
result += CE_VECTOR(ent, netvar.vVelocity) * latency;
|
||||
return result;
|
||||
}
|
||||
@ -102,6 +102,6 @@ float DistanceToGround(Vector origin) {
|
||||
Vector endpos = origin;
|
||||
endpos.z -= 8192;
|
||||
ray.Init(origin, endpos);
|
||||
interfaces::trace->TraceRay(ray, MASK_PLAYERSOLID, trace::g_pFilterNoPlayer, ground_trace);
|
||||
g_ITrace->TraceRay(ray, MASK_PLAYERSOLID, trace::g_pFilterNoPlayer, ground_trace);
|
||||
return 8192.0f * ground_trace->fraction;
|
||||
}
|
||||
|
@ -14,7 +14,8 @@
|
||||
#include <link.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
const char* path_from_proc_maps(const char* name) {
|
||||
// TODO rewrite!
|
||||
const char* path_from_proc_maps(const std::string& name) {
|
||||
FILE* proc_maps = fopen(strfmt("/proc/%i/maps", getpid()), "r");
|
||||
if (!proc_maps) return (const char*)0;
|
||||
char* buffer = new char[512];
|
||||
@ -29,7 +30,7 @@ const char* path_from_proc_maps(const char* name) {
|
||||
if (!path_begin || !filename_begin) continue;
|
||||
char* filename = buffer + filename_begin;
|
||||
filename[strlen(filename) - 1] = '\0';
|
||||
if (!strcmp(name, filename)) {
|
||||
if (!strcmp(name.c_str(), filename)) {
|
||||
return buffer + path_begin;
|
||||
}
|
||||
}
|
||||
@ -77,7 +78,7 @@ sharedobj::SharedObject* sharedobj::tier0 = 0;
|
||||
sharedobj::SharedObject* sharedobj::inputsystem = 0;
|
||||
sharedobj::SharedObject* sharedobj::studiorender = 0;
|
||||
|
||||
sharedobj::SharedObject::SharedObject(const char* name, bool factory) {
|
||||
sharedobj::SharedObject::SharedObject(const std::string& name, bool factory) {
|
||||
while (!(this->path = path_from_proc_maps(name))) {
|
||||
sleep(1);
|
||||
}
|
||||
@ -104,13 +105,8 @@ int* sharedobj::SharedObject::Pointer(int offset) {
|
||||
}
|
||||
}
|
||||
|
||||
void* sharedobj::SharedObject::CreateInterface(const char* name) {
|
||||
int result;
|
||||
void* interface = (void*)(fptr(name, &result));
|
||||
if (result) {
|
||||
logging::Info("Interface creation failed: %s from %s", name, basename(lmap->l_name));
|
||||
}
|
||||
return interface;
|
||||
void* sharedobj::SharedObject::CreateInterface(const std::string& name) {
|
||||
return (void*)(fptr(name.c_str(), nullptr));;
|
||||
}
|
||||
|
||||
void sharedobj::LoadAllSharedObjects() {
|
||||
|
@ -8,19 +8,23 @@
|
||||
#ifndef SHAREDOBJ_H_
|
||||
#define SHAREDOBJ_H_
|
||||
|
||||
#include "beforecheaders.h"
|
||||
#include <string>
|
||||
#include "aftercheaders.h"
|
||||
|
||||
struct link_map;
|
||||
typedef void *(*fn_CreateInterface_t)(const char*, int*);
|
||||
|
||||
const char* path_from_proc_maps(const char* path);
|
||||
const char* path_from_proc_maps(const std::string& path);
|
||||
const char* tf_path_from_maps();
|
||||
|
||||
namespace sharedobj {
|
||||
|
||||
class SharedObject {
|
||||
public:
|
||||
SharedObject(const char* path, bool factory);
|
||||
SharedObject(const std::string& name, bool factory);
|
||||
int* Pointer(int offset);
|
||||
void* CreateInterface(const char* name);
|
||||
void* CreateInterface(const std::string& name);
|
||||
fn_CreateInterface_t fptr;
|
||||
const char* path;
|
||||
link_map* lmap;
|
||||
|
Reference in New Issue
Block a user