init
This commit is contained in:
125
TempleWare-CS2/source/templeware/features/aim/aim.cpp
Normal file
125
TempleWare-CS2/source/templeware/features/aim/aim.cpp
Normal file
@@ -0,0 +1,125 @@
|
||||
#include "../../../cs2/entity/C_CSPlayerPawn/C_CSPlayerPawn.h"
|
||||
#include "../../../templeware/interfaces/CGameEntitySystem/CGameEntitySystem.h"
|
||||
#include "../../../templeware/interfaces/interfaces.h"
|
||||
#include "../../../templeware/hooks/hooks.h"
|
||||
#include "../../../templeware/config/config.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <Windows.h>
|
||||
#include "../../menu/hud.h"
|
||||
|
||||
// Literally the most autistic code ive ever written in my life
|
||||
// Please dont ever make me do this again
|
||||
|
||||
Vector_t GetEntityEyePos(const C_CSPlayerPawn* Entity) {
|
||||
if (!Entity)
|
||||
return {};
|
||||
|
||||
uintptr_t game_scene_node = *reinterpret_cast<uintptr_t*>((uintptr_t)Entity + SchemaFinder::Get(hash_32_fnv1a_const("C_BaseEntity->m_pGameSceneNode")));
|
||||
|
||||
auto Origin = *reinterpret_cast<Vector_t*>(game_scene_node + SchemaFinder::Get(hash_32_fnv1a_const("CGameSceneNode->m_vecAbsOrigin")));
|
||||
auto ViewOffset = *reinterpret_cast<Vector_t*>((uintptr_t)Entity + SchemaFinder::Get(hash_32_fnv1a_const("C_BaseModelEntity->m_vecViewOffset")));
|
||||
|
||||
Vector_t Result = Origin + ViewOffset;
|
||||
if (!std::isfinite(Result.x) || !std::isfinite(Result.y) || !std::isfinite(Result.z))
|
||||
return {};
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline QAngle_t CalcAngles(Vector_t viewPos, Vector_t aimPos)
|
||||
{
|
||||
QAngle_t angle = { 0, 0, 0 };
|
||||
|
||||
Vector_t delta = aimPos - viewPos;
|
||||
|
||||
angle.x = -asin(delta.z / delta.Length()) * (180.0f / 3.141592654f);
|
||||
angle.y = atan2(delta.y, delta.x) * (180.0f / 3.141592654f);
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
inline float GetFov(const QAngle_t& viewAngle, const QAngle_t& aimAngle)
|
||||
{
|
||||
QAngle_t delta = (aimAngle - viewAngle).Normalize();
|
||||
|
||||
return sqrtf(powf(delta.x, 2.0f) + powf(delta.y, 2.0f));
|
||||
}
|
||||
|
||||
void Aimbot() {
|
||||
static C_CSPlayerPawn* lockedTarget = nullptr;
|
||||
static bool prevAimbotState = false;
|
||||
|
||||
bool aimbotActive = Config::aimbot;
|
||||
|
||||
// Получаем локального игрока и viewangles всегда, чтобы не дублировать код
|
||||
C_CSPlayerPawn* lp = H::oGetLocalPlayer(0);
|
||||
Vector_t lep = GetEntityEyePos(lp);
|
||||
QAngle_t* viewangles = (QAngle_t*)(modules.getModule("client") + 0x1A78650);
|
||||
|
||||
// Если кнопка только что нажата (переход с false на true) — ищем новую цель
|
||||
if (aimbotActive && !prevAimbotState) {
|
||||
int nMaxHighestEntity = I::GameEntity->Instance->GetHighestEntityIndex();
|
||||
float bestFov = Config::aimbot_fov;
|
||||
C_CSPlayerPawn* bestTarget = nullptr;
|
||||
QAngle_t bestAngle = {0, 0, 0};
|
||||
|
||||
for (int i = 1; i <= nMaxHighestEntity; i++) {
|
||||
auto Entity = I::GameEntity->Instance->Get(i);
|
||||
if (!Entity)
|
||||
continue;
|
||||
if (!Entity->handle().valid())
|
||||
continue;
|
||||
SchemaClassInfoData_t* _class = nullptr;
|
||||
Entity->dump_class_info(&_class);
|
||||
if (!_class)
|
||||
continue;
|
||||
const uint32_t hash = HASH(_class->szName);
|
||||
if (hash == HASH("C_CSPlayerPawn")) {
|
||||
C_CSPlayerPawn* pawn = (C_CSPlayerPawn*)Entity;
|
||||
if (pawn->get_entity_by_handle() == lp->get_entity_by_handle())
|
||||
continue;
|
||||
if (pawn->getHealth() <= 0)
|
||||
continue;
|
||||
/* if (!Config::team_check && pawn->getTeam() == lp->getTeam())
|
||||
continue;*/
|
||||
Vector_t eye_pos = GetEntityEyePos(pawn);
|
||||
QAngle_t angle = CalcAngles(eye_pos, lep);
|
||||
angle.x *= -1.f;
|
||||
angle.y += 180.f;
|
||||
const float fov = GetFov(*viewangles, angle);
|
||||
if (!std::isfinite(fov) || fov > bestFov)
|
||||
continue;
|
||||
bestFov = fov;
|
||||
bestTarget = pawn;
|
||||
bestAngle = angle;
|
||||
}
|
||||
}
|
||||
lockedTarget = bestTarget;
|
||||
}
|
||||
|
||||
// Если кнопка отпущена — сбрасываем захват
|
||||
if (!aimbotActive)
|
||||
lockedTarget = nullptr;
|
||||
|
||||
// Если есть захваченная цель и кнопка удерживается
|
||||
if (aimbotActive && lockedTarget) {
|
||||
// Проверяем, что цель всё ещё валидна
|
||||
if (!lockedTarget->handle().valid() || lockedTarget->getHealth() <= 0) {
|
||||
lockedTarget = nullptr;
|
||||
} else {
|
||||
Vector_t eye_pos = GetEntityEyePos(lockedTarget);
|
||||
QAngle_t angle = CalcAngles(eye_pos, lep);
|
||||
angle.x *= -1.f;
|
||||
angle.y += 180.f;
|
||||
QAngle_t ang_punch_angle = *(QAngle_t*)((uintptr_t)lp + SchemaFinder::Get(hash_32_fnv1a_const("C_CSPlayerPawn->m_aimPunchAngle")));
|
||||
if (Config::rcs)
|
||||
angle -= ang_punch_angle * 2.f;
|
||||
angle.z = 0.f;
|
||||
angle = angle.Normalize();
|
||||
*viewangles = angle;
|
||||
}
|
||||
}
|
||||
|
||||
prevAimbotState = aimbotActive;
|
||||
}
|
||||
3
TempleWare-CS2/source/templeware/features/aim/aim.h
Normal file
3
TempleWare-CS2/source/templeware/features/aim/aim.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void Aimbot();
|
||||
281
TempleWare-CS2/source/templeware/features/chams/chams.cpp
Normal file
281
TempleWare-CS2/source/templeware/features/chams/chams.cpp
Normal file
@@ -0,0 +1,281 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include "chams.h"
|
||||
#include "../../hooks/hooks.h"
|
||||
#include "../../config/config.h"
|
||||
#include "../../../../external/imgui/imgui.h"
|
||||
#include "../../utils/math/utlstronghandle/utlstronghandle.h"
|
||||
#include "../../../cs2/entity/C_Material/C_Material.h"
|
||||
#include "../../interfaces/interfaces.h"
|
||||
#include "../../interfaces/CGameEntitySystem/CGameEntitySystem.h"
|
||||
#include "../../../cs2/datatypes/keyvalues/keyvalues.h"
|
||||
#include "../../../cs2/datatypes/cutlbuffer/cutlbuffer.h"
|
||||
|
||||
CStrongHandle<CMaterial2> chams::create(const char* name, const char szVmatBuffer[])
|
||||
{
|
||||
CKeyValues3* pKeyValues3 = nullptr;
|
||||
|
||||
pKeyValues3 = pKeyValues3->create_material_from_resource();
|
||||
|
||||
pKeyValues3->LoadFromBuffer(szVmatBuffer);
|
||||
|
||||
CStrongHandle<CMaterial2> pCustomMaterial = {};
|
||||
|
||||
I::CreateMaterial(nullptr, &pCustomMaterial, name, pKeyValues3, 0, 1);
|
||||
|
||||
return pCustomMaterial;
|
||||
}
|
||||
|
||||
struct resource_material_t
|
||||
{
|
||||
CStrongHandle<CMaterial2> mat;
|
||||
CStrongHandle<CMaterial2> mat_invs;
|
||||
};
|
||||
|
||||
static resource_material_t resourceMaterials[ChamsType::MAXCOUNT];
|
||||
bool loaded_materials = false;
|
||||
bool chams::Materials::init()
|
||||
{
|
||||
// flat
|
||||
resourceMaterials[FLAT] = resource_material_t{
|
||||
.mat = create("materials/dev/flat.vmat", R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
Shader = "csgo_unlitgeneric.vfx"
|
||||
|
||||
F_IGNOREZ = 0
|
||||
F_DISABLE_Z_WRITE = 0
|
||||
F_DISABLE_Z_BUFFERING = 0
|
||||
F_BLEND_MODE = 1
|
||||
F_TRANSLUCENT = 1
|
||||
F_RENDER_BACKFACES = 0
|
||||
|
||||
g_vColorTint = [1.000000, 1.000000, 1.000000, 1.000000]
|
||||
g_vGlossinessRange = [0.000000, 1.000000, 0.000000, 0.000000]
|
||||
g_vNormalTexCoordScale = [1.000000, 1.000000, 0.000000, 0.000000]
|
||||
g_vTexCoordOffset = [0.000000, 0.000000, 0.000000, 0.000000]
|
||||
g_vTexCoordScale = [1.000000, 1.000000, 0.000000, 0.000000]
|
||||
g_tColor = resource:"materials/dev/primary_white_color_tga_f7b257f6.vtex"
|
||||
g_tNormal = resource:"materials/default/default_normal_tga_7652cb.vtex"
|
||||
})"),
|
||||
.mat_invs = create("materials/dev/flat_i.vmat", R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
Shader = "csgo_unlitgeneric.vfx"
|
||||
F_IGNOREZ = 1
|
||||
F_DISABLE_Z_WRITE = 1
|
||||
F_DISABLE_Z_BUFFERING = 1
|
||||
F_BLEND_MODE = 1
|
||||
F_TRANSLUCENT = 1
|
||||
g_vColorTint = [1.000000, 1.000000, 1.000000, 0.000000]
|
||||
g_vGlossinessRange = [0.000000, 1.000000, 0.000000, 0.000000]
|
||||
g_vNormalTexCoordScale = [1.000000, 1.000000, 0.000000, 0.000000]
|
||||
g_vTexCoordOffset = [0.000000, 0.000000, 0.000000, 0.000000]
|
||||
g_vTexCoordScale = [1.000000, 1.000000, 0.000000, 0.000000]
|
||||
g_tColor = resource:"materials/dev/primary_white_color_tga_f7b257f6.vtex"
|
||||
g_tNormal = resource:"materials/default/default_normal_tga_7652cb.vtex"
|
||||
})")
|
||||
};
|
||||
resourceMaterials[ILLUMINATE] = resource_material_t{
|
||||
.mat = create("materials/dev/primary_white.vmat", R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
shader = "csgo_complex.vfx"
|
||||
|
||||
F_SELF_ILLUM = 1
|
||||
F_PAINT_VERTEX_COLORS = 1
|
||||
F_TRANSLUCENT = 1
|
||||
|
||||
g_vColorTint = [ 1.000000, 1.000000, 1.000000, 1.000000 ]
|
||||
g_flSelfIllumScale = [ 3.000000, 3.000000, 3.000000, 3.000000 ]
|
||||
g_flSelfIllumBrightness = [ 3.000000, 3.000000, 3.000000, 3.000000 ]
|
||||
g_vSelfIllumTint = [ 10.000000, 10.000000, 10.000000, 10.000000 ]
|
||||
|
||||
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tSelfIllumMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
TextureAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
g_tAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
})"),
|
||||
.mat_invs = create("materials/dev/primary_white.vmat", R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
shader = "csgo_complex.vfx"
|
||||
|
||||
F_SELF_ILLUM = 1
|
||||
F_PAINT_VERTEX_COLORS = 1
|
||||
F_TRANSLUCENT = 1
|
||||
F_DISABLE_Z_BUFFERING = 1
|
||||
|
||||
g_vColorTint = [ 1.000000, 1.000000, 1.000000, 1.000000 ]
|
||||
g_flSelfIllumScale = [ 3.000000, 3.000000, 3.000000, 3.000000 ]
|
||||
g_flSelfIllumBrightness = [ 3.000000, 3.000000, 3.000000, 3.000000 ]
|
||||
g_vSelfIllumTint = [ 10.000000, 10.000000, 10.000000, 10.000000 ]
|
||||
|
||||
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tSelfIllumMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
TextureAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
g_tAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
})")
|
||||
};
|
||||
|
||||
resourceMaterials[GLOW] = resource_material_t{
|
||||
.mat = create("materials/dev/primary_white.vmat", R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
shader = "csgo_effects.vfx"
|
||||
g_flFresnelExponent = 7.0
|
||||
g_flFresnelFalloff = 10.0
|
||||
g_flFresnelMax = 0.1
|
||||
g_flFresnelMin = 1.0
|
||||
g_tColor = resource:"materials/dev/primary_white_color_tga_21186c76.vtex"
|
||||
g_tMask1 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask2 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask3 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tSceneDepth = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_flToolsVisCubemapReflectionRoughness = 1.0
|
||||
g_flBeginMixingRoughness = 1.0
|
||||
g_vColorTint = [ 1.000000, 1.000000, 1.000000, 0 ]
|
||||
F_IGNOREZ = 0
|
||||
F_TRANSLUCENT = 1
|
||||
|
||||
F_DISABLE_Z_WRITE = 0
|
||||
F_DISABLE_Z_BUFFERING = 1
|
||||
F_RENDER_BACKFACES = 0
|
||||
})"),
|
||||
|
||||
.mat_invs = create("materials/dev/primary_white.vmat", R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
shader = "csgo_effects.vfx"
|
||||
g_flFresnelExponent = 7.0
|
||||
g_flFresnelFalloff = 10.0
|
||||
g_flFresnelMax = 0.1
|
||||
g_flFresnelMin = 1.0
|
||||
g_tColor = resource:"materials/dev/primary_white_color_tga_21186c76.vtex"
|
||||
g_tMask1 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask2 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask3 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tSceneDepth = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_flToolsVisCubemapReflectionRoughness = 1.0
|
||||
g_flBeginMixingRoughness = 1.0
|
||||
g_vColorTint = [ 1.000000, 1.000000, 1.000000, 0 ]
|
||||
F_IGNOREZ = 1
|
||||
F_TRANSLUCENT = 1
|
||||
|
||||
F_DISABLE_Z_WRITE = 1
|
||||
F_DISABLE_Z_BUFFERING = 1
|
||||
F_RENDER_BACKFACES = 0
|
||||
})")
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ChamsEntity chams::GetTargetType(C_BaseEntity* render_ent) noexcept {
|
||||
auto local = H::oGetLocalPlayer(0);
|
||||
if (!local)
|
||||
return ChamsEntity::INVALID;
|
||||
|
||||
if (render_ent->IsViewmodelAttachment())
|
||||
return ChamsEntity::HANDS;
|
||||
|
||||
if (render_ent->IsViewmodel())
|
||||
return ChamsEntity::VIEWMODEL;
|
||||
|
||||
if (!render_ent->IsBasePlayer() && !render_ent->IsPlayerController())
|
||||
return ChamsEntity::INVALID;
|
||||
|
||||
auto player = (C_CSPlayerPawn*)render_ent;
|
||||
if (!player)
|
||||
return ChamsEntity::INVALID;
|
||||
|
||||
auto alive = player->m_iHealth() > 0;
|
||||
if (!alive)
|
||||
return ChamsEntity::INVALID;
|
||||
|
||||
if (player->m_iTeamNum() == local->m_iTeamNum())
|
||||
return ChamsEntity::INVALID;
|
||||
|
||||
return ChamsEntity::ENEMY;
|
||||
}
|
||||
|
||||
CMaterial2* GetMaterial(int type, bool invisible) { return invisible ? resourceMaterials[type].mat_invs : resourceMaterials[type].mat; }
|
||||
|
||||
void __fastcall chams::hook(void* a1, void* a2, CMeshData* pMeshScene, int nMeshCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2)
|
||||
{
|
||||
static auto original = H::DrawArray.GetOriginal();
|
||||
|
||||
if (!I::EngineClient->valid())
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
auto local_player = H::oGetLocalPlayer(0);
|
||||
if (!local_player)
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
if (!pMeshScene)
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
if (!pMeshScene->pSceneAnimatableObject)
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
if (nMeshCount < 1)
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
CMeshData* render_data = pMeshScene;
|
||||
if (!render_data)
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
if (!render_data->pSceneAnimatableObject)
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
auto render_ent = render_data->pSceneAnimatableObject->Owner();
|
||||
if (!render_ent.valid())
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
auto entity = I::GameEntity->Instance->Get(render_ent);
|
||||
if (!entity)
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
const auto target = GetTargetType(entity);
|
||||
|
||||
if (target == ChamsEntity::VIEWMODEL && Config::viewmodelChams) {
|
||||
pMeshScene->pMaterial = GetMaterial(Config::chamsMaterial, false);
|
||||
pMeshScene->color.r = static_cast<uint8_t>(Config::colViewmodelChams.x * 255.0f);
|
||||
pMeshScene->color.g = static_cast<uint8_t>(Config::colViewmodelChams.y * 255.0f);
|
||||
pMeshScene->color.b = static_cast<uint8_t>(Config::colViewmodelChams.z * 255.0f);
|
||||
pMeshScene->color.a = static_cast<uint8_t>(Config::colViewmodelChams.w * 255.0f);
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
}
|
||||
|
||||
if (target == ChamsEntity::HANDS && Config::armChams) {
|
||||
pMeshScene->pMaterial = GetMaterial(Config::chamsMaterial, false);
|
||||
pMeshScene->color.r = static_cast<uint8_t>(Config::colArmChams.x * 255.0f);
|
||||
pMeshScene->color.g = static_cast<uint8_t>(Config::colArmChams.y * 255.0f);
|
||||
pMeshScene->color.b = static_cast<uint8_t>(Config::colArmChams.z * 255.0f);
|
||||
pMeshScene->color.a = static_cast<uint8_t>(Config::colArmChams.w * 255.0f);
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
}
|
||||
|
||||
if (target != ENEMY)
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
bool og = !Config::enemyChams && !Config::enemyChamsInvisible;
|
||||
if (og)
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
if (Config::enemyChamsInvisible) {
|
||||
pMeshScene->pMaterial = GetMaterial(Config::chamsMaterial, true);
|
||||
pMeshScene->color.r = static_cast<uint8_t>(Config::colVisualChamsIgnoreZ.x * 255.0f);
|
||||
pMeshScene->color.g = static_cast<uint8_t>(Config::colVisualChamsIgnoreZ.y * 255.0f);
|
||||
pMeshScene->color.b = static_cast<uint8_t>(Config::colVisualChamsIgnoreZ.z * 255.0f);
|
||||
pMeshScene->color.a = static_cast<uint8_t>(Config::colVisualChamsIgnoreZ.w * 255.0f);
|
||||
|
||||
original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
}
|
||||
|
||||
if (Config::enemyChams) {
|
||||
pMeshScene->pMaterial = GetMaterial(Config::chamsMaterial, false);
|
||||
pMeshScene->color.r = static_cast<uint8_t>(Config::colVisualChams.x * 255.0f);
|
||||
pMeshScene->color.g = static_cast<uint8_t>(Config::colVisualChams.y * 255.0f);
|
||||
pMeshScene->color.b = static_cast<uint8_t>(Config::colVisualChams.z * 255.0f);
|
||||
pMeshScene->color.a = static_cast<uint8_t>(Config::colVisualChams.w * 255.0f);
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
}
|
||||
|
||||
// If we get here, neither chams type is enabled, so just render normally
|
||||
return original(a1, a2, pMeshScene, nMeshCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
}
|
||||
42
TempleWare-CS2/source/templeware/features/chams/chams.h
Normal file
42
TempleWare-CS2/source/templeware/features/chams/chams.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "../../../cs2/entity/C_BaseEntity/C_BaseEntity.h"
|
||||
#include "../../../cs2/entity/C_Material/C_Material.h"
|
||||
|
||||
#include "../../utils/math/utlstronghandle/utlstronghandle.h"
|
||||
|
||||
// forward declarations
|
||||
class CMeshData;
|
||||
|
||||
enum ChamsType {
|
||||
FLAT,
|
||||
ILLUMINATE,
|
||||
GLOW,
|
||||
MAXCOUNT
|
||||
};
|
||||
|
||||
enum ChamsEntity : std::int32_t {
|
||||
INVALID = 0,
|
||||
ENEMY,
|
||||
TEAM,
|
||||
VIEWMODEL,
|
||||
HANDS
|
||||
};
|
||||
|
||||
enum MaterialType {
|
||||
e_visible,
|
||||
e_invisible,
|
||||
e_max_material
|
||||
};
|
||||
|
||||
namespace chams
|
||||
{
|
||||
class Materials {
|
||||
public:
|
||||
bool init();
|
||||
};
|
||||
|
||||
static ChamsEntity GetTargetType(C_BaseEntity* entity) noexcept;
|
||||
CStrongHandle<CMaterial2> create(const char* name, const char szVmatBuffer[]);
|
||||
void __fastcall hook(void* pAnimatableSceneObjectDesc, void* pDx11, CMeshData* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "../../../hooks/hooks.h"
|
||||
#include "../../../config/config.h"
|
||||
|
||||
void __fastcall H::hkRenderFlashbangOverlay(void* a1, void* a2, void* a3, void* a4, void* a5) {
|
||||
if (Config::antiflash) return;
|
||||
return RenderFlashBangOverlay.GetOriginal()(a1, a2, a3, a4, a5);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "../../../hooks/hooks.h"
|
||||
#include "../../../config/config.h"
|
||||
|
||||
float H::hkGetRenderFov(void* rcx) {
|
||||
if (Config::fovEnabled) {
|
||||
float flTargetFov = Config::fov;
|
||||
g_flActiveFov = flTargetFov;
|
||||
}else
|
||||
g_flActiveFov = H::GetRenderFov.GetOriginal()(rcx);
|
||||
|
||||
return g_flActiveFov;
|
||||
}
|
||||
268
TempleWare-CS2/source/templeware/features/visuals/visuals.cpp
Normal file
268
TempleWare-CS2/source/templeware/features/visuals/visuals.cpp
Normal file
@@ -0,0 +1,268 @@
|
||||
#include "visuals.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include "../../hooks/hooks.h"
|
||||
#include "../../players/players.h"
|
||||
#include "../../utils/memory/patternscan/patternscan.h"
|
||||
#include "../../utils/memory/gaa/gaa.h"
|
||||
#include "../../../../external/imgui/imgui.h"
|
||||
#include "../../interfaces/interfaces.h"
|
||||
#include "../../config/config.h"
|
||||
#include "../../menu/menu.h"
|
||||
using namespace Esp;
|
||||
|
||||
LocalPlayerCached cached_local;
|
||||
std::vector<PlayerCache> cached_players;
|
||||
|
||||
void Visuals::init() {
|
||||
viewMatrix.viewMatrix = (viewmatrix_t*)M::getAbsoluteAddress(M::patternScan("client", "48 8D 0D ? ? ? ? 48 C1 E0 06"), 3, 0);
|
||||
}
|
||||
|
||||
void Esp::cache()
|
||||
{
|
||||
if (!I::EngineClient->valid())
|
||||
return;
|
||||
|
||||
/* Old method READ ME
|
||||
* @ // @here: manually cache once all existing entitys
|
||||
// to avoid issues when injecting mid game and hkAddEnt not called by game on existing Entity's
|
||||
|
||||
int highest_index = I::GameEntity->Instance->GetHighestEntityIndex();
|
||||
for (int i = 1; i <= highest_index; i++) {
|
||||
auto entity = I::GameEntity->Instance->Get(i);
|
||||
if (!entity)
|
||||
continue;
|
||||
|
||||
uintptr_t entityPointer = reinterpret_cast<uintptr_t>(entity);
|
||||
|
||||
SchemaClassInfoData_t* entityInfo = nullptr;
|
||||
GetSchemaClassInfo(entityPointer, &entityInfo);
|
||||
if (!entityInfo) continue;
|
||||
|
||||
if (strcmp(entityInfo->szName, "C_CSPlayerPawn") == 0) {
|
||||
bool exists = std::any_of(Players::pawns.begin(), Players::pawns.end(),
|
||||
[&](const C_CSPlayerPawn& pawn) { return pawn.getAddress() == entityPointer; });
|
||||
if (!exists) {
|
||||
Players::pawns.emplace_back(entityPointer);
|
||||
std::cout << "Added pawn " << Players::pawns.size() << "\n";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(entityInfo->szName, "CCSPlayerController") == 0) {
|
||||
bool exists = std::any_of(Players::controllers.begin(), Players::controllers.end(),
|
||||
[&](const CCSPlayerController& controller) { return controller.getAddress() == entityPointer; });
|
||||
if (!exists) {
|
||||
Players::controllers.emplace_back(entityPointer);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
|
||||
cached_players.clear();
|
||||
|
||||
int nMaxHighestEntity = I::GameEntity->Instance->GetHighestEntityIndex();
|
||||
|
||||
for (int i = 1; i <= nMaxHighestEntity; i++)
|
||||
{
|
||||
auto Entity = I::GameEntity->Instance->Get(i);
|
||||
if (!Entity)
|
||||
continue;
|
||||
|
||||
if (!Entity->handle().valid())
|
||||
continue;
|
||||
|
||||
SchemaClassInfoData_t* _class = nullptr;
|
||||
Entity->dump_class_info(&_class);
|
||||
if (!_class)
|
||||
continue;
|
||||
|
||||
const uint32_t hash = HASH(_class->szName);
|
||||
|
||||
PlayerType_t type = none;
|
||||
|
||||
if (hash == HASH("CCSPlayerController"))
|
||||
{
|
||||
|
||||
type = none; int health = 0;
|
||||
Vector_t position; Vector_t viewOffset;
|
||||
const char* name = "none"; const char* weapon_name = "none";
|
||||
|
||||
CCSPlayerController* Controller = reinterpret_cast<CCSPlayerController*>(Entity);
|
||||
if (!Controller)
|
||||
continue;
|
||||
|
||||
if (!Controller->m_hPawn().valid())
|
||||
continue;
|
||||
|
||||
//@handle caching local player
|
||||
if (Controller->IsLocalPlayer()) {
|
||||
auto LocalPlayer = I::GameEntity->Instance->Get<C_CSPlayerPawn>(Controller->m_hPawn().index());
|
||||
if (!LocalPlayer) {
|
||||
cached_local.reset();
|
||||
continue;
|
||||
}
|
||||
|
||||
cached_local.alive = LocalPlayer->m_iHealth() > 0;
|
||||
if (LocalPlayer->m_iHealth() > 0) {
|
||||
cached_local.poisition = LocalPlayer->m_vOldOrigin();
|
||||
cached_local.health = LocalPlayer->m_iHealth();
|
||||
cached_local.handle = LocalPlayer->handle().index();
|
||||
cached_local.team = LocalPlayer->m_iTeamNum();
|
||||
}
|
||||
else {
|
||||
cached_local.reset();
|
||||
}
|
||||
}
|
||||
else // @handle only players
|
||||
{
|
||||
auto Player = I::GameEntity->Instance->Get<C_CSPlayerPawn>(Controller->m_hPawn().index());
|
||||
if (!Player)
|
||||
continue;
|
||||
|
||||
if (Player->m_iHealth() <= 0)
|
||||
continue;
|
||||
|
||||
health = Player->m_iHealth();
|
||||
name = Controller->m_sSanitizedPlayerName();
|
||||
position = Player->m_vOldOrigin(); viewOffset = Player->m_vecViewOffset();
|
||||
|
||||
cached_players.emplace_back(Entity, Player, Player->handle(),
|
||||
type, health, name,
|
||||
weapon_name, position, viewOffset, Player->m_iTeamNum());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Visuals::esp() {
|
||||
// Only proceed if at least one ESP component is enabled
|
||||
if (!Config::esp && !Config::showHealth && !Config::espFill && !Config::showNameTags) {
|
||||
return; // Exit early if no component is enabled
|
||||
}
|
||||
|
||||
//@better example of getting local pawn
|
||||
C_CSPlayerPawn* localPawn = H::oGetLocalPlayer(0);
|
||||
if (!localPawn) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cached_players.empty())
|
||||
return;
|
||||
|
||||
for (const auto& Player : cached_players)
|
||||
{
|
||||
|
||||
if (!Player.handle.valid() || Player.health <= 0 || Player.handle.index() == INVALID_EHANDLE_INDEX)
|
||||
continue;
|
||||
|
||||
if (Config::teamCheck && (Player.team_num == cached_local.team))
|
||||
continue;
|
||||
|
||||
ImDrawList* drawList = ImGui::GetBackgroundDrawList();
|
||||
Vector_t feetPos = Player.position;
|
||||
Vector_t headPos = Player.position + Player.viewOffset;
|
||||
|
||||
Vector_t feetScreen, headScreen;
|
||||
if (!viewMatrix.WorldToScreen(feetPos, feetScreen) ||
|
||||
!viewMatrix.WorldToScreen(headPos, headScreen))
|
||||
continue;
|
||||
|
||||
float boxHeight = (feetScreen.y - headScreen.y) * 1.3f;
|
||||
float boxWidth = boxHeight / 2.0f;
|
||||
|
||||
float centerX = (feetScreen.x + headScreen.x) / 2.0f;
|
||||
float boxX = centerX - (boxWidth / 2.0f);
|
||||
|
||||
float boxY = headScreen.y - (boxHeight - (feetScreen.y - headScreen.y)) / 2.0f;
|
||||
|
||||
ImVec4 espColorWithAlpha = Config::espColor;
|
||||
espColorWithAlpha.w = Config::espFillOpacity;
|
||||
ImU32 boxColor = ImGui::ColorConvertFloat4ToU32(Config::espColor);
|
||||
ImU32 fillColor = ImGui::ColorConvertFloat4ToU32(espColorWithAlpha);
|
||||
|
||||
// ESP Fill
|
||||
if (Config::espFill) {
|
||||
drawList->AddRectFilled(
|
||||
ImVec2(boxX, boxY),
|
||||
ImVec2(boxX + boxWidth, boxY + boxHeight),
|
||||
fillColor
|
||||
);
|
||||
}
|
||||
|
||||
// ESP Box - only render if Config::esp is enabled
|
||||
if (Config::esp) {
|
||||
drawList->AddRect(
|
||||
ImVec2(boxX, boxY),
|
||||
ImVec2(boxX + boxWidth, boxY + boxHeight),
|
||||
boxColor,
|
||||
0.0f,
|
||||
0,
|
||||
Config::espThickness
|
||||
);
|
||||
}
|
||||
|
||||
// Health Bar
|
||||
if (Config::showHealth) {
|
||||
int health = Player.health;
|
||||
float healthHeight = boxHeight * (static_cast<float>(health) / 100.0f);
|
||||
float barWidth = 4.0f;
|
||||
float barX = boxX - (barWidth + 2);
|
||||
float barY = boxY + (boxHeight - healthHeight);
|
||||
|
||||
drawList->AddRectFilled(
|
||||
ImVec2(barX, boxY),
|
||||
ImVec2(barX + barWidth, boxY + boxHeight),
|
||||
IM_COL32(70, 70, 70, 255)
|
||||
);
|
||||
|
||||
ImU32 healthColor = IM_COL32(
|
||||
static_cast<int>((100 - health) * 2.55f),
|
||||
static_cast<int>(health * 2.55f),
|
||||
0,
|
||||
255
|
||||
);
|
||||
drawList->AddRectFilled(
|
||||
ImVec2(barX, barY),
|
||||
ImVec2(barX + barWidth, barY + healthHeight),
|
||||
healthColor
|
||||
);
|
||||
|
||||
std::string displayText = "[" + std::to_string(health) + "HP]";
|
||||
ImVec2 textSize = ImGui::CalcTextSize(displayText.c_str());
|
||||
float textX = boxX + (boxWidth - textSize.x) / 2;
|
||||
float textY = boxY + boxHeight + 2;
|
||||
drawList->AddText(
|
||||
ImVec2(textX + 1, textY + 1),
|
||||
IM_COL32(0, 0, 0, 255),
|
||||
displayText.c_str()
|
||||
);
|
||||
drawList->AddText(
|
||||
ImVec2(textX, textY),
|
||||
IM_COL32(255, 255, 255, 255),
|
||||
displayText.c_str()
|
||||
);
|
||||
}
|
||||
|
||||
if (Config::showNameTags) {
|
||||
std::string playerName = Player.name;
|
||||
ImVec2 nameSize = ImGui::CalcTextSize(playerName.c_str());
|
||||
|
||||
float nameX = boxX + (boxWidth - nameSize.x) / 2;
|
||||
float nameY = boxY - nameSize.y - 2;
|
||||
|
||||
//@FIXME: shit method to do outline
|
||||
drawList->AddText(
|
||||
ImVec2(nameX + 1, nameY + 1),
|
||||
IM_COL32(0, 0, 0, 255),
|
||||
playerName.c_str()
|
||||
);
|
||||
|
||||
drawList->AddText(
|
||||
ImVec2(nameX, nameY),
|
||||
IM_COL32(255, 255, 255, 255),
|
||||
playerName.c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
60
TempleWare-CS2/source/templeware/features/visuals/visuals.h
Normal file
60
TempleWare-CS2/source/templeware/features/visuals/visuals.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
#include "../../utils/math/viewmatrix/viewmatrix.h"
|
||||
#include "..\..\..\cs2\entity\C_CSPlayerPawn\C_CSPlayerPawn.h"
|
||||
#include "..\..\..\cs2\entity\C_BaseEntity\C_BaseEntity.h"
|
||||
|
||||
class LocalPlayerCached {
|
||||
public:
|
||||
int handle;
|
||||
int health;
|
||||
int team;
|
||||
bool alive;
|
||||
Vector_t poisition;
|
||||
void reset() {
|
||||
poisition = Vector_t();
|
||||
team = 0;
|
||||
health = 0;
|
||||
handle = 0;
|
||||
alive = false;
|
||||
}
|
||||
};
|
||||
|
||||
enum PlayerType_t : int
|
||||
{
|
||||
none = -1,
|
||||
enemy = 0,
|
||||
team = 1,
|
||||
};
|
||||
|
||||
struct PlayerCache
|
||||
{
|
||||
PlayerCache(C_BaseEntity* a1, C_CSPlayerPawn* plyr, CBaseHandle hdl, PlayerType_t typ, int hp, const char* nm,
|
||||
const char* wep_name, Vector_t pos, Vector_t viewOff, int teamnm) :
|
||||
entity(a1), player(plyr), handle(hdl), type(typ), health(hp), name(nm),
|
||||
weapon_name(wep_name), position(pos), viewOffset(viewOff), team_num(teamnm) { }
|
||||
|
||||
C_BaseEntity* entity;
|
||||
C_CSPlayerPawn* player;
|
||||
CBaseHandle handle;
|
||||
PlayerType_t type;
|
||||
int health;
|
||||
const char* name;
|
||||
const char* weapon_name;
|
||||
Vector_t position;
|
||||
Vector_t viewOffset;
|
||||
int team_num;
|
||||
};
|
||||
|
||||
namespace Esp {
|
||||
class Visuals {
|
||||
public:
|
||||
void init();
|
||||
void esp();
|
||||
private:
|
||||
ViewMatrix viewMatrix;
|
||||
};
|
||||
void cache();
|
||||
}
|
||||
|
||||
extern LocalPlayerCached cached_local;
|
||||
extern std::vector<PlayerCache> cached_players;
|
||||
43
TempleWare-CS2/source/templeware/features/world/world.cpp
Normal file
43
TempleWare-CS2/source/templeware/features/world/world.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include "../../hooks/hooks.h"
|
||||
#include "../../players/players.h"
|
||||
#include "../../config/config.h"
|
||||
#include "../../../../external/imgui/imgui.h"
|
||||
|
||||
|
||||
void reset_walls(C_AggregateSceneObject* object) {
|
||||
for (int i = 0; i < object->m_nCount; i++) {
|
||||
object->m_pData[i].r = 255;
|
||||
object->m_pData[i].g = 255;
|
||||
object->m_pData[i].b = 255;
|
||||
}
|
||||
}
|
||||
|
||||
void apply_walls(C_AggregateSceneObject* object, ImVec4 colors) {
|
||||
for (int i = 0; i < object->m_nCount; i++) {
|
||||
object->m_pData[i].r = static_cast<uint8_t>(colors.x * 255.0f);
|
||||
object->m_pData[i].g = static_cast<uint8_t>(colors.y * 255.0f);
|
||||
object->m_pData[i].b = static_cast<uint8_t>(colors.z * 255.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void* __fastcall H::hkUpdateSceneObject(C_AggregateSceneObject* object, void* unk)
|
||||
{
|
||||
static auto update_walls_object = UpdateWallsObject.GetOriginal();
|
||||
auto result = update_walls_object(object, unk);
|
||||
auto colors = Config::NightColor;
|
||||
|
||||
if (object) {
|
||||
if (Config::Night) {
|
||||
apply_walls(object, colors);
|
||||
}
|
||||
else {
|
||||
reset_walls(object);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user