This commit is contained in:
Oscar 2025-07-25 21:45:33 +03:00
parent 1edd51c46f
commit 50f4002acc
396 changed files with 243692 additions and 86 deletions

View File

@ -390,129 +390,256 @@ void Aimbot() {
prevAimbotState = aimbotActive; prevAimbotState = aimbotActive;
} }
//void SilentAimbot(CUserCmd* pCmd) {
// if (!Config::silent_aim || !pCmd) return;
// static C_CSPlayerPawn* lockedTarget = nullptr;
// static bool prevSilentState = false;
// static QAngle_t last_punch_angle = {0,0,0};
// static int shotCount = 0;
// C_CSPlayerPawn* lp = H::oGetLocalPlayer(0);
// if (!lp || !lp->handle().valid() || lp->getHealth() <= 0) return;
// Vector_t lep = GetEntityEyePos(lp);
// QAngle_t* cur = (QAngle_t*)(modules.getModule("client") + 0x1A78650);
// if (!cur) return;
// bool silentActive = Config::always_on_silent_aim ? true : (GetAsyncKeyState(Config::silent_aim_key) & 0x8000);
// // --- shooterAfterAim + triggerbot_key для сайлент аимбота ---
// if (Config::silent_shooterAfterAim && (GetAsyncKeyState(Config::triggerbot_key) & 0x8000)) {
// silentActive = true;
// }
// int shotsFired = lp ? lp->getShotsFired() : 0;
// shotCount = shotsFired;
//
// // Если кнопка только что нажата — ищем новую цель
// if (silentActive && !prevSilentState) {
// 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) continue;
// 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 target_pos = GetAimbotTargetPos(pawn, lep, *cur);
// QAngle_t angle = CalcAngles(target_pos, lep);
// angle.x *= -1.f;
// angle.y += 180.f;
// float fov = GetFov(*cur, angle);
// if (!std::isfinite(fov) || fov > bestFov) continue;
// bestFov = fov;
// bestTarget = pawn;
// bestAngle = angle;
// }
// }
// lockedTarget = bestTarget;
// last_punch_angle = {0,0,0};
// }
//
// // Если кнопка зажата, цели нет — постоянный поиск цели
// if (silentActive && !lockedTarget) {
// 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) continue;
// 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 target_pos = GetAimbotTargetPos(pawn, lep, *cur);
// QAngle_t angle = CalcAngles(target_pos, lep);
// angle.x *= -1.f;
// angle.y += 180.f;
// float fov = GetFov(*cur, angle);
// if (!std::isfinite(fov) || fov > bestFov) continue;
// bestFov = fov;
// bestTarget = pawn;
// bestAngle = angle;
// }
// }
// lockedTarget = bestTarget;
// last_punch_angle = {0,0,0};
// }
//
// // Если кнопка отпущена — сбрасываем захват
// if (!silentActive) {
// lockedTarget = nullptr;
// last_punch_angle = {0,0,0};
// }
//
// // Если есть захваченная цель и кнопка удерживается
// if (silentActive && lockedTarget) {
// // Проверяем, что цель всё ещё валидна
// if (!lp || !lp->handle().valid() || lp->getHealth() <= 0 ||
// lockedTarget->get_entity_by_handle() == lp->get_entity_by_handle() ||
// lockedTarget->getHealth() <= 0 ||
// !lockedTarget->handle().valid() ||
// (Config::team_check && lockedTarget->getTeam() == lp->getTeam())) {
// lockedTarget = nullptr;
// last_punch_angle = {0,0,0};
// prevSilentState = silentActive;
// return;
// }
// Vector_t target_pos = GetAimbotTargetPos(lockedTarget, lep, *cur);
// QAngle_t angle = CalcAngles(target_pos, lep);
// angle.x *= -1.f;
// angle.y += 180.f;
// //QAngle_t cur_punch_angle = *(QAngle_t*)((uintptr_t)lp + SchemaFinder::Get(hash_32_fnv1a_const("C_CSPlayerPawn->m_aimPunchAngle")));
// //// --- RCS ---
// //bool rcsActive = (Config::rcs || Config::silent_shooterAfterAim) && (shotCount > Config::rcsActivationShots);
// //if (rcsActive && shotCount > 1) {
// // angle -= cur_punch_angle * 2.f;
// // last_punch_angle = cur_punch_angle;
// //} else {
// // last_punch_angle = {0,0,0};
// //}
// //angle.z = 0.f;
// //angle = angle.Normalize();
// // --- Smooth ---
// if (Config::silent_aim_smooth > 0.f) {
// QAngle_t delta = (angle - *cur).Normalize();
// float smooth = Config::silent_aim_smooth;
// angle = *cur + delta * (1.f / smooth);
// angle = angle.Normalize();
// }
// *cur = angle;
// }
// prevSilentState = silentActive;
//}
//
void SilentAimbot(CUserCmd* pCmd) { void SilentAimbot(CUserCmd* pCmd) {
// --- Silent Aim: чистая и безопасная реализация ---
if (!Config::silent_aim || !pCmd) return; if (!Config::silent_aim || !pCmd) return;
static C_CSPlayerPawn* lockedTarget = nullptr; static C_CSPlayerPawn* lockedTarget = nullptr;
static bool prevSilentState = false; static bool prevSilentState = false;
static QAngle_t last_punch_angle = {0,0,0}; static QAngle_t last_punch_angle = { 0,0,0 };
static int shotCount = 0; static int shotCount = 0;
static bool targetWasLost = false;
static bool targetWasLockedThisPress = false;
C_CSPlayerPawn* lp = H::oGetLocalPlayer(0); C_CSPlayerPawn* lp = H::oGetLocalPlayer(0);
if (!lp || !lp->handle().valid() || lp->getHealth() <= 0) return; if (!lp || !lp->handle().valid() || lp->getHealth() <= 0) return;
Vector_t lep = GetEntityEyePos(lp); Vector_t lep = GetEntityEyePos(lp);
// Получаем viewangles только из CUserCmd!
QAngle_t* cur = (QAngle_t*)(modules.getModule("client") + 0x1A78650); QAngle_t* cur = (QAngle_t*)(modules.getModule("client") + 0x1A78650);
if (!cur) return; if (!cur) return;
// --- Кнопка активации ---
bool silentActive = Config::always_on_silent_aim ? true : (GetAsyncKeyState(Config::silent_aim_key) & 0x8000); bool silentActive = Config::always_on_silent_aim ? true : (GetAsyncKeyState(Config::silent_aim_key) & 0x8000);
// --- shooterAfterAim + triggerbot_key для сайлент аимбота ---
if (Config::silent_shooterAfterAim && (GetAsyncKeyState(Config::triggerbot_key) & 0x8000)) { if (Config::silent_shooterAfterAim && (GetAsyncKeyState(Config::triggerbot_key) & 0x8000)) {
silentActive = true; silentActive = true;
} }
int shotsFired = lp ? lp->getShotsFired() : 0; int shotsFired = lp ? lp->getShotsFired() : 0;
shotCount = shotsFired; shotCount = shotsFired;
// --- Сброс флагов при новом нажатии ---
// Если кнопка только что нажата — ищем новую цель
if (silentActive && !prevSilentState) { if (silentActive && !prevSilentState) {
int nMaxHighestEntity = I::GameEntity->Instance->GetHighestEntityIndex(); targetWasLost = false;
float bestFov = Config::aimbot_fov; targetWasLockedThisPress = false;
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) continue;
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 target_pos = GetAimbotTargetPos(pawn, lep, *cur);
QAngle_t angle = CalcAngles(target_pos, lep);
angle.x *= -1.f;
angle.y += 180.f;
float fov = GetFov(*cur, angle);
if (!std::isfinite(fov) || fov > bestFov) continue;
bestFov = fov;
bestTarget = pawn;
bestAngle = angle;
}
}
lockedTarget = bestTarget;
last_punch_angle = {0,0,0};
} }
// --- Поиск цели ---
// Если кнопка зажата, цели нет — постоянный поиск цели
if (silentActive && !lockedTarget) { if (silentActive && !lockedTarget) {
int nMaxHighestEntity = I::GameEntity->Instance->GetHighestEntityIndex(); if ((!targetWasLost && !targetWasLockedThisPress)) {
float bestFov = Config::aimbot_fov; int nMaxHighestEntity = I::GameEntity->Instance->GetHighestEntityIndex();
C_CSPlayerPawn* bestTarget = nullptr; float bestFov = Config::silent_aim_fov;
QAngle_t bestAngle = { 0, 0, 0 }; C_CSPlayerPawn* bestTarget = nullptr;
for (int i = 1; i <= nMaxHighestEntity; i++) { QAngle_t bestAngle = { 0, 0, 0 };
auto Entity = I::GameEntity->Instance->Get(i); for (int i = 1; i <= nMaxHighestEntity; i++) {
if (!Entity) continue; auto Entity = I::GameEntity->Instance->Get(i);
if (!Entity->handle().valid()) continue; if (!Entity) continue;
SchemaClassInfoData_t* _class = nullptr; if (!Entity->handle().valid()) continue;
Entity->dump_class_info(&_class); SchemaClassInfoData_t* _class = nullptr;
if (!_class) continue; Entity->dump_class_info(&_class);
const uint32_t hash = HASH(_class->szName); if (!_class) continue;
if (hash == HASH("C_CSPlayerPawn")) { const uint32_t hash = HASH(_class->szName);
C_CSPlayerPawn* pawn = (C_CSPlayerPawn*)Entity; if (hash == HASH("C_CSPlayerPawn")) {
if (!pawn) continue; C_CSPlayerPawn* pawn = (C_CSPlayerPawn*)Entity;
if (pawn->get_entity_by_handle() == lp->get_entity_by_handle()) continue; if (!pawn) continue;
if (pawn->getHealth() <= 0) continue; if (pawn->get_entity_by_handle() == lp->get_entity_by_handle()) continue;
if (Config::team_check && pawn->getTeam() == lp->getTeam()) continue; if (pawn->getHealth() <= 0) continue;
Vector_t target_pos = GetAimbotTargetPos(pawn, lep, *cur); if (Config::team_check && pawn->getTeam() == lp->getTeam()) continue;
QAngle_t angle = CalcAngles(target_pos, lep); // --- Выбор кости для silent aim ---
angle.x *= -1.f; Vector_t target_pos;
angle.y += 180.f; switch (Config::silent_aim_bone) {
float fov = GetFov(*cur, angle); case Config::BONE_HEAD:
if (!std::isfinite(fov) || fov > bestFov) continue; target_pos = GetBonePosition(pawn, BONE_INDEX_HEAD); break;
bestFov = fov; case Config::BONE_NECK:
bestTarget = pawn; target_pos = GetBonePosition(pawn, BONE_INDEX_NECK); break;
bestAngle = angle; case Config::BONE_BODY:
target_pos = GetBonePosition(pawn, BONE_INDEX_BODY); break;
case Config::BONE_NEAREST:
default:
target_pos = GetAimbotTargetPos(pawn, lep, *cur); break;
}
QAngle_t angle = CalcAngles(target_pos, lep);
angle.x *= -1.f;
angle.y += 180.f;
float fov = GetFov(*cur, angle);
if (!std::isfinite(fov) || fov > bestFov) continue;
bestFov = fov;
bestTarget = pawn;
bestAngle = angle;
}
} }
lockedTarget = bestTarget;
last_punch_angle = { 0,0,0 };
if (lockedTarget) targetWasLockedThisPress = true;
if (!lockedTarget) targetWasLost = true;
} }
lockedTarget = bestTarget;
last_punch_angle = {0,0,0};
} }
// --- Сброс при отпускании кнопки ---
// Если кнопка отпущена — сбрасываем захват
if (!silentActive) { if (!silentActive) {
lockedTarget = nullptr; lockedTarget = nullptr;
last_punch_angle = {0,0,0}; last_punch_angle = { 0,0,0 };
targetWasLost = false;
targetWasLockedThisPress = false;
} }
// --- Наведение на цель ---
// Если есть захваченная цель и кнопка удерживается
if (silentActive && lockedTarget) { if (silentActive && lockedTarget) {
// Проверяем, что цель всё ещё валидна // Проверка валидности цели
if (!lp || !lp->handle().valid() || lp->getHealth() <= 0 || if (!lp || !lp->handle().valid() || lp->getHealth() <= 0 ||
lockedTarget->get_entity_by_handle() == lp->get_entity_by_handle() || lockedTarget->get_entity_by_handle() == lp->get_entity_by_handle() ||
lockedTarget->getHealth() <= 0 || lockedTarget->getHealth() <= 0 ||
!lockedTarget->handle().valid() || !lockedTarget->handle().valid() ||
(Config::team_check && lockedTarget->getTeam() == lp->getTeam())) { (Config::team_check && lockedTarget->getTeam() == lp->getTeam())) {
lockedTarget = nullptr; lockedTarget = nullptr;
last_punch_angle = {0,0,0}; last_punch_angle = { 0,0,0 };
targetWasLost = true;
prevSilentState = silentActive; prevSilentState = silentActive;
return; return;
} }
Vector_t target_pos = GetAimbotTargetPos(lockedTarget, lep, *cur); // --- Выбор кости для silent aim ---
Vector_t target_pos;
switch (Config::silent_aim_bone) {
case Config::BONE_HEAD:
target_pos = GetBonePosition(lockedTarget, BONE_INDEX_HEAD); break;
case Config::BONE_NECK:
target_pos = GetBonePosition(lockedTarget, BONE_INDEX_NECK); break;
case Config::BONE_BODY:
target_pos = GetBonePosition(lockedTarget, BONE_INDEX_BODY); break;
case Config::BONE_NEAREST:
default:
target_pos = GetAimbotTargetPos(lockedTarget, lep, *cur); break;
}
QAngle_t angle = CalcAngles(target_pos, lep); QAngle_t angle = CalcAngles(target_pos, lep);
angle.x *= -1.f; angle.x *= -1.f;
angle.y += 180.f; angle.y += 180.f;
//QAngle_t cur_punch_angle = *(QAngle_t*)((uintptr_t)lp + SchemaFinder::Get(hash_32_fnv1a_const("C_CSPlayerPawn->m_aimPunchAngle")));
//// --- RCS ---
//bool rcsActive = (Config::rcs || Config::silent_shooterAfterAim) && (shotCount > Config::rcsActivationShots);
//if (rcsActive && shotCount > 1) {
// angle -= cur_punch_angle * 2.f;
// last_punch_angle = cur_punch_angle;
//} else {
// last_punch_angle = {0,0,0};
//}
//angle.z = 0.f;
//angle = angle.Normalize();
// --- Smooth --- // --- Smooth ---
if (Config::silent_aim_smooth > 0.f) { if (Config::silent_aim_smooth > 0.f) {
QAngle_t delta = (angle - *cur).Normalize(); QAngle_t delta = (angle - *cur).Normalize();
@ -523,4 +650,4 @@ void SilentAimbot(CUserCmd* pCmd) {
*cur = angle; *cur = angle;
} }
prevSilentState = silentActive; prevSilentState = silentActive;
} }

View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 T1GXR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,52 @@
# Axion-CS2-RAGE-CHEAT
+ The source code of AXION CS2 internal rage cheat.
+ It's made on asphyxia base and has some features implemented from csgo cheats like Pandora.
+ I decided to make it public beacause it has been sold for 75$ and then leaked on the internet.
+ It has some great features but it can't be used for hvh because its preety buggy.
+ The cheat might get you VAC banned so only use it at your own risk (better on non prime accounts).
# Status: Needs update!
I don't have time to work on it anymore because of lack of time and other personal projects but I'll let it for the community.
If you are trying to fix it, you have to:
- Update the schema (take it from asphyxia because it's the same)
- Update the signatures (You can find them in hooks.cpp/hooks.h).
- Make sure you build it on publish and not on release. (If you build on release you will get a lot of errors)
- Make sure you include everything required in the project settings!
# PREVIEW
![Screenshot 2024-04-14 175107](https://github.com/T1GxR/AxionCS2-RAGE-CHEAT/assets/106729571/df318ac7-1723-43c0-bc00-d5900812df52)
![Screenshot 2024-04-14 175057](https://github.com/T1GxR/AxionCS2-RAGE-CHEAT/assets/106729571/2496ee46-667e-47b6-b1c7-8c97c18f88bf)
![Screenshot 2024-04-14 175032](https://github.com/T1GxR/AxionCS2-RAGE-CHEAT/assets/106729571/719246a9-4812-4134-a269-efadf648d78c)
![Screenshot 2024-04-14 175018](https://github.com/T1GxR/AxionCS2-RAGE-CHEAT/assets/106729571/3f80c0a0-96f4-432f-b55f-e2232297b323)
![Screenshot 2024-04-14 175010](https://github.com/T1GxR/AxionCS2-RAGE-CHEAT/assets/106729571/7535baf2-577a-4ae5-8bd3-39cf2a53a6d6)
# Features:
+ RAGE BOT:
- Rapid Fire
- Anti Aim (Jitter)
- Multipoint
- PSilent
+ Visual:
- ESP (BOX, SKELETON AND MORE)
- CHAMS
- ITEM ESP
- FLAGS
- FOV changer
+ Misc:
- Night mode
- Sky box changer
- No flash
- No smoke
- Third person
- No impact
+ Other features:
- Inventory changer with item dump
- In game skin changer
- Configs tab (Path: Documents/.cs2/settings)
- Plant bomb anywhere (only works at the beginning of the round for a second only)
- AND MORE
# TO-DO
+ Improve the rage tab and some miscellaneous features because they were created to manipulate the game server and they only work on local games/practice games. Basically on higher ping games, the rage is completely useless, as well as bhop which makes the character fly while holding space. All those bugs can be fixed if you know what to do.

View File

@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33801.447
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cstrike", "cstrike\cstrike.vcxproj", "{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Developer|x64 = Developer|x64
Distrib|x64 = Distrib|x64
Publish|x64 = Publish|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Debug|x64.ActiveCfg = Debug|x64
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Debug|x64.Build.0 = Debug|x64
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Developer|x64.ActiveCfg = Developer|x64
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Developer|x64.Build.0 = Developer|x64
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Distrib|x64.ActiveCfg = Distrib|x64
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Distrib|x64.Build.0 = Distrib|x64
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Publish|x64.ActiveCfg = Publish|x64
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Publish|x64.Build.0 = Publish|x64
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Release|x64.ActiveCfg = Release|x64
{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0BA324F3-F438-4261-89D4-5AF13CD1FA32}
EndGlobalSection
EndGlobal

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

View File

@ -0,0 +1,251 @@
#pragma once
/*
* current build of cheat, change this when you made noticeable changes
* - used for automatic adaptation mechanism of configuration files from previous versions
*/
#define CS_VERSION 2000
#pragma section(".text")
__declspec(allocate(".text")) const unsigned char _fake_addr[] = { 0xFF, 0x23 };
/*
* game's modules
*/
#define CLIENT_DLL CS_XOR(L"client.dll")
#define SERVER_DLL CS_XOR(L"server.dll")
#define ENGINE2_DLL CS_XOR(L"engine2.dll")
#define SCHEMASYSTEM_DLL CS_XOR(L"schemasystem.dll")
#define INPUTSYSTEM_DLL CS_XOR(L"inputsystem.dll")
#define SDL3_DLL CS_XOR(L"SDL3.dll")
#define TIER0_DLL CS_XOR(L"tier0.dll")
#define ENGINE2_DLL CS_XOR(L"engine2.dll")
#define NAVSYSTEM_DLL CS_XOR(L"navsystem.dll")
#define RENDERSYSTEM_DLL CS_XOR(L"rendersystemdx11.dll")
#define LOCALIZE_DLL CS_XOR(L"localize.dll")
#define DBGHELP_DLL CS_XOR(L"dbghelp.dll")
#define GAMEOVERLAYRENDERER_DLL CS_XOR(L"GameOverlayRenderer64.dll")
#define PARTICLES_DLL CS_XOR(L"particles.dll")
#define SCENESYSTEM_DLL CS_XOR(L"scenesystem.dll")
#define MATERIAL_SYSTEM2_DLL CS_XOR(L"materialsystem2.dll")
#define MATCHMAKING_DLL CS_XOR(L"matchmaking.dll")
#define RESOURCESYSTEM_DLL CS_XOR(L"resourcesystem.dll")
/*
* define to specify default string encryption
*/
#ifdef _DEBUG
#define CS_XOR(STRING) STRING
#else
#define JM_XORSTR_DISABLE_AVX_INTRINSICS
// used: string encryption
#include "xorstr.h"
#define CS_XOR(STRING) xorstr_(STRING)
#endif
// define to enable logging output to console
#ifdef _DEBUG
#define CS_LOG_CONSOLE
#endif
// define to enable logging output to file
#define CS_LOG_FILE
// define to enable additional run-time checks
#ifdef _DEBUG
#define CS_PARANOID
#endif
/*
* define to search all possible occurrences for pattern and log if pattern isn't unique
* - useful for keeping patterns up to date and preventing possible inconsistent behavior
*/
#ifdef _DEBUG
#define CS_PARANOID_PATTERN_UNIQUENESS
#endif
/*
* define to overwrite configuration file formatter implementation
*/
#define CS_CONFIGURATION_BINARY
// name of the default configuration file
#define CS_CONFIGURATION_DEFAULT_FILE_NAME L"default"
// define to force disable behavior based on "Run-Time Type Information", even if available
//#define CS_NO_RTTI
// @todo: use #warning instead of static asserts when c++23 comes out
#pragma region common_architecture_specific
#if defined(i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__i386) || defined(_M_IX86) || defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || defined(__INTEL__)
#define CS_ARCH_X86
#elif defined(__LP64__) || (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || defined(__ia64) || defined(_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
#define CS_ARCH_X64
#else
static_assert(false, "could not determine the target architecture, consider define it manually!");
#endif
#pragma region common_compiler_specific
#ifdef _MSC_VER
#define CS_COMPILER_MSC
#endif
#ifdef __clang__ // @note: clang-cl have defined both 'CS_COMPILER_CLANG' and 'CS_COMPILER_MSC'
#define CS_COMPILER_CLANG
#endif
#ifdef __has_builtin
#define CS_HAS_BUILTIN(BUILTIN) __has_builtin(BUILTIN)
#else
#define CS_HAS_BUILTIN(BUILTIN) 0
#endif
#ifdef CS_COMPILER_MSC
// treat "discarding return value of function with 'nodiscard' attribute" warning as error
#pragma warning(error: 4834)
#endif
#ifdef CS_COMPILER_CLANG
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#if defined(CS_COMPILER_MSC) || defined(CS_COMPILER_CLANG)
#define CS_NAKED __declspec(naked)
#endif
// @todo: platform dependent / but currently we shouldn't give fuck on it
#define CS_CDECL __cdecl
#define CS_STDCALL __stdcall
#define CS_FASTCALL __fastcall
#define CS_THISCALL __thiscall
#define CS_VECTORCALL __vectorcall
#pragma endregion
#pragma region common_implementation_specific
#define _CS_INTERNAL_CONCATENATE(LEFT, RIGHT) LEFT##RIGHT
#define _CS_INTERNAL_STRINGIFY(NAME) #NAME
#define _CS_INTERNAL_UNPARENTHESIZE(...) __VA_ARGS__
// convert plain text to string
#define CS_STRINGIFY(NAME) _CS_INTERNAL_STRINGIFY(NAME)
// concatenate plain text
#define CS_CONCATENATE(LEFT, RIGHT) _CS_INTERNAL_CONCATENATE(LEFT, RIGHT)
// unparenthesize variadic arguments
#define CS_UNPARENTHESIZE(...) _CS_INTERNAL_UNPARENTHESIZE(__VA_ARGS__)
// calculate elements count of fixed-size C array
#define CS_ARRAYSIZE(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
// calculate the offset of a struct member variable, in bytes
#if defined(_CRT_USE_BUILTIN_OFFSETOF) || CS_HAS_BUILTIN(__builtin_offsetof)
#define CS_OFFSETOF(STRUCT, MEMBER) __builtin_offsetof(STRUCT, MEMBER)
#else
#define CS_OFFSETOF(STRUCT, MEMBER) reinterpret_cast<std::size_t>(std::addressof(static_cast<STRUCT*>(nullptr)->MEMBER))
#endif
#ifndef CS_NO_RTTI
#if defined(CS_COMPILER_MSC) && !defined(_CPPRTTI)
#define CS_NO_RTTI
#elif defined(CS_COMPILER_CLANG)
#if !__has_feature(cxx_rtti)
#define CS_NO_RTTI
#endif
#endif
#endif
#ifndef CS_INLINE
#if defined(CS_COMPILER_MSC)
#define CS_INLINE __forceinline
#else
// referenced to clang documentation, this is enough: https://clang.llvm.org/compatibility.html
#define CS_INLINE inline
#endif
#endif
#ifndef CS_RETURN_ADDRESS
#if defined(CS_COMPILER_MSC)
#define CS_RETURN_ADDRESS() _ReturnAddress()
#elif defined(CS_COMPILER_CLANG)
#define CS_RETURN_ADDRESS() __builtin_return_address(0)
#else
static_assert(false, "it is expected you to define CS_RETURN_ADDRESS() into something that will get the return address off the stack!")
#define CS_RETURN_ADDRESS()
#endif
#endif
#ifndef CS_FRAME_ADDRESS
#if defined(CS_COMPILER_MSC)
#define CS_FRAME_ADDRESS() _AddressOfReturnAddress()
#elif defined(CS_COMPILER_CLANG)
// @note: it isn't always what we're expecting, compiler dependent
#define CS_FRAME_ADDRESS() __builtin_frame_address(0)
#else
static_assert(false, "it is expected you to define CS_FRAME_ADDRESS() into something that will get the address of the method's stack frame!")
#define CS_FRAME_ADDRESS()
#endif
#endif
#ifndef CS_DEBUG_BREAK
#if defined(CS_COMPILER_MSC)
#define CS_DEBUG_BREAK() __debugbreak()
#elif defined(CS_COMPILER_CLANG)
#define CS_DEBUG_BREAK() __builtin_debugtrap()
#else
static_assert(false, "it is expected you to define CS_DEBUG_BREAK() into something that will break in a debugger!");
#define CS_DEBUG_BREAK()
#endif
#endif
#ifndef CS_ASSERT
#ifdef _DEBUG
#define CS_ASSERT(EXPRESSION) static_cast<void>(!!(EXPRESSION) || (CS_DEBUG_BREAK(), 0))
#else
// disable assertion for release builds
#define CS_ASSERT(EXPRESSION) static_cast<void>(0)
#endif
#endif
#if !defined(CS_CONFIGURATION_BINARY) && !defined(CS_CONFIGURATION_JSON) && !defined(CS_CONFIGURATION_TOML)
static_assert(false, "it is expected you to define one of the available configuration file formatters!");
// fallback to binary formatter by default
#define CS_CONFIGURATION_BINARY
#endif
#ifndef CS_CONFIGURATION_FILE_EXTENSION
#if defined(CS_CONFIGURATION_BINARY)
#define CS_CONFIGURATION_FILE_EXTENSION L".bin"
#elif defined(CS_CONFIGURATION_JSON)
#define CS_CONFIGURATION_FILE_EXTENSION L".json"
#elif defined(CS_CONFIGURATION_TOML)
#define CS_CONFIGURATION_FILE_EXTENSION L".toml"
#endif
#endif
#pragma endregion
/*
* explicitly delete the following constructors, to prevent attempts on using them:
* constructor, move-constructor, copy-constructor
*/
#define CS_CLASS_NO_CONSTRUCTOR(CLASS) \
CLASS() = delete; \
CLASS(CLASS&&) = delete; \
CLASS(const CLASS&) = delete;
/*
* explicitly delete the following assignment operators, to prevent attempts on using them:
* move-assignment, copy-assignment
*/
#define CS_CLASS_NO_ASSIGNMENT(CLASS) \
CLASS& operator=(CLASS&&) = delete; \
CLASS& operator=(const CLASS&) = delete;
// explicitly delete any class initializer to prevent attempts on using them
#define CS_CLASS_NO_INITIALIZER(CLASS) \
CS_CLASS_NO_CONSTRUCTOR(CLASS) \
CS_CLASS_NO_ASSIGNMENT(CLASS)
// explicitly delete class heap allocator and deallocator, to prevent attempts on using class at heap memory
#define CS_CLASS_NO_ALLOC() \
void* operator new(const std::size_t nSize) = delete; \
void operator delete(void* pMemory) = delete;

View File

@ -0,0 +1,247 @@
// used: [win] shgetknownfolderpath
#include <shlobj_core.h>
#include "core.h"
// used: features setup
#include "features.h"
// used: string copy
#include "utilities/crt.h"
// used: mem
#include "utilities/memory.h"
// used: l_print
#include "utilities/log.h"
// used: inputsystem setup/restore
#include "utilities/inputsystem.h"
// used: draw destroy
#include "utilities/draw.h"
// used: interfaces setup/destroy
#include "core/interfaces.h"
// used: sdk setup
#include "core/sdk.h"
// used: config setup & variables
#include "core/variables.h"
// used: hooks setup/destroy
#include "core/hooks.h"
// used: schema setup/dump
#include "core/schema.h"
// used: convar setup
#include "core/convars.h"
// used: menu
#include "core/menu.h"
#include <d3d11.h>
bool CORE::GetWorkingPath(wchar_t* wszDestination)
{
bool bSuccess = false;
PWSTR wszPathToDocuments = nullptr;
// get path to user documents
if (SUCCEEDED(::SHGetKnownFolderPath(FOLDERID_Documents, KF_FLAG_CREATE, nullptr, &wszPathToDocuments)))
{
CRT::StringCat(CRT::StringCopy(wszDestination, wszPathToDocuments), CS_XOR(L"\\.cs2\\"));
bSuccess = true;
// create directory if it doesn't exist
if (!CreateDirectoryW(wszDestination, nullptr))
{
if (::GetLastError() != ERROR_ALREADY_EXISTS)
{
L_PRINT(LOG_ERROR) << CS_XOR("failed to create default working directory, because one or more intermediate directories don't exist");
bSuccess = false;
}
}
}
::CoTaskMemFree(wszPathToDocuments);
return bSuccess;
}
static bool Setup(HMODULE hModule)
{
#ifdef CS_LOG_CONSOLE
if (!L::AttachConsole(CS_XOR(L"cs2 developer-mode")))
{
CS_ASSERT(false); // failed to attach console
return false;
}
#endif
#ifdef CS_LOG_FILE
if (!L::OpenFile(CS_XOR(L"cs2.log")))
{
CS_ASSERT(false); // failed to open file
return false;
}
#endif
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("logging system initialization completed");
// setup game's exported functions
if (!MEM::Setup())
{
CS_ASSERT(false); // failed to setup memory system
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("memory system initialization completed");
if (!MATH::Setup())
{
CS_ASSERT(false); // failed to setup math system
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("math system initialization completed");
// grab game's interfaces
if (!I::Setup())
{
CS_ASSERT(false); // failed to setup interfaces
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("interfaces initialization completed");
if (!SDK::Setup())
{
CS_ASSERT(false); // failed to setup sdk
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("sdk initialization completed");
// setup input system and replace game's window messages processor with our
if (!IPT::Setup())
{
CS_ASSERT(false); // failed to setup input system
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("input system initialization completed");
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("renderer backend initialization completed");
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("menu style Iinitialization completed");
// initialize feature-related stuff
if (!F::Setup())
{
CS_ASSERT(false); // failed to setup features
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("features initialization completed");
if (!SCHEMA::Setup(CS_XOR(L"schema.txt")))
{
CS_ASSERT(false); // failed to setup schema system
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("schema system initialization completed");
if (!CONVAR::Dump(CS_XOR(L"convars.txt")))
{
CS_ASSERT(false); // failed to setup convars system
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("convars dumped completed, output: \"convars.txt\"");
if (!CONVAR::Setup())
{
CS_ASSERT(false); // failed to setup convars system
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("convars system initialization completed");
// setup hooks
if (!H::Setup())
{
CS_ASSERT(false); // failed to setup hooks
return false;
}
L_PRINT(LOG_NONE) << CS_XOR("hooks initialization completed");
L_PRINT(LOG_NONE) << CS_XOR("menu style initialization completed");
// setup values to save/load cheat variables into/from files and load default configuration
if (!C::Setup(CS_XOR(CS_CONFIGURATION_DEFAULT_FILE_NAME)))
// this error is not critical, only show that
L_PRINT(LOG_WARNING) << CS_XOR("failed to setup and/or load default configuration");
else
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("configuration system initialization completed");
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_CYAN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("cs2 initialization completed, version: ") << CS_STRINGIFY(CS_VERSION);
return true;
}
// @todo: some of those may crash while closing process, because we dont have any dependencies from the game modules, it means them can be unloaded and destruct interfaces etc before our module | modify ldrlist?
static void Destroy()
{
// restore window messages processor to original
IPT::Destroy();
// restore hooks
H::Destroy();
// destroy renderer backend
D::Destroy();
#ifdef CS_LOG_CONSOLE
L::DetachConsole();
#endif
#ifdef CS_LOG_FILE
L::CloseFile();
#endif
}
DWORD WINAPI PanicThread(LPVOID lpParameter)
{
// don't let proceed unload until user press specified key
while (!IPT::IsKeyReleased(C_GET(unsigned int, Vars.nPanicKey)))
::Sleep(500UL);
// call detach code and exit this thread
FreeLibraryAndExitThread(static_cast<HMODULE>(lpParameter), EXIT_SUCCESS);
}
extern "C" BOOL WINAPI _CRT_INIT(HMODULE hModule, DWORD dwReason, LPVOID lpReserved);
BOOL APIENTRY CoreEntryPoint(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
// process destroy of the cheat before crt calls atexit table
if (dwReason == DLL_PROCESS_DETACH)
Destroy();
if (dwReason == DLL_PROCESS_ATTACH)
{ // dispatch reason for c-runtime, initialize/destroy static variables, TLS etc
if (!_CRT_INIT(hModule, dwReason, lpReserved))
return FALSE;
CORE::hProcess = MEM::GetModuleBaseHandle(nullptr);
// basic process check
if (CORE::hProcess == nullptr)
return FALSE;
/*
* check did all game modules have been loaded
* @note: navsystem.dll is the last loaded module
*/
if (MEM::GetModuleBaseHandle(NAVSYSTEM_DLL) == nullptr)
return FALSE;
// save our module handle
CORE::hDll = hModule;
// check did we perform main initialization successfully
if (!Setup(hModule))
{
// undo the things we've done
Destroy();
return FALSE;
}
// create panic thread, it isn't critical error if it fails
HANDLE hThread = CreateThread(nullptr, 0U, &PanicThread, hModule, 0UL, nullptr);
if (hThread != nullptr)
CloseHandle(hThread);
}
return TRUE;
}

View File

@ -0,0 +1,15 @@
#pragma once
namespace CORE
{
/* @section: get */
/// @param[out] wszDestination output for working path where files will be saved (default: "%userprofile%\documents\.crown")
/// @returns: true if successfully got the path, false otherwise
bool GetWorkingPath(wchar_t* wszDestination);
/* @section: values */
// handle of self module
inline void* hDll = nullptr;
// current process handle
inline void* hProcess = nullptr;
}

View File

@ -0,0 +1,406 @@
// used: [win] winapi
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include "config.h"
// used: getworkingpath
#include "../core.h"
// used: l_print
#include "../utilities/log.h"
// used: integertostring
#include "../utilities/crt.h"
// used: heapalloc, heapfree
#include "../utilities/memory.h"
// used: formatter implementation
#if defined(CS_CONFIGURATION_BINARY)
#include "../../extensions/binary.h"
#elif defined(CS_CONFIGURATION_JSON)
#include "../../extensions/json.h"
#elif defined(CS_CONFIGURATION_TOML)
#include "../../extensions/toml.h"
#endif
// default configurations working path
static wchar_t wszConfigurationsPath[MAX_PATH];
#pragma region config_user_data_type
std::size_t C::UserDataType_t::GetSerializationSize() const
{
std::size_t nTotalDataSize = 0U;
for (const UserDataMember_t& member : vecMembers)
nTotalDataSize += sizeof(FNV1A_t[2]) + member.nDataSize;
return nTotalDataSize;
}
#pragma endregion
#pragma region config_variable_object
void C::VariableObject_t::SetStorage(const void* pValue)
{
// check is available to store value in the local storage
if (this->nStorageSize <= sizeof(this->storage.uLocal))
{
CRT::MemorySet(&this->storage.uLocal, 0U, sizeof(this->storage.uLocal));
CRT::MemoryCopy(&this->storage.uLocal, pValue, this->nStorageSize);
}
// otherwise use heap memory to store it
else
{
CS_ASSERT(this->storage.pHeap != nullptr); // tried to access non allocated storage
CRT::MemorySet(this->storage.pHeap, 0U, this->nStorageSize);
CRT::MemoryCopy(this->storage.pHeap, pValue, this->nStorageSize);
}
}
std::size_t C::VariableObject_t::GetSerializationSize() const
{
std::size_t nSerializationSize = this->nStorageSize;
// denote a custom serialization size when it different from the storage size
switch (this->uTypeHash)
{
// lookup for array data type
case FNV1A::HashConst("bool[]"):
case FNV1A::HashConst("int[]"):
case FNV1A::HashConst("unsigned int[]"):
case FNV1A::HashConst("float[]"):
case FNV1A::HashConst("char[][]"):
// arrays also serialize their size
nSerializationSize += sizeof(std::size_t);
break;
// lookup for user-defined data type
default:
{
for (const UserDataType_t& userType : vecUserTypes)
{
if (userType.uTypeHash == this->uTypeHash)
{
nSerializationSize = sizeof(std::size_t) + userType.GetSerializationSize();
break;
}
}
break;
}
}
return nSerializationSize;
}
#pragma endregion
bool C::Setup(const wchar_t* wszDefaultFileName)
{
if (!CORE::GetWorkingPath(wszConfigurationsPath))
return false;
CRT::StringCat(wszConfigurationsPath, CS_XOR(L"settings\\"));
// create directory if it doesn't exist
if (!::CreateDirectoryW(wszConfigurationsPath, nullptr))
{
if (::GetLastError() != ERROR_ALREADY_EXISTS)
{
L_PRINT(LOG_ERROR) << CS_XOR("failed to create configurations directory, because one or more intermediate directories don't exist");
return false;
}
}
// @note: define custom data types we want to serialize
AddUserType(FNV1A::HashConst("KeyBind_t"),
{
UserDataMember_t{ FNV1A::HashConst("uKey"), FNV1A::HashConst("unsigned int"), &KeyBind_t::uKey },
UserDataMember_t{ FNV1A::HashConst("nMode"), FNV1A::HashConst("int"), &KeyBind_t::nMode }
});
AddUserType(FNV1A::HashConst("ColorPickerVar_t"),
{
UserDataMember_t{ FNV1A::HashConst("bRainbow"), FNV1A::HashConst("bool"), &ColorPickerVar_t::bRainbow },
UserDataMember_t{ FNV1A::HashConst("flRainbowSpeed"), FNV1A::HashConst("float"), &ColorPickerVar_t::flRainbowSpeed },
UserDataMember_t{ FNV1A::HashConst("colPrimary"), FNV1A::HashConst("Color_t"), &ColorPickerVar_t::colValue },
});
AddUserType(FNV1A::HashConst("TextOverlayVar_t"),
{
UserDataMember_t{ FNV1A::HashConst("bEnable"), FNV1A::HashConst("bool"), &TextOverlayVar_t::bEnable },
UserDataMember_t{ FNV1A::HashConst("flThickness"), FNV1A::HashConst("float"), &TextOverlayVar_t::flThickness },
UserDataMember_t{ FNV1A::HashConst("colPrimary"), FNV1A::HashConst("Color_t"), &TextOverlayVar_t::colPrimary },
UserDataMember_t{ FNV1A::HashConst("colOutline"), FNV1A::HashConst("Color_t"), &TextOverlayVar_t::colOutline }
});
AddUserType(FNV1A::HashConst("FrameOverlayVar_t"),
{
UserDataMember_t{ FNV1A::HashConst("bEnable"), FNV1A::HashConst("bool"), &FrameOverlayVar_t::bEnable },
UserDataMember_t{ FNV1A::HashConst("flThickness"), FNV1A::HashConst("float"), &FrameOverlayVar_t::flThickness },
UserDataMember_t{ FNV1A::HashConst("flRounding"), FNV1A::HashConst("float"), &FrameOverlayVar_t::flRounding },
UserDataMember_t{ FNV1A::HashConst("colPrimary"), FNV1A::HashConst("Color_t"), &FrameOverlayVar_t::colPrimary },
UserDataMember_t{ FNV1A::HashConst("colOutline"), FNV1A::HashConst("Color_t"), &FrameOverlayVar_t::colOutline }
});
AddUserType(FNV1A::HashConst("BarOverlayVar_t"),
{
UserDataMember_t{ FNV1A::HashConst("bEnable"), FNV1A::HashConst("bool"), &BarOverlayVar_t::bEnable },
UserDataMember_t{ FNV1A::HashConst("bGradient"), FNV1A::HashConst("bool"), &BarOverlayVar_t::bGradient },
UserDataMember_t{ FNV1A::HashConst("bUseFactorColor"), FNV1A::HashConst("bool"), &BarOverlayVar_t::bUseFactorColor },
UserDataMember_t{ FNV1A::HashConst("flThickness"), FNV1A::HashConst("float"), &BarOverlayVar_t::flThickness },
UserDataMember_t{ FNV1A::HashConst("colPrimary"), FNV1A::HashConst("Color_t"), &BarOverlayVar_t::colPrimary },
UserDataMember_t{ FNV1A::HashConst("colSecondary"), FNV1A::HashConst("Color_t"), &BarOverlayVar_t::colSecondary },
UserDataMember_t{ FNV1A::HashConst("colBackground"), FNV1A::HashConst("Color_t"), &BarOverlayVar_t::colBackground },
UserDataMember_t{ FNV1A::HashConst("colOutline"), FNV1A::HashConst("Color_t"), &BarOverlayVar_t::colOutline }
});
// create default configuration
if (!CreateFile(wszDefaultFileName))
return false;
// store existing configurations list
Refresh();
return true;
}
#pragma region config_main
void C::Refresh()
{
// clear and free previous stored file names
vecFileNames.clear();
// make configuration files path filter
wchar_t wszPathFilter[MAX_PATH];
CRT::StringCat(CRT::StringCopy(wszPathFilter, wszConfigurationsPath), CS_XOR(L"*" CS_CONFIGURATION_FILE_EXTENSION));
// iterate through all files with our filter
WIN32_FIND_DATAW findData;
if (const HANDLE hFindFile = ::FindFirstFileW(wszPathFilter, &findData); hFindFile != INVALID_HANDLE_VALUE)
{
do
{
vecFileNames.push_back(new wchar_t[CRT::StringLength(findData.cFileName) + 1U]);
CRT::StringCopy(vecFileNames.back(), findData.cFileName);
L_PRINT(LOG_INFO) << CS_XOR("found configuration file: \"") << findData.cFileName << CS_XOR("\"");
} while (::FindNextFileW(hFindFile, &findData));
::FindClose(hFindFile);
}
}
void C::AddUserType(const FNV1A_t uTypeHash, const std::initializer_list<UserDataMember_t> vecUserMembers)
{
if (vecUserMembers.size() == 0U)
return;
UserDataType_t userDataType;
userDataType.uTypeHash = uTypeHash;
for (const auto& userDataMember : vecUserMembers)
userDataType.vecMembers.push_back(userDataMember);
vecUserTypes.emplace_back(CRT::Move(userDataType));
}
bool C::SaveFileVariable(const std::size_t nFileIndex, const VariableObject_t& variable)
{
const wchar_t* wszFileName = vecFileNames[nFileIndex];
wchar_t wszFilePath[MAX_PATH];
CRT::StringCat(CRT::StringCopy(wszFilePath, wszConfigurationsPath), wszFileName);
#if defined(CS_CONFIGURATION_BINARY)
if (BIN::SaveVariable(wszFilePath, variable))
#elif defined(CS_CONFIGURATION_JSON)
if (JSON::SaveVariable(wszFilePath, variable))
#elif defined(CS_CONFIGURATION_TOML)
if (TOML::SaveVariable(wszFilePath, variable))
#endif
{
return true;
}
return false;
}
bool C::LoadFileVariable(const std::size_t nFileIndex, VariableObject_t& variable)
{
const wchar_t* wszFileName = vecFileNames[nFileIndex];
wchar_t wszFilePath[MAX_PATH];
CRT::StringCat(CRT::StringCopy(wszFilePath, wszConfigurationsPath), wszFileName);
#if defined(CS_CONFIGURATION_BINARY)
if (BIN::LoadVariable(wszFilePath, variable))
#elif defined(CS_CONFIGURATION_JSON)
if (JSON::LoadVariable(wszFilePath, variable))
#elif defined(CS_CONFIGURATION_TOML)
if (TOML::LoadVariable(wszFilePath, variable))
#endif
{
return true;
}
return false;
}
bool C::RemoveFileVariable(const std::size_t nFileIndex, const VariableObject_t& variable)
{
const wchar_t* wszFileName = vecFileNames[nFileIndex];
wchar_t wszFilePath[MAX_PATH];
CRT::StringCat(CRT::StringCopy(wszFilePath, wszConfigurationsPath), wszFileName);
#if defined(CS_CONFIGURATION_BINARY)
if (BIN::RemoveVariable(wszFilePath, variable))
#elif defined(CS_CONFIGURATION_JSON)
if (JSON::RemoveVariable(wszFilePath, variable))
#elif defined(CS_CONFIGURATION_TOML)
if (TOML::RemoveVariable(wszFilePath, variable))
#endif
{
return true;
}
return false;
}
bool C::CreateFile(const wchar_t* wszFileName)
{
const wchar_t* wszFileExtension = CRT::StringCharR(wszFileName, L'.');
// get length of the given filename and strip out extension if there any
const std::size_t nFileNameLength = (wszFileExtension != nullptr ? wszFileExtension - wszFileName : CRT::StringLength(wszFileName));
wchar_t* wszFullFileName = new wchar_t[nFileNameLength + CRT::StringLength(CS_CONFIGURATION_FILE_EXTENSION) + 1U];
// copy filename without extension
wchar_t* wszFullFileNameEnd = CRT::StringCopyN(wszFullFileName, wszFileName, nFileNameLength);
*wszFullFileNameEnd = L'\0';
// append correct extension to the filename
CRT::StringCat(wszFullFileNameEnd, CS_XOR(CS_CONFIGURATION_FILE_EXTENSION));
// add filename to the list
vecFileNames.push_back(wszFullFileName);
// create and save it by the index
if (SaveFile(vecFileNames.size() - 1U))
{
L_PRINT(LOG_INFO) << CS_XOR("created configuration file: \"") << wszFullFileName << CS_XOR("\"");
return true;
}
L_PRINT(LOG_WARNING) << CS_XOR("failed to create configuration file: \"") << wszFullFileName << CS_XOR("\"");
return false;
}
bool C::SaveFile(const std::size_t nFileIndex)
{
const wchar_t* wszFileName = vecFileNames[nFileIndex];
wchar_t wszFilePath[MAX_PATH];
CRT::StringCat(CRT::StringCopy(wszFilePath, wszConfigurationsPath), wszFileName);
#if defined(CS_CONFIGURATION_BINARY)
if (BIN::SaveFile(wszFilePath))
#elif defined(CS_CONFIGURATION_JSON)
if (JSON::SaveFile(wszFilePath))
#elif defined(CS_CONFIGURATION_TOML)
if (TOML::SaveFile(wszFilePath))
#endif
{
L_PRINT(LOG_INFO) << CS_XOR("saved configuration file: \"") << wszFileName << CS_XOR("\"");
return true;
}
L_PRINT(LOG_WARNING) << CS_XOR("failed to save configuration file: \"") << wszFileName << CS_XOR("\"");
return false;
}
bool C::LoadFile(const std::size_t nFileIndex)
{
const wchar_t* wszFileName = vecFileNames[nFileIndex];
wchar_t wszFilePath[MAX_PATH];
CRT::StringCat(CRT::StringCopy(wszFilePath, wszConfigurationsPath), wszFileName);
#if defined(CS_CONFIGURATION_BINARY)
if (BIN::LoadFile(wszFilePath))
#elif defined(CS_CONFIGURATION_JSON)
if (JSON::LoadFile(wszFilePath))
#elif defined(CS_CONFIGURATION_TOML)
if (TOML::LoadFile(wszFilePath))
#endif
{
L_PRINT(LOG_INFO) << CS_XOR("loaded configuration file: \"") << wszFileName << CS_XOR("\"");
return true;
}
L_PRINT(LOG_WARNING) << CS_XOR("failed to load configuration file: \"") << wszFileName << CS_XOR("\"");
return false;
}
void C::RemoveFile(const std::size_t nFileIndex)
{
const wchar_t* wszFileName = vecFileNames[nFileIndex];
// unable to delete default config
if (CRT::StringCompare(wszFileName, CS_XOR(CS_CONFIGURATION_DEFAULT_FILE_NAME CS_CONFIGURATION_FILE_EXTENSION)) == 0)
{
L_PRINT(LOG_WARNING) << CS_XOR("unable to remove default configuration file: \"") << wszFileName << CS_XOR("\"");
return;
}
wchar_t wszFilePath[MAX_PATH];
CRT::StringCat(CRT::StringCopy(wszFilePath, wszConfigurationsPath), wszFileName);
if (::DeleteFileW(wszFilePath))
{
// erase and free filename from the list
vecFileNames.erase(vecFileNames.cbegin() + nFileIndex);
L_PRINT(LOG_INFO) << CS_XOR("removed configuration file: \"") << wszFileName << CS_XOR("\"");
}
}
#pragma endregion
#pragma region config_get
std::size_t C::GetVariableIndex(const FNV1A_t uNameHash)
{
for (std::size_t i = 0U; i < vecVariables.size(); i++)
{
if (vecVariables[i].uNameHash == uNameHash)
return i;
}
return C_INVALID_VARIABLE;
}
#pragma endregion
#pragma region config_user_types
void ColorPickerVar_t::UpdateRainbow()
{
// @todo: improve + optimize this code
// progress rainbow color
if (this->bRainbow)
{
const float flTime = static_cast<float>(ImGui::GetTime());
// create a rainbow color with copied alpha
float arrRainbowColors[] = {
sin(flTime * this->flRainbowSpeed) * 0.5f + 0.5f,
sin(flTime * this->flRainbowSpeed * MATH::_PI / 3) * 0.5f + 0.5f,
sin(flTime * this->flRainbowSpeed * MATH::_PI / 3) * 0.5f + 0.5f,
this->colValue.Base<COLOR_A>()
};
// set the rainbow color
this->colValue = Color_t::FromBase4(arrRainbowColors);
}
}

View File

@ -0,0 +1,462 @@
#pragma once
// used: [stl] vector
#include <vector>
// used: [stl] type_info
#include <typeinfo>
// used: [win] undname_no_arguments
#include <dbghelp.h>
#include "../common.h"
#include "../sdk/datatypes/color.h"
// used: l_print
#include "../utilities/log.h"
// used: heapalloc, heapfree
#include "../utilities/memory.h"
// used: fnv1a hashing
#include "../utilities/fnv1a.h"
#pragma region config_definitions
#define C_ADD_VARIABLE(TYPE, NAME, DEFAULT) const std::size_t NAME = C::AddVariable<TYPE>(FNV1A::HashConst(#NAME), FNV1A::HashConst(#TYPE), DEFAULT);
#define C_ADD_VARIABLE_ARRAY(TYPE, SIZE, NAME, DEFAULT) const std::size_t NAME = C::AddVariableArray<TYPE[SIZE]>(FNV1A::HashConst(#NAME), FNV1A::HashConst(#TYPE "[]"), DEFAULT);
#define C_ADD_VARIABLE_ARRAY_ARRAY(TYPE, SIZE, SUBSIZE, NAME, DEFAULT) const std::size_t NAME = C::AddVariableArray<TYPE[SIZE][SUBSIZE]>(FNV1A::HashConst(#NAME), FNV1A::HashConst(#TYPE "[][]"), DEFAULT);
#define C_INVALID_VARIABLE static_cast<std::size_t>(-1)
#define C_GET(TYPE, NAME) C::Get<TYPE>(NAME)
#define C_SET(TYPE, NAME, VALUE) C::Set<TYPE>(C::GetVariableIndex(FNV1A::HashConst(#NAME)), VALUE)
#define C_GET_ARRAY(TYPE, SIZE, NAME, INDEX) C::Get<TYPE[SIZE]>(NAME)[INDEX]
#pragma endregion
#pragma region config_user_types
enum class EKeyBindMode : int
{
HOLD = 0,
TOGGLE
};
struct KeyBind_t
{
constexpr KeyBind_t(const char* szName, const unsigned int uKey = 0U, const EKeyBindMode nMode = EKeyBindMode::HOLD) :
szName(szName), uKey(uKey), nMode(nMode) { }
bool bEnable = false;
const char* szName = nullptr;
unsigned int uKey = 0U;
EKeyBindMode nMode = EKeyBindMode::HOLD;
};
struct ColorPickerVar_t
{
// default constructor
constexpr ColorPickerVar_t(const Color_t& colValue = Color_t(255, 255, 255), const bool bRainbow = false, const float flRainbowSpeed = 0.5f) :
colValue(colValue), bRainbow(bRainbow), flRainbowSpeed(flRainbowSpeed) { }
// @note: other contructors will only construct Color_t object and set rainbow to false and speed to 0.5f
// 8-bit color constructor (in: [0 .. 255])
constexpr ColorPickerVar_t(const std::uint8_t r, const std::uint8_t g, const std::uint8_t b, const std::uint8_t a = 255) :
colValue(r, g, b, a), bRainbow(false), flRainbowSpeed(0.5f) { }
// 8-bit color constructor (in: [0 .. 255])
constexpr ColorPickerVar_t(const int r, const int g, const int b, const int a = 255) :
colValue(r, g, b, a), bRainbow(false), flRainbowSpeed(0.5f) { }
// 8-bit array color constructor (in: [0.0 .. 1.0])
explicit constexpr ColorPickerVar_t(const std::uint8_t arrColor[4]) :
colValue(arrColor), bRainbow(false), flRainbowSpeed(0.5f) { }
// 32-bit packed color constructor (in: 0x00000000 - 0xFFFFFFFF)
explicit constexpr ColorPickerVar_t(const ImU32 uPackedColor) :
colValue(uPackedColor), bRainbow(false), flRainbowSpeed(0.5f) { }
// 32-bit color constructor (in: [0.0 .. 1.0])
constexpr ColorPickerVar_t(const float r, const float g, const float b, const float a = 1.0f) :
colValue(r, g, b, a), bRainbow(false), flRainbowSpeed(0.5f) { }
void UpdateRainbow();
Color_t colValue = Color_t(255, 255, 255, 255);
bool bRainbow = false;
float flRainbowSpeed = 0.5f;
};
/// hold config variables for text component overlay
struct TextOverlayVar_t
{
constexpr TextOverlayVar_t(const bool bEnable, const bool bIcon, const float flThickness = 1.f, const Color_t& colPrimary = Color_t(255, 255, 255), const Color_t& colOutline = Color_t(0, 0, 0)) :
bEnable(bEnable), bIcon(bIcon), flThickness(flThickness), colPrimary(colPrimary), colOutline(colOutline) { }
bool bEnable = false;
bool bIcon = false;
float flThickness = 1.f;
Color_t colPrimary = Color_t(255, 255, 255);
Color_t colOutline = Color_t(0, 0, 0);
};
/// hold config variables for frame/box component overlay
struct FrameOverlayVar_t
{
constexpr FrameOverlayVar_t(const bool bEnable, const float flThickness = 1.f, const float flRounding = 0.f, const Color_t& colPrimary = Color_t(255, 255, 255), const Color_t& colOutline = Color_t(0, 0, 0)) :
bEnable(bEnable), flThickness(flThickness), flRounding(flRounding), colPrimary(colPrimary), colOutline(colOutline) { }
bool bEnable = false;
float flThickness = 1.f;
float flRounding = 0.f;
Color_t colPrimary = Color_t(255, 255, 255);
Color_t colOutline = Color_t(0, 0, 0);
};
/// hold config variables for bar component overlay
struct BarOverlayVar_t
{
constexpr BarOverlayVar_t(const bool bEnable, const bool bGradient = false, const bool bUseFactorColor = false, const float flThickness = 1.f, const Color_t& colPrimary = Color_t(255, 255, 255), const Color_t& colSecondary = Color_t(255, 255, 255), const Color_t& colBackground = Color_t(), const Color_t& colOutline = Color_t(), const bool background = true, const bool outline = true) :
bEnable(bEnable), bGradient(bGradient), bUseFactorColor(bUseFactorColor), flThickness(flThickness), colPrimary(colPrimary), colSecondary(colSecondary), colBackground(colBackground), colOutline(colOutline), bBackground(background), bOutline(outline) { }
bool bEnable = false;
bool bGradient = false;
bool bShowValue = false;
bool bOutline = false;
bool bGlowShadow = false;
bool bBackground = false;
bool bUseFactorColor = false;
float flThickness = 1.f;
Color_t colPrimary = Color_t(255, 255, 255);
Color_t colSecondary = Color_t(255, 255, 255);
Color_t colShadow = Color_t(56, 255, 125);
Color_t colBackground = Color_t{15, 15, 15, 55};
Color_t colOutline = Color_t{ 0, 0, 0, 55 };
};
#pragma endregion
/*
* CONFIGURATION
* - cheat variables serialization/de-serialization manager
*/
namespace C
{
// member of user-defined custom serialization structure
struct UserDataMember_t
{
// @todo: not sure is it possible and how todo this with projections, so currently done with pointer-to-member thing, probably could be optimized
template <typename T, typename C>
constexpr UserDataMember_t(const FNV1A_t uNameHash, const FNV1A_t uTypeHash, const T C::*pMember) :
uNameHash(uNameHash), uTypeHash(uTypeHash), nDataSize(sizeof(std::remove_pointer_t<T>)), uBaseOffset(reinterpret_cast<std::size_t>(std::addressof(static_cast<C*>(nullptr)->*pMember))) { } // @test: 'CS_OFFSETOF' must expand to the same result but for some reason it doesn't
// hash of custom variable name
FNV1A_t uNameHash = 0U;
// hash of custom variable type
FNV1A_t uTypeHash = 0U;
// data size of custom variable type
std::size_t nDataSize = 0U;
// offset to the custom variable from the base of class
std::size_t uBaseOffset = 0U;
};
// user-defined custom serialization structure
struct UserDataType_t
{
[[nodiscard]] std::size_t GetSerializationSize() const;
FNV1A_t uTypeHash = 0U;
std::vector<UserDataMember_t> vecMembers = {};
};
// variable info and value storage holder
struct VariableObject_t
{
// @test: it's required value to be either trivially copyable or allocated/copied by new/placement-new operators, otherwise it may cause UB
template <typename T> requires (!std::is_void_v<T> && std::is_trivially_copyable_v<T>)
VariableObject_t(const FNV1A_t uNameHash, const FNV1A_t uTypeHash, const T& valueDefault) :
uNameHash(uNameHash), uTypeHash(uTypeHash), nStorageSize(sizeof(T))
{
#ifndef CS_NO_RTTI
// store RTTI address if available
this->pTypeInfo = &typeid(std::remove_cvref_t<T>);
#endif
// @todo: do not call setstorage, instead construct it by placement-new operator
// allocate storage on the heap if it doesnt't fit on the local one
if constexpr (sizeof(T) > sizeof(this->storage.uLocal))
this->storage.pHeap = MEM::HeapAlloc(this->nStorageSize);
SetStorage(&valueDefault);
}
VariableObject_t(VariableObject_t&& other) noexcept :
uNameHash(other.uNameHash), uTypeHash(other.uTypeHash), nStorageSize(other.nStorageSize)
{
#ifndef CS_NO_RTTI
this->pTypeInfo = other.pTypeInfo;
#endif
if (this->nStorageSize <= sizeof(this->storage.uLocal))
CRT::MemoryCopy(&this->storage.uLocal, &other.storage.uLocal, sizeof(this->storage.uLocal));
else
{
this->storage.pHeap = other.storage.pHeap;
// prevent it from being freed when the moved object is destroyed
other.storage.pHeap = nullptr;
}
}
VariableObject_t(const VariableObject_t& other) :
uNameHash(other.uNameHash), uTypeHash(other.uTypeHash), nStorageSize(other.nStorageSize)
{
#ifndef CS_NO_RTTI
this->pTypeInfo = other.pTypeInfo;
#endif
if (this->nStorageSize <= sizeof(this->storage.uLocal))
CRT::MemoryCopy(&this->storage.uLocal, &other.storage.uLocal, sizeof(this->storage.uLocal));
else if (other.storage.pHeap != nullptr)
{
this->storage.pHeap = MEM::HeapAlloc(this->nStorageSize);
CRT::MemoryCopy(this->storage.pHeap, other.storage.pHeap, this->nStorageSize);
}
}
~VariableObject_t()
{
// check if heap memory is in use and allocated
if (this->nStorageSize > sizeof(this->storage.uLocal) && this->storage.pHeap != nullptr)
MEM::HeapFree(this->storage.pHeap);
}
VariableObject_t& operator=(VariableObject_t&& other) noexcept
{
// check if heap memory is in use and allocated
if (this->nStorageSize > sizeof(this->storage.uLocal) && this->storage.pHeap != nullptr)
MEM::HeapFree(this->storage.pHeap);
this->uNameHash = other.uNameHash;
this->uTypeHash = other.uTypeHash;
this->nStorageSize = other.nStorageSize;
#ifndef CS_NO_RTTI
this->pTypeInfo = other.pTypeInfo;
#endif
if (this->nStorageSize <= sizeof(this->storage.uLocal))
CRT::MemoryCopy(&this->storage.uLocal, &other.storage.uLocal, sizeof(this->storage.uLocal));
else
{
this->storage.pHeap = other.storage.pHeap;
// prevent it from being freed when the moved object is destroyed
other.storage.pHeap = nullptr;
}
return *this;
}
VariableObject_t& operator=(const VariableObject_t& other)
{
// check if heap memory is in use and allocated
if (this->nStorageSize > sizeof(this->storage.uLocal) && this->storage.pHeap != nullptr)
MEM::HeapFree(this->storage.pHeap);
this->uNameHash = other.uNameHash;
this->uTypeHash = other.uTypeHash;
this->nStorageSize = other.nStorageSize;
#ifndef CS_NO_RTTI
this->pTypeInfo = other.pTypeInfo;
#endif
if (this->nStorageSize <= sizeof(this->storage.uLocal))
CRT::MemoryCopy(&this->storage.uLocal, &other.storage.uLocal, sizeof(this->storage.uLocal));
else if (other.storage.pHeap != nullptr)
{
this->storage.pHeap = MEM::HeapAlloc(this->nStorageSize);
CRT::MemoryCopy(this->storage.pHeap, other.storage.pHeap, this->nStorageSize);
}
return *this;
}
/// @tparam bTypeSafe if true, activates additional comparison of source and requested type information, requires RTTI
/// @returns: pointer to the value storage, null if @a'bTypeSafe' is active and the access type does not match the variable type
template <typename T, bool bTypeSafe = true> requires (std::is_object_v<T>)
[[nodiscard]] const T* GetStorage() const
{
/*
#ifndef CS_NO_RTTI
// sanity check of stored value type and asked value type
if constexpr (bTypeSafe)
{
if (const std::type_info& currentTypeInfo = typeid(std::remove_cvref_t<T>); this->pTypeInfo != nullptr && CRT::StringCompare(this->pTypeInfo->raw_name(), currentTypeInfo.raw_name()) != 0)
{
if (char szPresentTypeName[64] = {}, szAccessTypeName[64] = {};
MEM::fnUnDecorateSymbolName(this->pTypeInfo->raw_name() + 1U, szPresentTypeName, CS_ARRAYSIZE(szPresentTypeName), UNDNAME_NO_ARGUMENTS) != 0UL &&
MEM::fnUnDecorateSymbolName(currentTypeInfo.raw_name() + 1U, szAccessTypeName, CS_ARRAYSIZE(szAccessTypeName), UNDNAME_NO_ARGUMENTS) != 0UL)
{
L_PRINT(LOG_ERROR) << CS_XOR("accessing variable of type: \"") << szPresentTypeName << CS_XOR("\" with wrong type: \"") << szAccessTypeName << CS_XOR("\"");
}
CS_ASSERT(false); // storage value and asked data type mismatch
return nullptr;
}
}
#endif*/
// check is value stored in the local storage
if (this->nStorageSize <= sizeof(this->storage.uLocal))
return reinterpret_cast<const std::remove_cvref_t<T>*>(&this->storage.uLocal);
// otherwise it is allocated in the heap memory
CS_ASSERT(this->storage.pHeap != nullptr); // tried to access non allocated storage
return static_cast<const std::remove_cvref_t<T>*>(this->storage.pHeap);
}
template <typename T, bool bTypeSafe = true> requires (std::is_object_v<T>)
[[nodiscard]] T* GetStorage()
{
return const_cast<T*>(static_cast<const VariableObject_t*>(this)->GetStorage<T, bTypeSafe>());
}
// replace variable contained value
void SetStorage(const void* pValue);
/// @returns: the size of the data to be serialized/de-serialized into/from the configuration file
[[nodiscard]] std::size_t GetSerializationSize() const;
// hash of variable name
FNV1A_t uNameHash = 0x0;
// hash of value type
FNV1A_t uTypeHash = 0x0;
#ifndef CS_NO_RTTI
// address of RTTI type data for value type
const std::type_info* pTypeInfo = nullptr;
#endif
// value storage size in bytes
std::size_t nStorageSize = 0U;
// value storage
union
{
void* pHeap;
std::uint8_t uLocal[sizeof(std::uintptr_t)]; // @test: expand local storage size to fit max possible size of trivial type so we can minimize heap allocations count
} storage = { nullptr };
};
// create directories and default configuration file
bool Setup(const wchar_t* wszDefaultFileName);
/* @section: main */
// loop through directory content and store all user configurations filenames
void Refresh();
/// register user-defined data structure type and it's member variables
/// @param[in] vecUserMembers member variables of structure that needs to be serialized/de-serialized
void AddUserType(const FNV1A_t uTypeHash, std::initializer_list<UserDataMember_t> vecUserMembers);
/// write/re-write single variable to existing configuration file
/// @returns: true if variable has been found or created and successfully written, false otherwise
bool SaveFileVariable(const std::size_t nFileIndex, const VariableObject_t& variable);
/// read single variable from existing configuration file
/// @remarks: when the version of cheat is greater than version of the configuration file and @a'variable' wasn't found, this function saves it and updates the version to the current one, note that it doesn't affect to return value
/// @returns: true if variable has been found and successfully read, false otherwise
bool LoadFileVariable(const std::size_t nFileIndex, VariableObject_t& variable);
/// erase single variable from existing configuration file
/// @returns: true if variable did not exist or was successfully removed, false otherwise
bool RemoveFileVariable(const std::size_t nFileIndex, const VariableObject_t& variable);
/// create a new configuration file and save it
/// @param[in] wszFileName file name of configuration file to save and write in
/// @returns: true if file has been successfully created and all variables were written to it, false otherwise
bool CreateFile(const wchar_t* wszFileName);
/// serialize variables into the configuration file
/// @param[in] nFileIndex index of the exist configuration file name
/// @returns: true if all variables were successfully written to the file, false otherwise
bool SaveFile(const std::size_t nFileIndex);
/// de-serialize variables from the configuration file
/// @param[in] nFileIndex index of the exist configuration file name
/// @returns: true if all variables were successfully loaded from the file, false otherwise
bool LoadFile(const std::size_t nFileIndex);
/// remove configuration file
/// @param[in] nFileIndex index of the exist configuration file name
void RemoveFile(const std::size_t nFileIndex);
/* @section: values */
// all user configuration filenames
inline std::vector<wchar_t*> vecFileNames = {};
// custom user-defined serialization data types
inline std::vector<UserDataType_t> vecUserTypes = {};
// configuration variables storage
inline std::vector<VariableObject_t> vecVariables = {};
/* @section: get */
/// @returns: index of variable with given name hash if it exist, 'C_INVALID_VARIABLE' otherwise
[[nodiscard]] std::size_t GetVariableIndex(const FNV1A_t uNameHash);
/// @tparam T type of variable we're going to get, must be exactly the same as when registered
/// @returns: variable value at given index
template <typename T>
[[nodiscard]] T& Get(const std::size_t nIndex)
{
return *vecVariables[nIndex].GetStorage<T>();
}
// @todo: get rid of templates, so it doesn't compile duplicates and we're able to merge things to .cpp
/// add new configuration variable
/// @returns: index of added variable
template <typename T> requires (!std::is_array_v<T>)
std::size_t AddVariable(const FNV1A_t uNameHash, const FNV1A_t uTypeHash, const T& valueDefault)
{
vecVariables.emplace_back(uNameHash, uTypeHash, valueDefault);
return vecVariables.size() - 1U;
}
template <typename T>
bool Set(const std::size_t nIndex, const T& value)
{
if (nIndex < vecVariables.size())
{
vecVariables[nIndex].SetStorage(&value);
return true;
}
return false;
}
/// add new configuration array variable initialized by single value
/// @returns: index of added array variable
template <typename T> requires (std::is_array_v<T>)
std::size_t AddVariableArray(const FNV1A_t uNameHash, const FNV1A_t uTypeHash, const std::remove_pointer_t<std::decay_t<T>> valueDefault)
{
using BaseType_t = std::remove_pointer_t<std::decay_t<T>>;
T arrValueDefault;
for (std::size_t i = 0U; i < sizeof(T) / sizeof(BaseType_t); i++)
arrValueDefault[i] = valueDefault;
vecVariables.emplace_back(uNameHash, uTypeHash, arrValueDefault);
return vecVariables.size() - 1U;
}
/// add new configuration array variable with multiple values initialized
/// @returns: index of added array variable
template <typename T> requires (std::is_array_v<T>)
std::size_t AddVariableArray(const FNV1A_t uNameHash, const FNV1A_t uTypeHash, std::initializer_list<std::remove_pointer_t<std::decay_t<T>>> vecValuesDefault)
{
using BaseType_t = std::remove_pointer_t<std::decay_t<T>>;
T arrValueDefault;
CRT::MemorySet(arrValueDefault, 0U, sizeof(T));
CRT::MemoryCopy(arrValueDefault, vecValuesDefault.begin(), vecValuesDefault.size() * sizeof(BaseType_t));
vecVariables.emplace_back(uNameHash, uTypeHash, arrValueDefault);
return vecVariables.size() - 1U;
}
inline void RemoveVariable(const std::size_t nIndex)
{
vecVariables.erase(vecVariables.begin() + nIndex);
}
}

View File

@ -0,0 +1,193 @@
// used: [stl] vector
#include <vector>
// used: [stl] find_if
#include <algorithm>
#include "convars.h"
// used: convar interface
#include "interfaces.h"
#include "../sdk/interfaces/ienginecvar.h"
// used: l_print
#include "../utilities/log.h"
// used: getworkingpath
#include "../core.h"
inline static void WriteConVarType(HANDLE hFile, const uint32_t nType)
{
switch ((EConVarType)nType)
{
case EConVarType_Bool:
::WriteFile(hFile, CS_XOR("[bool] "), CRT::StringLength(CS_XOR("[bool] ")), nullptr, nullptr);
break;
case EConVarType_Int16:
::WriteFile(hFile, CS_XOR("[int16] "), CRT::StringLength(CS_XOR("[int16] ")), nullptr, nullptr);
break;
case EConVarType_UInt16:
::WriteFile(hFile, CS_XOR("[uint16] "), CRT::StringLength(CS_XOR("[uint16] ")), nullptr, nullptr);
break;
case EConVarType_Int32:
::WriteFile(hFile, CS_XOR("[int32] "), CRT::StringLength(CS_XOR("[int32] ")), nullptr, nullptr);
break;
case EConVarType_UInt32:
::WriteFile(hFile, CS_XOR("[uint32] "), CRT::StringLength(CS_XOR("[uint32] ")), nullptr, nullptr);
break;
case EConVarType_Int64:
::WriteFile(hFile, CS_XOR("[int64] "), CRT::StringLength(CS_XOR("[int64] ")), nullptr, nullptr);
break;
case EConVarType_UInt64:
::WriteFile(hFile, CS_XOR("[uint64] "), CRT::StringLength(CS_XOR("[uint64] ")), nullptr, nullptr);
break;
case EConVarType_Float32:
::WriteFile(hFile, CS_XOR("[float32] "), CRT::StringLength(CS_XOR("[float32] ")), nullptr, nullptr);
break;
case EConVarType_Float64:
::WriteFile(hFile, CS_XOR("[float64] "), CRT::StringLength(CS_XOR("[float64] ")), nullptr, nullptr);
break;
case EConVarType_String:
::WriteFile(hFile, CS_XOR("[string] "), CRT::StringLength(CS_XOR("[string] ")), nullptr, nullptr);
break;
case EConVarType_Color:
::WriteFile(hFile, CS_XOR("[color] "), CRT::StringLength(CS_XOR("[color] ")), nullptr, nullptr);
break;
case EConVarType_Vector2:
::WriteFile(hFile, CS_XOR("[vector2] "), CRT::StringLength(CS_XOR("[vector2] ")), nullptr, nullptr);
break;
case EConVarType_Vector3:
::WriteFile(hFile, CS_XOR("[vector3] "), CRT::StringLength(CS_XOR("[vector3] ")), nullptr, nullptr);
break;
case EConVarType_Vector4:
::WriteFile(hFile, CS_XOR("[vector4] "), CRT::StringLength(CS_XOR("[vector4] ")), nullptr, nullptr);
break;
case EConVarType_Qangle:
::WriteFile(hFile, CS_XOR("[qangle] "), CRT::StringLength(CS_XOR("[qangle] ")), nullptr, nullptr);
break;
default:
::WriteFile(hFile, CS_XOR("[unknown-type] "), CRT::StringLength(CS_XOR("[unknown-type] ")), nullptr, nullptr);
break;
}
}
inline static void WriteConVarFlags(HANDLE hFile, const uint32_t nFlags)
{
if (nFlags & FCVAR_CLIENTDLL)
::WriteFile(hFile, CS_XOR("[client.dll] "), CRT::StringLength(CS_XOR("[client.dll] ")), nullptr, nullptr);
else if (nFlags & FCVAR_GAMEDLL)
::WriteFile(hFile, CS_XOR("[games's dll] "), CRT::StringLength(CS_XOR("[games's dll] ")), nullptr, nullptr);
if (nFlags & FCVAR_PROTECTED)
::WriteFile(hFile, CS_XOR("[protected] "), CRT::StringLength(CS_XOR("[protected] ")), nullptr, nullptr);
if (nFlags & FCVAR_CHEAT)
::WriteFile(hFile, CS_XOR("[cheat] "), CRT::StringLength(CS_XOR("[cheat] ")), nullptr, nullptr);
if (nFlags & FCVAR_HIDDEN)
::WriteFile(hFile, CS_XOR("[hidden] "), CRT::StringLength(CS_XOR("[hidden] ")), nullptr, nullptr);
if (nFlags & FCVAR_DEVELOPMENTONLY)
::WriteFile(hFile, CS_XOR("[devonly] "), CRT::StringLength(CS_XOR("[devonly] ")), nullptr, nullptr);
::WriteFile(hFile, CS_XOR("\n"), CRT::StringLength(CS_XOR("\n")), nullptr, nullptr);
}
bool CONVAR::Dump(const wchar_t* wszFileName)
{
wchar_t wszDumpFilePath[MAX_PATH];
if (!CORE::GetWorkingPath(wszDumpFilePath))
return false;
CRT::StringCat(wszDumpFilePath, wszFileName);
HANDLE hOutFile = ::CreateFileW(wszDumpFilePath, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hOutFile == INVALID_HANDLE_VALUE)
return false;
// @todo: maybe remove this redundant? and put it inside CRT::String_t c'tor
const std::time_t time = std::time(nullptr);
std::tm timePoint;
localtime_s(&timePoint, &time);
CRT::String_t<64> szTimeBuffer(CS_XOR("[%d-%m-%Y %T] asphyxia | convars dump\n\n"), &timePoint);
// write current date, time and info
::WriteFile(hOutFile, szTimeBuffer.Data(), szTimeBuffer.Length(), nullptr, nullptr);
for (int i = I::Cvar->listConvars.Head(); i != I::Cvar->listConvars.InvalidIndex(); i = I::Cvar->listConvars.Next(i))
{
CConVar* pConVar = I::Cvar->listConvars.Element(i);
if (pConVar != nullptr)
{
// dump to file
WriteConVarType(hOutFile, pConVar->nType);
CRT::String_t<526> szBuffer(CS_XOR("%s : \"%s\" "), pConVar->szName, pConVar->szDescription[0] == '\0' ? CS_XOR("no description") : pConVar->szDescription);
::WriteFile(hOutFile, szBuffer.Data(), szBuffer.Length(), nullptr, nullptr);
// write flags
WriteConVarFlags(hOutFile, pConVar->nFlags);
}
}
::CloseHandle(hOutFile);
return true;
}
bool CONVAR::Setup()
{
bool bSuccess = true;
m_pitch = I::Cvar->Find(FNV1A::HashConst("m_pitch"));
bSuccess &= m_pitch != nullptr;
m_yaw = I::Cvar->Find(FNV1A::HashConst("m_yaw"));
bSuccess &= m_yaw != nullptr;
sensitivity = I::Cvar->Find(FNV1A::HashConst("sensitivity"));
bSuccess &= sensitivity != nullptr;
game_type = I::Cvar->Find(FNV1A::HashConst("game_type"));
bSuccess &= game_type != nullptr;
game_mode = I::Cvar->Find(FNV1A::HashConst("game_mode"));
bSuccess &= game_mode != nullptr;
mp_teammates_are_enemies = I::Cvar->Find(FNV1A::HashConst("mp_teammates_are_enemies"));
bSuccess &= mp_teammates_are_enemies != nullptr;
sv_autobunnyhopping = I::Cvar->Find(FNV1A::HashConst("sv_autobunnyhopping"));
bSuccess &= sv_autobunnyhopping != nullptr;
cam_idealdist = I::Cvar->Find(FNV1A::HashConst("cam_idealdist")); // flaot
bSuccess &= cam_idealdist != nullptr;
cam_collision = I::Cvar->Find(FNV1A::HashConst("cam_collision")); // flaot
bSuccess &= cam_collision != nullptr;
cam_snapto = I::Cvar->Find(FNV1A::HashConst("cam_snapto")); // flaot
bSuccess &= cam_snapto != nullptr;
c_thirdpersonshoulder = I::Cvar->Find(FNV1A::HashConst("c_thirdpersonshoulder")); // flaot
bSuccess &= c_thirdpersonshoulder != nullptr;
c_thirdpersonshoulderaimdist = I::Cvar->Find(FNV1A::HashConst("c_thirdpersonshoulderaimdist")); // flaot
bSuccess &= c_thirdpersonshoulderaimdist != nullptr;
c_thirdpersonshoulderdist = I::Cvar->Find(FNV1A::HashConst("c_thirdpersonshoulderdist")); // flaot
bSuccess &= c_thirdpersonshoulderdist != nullptr;
c_thirdpersonshoulderheight = I::Cvar->Find(FNV1A::HashConst("c_thirdpersonshoulderheight")); // flaot
bSuccess &= c_thirdpersonshoulderheight != nullptr;
c_thirdpersonshoulderoffset = I::Cvar->Find(FNV1A::HashConst("c_thirdpersonshoulderoffset")); // flaot
bSuccess &= c_thirdpersonshoulderoffset != nullptr;
cl_interpolate = I::Cvar->Find(FNV1A::HashConst("cl_interpolate")); // flaot
bSuccess &= cl_interpolate != nullptr;
cl_interp_ratio = I::Cvar->Find(FNV1A::HashConst("cl_interp_ratio")); // flaot
bSuccess &= cl_interp_ratio != nullptr;
return bSuccess;
}

View File

@ -0,0 +1,42 @@
#pragma once
class CConVar;
namespace CONVAR
{
// dump convars to file
bool Dump(const wchar_t* wszFileName);
// setup convars
bool Setup();
inline CConVar* m_pitch = nullptr;
inline CConVar* m_yaw = nullptr;
inline CConVar* sensitivity = nullptr;
inline CConVar* game_type = nullptr;
inline CConVar* game_mode = nullptr;
inline CConVar* mp_teammates_are_enemies = nullptr;
inline CConVar* sv_autobunnyhopping = nullptr;
inline CConVar* cam_idealdist = nullptr;
inline CConVar* cam_collision = nullptr;
inline CConVar* cam_snapto = nullptr;
inline CConVar* c_thirdpersonshoulder = nullptr;
inline CConVar* c_thirdpersonshoulderaimdist = nullptr;
inline CConVar* c_thirdpersonshoulderdist = nullptr;
inline CConVar* c_thirdpersonshoulderheight = nullptr;
inline CConVar* c_thirdpersonshoulderoffset = nullptr;
inline CConVar* cl_interpolate = nullptr;
inline CConVar* cl_interp_ratio = nullptr;
}

View File

@ -0,0 +1,57 @@
#include "sigscan.hpp"
#include "../../utilities/log.h"
#include "../memory/memadd.h"
CSigScan::CSigScan(const char* name, const char* libraryName, const std::initializer_list<SigData_t>& data) {
#ifdef SDK_ENABLE_LOGGING
m_Name = name;
#else
m_Name = "";
#endif
m_LibraryName = libraryName;
m_Data.reserve(data.size());
m_Data.insert(m_Data.end(), data.begin(), data.end());
CSigScanManager::Get().ScheduleScan(this);
}
void CSigScan::FindSignature() {
auto& library = CMemory::GetModule(m_LibraryName);
if (!library) {
L_PRINT(LOG_WARNING) << CS_XOR("\"signature\" Couldn't find {} because {} was not loaded.");
}
for (size_t i = 0; i < m_Data.size(); ++i) {
// Faster than m_Data[] in debug builds because of _STL_VERIFY.
const auto& data = m_Data.data()[i];
m_Value = library->FindPattern(data.m_Signature);
if (m_Value.IsValid()) {
if (data.m_Procedure) {
data.m_Procedure(m_Value);
}
L_PRINT(LOG_INFO) << CS_XOR("\"signature\" Couldn't find " << m_Name << " because{} " << m_Value.Get<void*>() << "was not loaded " << i << " | index.");
}
}
L_PRINT(LOG_ERROR) << CS_XOR("\"signature\" Couldn't find ");
}
void CSigScanManager::ScheduleScan(CSigScan* sigScan) { m_ScheduledScans.emplace_back(sigScan); }
void CSigScanManager::ProcessScans() {
for (size_t i = 0; i < m_ScheduledScans.size(); ++i) {
// Faster than m_ScheduledScans[] in debug builds because of _STL_VERIFY.
const auto& scheduledScan = m_ScheduledScans.data()[i];
scheduledScan->FindSignature();
scheduledScan->FreeData();
}
// No need to keep the scans in memory if we're done with them.
std::vector<CSigScan*>().swap(m_ScheduledScans);
}

View File

@ -0,0 +1,52 @@
#pragma once
#include "../pointer/pointer.hpp"
#include <span>
#include <functional>
class CSigScan {
public:
using ProcedureFn = std::function<void(CPointer&)>;
struct SigData_t {
std::span<const int> m_Signature;
ProcedureFn m_Procedure;
};
CSigScan(const char* name, const char* libraryName, const std::initializer_list<SigData_t>& data);
void FindSignature();
auto FreeData() { std::vector<SigData_t>().swap(m_Data); }
auto GetPtr() const { return m_Value; }
template <typename T>
auto GetPtrAs() const {
return m_Value.Get<T>();
}
CSigScan(const CSigScan&) = delete;
CSigScan& operator=(const CSigScan&) = delete;
private:
const char* m_Name;
const char* m_LibraryName;
std::vector<SigData_t> m_Data;
CPointer m_Value;
};
class CSigScanManager {
public:
static CSigScanManager& Get() {
static CSigScanManager inst;
return inst;
}
void ScheduleScan(CSigScan* sigScan);
void ProcessScans();
private:
std::vector<CSigScan*> m_ScheduledScans;
};

View File

@ -0,0 +1,5 @@
#pragma once
namespace fnv1a {
constexpr uint32_t Hash(const char* str) noexcept { return (*str ? (Hash(str + 1) ^ *str) * 0x01000193 : 0x811c9dc5); }
} // namespace fnv1a

View File

@ -0,0 +1,693 @@
#include "hooks.h"
// used: variables
#include "variables.h"
// used: game's sdk
#include "../sdk/interfaces/iswapchaindx11.h"
#include "../sdk/interfaces/iviewrender.h"
#include "../sdk/interfaces/cgameentitysystem.h"
#include "../sdk/interfaces/ccsgoinput.h"
#include "../sdk/interfaces/iinputsystem.h"
#include "../sdk/interfaces/iengineclient.h"
#include "../sdk/interfaces/inetworkclientservice.h"
#include "../sdk/interfaces/iglobalvars.h"
#include "../sdk/interfaces/imaterialsystem.h"
#include "../core/memory/cmodule.hpp"
#include "../features/visuals/overlay.h"
#include "../features/visuals/overlay.h"
#include "../features/legit/legit.h"
#include "../features/lagcomp/lagcomp.h"
#include "../features/skins/ccsinventorymanager.hpp"
#include "../cstrike/features/skins/skin_changer.hpp"
#include "../cstrike/features/antiaim/antiaim.hpp"
// used: viewsetup
#include "../sdk/datatypes/viewsetup.h"
// used: entity
#include "../sdk/entity.h"
// used: get virtual function, find pattern, ...
#include "../utilities/memory.h"
// used: inputsystem
#include "../utilities/inputsystem.h"
// used: draw
#include "../utilities/draw.h"
// used: features callbacks
#include "../features.h"
// used: game's interfaces
#include "interfaces.h"
#include "sdk.h"
// used: menu
#include "menu.h"
#define STB_OMIT_TESTS
#include "stb.hh"
#include "../sdk/interfaces/events.h"
#include "../cstrike/features/legit/legit.h"
#include "spoofcall/invoker.h"
#include "convars.h"
#include "../sdk/interfaces/ienginecvar.h"
#include "../cstrike/features/rage/rage.h"
#include "spoofcall/virtualization/VirtualizerSDK64.h"
#include <dxgi.h>
#include <d3d11.h>
#define SDK_SIG(sig) stb::simple_conversion::build<stb::fixed_string{sig}>::value
IDXGIDevice* pDXGIDevice = NULL;
IDXGIAdapter* pDXGIAdapter = NULL;
IDXGIFactory* pIDXGIFactory = NULL;
#define MEMORY_VARIABLE(var) var, "H::" #var
namespace sigs {
CSigScan GetHitboxSet("C_BaseEntity::GetHitboxSet", "client.dll",
{
{SDK_SIG("E8 ? ? ? ? 48 85 C0 0F 85 ? ? ? ? 44 8D 48 07"), [](CPointer& ptr) { ptr.Absolute(1, 0); }},
{SDK_SIG("41 8B D6 E8 ? ? ? ? 4C 8B F8"), [](CPointer& ptr) { ptr.Absolute(4, 0); }},
});
CSigScan GetBoneName("CModel::GetBoneName", "client.dll",
{
{SDK_SIG("48 8B CE E8 ? ? ? ? 48 8B 0F"), [](CPointer& ptr) { ptr.Offset(0x4); }},
});
CSigScan HitboxToWorldTransforms("C_BaseEntity::HitboxToWorldTransforms", "client.dll",
{
{SDK_SIG("E8 ? ? ? ? 4C 8B A3"), [](CPointer& ptr) { ptr.Absolute(1, 0); }},
});
CSigScan ComputeHitboxSurroundingBox("C_BaseEntity::ComputeHitboxSurroundingBox", "client.dll",
{
{SDK_SIG("E9 ? ? ? ? F6 43 5B FD"), [](CPointer& ptr) { ptr.Absolute(1, 0); }},
});
}
#define CS2_SDK_SIGs(sig) \
stb::simple_conversion::build<stb::fixed_string{sig}>::value
#define COMPUTE_HITBOX_SURROUNDING_BOX CS2_SDK_SIGs("E9 ? ? ? ? F6 43 5B FD")
bool H::Setup()
{
VIRTUALIZER_MUTATE_ONLY_START;
if (MH_Initialize() != MH_OK)
{
L_PRINT(LOG_ERROR) << CS_XOR("failed to initialize minhook");
return false;
}
L_PRINT(LOG_INFO) << CS_XOR("Initializing ShadowVMT & SilentInlineHoooking");
SilenthkPresent.Setup(I::SwapChain->pDXGISwapChain);
SilenthkPresent.HookIndex((int)VTABLE::D3D::PRESENT, Present);
SilenthkPresent.HookIndex((int)VTABLE::D3D::RESIZEBUFFERS, ResizeBuffers);
I::Device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice));
pDXGIDevice->GetAdapter(&pDXGIAdapter);
pDXGIAdapter->GetParent(IID_PPV_ARGS(&pIDXGIFactory));
Silentdxgi.Setup(pIDXGIFactory);
Silentdxgi.HookIndex((int)VTABLE::DXGI::CREATESWAPCHAIN, CreateSwapChain);
if (pDXGIDevice) {
pDXGIDevice->Release();
pDXGIDevice = nullptr;
}
if (pDXGIAdapter) {
pDXGIAdapter->Release();
pDXGIAdapter = nullptr;
}
if (pIDXGIFactory) {
pIDXGIFactory->Release();
pIDXGIFactory = nullptr;
}
// fnGetClientSystem = reinterpret_cast<CGCClientSystem*>(MEM::ResolveRelativeAddress(MEM::FindPattern(CLIENT_DLL, CS_XOR("E8 ? ? ? ? 48 8B 4F 10 8B 1D ? ? ? ?")), 0x1, 0x0));
// L_PRINT(LOG_INFO) << CS_XOR("captured fnGetClientSystem \"") << CS_XOR("\" interface at address: ") << L::AddFlags(LOG_MODE_INT_SHOWBASE | LOG_MODE_INT_FORMAT_HEX) << reinterpret_cast<std::uintptr_t>(fnGetClientSystem);
MEM::FindPatterns(CLIENT_DLL, CS_XOR("E8 ? ? ? ? 48 8B 4F 10 8B 1D ? ? ? ?")).ToAbsolute(1, 0).Get(MEMORY_VARIABLE(fnGetClientSystem));
MEM::FindPatterns(CLIENT_DLL, CS_XOR("48 83 EC 28 B9 ? ? ? ? E8 ? ? ? ? 48 85 C0 74 3A 48 8D 0D ? ? ? ? C7 40 ? ? ? ? ?")).Get(MEMORY_VARIABLE(fnCreateSharedObjectSubclassEconItem));
MEM::FindPatterns(CLIENT_DLL, CS_XOR("E9 ? ? ? ? CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC 49 8B C0 48")).ToAbsolute(1, 0).Get(MEMORY_VARIABLE(fnSetDynamicAttributeValueUint));
MEM::FindPatterns(CLIENT_DLL, CS_XOR("E8 ? ? ? ? 48 63 BB ? ? ? ? 48 8D 68 28 83 FF FF")).ToAbsolute(1, 0).Get(MEMORY_VARIABLE(fnGetInventoryManager));
MEM::FindPatterns(CLIENT_DLL, CS_XOR("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 48 8D 99 60")).Get(MEMORY_VARIABLE(SetMeshGroupMask));
MEM::FindPatterns(CLIENT_DLL, CS_XOR("48 89 5C 24 10 48 89 6C 24 18 56 57 41 57 48 83 EC 20 83 79 10 00 49 8B F1 41 8B E8 4C 8B FA 48 8B D9 74 72 44 8B 49 14 48 8B 39 41 FF C9 45 8B D9 45 23 D8 41")).Get(MEMORY_VARIABLE(fnFindMaterialIndex));
SilentEntitySystem.Setup(I::GameResourceService->pGameEntitySystem);
SilentEntitySystem.HookIndex(14, OnAddEntity);
SilentEntitySystem.HookIndex(15, OnRemoveEntity);
SilentInput.Setup(I::Input);
SilentInput.HookIndex((int)VTABLE::CLIENT::MOUSEINPUTENABLED, MouseInputEnabled);
SilentInput.HookIndex((int)VTABLE::CLIENT::CREATEMOVE, CreateMove);
spoof_call<void>(_fake_addr, &EntCache::CacheCurrentEntities);
// @ida: class CViewRender->OnRenderStart call GetMatricesForView
CS_ASSERT(hkGetMatrixForView.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("40 53 48 81 EC ? ? ? ? 49 8B C1")), reinterpret_cast<void*>(&GetMatrixForView)));
CS_ASSERT(hkSetViewModelFOV.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("40 53 48 83 EC 30 33 C9 E8 ? ? ? ? 48 8B D8 48 85 C0 0F 84 ? ? ? ? 48 8B 00 48 8B CB FF 90 ? ? ? ? 84 C0 0F 84 ? ? ? ? 48 8B CB")), reinterpret_cast<float*>(&SetViewModelFOV)));
CS_ASSERT(hkFOVObject.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("40 53 48 81 EC 80 00 00 00 48 8B D9 E8 ?? ?? ?? ?? 48 85")), reinterpret_cast<float*>(&GetRenderFov)));
CS_ASSERT(hkInputParser.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 8B C4 4C 89 48 20 55 56 41 56 48 8D 68 B1 48 81 EC D0 00 00 00")), reinterpret_cast<void*>(&InputParser)));
// client.dll; 40 55 53 41 55 41 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 02
CS_ASSERT(hkGameEvents.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("40 55 53 41 55 41 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 02")), reinterpret_cast<void*>(&HandleGameEvents)));
// I could just do VTABLE too idx: 15
//CS_ASSERT(hkPredictionSimulation.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 8B C4 4C 89 40 18 48 89 48 08 55 53 56 57 48")), reinterpret_cast<void*>(&PredictionSimulation)));
// @ida: ClientModeShared -> #STR: "mapname", "transition", "game_newmap"
CS_ASSERT(hkLevelInit.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 5C 24 ? 56 48 83 EC ? 48 8B 0D ? ? ? ? 48 8B F2")), reinterpret_cast<void*>(&LevelInit)));
// @ida: ClientModeShared -> #STR: "map_shutdown"
CS_ASSERT(hkLevelShutdown.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 83 EC ? 48 8B 0D ? ? ? ? 48 8D 15 ? ? ? ? 45 33 C9 45 33 C0 48 8B 01 FF 50 ? 48 85 C0 74 ? 48 8B 0D ? ? ? ? 48 8B D0 4C 8B 01 48 83 C4 ? 49 FF 60 ? 48 83 C4 ? C3 CC CC CC 48 83 EC ? 4C 8B D9")), reinterpret_cast<void*>(&LevelShutdown)));
CS_ASSERT(hkDrawObject.Create(MEM::FindPattern(SCENESYSTEM_DLL, CS_XOR("48 8B C4 48 89 50 ? 55 41 56")), reinterpret_cast<void*>(&DrawObject)));
//CS_ASSERT(hkCameraInput.Create(MEM::GetVFunc(I::Input, VTABLE::CLIENT::CAMERA), reinterpret_cast<void*>(&CameraInput)));
//CS_ASSERT(hkSendInputMessage.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 41 56 48 81 EC ? ? ? ? 49 8B D9")), reinterpret_cast<void*>(&SendNetInputMessage)));
CS_ASSERT(hkFrameStageNotify.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 5C 24 10 56 48 83 EC 30 8B 05")), reinterpret_cast<void*>(&FrameStageNotify)));
CS_ASSERT(hkSetModel.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 5C 24 10 48 89 7C 24 20 55 48 8B EC 48 83 EC 50")), reinterpret_cast<void*>(&SetModel)));
CS_ASSERT(hkEquipItemInLoadout.Create(MEM::GetVFunc(CCSInventoryManager::GetInstance(), 54u), reinterpret_cast<void*>(&EquipItemInLoadout)));
CS_ASSERT(hkOverrideView.Create(MEM::GetVFunc(I::Input, 9u), reinterpret_cast<void*>(&OverrideView)));
CS_ASSERT(hkAllowCameraChange.Create(MEM::GetVFunc(I::Input, 7u), reinterpret_cast<void*>(&AllowCameraAngleChange)));
//CS_ASSERT(hkPreFireEvent.Create(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 5C 24 ? 56 57 41 54 48 83 EC 30 48 8B F2")), reinterpret_cast<void*>(&FireEventClientSide)));
F::RAGE::rage->BuildSeed();
F::LAGCOMP::lagcomp->Initialize();
//F::LAGCOMP::lagcomp->Initialize();
VIRTUALIZER_MUTATE_ONLY_END;
return true;
}
void H::Destroy()
{
skin_changer::Shutdown();
MH_DisableHook(MH_ALL_HOOKS);
MH_RemoveHook(MH_ALL_HOOKS);
MH_Uninitialize();
SilenthkPresent.UnhookAll();
Silentdxgi.UnhookAll();
SilentInput.UnhookAll();
SilentEntitySystem.UnhookAll();
}
// client.dll; 40 55 53 41 55 41 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 02
// xref: "winpanel-basic-round-result-visible"
using namespace F::RAGE;
void* CS_FASTCALL H::InputParser(CCSInputMessage* Input, CCSGOInputHistoryEntryPB* InputHistoryEntry, char a3, void* a4, void* a5, void* a6)
{
auto original = hkInputParser.GetOriginal();
auto result = original(Input, InputHistoryEntry, a3, a4, a5, a6);
if (!SDK::Cmd)
return result;
if (I::Engine->IsConnected() || I::Engine->IsInGame() && SDK::LocalPawn && SDK::LocalPawn->GetHealth() > 0 ) {
if (rage->sub_tick_data.command == F::RAGE::impl::command_msg::silent) {
// modify predicted sub tick viewangles to our rage bestpoint forcing silent w predicted cmds
Input->m_view_angles = rage->sub_tick_data.best_point_vec;
Input->m_view_angles.clamp();
InputHistoryEntry->m_pViewCmd->m_angValue = rage->sub_tick_data.best_point;
InputHistoryEntry->m_pViewCmd->m_angValue.Clamp();
rage->sub_tick_data.response = impl::response_msg::validated_view_angles;
}
else
rage->sub_tick_data.response = impl::response_msg::empty;
if (F::RAGE::rage->rage_data.rapid_fire) {
if (rage->sub_tick_data.command == impl::command_msg::rapid_fire) {
// override angles just to prevent
Input->m_view_angles = rage->sub_tick_data.best_point_vec;
Input->m_view_angles.clamp();
InputHistoryEntry->m_pViewCmd->m_angValue = rage->sub_tick_data.best_point;
InputHistoryEntry->m_pViewCmd->m_angValue.Clamp();
// override tickcount
InputHistoryEntry->m_nPlayerTickCount = 0;
Input->m_player_tick_count = 0;
// perform shooting
SDK::Cmd->m_nButtons.m_nValue |= IN_ATTACK;
}
else
SDK::Cmd->m_nButtons.m_nValue &= ~IN_ATTACK;
}
if (rage->sub_tick_data.command == impl::command_msg::teleport) {
// overflow viewangles
// send new msg to sv
// maybe change our shoot pos? idk
}
}
return result;
}
//40 53 48 83 EC 20 48 8B D9 E8 ?? ?? ?? ?? 48 C7 83 D0
void CS_FASTCALL H::CameraInput(void* Input, int a1) {
//auto horiginal = hkCameraInput.GetOriginal();
//if (!I::Engine->IsConnected() || !I::Engine->IsInGame() || !SDK::LocalPawn || !cheat->alive)
// return horiginal(Input, a1);
//auto backup = *(Vector_t*)((uintptr_t)Input + 0x5390);
//// store old camera angles
//// call original
//horiginal(Input, a1);
//*(Vector_t*)((uintptr_t)Input + 0x5390) = backup;
}
float CS_FASTCALL H::GetRenderFov(uintptr_t rcx)
{
const auto oFOV = hkFOVObject.GetOriginal();
if (!I::Engine->IsConnected() || !I::Engine->IsInGame())
{
oFOV(rcx);
}
else if (!SDK::LocalController || !SDK::LocalController->IsPawnAlive()) // Checking if your spectating and alive
{
oFOV(rcx);
}
else
{
auto localPlayerController = SDK::LocalController;
auto localPlayerPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(localPlayerController->GetPawnHandle());
if (C_GET(bool, Vars.bFOV) && !localPlayerPawn->IsScoped())
{
return C_GET(float, Vars.fFOVAmount);
}
else
{
oFOV(rcx);
}
}
}
float CS_FASTCALL H::SetViewModelFOV()
{
const auto oSetViewModelFOV = hkSetViewModelFOV.GetOriginal();
if (C_GET(float, Vars.flSetViewModelFOV) == 0.f)
return oSetViewModelFOV();
return C_GET(float, Vars.flSetViewModelFOV);
}
// client.dll; 40 55 53 41 55 41 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 02
// xref: "winpanel-basic-round-result-visible"
void CS_FASTCALL H::HandleGameEvents(void* rcx, IGameEvent* const ev)
{
const auto original = hkGameEvents.GetOriginal();
if (!I::Engine->IsConnected() || !I::Engine->IsInGame() || !SDK::LocalPawn || !cheat->alive)
return original(rcx, ev);
switch (const char* event_name{ ev->GetName() }; FNV1A::Hash(event_name)) {
case FNV1A::HashConst(CS_XOR("player_death")): {
auto controller = SDK::LocalController;
if (!controller)
break;
const auto event_controller = ev->get_player_controller("attacker");
if (!event_controller)
return;
skin_changer::OnPreFireEvent(ev);
F::LEGIT::legit->Events(ev, F::LEGIT::events::player_death);
} break;
case FNV1A::HashConst(CS_XOR("round_start")): {
auto controller = SDK::LocalController;
if (!controller)
break;
// fix skins not showing up on round start event
Vars.full_update = true;
// reset some shit related to legitbot
F::LEGIT::legit->Events(ev, F::LEGIT::events::round_start);
} break;
default:
break;
}
original(rcx, ev);
}
bool init = false;
HRESULT __stdcall H::Present(IDXGISwapChain* pSwapChain, UINT uSyncInterval, UINT uFlags)
{
auto hResult = SilenthkPresent.GetOg<decltype(&Present)>((int)VTABLE::D3D::PRESENT);
if (!init && I::RenderTargetView == nullptr)
{
if (SUCCEEDED(pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&I::Device)))
{
I::Device->GetImmediateContext(&I::DeviceContext);
DXGI_SWAP_CHAIN_DESC sd;
pSwapChain->GetDesc(&sd);
IPT::hWindow = sd.OutputWindow;
ID3D11Texture2D* pBackBuffer;
pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
I::Device->CreateRenderTargetView(pBackBuffer, NULL, &I::RenderTargetView);
pBackBuffer->Release();
D::InitImGui();
init = true;
}
else
return hResult(pSwapChain, uSyncInterval, uFlags);
}
D::Render();
return hResult(pSwapChain, uSyncInterval, uFlags);
}
#include"../dependencies/imgui/imgui_impl_dx11.h"
#include"../dependencies/imgui/imgui_impl_win32.h"
HRESULT CS_FASTCALL H::ResizeBuffers(IDXGISwapChain* pSwapChain, std::uint32_t nBufferCount, std::uint32_t nWidth, std::uint32_t nHeight, DXGI_FORMAT newFormat, std::uint32_t nFlags)
{
ImGui_ImplDX11_InvalidateDeviceObjects();
auto hResult = SilenthkPresent.GetOg<decltype(&ResizeBuffers)>((int)VTABLE::D3D::RESIZEBUFFERS);
if (SUCCEEDED(hResult))
I::CreateRenderTarget(pSwapChain);
return hResult(pSwapChain, nBufferCount, nWidth, nHeight, newFormat, nFlags);
}
HRESULT __stdcall H::CreateSwapChain(IDXGIFactory* pFactory, IUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain)
{
auto hResult = Silentdxgi.GetOg<decltype(&CreateSwapChain)>((int)VTABLE::DXGI::CREATESWAPCHAIN);
I::DestroyRenderTarget();
L_PRINT(LOG_INFO) << CS_XOR("render target view has been destroyed");
return hResult(pFactory, pDevice, pDesc, ppSwapChain);
}
long H::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (D::OnWndProc(hWnd, uMsg, wParam, lParam))
return 1L;
return ::CallWindowProcW(IPT::pOldWndProc, hWnd, uMsg, wParam, lParam);
}
void* CS_FASTCALL H::OnAddEntity(void* rcx, CEntityInstance* pInstance, CBaseHandle hHandle) {
spoof_call<void>(_fake_addr, EntCache::OnAddEntity, pInstance, hHandle);
return SilentEntitySystem.GetOg<decltype(&OnAddEntity)>(14)(rcx, pInstance, hHandle);
}
void* CS_FASTCALL H::OnRemoveEntity(void* rcx, CEntityInstance* pInstance, CBaseHandle hHandle) {
spoof_call<void>(_fake_addr, EntCache::OnRemoveEntity, pInstance, hHandle);
return SilentEntitySystem.GetOg<decltype(&OnRemoveEntity)>(15)(rcx, pInstance, hHandle);
}
ViewMatrix_t* CS_FASTCALL H::GetMatrixForView(CRenderGameSystem* pRenderGameSystem, IViewRender* pViewRender, ViewMatrix_t* pOutWorldToView, ViewMatrix_t* pOutViewToProjection, ViewMatrix_t* pOutWorldToProjection, ViewMatrix_t* pOutWorldToPixels)
{ // Call the original function
const auto oGetMatrixForView = hkGetMatrixForView.GetOriginal();
ViewMatrix_t* matResult = oGetMatrixForView(pRenderGameSystem, pViewRender, pOutWorldToView, pOutViewToProjection, pOutWorldToProjection, pOutWorldToPixels); // get view matrix
SDK::ViewMatrix = *pOutWorldToProjection;
// get camera position
// @note: ida @GetMatrixForView(global_pointer, pRenderGameSystem + 16, ...)
SDK::CameraPosition = pViewRender->vecOrigin;
// keep bounding box updated
if (I::Engine->IsConnected() && I::Engine->IsInGame())
spoof_call<void>(_fake_addr, &F::VISUALS::OVERLAY::CalculateBoundingBoxes);
return matResult;
}
// SendNetInputMessage - 48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 41 56 48 81 EC ? ? ? ? 49 8B D9
int64_t CS_FASTCALL H::SendNetInputMessage(CNetInputMessage* a1, int64_t a2, int64_t a3, int64_t a4, int64_t a5, int64_t a6)
{
const auto bres = hkSendInputMessage.GetOriginal();
return bres(a1, a2, a3, a4, a5, a6);
}
#include "..\cstrike\sdk\datatypes\usercmd.h"
#include "../features/misc.h"
#include "../features/misc/movement.h"
void H::AllowCameraAngleChange(CCSGOInput* pCSGOInput, int a2)
{
const auto Original = hkAllowCameraChange.GetOriginal();
if (!I::Engine->IsInGame() || !I::Engine->IsConnected() || pCSGOInput == nullptr)
return Original(pCSGOInput, a2);
CUserCmd* pCmd = pCSGOInput->GetUserCmd();
if (pCmd == nullptr)
return Original(pCSGOInput, a2);
QAngle_t angOriginalAngle = pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue;
pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue = F::ANTIAIM::angStoredViewBackup;
Original(pCSGOInput, a2);
pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue = angOriginalAngle;
}
bool CS_FASTCALL H::CreateMove(CCSGOInput* pInput, int nSlot, bool nUnk, std::byte nUnk2)
{
const bool bResult = SilentInput.GetOg<decltype(&CreateMove)>((int)VTABLE::CLIENT::CREATEMOVE)(pInput, nSlot, nUnk, nUnk2);
if (!I::Engine->IsConnected() || !I::Engine->IsInGame())
return bResult;
CUserCmd* pCmd = SDK::Cmd = pInput->GetUserCmd();
if (pCmd == nullptr)
return bResult;
F::ANTIAIM::angStoredViewBackup = pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue;
SDK::LocalController = CCSPlayerController::GetLocalPlayerController();
if (SDK::LocalController == nullptr)
return bResult;
SDK::LocalPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(SDK::LocalController->GetPawnHandle());
if (SDK::LocalPawn == nullptr)
return bResult;
F::ANTIAIM::RunAA(pCmd);
cheat->alive = SDK::LocalPawn->GetHealth() > 0 && SDK::LocalPawn->GetLifeState() != ELifeState::LIFE_DEAD;
cheat->onground = (SDK::LocalPawn->GetFlags() & FL_ONGROUND);
cheat->canShot = SDK::LocalPawn->CanShoot(I::GlobalVars->nTickCount);
if (cheat->alive) {
auto network = I::NetworkClientService->GetNetworkClient();
if (network && Vars.full_update) {
network->Update();
Vars.full_update = false;
}
// process legit bot
if (C_GET(bool, Vars.legit_enable)) {
F::LEGIT::legit->SetupAdaptiveWeapon(SDK::LocalPawn);
F::LEGIT::legit->Run(pCmd);
}
F::LAGCOMP::lagcomp->Start(pCmd);
// we should run engine pred here for movement features etc
// in order to predict ( velocity, flags, origin )
// setup menu adaptive weapon with rage data
if (C_GET(bool, Vars.rage_enable)) {
F::RAGE::rage->SetupAdaptiveWeapon(SDK::LocalPawn);
F::RAGE::rage->Run(SDK::LocalPawn, pInput, pCmd);
}
F::MISC::MOVEMENT::ProcessMovement(pCmd, SDK::LocalController, SDK::LocalPawn);
}
return bResult;
}
#include "../features/misc/movement.h"
void CS_FASTCALL H::PredictionSimulation(CCSGOInput* pInput, int nSlot, CUserCmd* pCmd)
{
static auto bResult = SilentInput.GetOg<decltype(&PredictionSimulation)>((int)VTABLE::CLIENT::PREDICTION);
if (!I::Engine->IsConnected() || !I::Engine->IsInGame())
return bResult(pInput, nSlot, pCmd);
CUserCmd* commandnr = pInput->GetUserCmd();
if (commandnr == nullptr)
return bResult(pInput, nSlot, pCmd);
auto predicted_local_controller = CCSPlayerController::GetLocalPlayerController();
if (predicted_local_controller == nullptr)
return bResult(pInput, nSlot, pCmd);
auto pred = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(predicted_local_controller->m_hPredictedPawn());
if (pred == nullptr)
return bResult(pInput, nSlot, pCmd);
// run auto stop w predicted cmd
// F::RAGE::rage->AutomaticStop(pred, pred->ActiveWeapon(), pCmd);
// fix our command number members for predicted values (move correction etc)
return bResult(pInput, nSlot, pCmd);
}
double CS_FASTCALL H::WeaponAcurracySpreadClientSide(void* a1) {
static auto fnWeaponAcurracySpreadClientSide = hkWeapoSpreadClientSide.GetOriginal();
if (C_GET(bool, Vars.remove_weapon_accuracy_spread))
return 0.0;
return fnWeaponAcurracySpreadClientSide(a1);
}
double CS_FASTCALL H::WeaponAcurracySpreadServerSide(void* a1) {
static auto fnWeaponAcurracySpreadServerSide = hkWeapoSpreadServerSide.GetOriginal();
if (C_GET(bool, Vars.remove_weapon_accuracy_spread))
return 0.0;
return fnWeaponAcurracySpreadServerSide(a1);
}
bool CS_FASTCALL H::FireEventClientSide(void* rcx, IGameEvent* event, bool bServerOnly)
{
const auto oPreFire = hkPreFireEvent.GetOriginal();
return oPreFire(rcx, event, bServerOnly);
}
bool CS_FASTCALL H::MouseInputEnabled(void* pThisptr)
{
return MENU::bMainWindowOpened ? false : SilentInput.GetOg<decltype(&MouseInputEnabled)>((int)VTABLE::CLIENT::MOUSEINPUTENABLED)(pThisptr);
}
void CS_FASTCALL H::SetModel(void* rcx, const char* model) {
const auto oSetModel = hkSetModel.GetOriginal();
skin_changer::OnSetModel((C_BaseModelEntity*)rcx, model);
return oSetModel(rcx, model);
}
bool CS_FASTCALL H::EquipItemInLoadout(void* rcx, int iTeam, int iSlot,
uint64_t iItemID) {
const auto oEquipItemInLoadout = hkEquipItemInLoadout.GetOriginal();
skin_changer::OnEquipItemInLoadout(iTeam, iSlot, iItemID);
return oEquipItemInLoadout(rcx, iTeam, iSlot, iItemID);
}
void CS_FASTCALL H::FrameStageNotify(void* rcx, int nFrameStage)
{
const auto oFrameStageNotify = hkFrameStageNotify.GetOriginal();
if (I::Engine->IsConnected() && I::Engine->IsInGame())
skin_changer::OnFrameStageNotify(nFrameStage);
return oFrameStageNotify(rcx, nFrameStage);
}
__int64* CS_FASTCALL H::LevelInit(void* pClientModeShared, const char* szNewMap)
{
const auto oLevelInit = hkLevelInit.GetOriginal();
// if global variables are not captured during I::Setup or we join a new game, recapture it
if (I::GlobalVars == nullptr)
I::GlobalVars = *reinterpret_cast<IGlobalVars**>(MEM::ResolveRelativeAddress(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 0D ? ? ? ? 48 89 41")), 0x3, 0x7));
return oLevelInit(pClientModeShared, szNewMap);
}
//0x8D4C00000D1C8310
// client.dll 7FFB83FD0000
__int64 CS_FASTCALL H::LevelShutdown(void* pClientModeShared)
{
const auto oLevelShutdown = hkLevelShutdown.GetOriginal();
// reset global variables since it got discarded by the game
I::GlobalVars = nullptr;
return oLevelShutdown(pClientModeShared);
}
void CS_FASTCALL H::OverrideView(void* pClientModeCSNormal, CViewSetup* pSetup)
{
const auto oOverrideView = hkOverrideView.GetOriginal();
if (!I::Engine->IsConnected() || !I::Engine->IsInGame())
return hkOverrideView.GetOriginal()(pClientModeCSNormal, pSetup);
if (!SDK::LocalController->IsPawnAlive() || !SDK::LocalController)
return hkOverrideView.GetOriginal()(pClientModeCSNormal, pSetup);
static auto progress = 0.f;
if (C_GET(bool, Vars.bThirdperson))
{
auto bezier = [](const float t)
{
return t * t * (3.0f - 2.0f * t);
};
progress = MATH::clamp(progress + I::GlobalVars->flFrameTime * 6.f, 40.f / C_GET(float, Vars.flThirdperson), 1.f);
CONVAR::cam_idealdist->value.fl = C_GET(float, Vars.flThirdperson) * (C_GET(bool, Vars.bThirdpersonNoInterp) ? 1.f : bezier(progress));
CONVAR::cam_collision->value.i1 = true;
CONVAR::cam_snapto->value.i1 = true;
CONVAR::c_thirdpersonshoulder->value.i1 = true;
CONVAR::c_thirdpersonshoulderaimdist->value.fl = 0.f;
CONVAR::c_thirdpersonshoulderdist->value.fl = 0.f;
CONVAR::c_thirdpersonshoulderheight->value.fl = 0.f;
CONVAR::c_thirdpersonshoulderoffset->value.fl = 0.f;
I::Input->bInThirdPerson = true;
}
else
{
progress = C_GET(bool, Vars.bThirdperson) ? 1.f : 0.f;
I::Input->bInThirdPerson = false;
}
oOverrideView(pClientModeCSNormal, pSetup);
}
//8D4C7FFB91198310
void CS_FASTCALL H::DrawObject(void* pAnimatableSceneObjectDesc, void* pDx11, material_data_t* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2)
{
const auto oDrawObject = hkDrawObject.GetOriginal();
if (!I::Engine->IsConnected() || !I::Engine->IsInGame())
return oDrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
if (SDK::LocalController == nullptr || SDK::LocalPawn == nullptr)
return oDrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
if (!F::OnDrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2))
oDrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
}

View File

@ -0,0 +1,150 @@
#pragma once
// used: [d3d] api
#include <d3d11.h>
#include <dxgi1_2.h>
// used: chookobject
#include "../utilities/detourhook.h"
#include "..\sdk\entity_handle.h"
// used: viewmatrix_t
#include "../sdk/datatypes/matrix.h"
#include "../core/sdk.h"
#include "../sdk/entity.h"
#include "../core/silentvmt/ShadowVMT.h"
#include "../core/silentvmt/InlineHook.h"
namespace VTABLE
{
namespace D3D
{
enum
{
PRESENT = 8U,
RESIZEBUFFERS = 13U,
RESIZEBUFFERS_CSTYLE = 39U,
};
}
namespace DXGI
{
enum
{
CREATESWAPCHAIN = 10U,
};
}
namespace CLIENT
{
enum
{
CREATEMOVE = 5U,
CAMERA = 7U,
PREDICTION = 15U,
MOUSEINPUTENABLED = 14U,
FRAMESTAGENOTIFY = 33U,
};
}
namespace INVENTORY
{
enum {
EQUIPITEMLOADOUT = 54U,
};
}
}
class CNetInputMessage;
class CRenderGameSystem;
class IViewRender;
class CCSGOInput;
class CViewSetup;
class IGameEvent;
class C_BaseModelEntity;
class material_data_t;
class CGCClientSystem;
class CGCClientSharedObjectTypeCache;
class CCSGOInputHistoryEntryPB;
class CCSInputMessage;
namespace sigs {
extern CSigScan GetHitboxSet;
extern CSigScan HitboxToWorldTransforms;
extern CSigScan ComputeHitboxSurroundingBox;
extern CSigScan GetBoneName;
} // namespace signatures
namespace H
{
bool Setup();
void Destroy();
/* @section: handlers */
// d3d11 & wndproc
HRESULT WINAPI Present(IDXGISwapChain* pSwapChain, UINT uSyncInterval, UINT uFlags);
HRESULT CS_FASTCALL ResizeBuffers(IDXGISwapChain* pSwapChain, std::uint32_t nBufferCount, std::uint32_t nWidth, std::uint32_t nHeight, DXGI_FORMAT newFormat, std::uint32_t nFlags);
HRESULT WINAPI CreateSwapChain(IDXGIFactory* pFactory, IUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain);
long CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
// game's functions
ViewMatrix_t* CS_FASTCALL GetMatrixForView(CRenderGameSystem* pRenderGameSystem, IViewRender* pViewRender, ViewMatrix_t* pOutWorldToView, ViewMatrix_t* pOutViewToProjection, ViewMatrix_t* pOutWorldToProjection, ViewMatrix_t* pOutWorldToPixels);
bool CS_FASTCALL CreateMove(CCSGOInput* pInput, int nSlot, bool nUnk, std::byte nUnk2);
void CS_FASTCALL PredictionSimulation(CCSGOInput* pInput, int nSlot, CUserCmd* cmd);
void CS_FASTCALL AllowCameraAngleChange(CCSGOInput* pCSGOInput, int a2);
double CS_FASTCALL WeaponAcurracySpreadServerSide(void* a1);
bool CS_FASTCALL FireEventClientSide(void* rcx, IGameEvent* event, bool bServerOnly);
double CS_FASTCALL WeaponAcurracySpreadClientSide(void* a1);
bool CS_FASTCALL EquipItemInLoadout(void* rcx, int iTeam, int iSlot, uint64_t iItemID);
bool CS_FASTCALL MouseInputEnabled(void* pThisptr);
void* CS_FASTCALL OnAddEntity(void* rcx, CEntityInstance* pInstance, CBaseHandle hHandle);
void* CS_FASTCALL OnRemoveEntity(void* rcx, CEntityInstance* pInstance, CBaseHandle hHandle);
void CS_FASTCALL FrameStageNotify(void* rcx, int nFrameStage);
__int64* CS_FASTCALL LevelInit(void* pClientModeShared, const char* szNewMap);
__int64 CS_FASTCALL LevelShutdown(void* pClientModeShared);
void CS_FASTCALL OverrideView(void* pClientModeCSNormal, CViewSetup* pSetup);
void CS_FASTCALL DrawObject(void* pAnimatableSceneObjectDesc, void* pDx11, material_data_t* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2);
void CS_FASTCALL HandleGameEvents(void* rcx, IGameEvent* const event);
void CS_FASTCALL SetModel(void* rcx, const char* model_name);
int64_t CS_FASTCALL SendNetInputMessage(CNetInputMessage* a1, int64_t a2, int64_t a3, int64_t a4, int64_t a5, int64_t a6);
void CS_FASTCALL CameraInput(void* Input, int a1);
float CS_FASTCALL SetViewModelFOV();
float CS_FASTCALL GetRenderFov(uintptr_t rcx);
void* CS_FASTCALL InputParser(CCSInputMessage* a1, CCSGOInputHistoryEntryPB* a2, char a3, void* a4, void* a5, void* a6);
inline ShadowVMT SilenthkPresent{ };
inline ShadowVMT Silentdxgi{ };
inline ShadowVMT SilentInput{ };
inline ShadowVMT SilentEntitySystem{ };
inline ShadowVMT SilentInvetoryManager{ };
inline CCSInventoryManager* (*fnGetInventoryManager)();
inline CGCClientSystem* (*fnGetClientSystem)();
inline void* (CS_FASTCALL* fnSetDynamicAttributeValueUint)(void*, void*,
void*);
inline CEconItem* (*fnCreateSharedObjectSubclassEconItem)();
inline void(CS_FASTCALL* SetMeshGroupMask)(void*, uint64_t);
inline int(CS_FASTCALL* fnFindMaterialIndex)(void*, void*, int, bool);
inline CBaseHookObject<decltype(&GetMatrixForView)> hkGetMatrixForView = {};
inline CBaseHookObject<decltype(&SetViewModelFOV)> hkSetViewModelFOV = {};
inline CBaseHookObject<decltype(&GetRenderFov)> hkFOVObject = {};
inline CBaseHookObject<decltype(&HandleGameEvents)> hkGameEvents = {};
inline CBaseHookObject<decltype(&LevelInit)> hkLevelInit = {};
inline CBaseHookObject<decltype(&DrawObject)> hkDrawObject = {};
inline CBaseHookObject<decltype(&LevelShutdown)> hkLevelShutdown = {};
inline CBaseHookObject<decltype(&WeaponAcurracySpreadClientSide)> hkWeapoSpreadClientSide = {};
inline CBaseHookObject<decltype(&WeaponAcurracySpreadServerSide)> hkWeapoSpreadServerSide = {};
inline CBaseHookObject<decltype(&FireEventClientSide)> hkPreFireEvent = {};
inline CBaseHookObject<decltype(&FrameStageNotify)> hkFrameStageNotify = {};
inline CBaseHookObject<decltype(&SetModel)> hkSetModel = {};
inline CBaseHookObject<decltype(&EquipItemInLoadout)> hkEquipItemInLoadout = {};
inline CBaseHookObject<decltype(&PredictionSimulation)> hkPredictionSimulation = {};
inline CBaseHookObject<decltype(&SendNetInputMessage)> hkSendInputMessage = {};
inline CBaseHookObject<decltype(&AllowCameraAngleChange)> hkAllowCameraChange = {};
inline CBaseHookObject<decltype(&CameraInput)> hkCameraInput = {};
inline CBaseHookObject<decltype(&OverrideView)> hkOverrideView = {};
inline CBaseHookObject<decltype(&InputParser)> hkInputParser = {};
}

View File

@ -0,0 +1,243 @@
// used: [d3d] api
#include <d3d11.h>
#include "interfaces.h"
// used: findpattern, callvirtual, getvfunc...
#include "../utilities/memory.h"
// used: l_print
#include "../utilities/log.h"
// used: iswapchaindx11
#include "../sdk/interfaces/iswapchaindx11.h"
#include "hooks.h"
#include "../sdk/datatypes/resourceutils.h"
#include "../cstrike/sdk/interfaces/events.h"
#include "../sdk/interfaces/imaterialsystem.h"
#pragma region interfaces_get
using InstantiateInterfaceFn_t = void* (*)();
class CInterfaceRegister
{
public:
InstantiateInterfaceFn_t fnCreate;
const char* szName;
CInterfaceRegister* pNext;
};
static const CInterfaceRegister* GetRegisterList(const wchar_t* wszModuleName)
{
void* hModule = MEM::GetModuleBaseHandle(wszModuleName);
if (hModule == nullptr)
return nullptr;
std::uint8_t* pCreateInterface = reinterpret_cast<std::uint8_t*>(MEM::GetExportAddress(hModule, CS_XOR("CreateInterface")));
if (pCreateInterface == nullptr)
{
L_PRINT(LOG_ERROR) << CS_XOR("failed to get \"CreateInterface\" address");
return nullptr;
}
return *reinterpret_cast<CInterfaceRegister**>(MEM::ResolveRelativeAddress(pCreateInterface, 0x3, 0x7));
}
template <typename T = void*>
T* Capture(const CInterfaceRegister* pModuleRegister, const char* szInterfaceName)
{
for (const CInterfaceRegister* pRegister = pModuleRegister; pRegister != nullptr; pRegister = pRegister->pNext)
{
if (const std::size_t nInterfaceNameLength = CRT::StringLength(szInterfaceName);
// found needed interface
CRT::StringCompareN(szInterfaceName, pRegister->szName, nInterfaceNameLength) == 0 &&
// and we've given full name with hardcoded digits
(CRT::StringLength(pRegister->szName) == nInterfaceNameLength ||
// or it contains digits after name
CRT::StringToInteger<int>(pRegister->szName + nInterfaceNameLength, nullptr, 10) > 0))
{
// capture our interface
void* pInterface = pRegister->fnCreate();
#ifdef _DEBUG
// log interface address
L_PRINT(LOG_INFO) << CS_XOR("captured \"") << pRegister->szName << CS_XOR("\" interface at address: ") << L::AddFlags(LOG_MODE_INT_SHOWBASE | LOG_MODE_INT_FORMAT_HEX) << reinterpret_cast<std::uintptr_t>(pInterface);
#else
L_PRINT(LOG_INFO) << CS_XOR("captured \"") << pRegister->szName << CS_XOR("\" interface");
#endif
return static_cast<T*>(pInterface);
}
}
L_PRINT(LOG_ERROR) << CS_XOR("failed to find interface \"") << szInterfaceName << CS_XOR("\"");
return nullptr;
}
#pragma endregion
bool I::Setup()
{
bool bSuccess = true;
#pragma region interface_game_exported
const auto pTier0Handle = MEM::GetModuleBaseHandle(TIER0_DLL);
if (pTier0Handle == nullptr)
return false;
MemAlloc = *reinterpret_cast<IMemAlloc**>(MEM::GetExportAddress(pTier0Handle, CS_XOR("g_pMemAlloc")));
bSuccess &= (MemAlloc != nullptr);
const auto pSchemaSystemRegisterList = GetRegisterList(SCHEMASYSTEM_DLL);
if (pSchemaSystemRegisterList == nullptr)
return false;
SchemaSystem = Capture<ISchemaSystem>(pSchemaSystemRegisterList, SCHEMA_SYSTEM);
bSuccess &= (SchemaSystem != nullptr);
const auto pInputSystemRegisterList = GetRegisterList(INPUTSYSTEM_DLL);
if (pInputSystemRegisterList == nullptr)
return false;
InputSystem = Capture<IInputSystem>(pInputSystemRegisterList, INPUT_SYSTEM_VERSION);
bSuccess &= (InputSystem != nullptr);
const auto pEngineRegisterList = GetRegisterList(ENGINE2_DLL);
if (pEngineRegisterList == nullptr)
return false;
GameResourceService = Capture<IGameResourceService>(pEngineRegisterList, GAME_RESOURCE_SERVICE_CLIENT);
bSuccess &= (GameResourceService != nullptr);
Engine = Capture<IEngineClient>(pEngineRegisterList, SOURCE2_ENGINE_TO_CLIENT);
bSuccess &= (Engine != nullptr);
NetworkClientService = Capture<INetworkClientService>(pEngineRegisterList, NETWORK_CLIENT_SERVICE);
bSuccess &= (NetworkClientService != nullptr);
const auto pTier0RegisterList = GetRegisterList(TIER0_DLL);
if (pTier0RegisterList == nullptr)
return false;
Cvar = Capture<IEngineCVar>(pTier0RegisterList, ENGINE_CVAR);
bSuccess &= (Cvar != nullptr);
const auto pClientRegister = GetRegisterList(CLIENT_DLL);
if (pClientRegister == nullptr)
return false;
Client = Capture<ISource2Client>(pClientRegister, SOURCE2_CLIENT);
bSuccess &= (Client != nullptr);
const auto pLocalizeRegisterList = GetRegisterList(LOCALIZE_DLL);
if (pLocalizeRegisterList == nullptr)
return false;
Localize = Capture<CLocalize>(pLocalizeRegisterList, LOCALIZE);
bSuccess &= (Localize != nullptr);
/* material sys */
const auto pMaterialSystem2Register = GetRegisterList(MATERIAL_SYSTEM2_DLL);
if (pMaterialSystem2Register == nullptr)
return false;
MaterialSystem2 = Capture<material_system_t>(pMaterialSystem2Register, MATERIAL_SYSTEM2);
bSuccess &= (MaterialSystem2 != nullptr);
const auto pResourceSystemRegisterList = GetRegisterList(RESOURCESYSTEM_DLL);
if (pResourceSystemRegisterList == nullptr)
return false;
ResourceSystem = Capture<IResourceSystem>(pResourceSystemRegisterList, RESOURCE_SYSTEM);
bSuccess &= (ResourceSystem != nullptr);
if (ResourceSystem != nullptr)
{
ResourceHandleUtils = reinterpret_cast<CResourceHandleUtils*>(ResourceSystem->QueryInterface(RESOURCE_HANDLE_UTILS));
bSuccess &= (ResourceHandleUtils != nullptr);
}
/* //render game sys
const auto pRenderSysRegister = GetRegisterList(RENDERSYSTEM_DLL);
if (pRenderSysRegister == nullptr)
return false;
RenderGameSystem = Capture<CRenderGameSystem>(pRenderSysRegister, RENDERSYS_SYSTEM);
bSuccess &= (RenderGameSystem != nullptr);*/
#pragma endregion
Trace = *reinterpret_cast<i_trace**>(MEM::GetAbsoluteAddress(MEM::FindPattern(CLIENT_DLL, CS_XOR("4C 8B 3D ? ? ? ? 24 C9 0C 49 66 0F 7F 45 ?")), 0x3));
bSuccess &= (Trace != nullptr);
L_PRINT(LOG_INFO) << CS_XOR("captured Trace \"") << CS_XOR("\" interface at address: ") << L::AddFlags(LOG_MODE_INT_SHOWBASE | LOG_MODE_INT_FORMAT_HEX) << reinterpret_cast<std::uintptr_t>(Trace);
GameEvent = *reinterpret_cast<IGameEventManager2**>(MEM::ResolveRelativeAddress(MEM::GetVFunc<std::uint8_t*>(Client, 14U) + 0x3E, 0x3, 0x7));
bSuccess &= (GameEvent != nullptr);
// @ida: #STR: "r_gpu_mem_stats", "-threads", "CTSListBase: Misaligned list\n", "CTSQueue: Misaligned queue\n", "Display GPU memory usage.", "-r_max_device_threads"
SwapChain = **reinterpret_cast<ISwapChainDx11***>(MEM::ResolveRelativeAddress(MEM::FindPattern(RENDERSYSTEM_DLL, CS_XOR("66 0F 7F 05 ? ? ? ? 66 0F 7F 0D ? ? ? ? 48 89 35")), 0x4, 0x8));
bSuccess &= (SwapChain != nullptr);
// grab's d3d11 interfaces for later use
if (SwapChain != nullptr)
{
if (FAILED(SwapChain->pDXGISwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&Device)))
{
L_PRINT(LOG_ERROR) << CS_XOR("failed to get device from swapchain");
CS_ASSERT(false);
return false;
}
else
// we successfully got device, so we can get immediate context
Device->GetImmediateContext(&DeviceContext);
}
bSuccess &= (Device != nullptr && DeviceContext != nullptr);
Input = *reinterpret_cast<CCSGOInput**>(MEM::ResolveRelativeAddress(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 8B 0D ? ? ? ? E8 ? ? ? ? 8B BE ? ? ? ? 44 8B F0 85 FF 78 04 FF C7 EB 03")), 0x3, 0x7));
bSuccess &= (Input != nullptr);
// @ida: STR '%s: %f tick(%d) curtime(%f) OnSequenceCycleChanged: %s : %d=[%s]'
GlobalVars = *reinterpret_cast<IGlobalVars**>(MEM::ResolveRelativeAddress(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 0D ? ? ? ? 48 89 41")), 0x3, 0x7));
bSuccess &= (GlobalVars != nullptr);
return bSuccess;
}
bool I::CreateRenderTarget(IDXGISwapChain* pSwapChain) {
SwapChain->pDXGISwapChain = pSwapChain;
DXGI_SWAP_CHAIN_DESC swapChainDesc;
if (FAILED(SwapChain->pDXGISwapChain->GetDesc(&swapChainDesc))) {
L_PRINT(LOG_ERROR) << (CS_XOR("Failed to get swap chain description."));
return false;
}
if (FAILED(SwapChain->pDXGISwapChain->GetDevice(__uuidof(ID3D11Device), reinterpret_cast<PVOID*>(&Device)))) {
L_PRINT(LOG_ERROR) << (CS_XOR("Failed to get device from swap chain."));
return false;
}
Device->GetImmediateContext(&DeviceContext);
ID3D11Texture2D* back_buffer;
if (FAILED(SwapChain->pDXGISwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<PVOID*>(&back_buffer)))) {
L_PRINT(LOG_ERROR) << (CS_XOR("Failed to get buffer from swap chain."));
return false;
}
D3D11_RENDER_TARGET_VIEW_DESC desc;
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
if (FAILED(Device->CreateRenderTargetView(back_buffer, &desc, &RenderTargetView))) {
back_buffer->Release();
L_PRINT(LOG_ERROR) << (CS_XOR("Failed to create render target view."));
return false;
}
back_buffer->Release();
return true;
}
void I::DestroyRenderTarget()
{
if (RenderTargetView != nullptr)
{
RenderTargetView->Release();
RenderTargetView = nullptr;
}
}

View File

@ -0,0 +1,92 @@
#pragma once
#include "../common.h"
#include <d3d11.h>
#include "../utilities/memory.h"
#pragma region sdk_definitons
#define GAME_RESOURCE_SERVICE_CLIENT CS_XOR("GameResourceServiceClientV00")
#define SOURCE2_CLIENT CS_XOR("Source2Client00")
#define SCHEMA_SYSTEM CS_XOR("SchemaSystem_00")
#define INPUT_SYSTEM_VERSION CS_XOR("InputSystemVersion00")
#define SOURCE2_ENGINE_TO_CLIENT CS_XOR("Source2EngineToClient00")
#define ENGINE_CVAR CS_XOR("VEngineCvar00")
#define LOCALIZE CS_XOR("Localize_00")
#define NETWORK_CLIENT_SERVICE CS_XOR("NetworkClientService_001")
#define MATERIAL_SYSTEM2 CS_XOR("VMaterialSystem2_00")
#define RENDERSYS_SYSTEM CS_XOR("RenderGameSystem_00")
#define RESOURCE_SYSTEM CS_XOR("ResourceSystem013")
#define RESOURCE_HANDLE_UTILS CS_XOR("ResourceHandleUtils001")
// @source: master/game/shared/shareddefs.h
#define TICK_INTERVAL (I::GlobalVars->flIntervalPerTick)
#define TIME_TO_TICKS(TIME) (static_cast<int>(0.5f + static_cast<float>(TIME) / TICK_INTERVAL))
#define TICKS_TO_TIME(TICKS) (TICK_INTERVAL * static_cast<float>(TICKS))
#define ROUND_TO_TICKS(TIME) (TICK_INTERVAL * TIME_TO_TICKS(TIME))
#define TICK_NEVER_THINK (-1)
#pragma endregion
// game interfaces
class ISwapChainDx11;
class IMemAlloc;
class CCSGOInput;
class ISchemaSystem;
class IGlobalVars;
class IInputSystem;
class IGameResourceService;
class ISource2Client;
class IEngineClient;
class IEngineCVar;
class INetworkClientService;
class material_system_t;
class CLocalize;
class IResourceSystem;
class CResourceHandleUtils;
class i_trace;
class IGameEvent;
class IGameEventManager2;
class CGCClientSystem;
class CCSInventoryManager;
// [d3d] struct
struct ID3D11Device;
struct ID3D11DeviceContext;
struct ID3D11RenderTargetView;
class CLocalize {
public:
auto FindSafe(const char* tokenName) {
return MEM::CallVFunc<const char*, 17U>(this, tokenName);
}
};
namespace I
{
bool Setup();
/* @section: helpers */
// create and destroy render target view for handling resize
bool CreateRenderTarget(IDXGISwapChain* pSwapChain);
void DestroyRenderTarget();
inline ID3D11ShaderResourceView* Maintexture = nullptr;
inline IGameEventManager2* GameEvent = nullptr;
inline i_trace* Trace = nullptr;
inline IMemAlloc* MemAlloc = nullptr;
inline ISwapChainDx11* SwapChain = nullptr;
inline ID3D11Device* Device = nullptr;
inline ID3D11DeviceContext* DeviceContext = nullptr;
inline ID3D11RenderTargetView* RenderTargetView = nullptr;
inline CCSGOInput* Input = nullptr;
inline ISchemaSystem* SchemaSystem = nullptr;
inline IGlobalVars* GlobalVars = nullptr;
inline IInputSystem* InputSystem = nullptr;
inline IGameResourceService* GameResourceService = nullptr;
inline ISource2Client* Client = nullptr;
inline IEngineClient* Engine = nullptr;
inline IEngineCVar* Cvar = nullptr;
inline INetworkClientService* NetworkClientService = nullptr;
inline material_system_t* MaterialSystem2 = nullptr;
inline CLocalize* Localize = nullptr;
inline CResourceHandleUtils* ResourceHandleUtils = nullptr;
inline IResourceSystem* ResourceSystem = nullptr;
}

View File

@ -0,0 +1,115 @@
#ifndef CS2_CHEAT_MEMORY_HPP
#define CS2_CHEAT_MEMORY_HPP
#include <vector>
#include <cstdint>
#include <cstddef>
#include <optional>
#include <string_view>
namespace Core::Memory
{
struct Address_t
{
constexpr Address_t() noexcept = default;
constexpr ~Address_t() noexcept = default;
explicit constexpr Address_t(std::uintptr_t uAddress) noexcept
: m_uAddress(uAddress)
{
}
explicit Address_t(const void* pAddress) noexcept
: m_uAddress(reinterpret_cast<std::uintptr_t>(pAddress))
{
}
constexpr operator std::uintptr_t() const noexcept
{
return m_uAddress;
}
constexpr operator bool() const noexcept
{
return m_uAddress;
}
operator void* () const noexcept
{
return reinterpret_cast<void*>(m_uAddress);
}
template< typename tReturn = Address_t >
[[nodiscard]] constexpr tReturn Offset(std::ptrdiff_t iOffset) const noexcept
{
return tReturn(m_uAddress + iOffset);
}
template< typename tReturn = Address_t >
[[nodiscard]] inline tReturn Get(std::uint32_t iDereferenceCount = 1) const noexcept
{
std::uintptr_t uOutAddress = m_uAddress;
while (iDereferenceCount-- && uOutAddress)
uOutAddress = *reinterpret_cast<std::uintptr_t*>(uOutAddress);
return tReturn(uOutAddress);
}
template< typename tReturn = Address_t >
[[nodiscard]] inline tReturn Jump(std::ptrdiff_t iOffset = 0x1) const noexcept
{
std::uintptr_t uOutAddress = m_uAddress + iOffset;
uOutAddress += *reinterpret_cast<std::int32_t*>(uOutAddress); // @note / xnxkzeu: those could be negative.
uOutAddress += 4;
return tReturn(uOutAddress);
}
template< typename tReturn = std::uintptr_t >
[[nodiscard]] constexpr tReturn Cast() const noexcept
{
return tReturn(m_uAddress);
}
private:
std::uintptr_t m_uAddress = { };
};
[[nodiscard]] Address_t GetModuleBaseAddress(std::string_view szModuleName) noexcept;
[[nodiscard]] Address_t GetModuleBaseAddress(std::wstring_view szModuleName) noexcept;
[[nodiscard]] Address_t GetExportAddress(Address_t uModuleBaseAddress, std::string_view szProcedureName) noexcept;
[[nodiscard]] bool GetSectionInfo(Address_t uModuleAddress, std::string_view szSectionName, Address_t* pOutSectionAddress, std::size_t* pOutSectionSize) noexcept;
[[nodiscard]] Address_t FindPattern(std::string_view szModuleName, std::string_view szPattern) noexcept;
[[nodiscard]] Address_t FindPattern(Address_t uRegionAddress, std::size_t uRegionSize, std::string_view szPattern) noexcept;
[[nodiscard]] std::vector< std::optional< std::byte > > PatternToBytes(std::string_view szPattern) noexcept;
template< typename tReturn, std::size_t uIndex, typename... tArgs >
constexpr inline tReturn CallVFunc(void* pInstance, tArgs... argList) noexcept
{
using fnVirtual_t = tReturn(__thiscall*)(void*, tArgs...) noexcept;
return (*static_cast<fnVirtual_t**>(pInstance))[uIndex](pInstance, argList...);
}
} // namespace Core::Memory
#define VFUNC( uIndex, fnVirtual, tArgs, tReturn, ... ) \
auto fnVirtual noexcept \
{ \
return Core::Memory::CallVFunc< tReturn __VA_OPT__(, ) __VA_ARGS__, uIndex > tArgs; \
}
#define OFFSET( iOffset, fnVariable, tReturn, ... ) \
[[nodiscard]] std::add_lvalue_reference_t< tReturn __VA_OPT__(, ) __VA_ARGS__ > fnVariable( ) noexcept \
{ \
return *reinterpret_cast< std::add_pointer_t< tReturn __VA_OPT__(, ) __VA_ARGS__ > >( reinterpret_cast< std::uintptr_t >( this ) + iOffset ); \
} \
[[nodiscard]] std::add_lvalue_reference_t< std::add_const_t< tReturn __VA_OPT__(, ) __VA_ARGS__ > > fnVariable( ) const noexcept \
{ \
return *reinterpret_cast< std::add_pointer_t< std::add_const_t< tReturn __VA_OPT__(, ) __VA_ARGS__ > > >( reinterpret_cast< std::uintptr_t >( this ) + iOffset ); \
}
#endif // CS2_CHEAT_MEMORY_HPP

View File

@ -0,0 +1,131 @@
#include "../pointer/pointer.hpp"
#include "cmodule.hpp"
#include "../fnv1a.hpp"
#include <wtypes.h>
#include <Psapi.h>
CModule::CModule(const char* name) {
m_Name = name;
m_Hash = fnv1a::Hash(name);
m_Handle = nullptr;
m_Begin = m_Size = 0;
}
CModule::~CModule() {
if (!m_Handle) {
return;
}
#ifndef _WIN32
dlclose(m_Handle);
#endif
}
bool CModule::Retrieve() {
if (m_Handle) {
return true;
}
InitializeHandle();
InitializeBounds();
return m_Handle != nullptr;
}
uintptr_t CModule::GetInterface(const char* version) {
uintptr_t rv = 0;
if (m_Handle) {
CPointer pCreateInterface = GetProcAddress("CreateInterface");
if (!pCreateInterface.IsValid()) {
return rv;
}
// Used internally to register classes.
struct InterfaceReg {
std::add_pointer_t<uintptr_t()> m_CreateFn;
const char* m_pName;
InterfaceReg* m_pNext; // For the global list.
};
InterfaceReg* s_pInterfaceRegs =
#ifdef _WIN32
pCreateInterface.Absolute(3, 0).Dereference(1).Get<InterfaceReg*>()
#elif __linux__
pCreateInterface.Absolute(1, 0).Absolute(19, 0).Dereference(1).Get<InterfaceReg*>()
#endif
;
uint32_t versionHash = fnv1a::Hash(version);
for (; s_pInterfaceRegs; s_pInterfaceRegs = s_pInterfaceRegs->m_pNext) {
if (fnv1a::Hash(s_pInterfaceRegs->m_pName) == versionHash) {
rv = s_pInterfaceRegs->m_CreateFn();
break;
}
}
}
return rv;
}
uintptr_t CModule::GetProcAddress(const char* procName) {
uintptr_t rv = 0;
if (m_Handle) {
rv = reinterpret_cast<uintptr_t>(::GetProcAddress(static_cast<HMODULE>(m_Handle), procName));
}
return rv;
}
uintptr_t CModule::FindPattern(const std::span<const int>& pattern) const {
uintptr_t rv = 0;
if (m_Handle) {
uint8_t* bytes = reinterpret_cast<uint8_t*>(m_Begin);
// Faster than pattern[] in debug builds because of _STL_VERIFY.
const int* patternData = pattern.data();
const size_t patternSize = pattern.size();
for (size_t i = 0; i < m_Size - patternSize; ++i) {
bool found = true;
for (size_t j = 0; j < patternSize; ++j) {
if (bytes[i + j] != patternData[j] && patternData[j] != -1) {
found = false;
break;
}
}
if (found) {
rv = reinterpret_cast<uintptr_t>(&bytes[i]);
break;
}
}
}
return rv;
}
void CModule::InitializeHandle() {
#ifdef _WIN32
m_Handle = GetModuleHandle(GetName());
#else
m_Handle = dlopen(GetName(), RTLD_LAZY | RTLD_NOLOAD);
#endif
}
void CModule::InitializeBounds() {
if (!m_Handle) {
return;
}
MODULEINFO mi;
BOOL status = GetModuleInformation(GetCurrentProcess(), static_cast<HMODULE>(m_Handle), &mi, sizeof(mi));
if (status != 0) {
SetBounds(reinterpret_cast<uintptr_t>(m_Handle), mi.SizeOfImage);
}
}
void CModule::SetBounds(uintptr_t begin, uintptr_t size) {
m_Begin = begin;
m_Size = size;
}

View File

@ -0,0 +1,38 @@
#pragma once
#include <cstdint>
#include <span>
#include <string>
class CModule {
public:
CModule(const char* name);
~CModule();
auto GetHash() const { return m_Hash; }
auto GetHandle() const { return m_Handle; }
auto GetName() const { return m_Name.c_str(); }
// Returns false if module not loaded.
bool Retrieve();
uintptr_t GetInterface(const char* version);
uintptr_t GetProcAddress(const char* procName);
uintptr_t FindPattern(const std::span<const int>& pattern) const;
private:
void InitializeHandle();
void InitializeBounds();
void SetBounds(uintptr_t begin, uintptr_t size);
// Module name.
std::string m_Name;
// Module name fnv1a hash.
uint32_t m_Hash;
// Module handle.
void* m_Handle;
// Used for pattern scanning.
uintptr_t m_Begin, m_Size;
};

View File

@ -0,0 +1,58 @@
#include "../memory/memadd.h"
#include "../csig/sigscan.hpp"
#include "../fnv1a.hpp"
void CMemory::Initialize() {
for (CSigScan* it : m_ScheduledScans) {
it->FindSignature();
it->FreeData();
}
std::vector<CSigScan*>().swap(m_ScheduledScans);
}
ModulePtr_t& CMemory::GetModuleInternal(const char* libName) {
auto hash = fnv1a::Hash(libName);
auto it = m_CachedModules.find(hash);
if (it != m_CachedModules.end()) {
return it->second;
}
auto module = std::make_unique<CModule>(libName);
if (module->Retrieve()) {
return m_CachedModules.emplace(hash, std::move(module)).first->second;
}
static ModulePtr_t null{};
return null;
}
CPointer CMemory::GetInterfaceInternal(const char* libName, const char* version) {
CPointer rv = 0;
auto& library = CMemory::GetModuleInternal(libName);
if (!library) {
return rv;
}
rv = library->GetInterface(version);
return rv;
}
CPointer CMemory::GetProcAddressInternal(const char* libName, const char* procName) {
CPointer rv = 0;
auto& library = CMemory::GetModuleInternal(libName);
if (!library) {
return rv;
}
rv = library->GetProcAddress(procName);
return rv;
}

View File

@ -0,0 +1,37 @@
#pragma once
#include "../memory/cmodule.hpp"
#include "../pointer/pointer.hpp"
#include <memory>
#include <vector>
#include <unordered_map>
class CSigScan;
using ModulePtr_t = std::unique_ptr<CModule>;
class CMemory {
public:
static CMemory& Get() {
static CMemory inst;
return inst;
}
static auto& GetModule(const char* libName) { return Get().GetModuleInternal(libName); }
static auto GetInterface(const char* libName, const char* version) { return Get().GetInterfaceInternal(libName, version); }
static auto GetProcAddress(const char* libName, const char* procName) { return Get().GetProcAddressInternal(libName, procName); }
// Used internally.
static auto ScheduleScan(CSigScan* sigScan) { Get().m_ScheduledScans.emplace_back(sigScan); }
void Initialize();
private:
ModulePtr_t& GetModuleInternal(const char* libName);
CPointer GetInterfaceInternal(const char* libName, const char* version);
CPointer GetProcAddressInternal(const char* libName, const char* procName);
std::unordered_map<uint32_t, ModulePtr_t> m_CachedModules;
std::vector<CSigScan*> m_ScheduledScans;
};

View File

@ -0,0 +1,106 @@
#pragma once
// used: [stl] vector
#include <vector>
#include "../common.h"
// used: [ext] imgui, draw, animation
#include "../utilities/draw.h"
#define MENU_MAX_BACKGROUND_PARTICLES 100
class CTab
{
public:
const char* szName;
void (*pRenderFunction)();
};
namespace MENU
{
void RenderMainWindow();
void RenderWatermark();
void UpdateStyle(ImGuiStyle* pStyle = nullptr);
/* @section: particles */
struct ParticleData_t
{
ParticleData_t(const ImVec2& vecPosition, const ImVec2& vecVelocity) :
vecPosition(vecPosition), vecVelocity(vecVelocity) { }
// current particle position
ImVec2 vecPosition = {};
// current particle velocity
ImVec2 vecVelocity = {};
};
struct ParticleContext_t
{
ParticleContext_t(const int nMaxParticles = 100)
{
// allocate memory for particles
this->vecParticles.reserve(nMaxParticles);
// create particles if needed
}
~ParticleContext_t()
{
// since no memory allocated, just clear vector
this->vecParticles.clear();
}
void Render(ImDrawList* pDrawList, const ImVec2& vecScreenSize, const float flAlpha);
// create particle with random velocity/position
void AddParticle(const ImVec2& vecScreenSize);
// current size of particles
const size_t Count() const { return this->vecParticles.size(); }
private:
// draw particle (circle)
void DrawParticle(ImDrawList* pDrawList, ParticleData_t& particle, const Color_t& colPrimary);
// find & draw connection as a line between particles
void FindConnections(ImDrawList* pDrawList, ParticleData_t& particle, const Color_t& colPrimary, float flMaxDistance);
void DrawConnection(ImDrawList* pDrawList, ParticleData_t& particle, ParticleData_t& otherParticle, float flAlpha, const Color_t& colPrimary) const;
// update particle position/velocity
// reversed direction when particle is out of screen
void UpdatePosition(ParticleData_t& particle, const ImVec2& vecScreenSize) const;
void ResolveScreenCollision(ParticleData_t& particle, const ImVec2& vecScreenSize) const;
// all our particles data
std::vector<ParticleData_t> vecParticles;
};
inline bool bMainWindowOpened = false;
inline int nCurrentMainTab = 0;
inline int g_cur_tab_idx = 0;
inline char szConfigFile[256U] = {};
inline unsigned long long nSelectedConfig = ~1U;
inline ParticleContext_t menuParticle = ParticleContext_t(MENU_MAX_BACKGROUND_PARTICLES);
inline AnimationHandler_t animMenuDimBackground;
inline float flDpiScale = 1.f;
}
namespace T
{
/* @section: main */
void Render(const char* szTabBar, const CTab* arrTabs, const unsigned long long nTabsCount, int* nCurrentTab, ImGuiTabBarFlags flags = ImGuiTabBarFlags_NoCloseWithMiddleMouseButton | ImGuiTabBarFlags_NoTooltip);
/* @section: tabs */
void RageBot();
void LegitBot();
void Visuals();
void Miscellaneous();
void SkinsChanger();
/* @section: values */
// user-defined configuration filename in miscellaneous tab
inline char szConfigFile[256U] = {};
// current selected configuration in miscellaneous tab
inline unsigned long long nSelectedConfig = ~1U;
// current sub tab overlay in visuals tab
inline int nCurrentOverlaySubtab = 0;
}

View File

@ -0,0 +1,44 @@
#include "pointer.hpp"
#include <iostream>
CPointer CPointer::GetFieldPtr(int offset) const {
if (IsValid()) {
return m_Value + offset;
}
LogInvalid();
static CPointer null{};
return &null;
}
CPointer& CPointer::Offset(int offset) {
if (IsValid()) {
m_Value += offset;
}
return *this;
}
CPointer& CPointer::Absolute(int preAbs, int postAbs) {
if (IsValid()) {
Offset(preAbs);
m_Value = m_Value + sizeof(int) + *reinterpret_cast<int*>(m_Value);
Offset(postAbs);
}
return *this;
}
CPointer& CPointer::Dereference(int count) {
if (IsValid()) {
while (count-- != 0) {
m_Value = *reinterpret_cast<uintptr_t*>(m_Value);
}
}
return *this;
}
void CPointer::LogInvalid() const { std::cout << "invalid offset\n"; }

View File

@ -0,0 +1,49 @@
#pragma once
#include <cstdint>
#include <type_traits>
class CPointer {
public:
CPointer() { m_Value = 0; }
template <typename T>
CPointer(T value) {
m_Value = (uintptr_t)(value);
}
bool IsValid() const { return m_Value != 0; }
template <typename T>
auto Get() const {
return reinterpret_cast<T>(m_Value);
}
template <typename T>
std::add_lvalue_reference_t<T> GetField(int offset) const {
return *GetFieldPtr(offset).Get<T*>();
}
template <typename T, typename... Args>
auto Call(Args... args) const {
if constexpr (std::is_invocable_v<T, Args...>) {
if (IsValid()) {
return std::invoke(Get<T>(), std::forward<Args>(args)...);
}
} else {
static_assert(std::is_invocable_v<T, Args...>, "T must be an invocable type.");
}
LogInvalid();
return std::invoke_result_t<T, Args...>{};
}
CPointer GetFieldPtr(int offset) const;
CPointer& Offset(int offset);
CPointer& Absolute(int preAbs, int postAbs);
CPointer& Dereference(int count);
private:
void LogInvalid() const;
uintptr_t m_Value;
};

View File

@ -0,0 +1,168 @@
#include "schema.h"
// used: [stl] vector
#include <vector>
// used: [stl] find_if
#include <algorithm>
// used: getworkingpath
#include "../core.h"
// used: ischemasystem
#include "interfaces.h"
#include "../sdk/interfaces/ischemasystem.h"
// used: l_print
#include "../utilities/log.h"
struct SchemaData_t
{
FNV1A_t uHashedFieldName = 0x0ULL;
std::uint32_t uOffset = 0x0U;
};
static std::vector<SchemaData_t> vecSchemaData;
bool SCHEMA::Setup(const wchar_t* wszFileName, const char* szModuleName)
{
wchar_t wszDumpFilePath[MAX_PATH];
if (!CORE::GetWorkingPath(wszDumpFilePath))
return false;
CRT::StringCat(wszDumpFilePath, wszFileName);
HANDLE hOutFile = ::CreateFileW(wszDumpFilePath, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hOutFile == INVALID_HANDLE_VALUE)
return false;
// @todo: maybe remove this redundant? and put it inside CRT::String_t c'tor
const std::time_t time = std::time(nullptr);
std::tm timePoint;
localtime_s(&timePoint, &time);
CRT::String_t<64> szTimeBuffer(CS_XOR("[%d-%m-%Y %T] asphyxia | schema dump\n\n"), &timePoint);
// write current date, time and info
::WriteFile(hOutFile, szTimeBuffer.Data(), szTimeBuffer.Length(), nullptr, nullptr);
CSchemaSystemTypeScope* pTypeScope = I::SchemaSystem->FindTypeScopeForModule(szModuleName);
if (pTypeScope == nullptr)
return false;
const int nTableSize = pTypeScope->hashClasses.Count();
L_PRINT(LOG_INFO) << CS_XOR("found \"") << nTableSize << CS_XOR("\" schema classes in module");
// allocate memory for elements
UtlTSHashHandle_t* pElements = new UtlTSHashHandle_t[nTableSize + 1U];
const auto nElements = pTypeScope->hashClasses.GetElements(0, nTableSize, pElements);
for (int i = 0; i < nElements; i++)
{
const UtlTSHashHandle_t hElement = pElements[i];
if (hElement == 0)
continue;
CSchemaClassBinding* pClassBinding = pTypeScope->hashClasses[hElement];
if (pClassBinding == nullptr)
continue;
SchemaClassInfoData_t* pDeclaredClassInfo;
pTypeScope->FindDeclaredClass(&pDeclaredClassInfo, pClassBinding->szBinaryName);
if (pDeclaredClassInfo == nullptr)
continue;
if (pDeclaredClassInfo->nFieldSize == 0)
continue;
CRT::String_t<MAX_PATH> szClassBuffer(CS_XOR("class %s\n"), pDeclaredClassInfo->szName);
::WriteFile(hOutFile, szClassBuffer.Data(), szClassBuffer.Length(), nullptr, nullptr);
for (auto j = 0; j < pDeclaredClassInfo->nFieldSize; j++)
{
SchemaClassFieldData_t* pFields = pDeclaredClassInfo->pFields;
CRT::String_t<MAX_PATH> szFieldClassBuffer(CS_XOR("%s->%s"), pClassBinding->szBinaryName, pFields[j].szName);
// store field info
vecSchemaData.emplace_back(FNV1A::Hash(szFieldClassBuffer.Data()), pFields[j].nSingleInheritanceOffset);
CRT::String_t<MAX_PATH> szFieldBuffer(CS_XOR(" %s %s = 0x%X\n"), pFields[j].pSchemaType->szName, pFields[j].szName, pFields[j].nSingleInheritanceOffset);
// write field info
::WriteFile(hOutFile, szFieldBuffer.Data(), szFieldBuffer.Length(), nullptr, nullptr);
}
#ifdef _DEBUG
L_PRINT(LOG_INFO) << CS_XOR("dumped \"") << pDeclaredClassInfo->szName << CS_XOR("\" (total: ") << pDeclaredClassInfo->nFieldSize << CS_XOR(" fields)");
#endif
}
// free allocated memory
delete[] pElements;
// close file
::CloseHandle(hOutFile);
return true;
}
std::uint32_t SCHEMA::GetOffset(const FNV1A_t uHashedFieldName)
{
if (const auto it = std::ranges::find_if(vecSchemaData, [uHashedFieldName](const SchemaData_t& data)
{ return data.uHashedFieldName == uHashedFieldName; });
it != vecSchemaData.end())
return it->uOffset;
L_PRINT(LOG_ERROR) << CS_XOR("failed to find offset for field with hash: ") << L::AddFlags(LOG_MODE_INT_FORMAT_HEX | LOG_MODE_INT_SHOWBASE) << uHashedFieldName;
CS_ASSERT(false); // schema field not found
return 0U;
}
// @todo: optimize this, this is really poorly do and can be done much better?
std::uint32_t SCHEMA::GetForeignOffset(const char* szModulenName, const FNV1A_t uHashedClassName, const FNV1A_t uHashedFieldName)
{
CSchemaSystemTypeScope* pTypeScope = I::SchemaSystem->FindTypeScopeForModule(szModulenName);
if (pTypeScope == nullptr)
return false;
const int nTableSize = pTypeScope->hashClasses.Count();
// allocate memory for elements
UtlTSHashHandle_t* pElements = new UtlTSHashHandle_t[nTableSize + 1U];
const auto nElements = pTypeScope->hashClasses.GetElements(0, nTableSize, pElements);
std::uint32_t uOffset = 0x0;
for (int i = 0; i < nElements; i++)
{
const UtlTSHashHandle_t hElement = pElements[i];
if (hElement == 0)
continue;
CSchemaClassBinding* pClassBinding = pTypeScope->hashClasses[hElement];
if (pClassBinding == nullptr)
continue;
SchemaClassInfoData_t* pDeclaredClassInfo;
pTypeScope->FindDeclaredClass(&pDeclaredClassInfo, pClassBinding->szBinaryName);
if (pDeclaredClassInfo == nullptr)
continue;
if (pDeclaredClassInfo->nFieldSize == 0)
continue;
for (auto j = 0; j < pDeclaredClassInfo->nFieldSize; j++)
{
SchemaClassFieldData_t* pFields = pDeclaredClassInfo->pFields;
if (pFields == nullptr)
continue;
SchemaClassFieldData_t field = pFields[j];
if (FNV1A::Hash(pClassBinding->szBinaryName) == uHashedClassName && FNV1A::Hash(field.szName) == uHashedFieldName)
uOffset = field.nSingleInheritanceOffset;
}
}
if (uOffset == 0x0)
L_PRINT(LOG_WARNING) << CS_XOR("failed to find offset for field with hash: ") << L::AddFlags(LOG_MODE_INT_FORMAT_HEX | LOG_MODE_INT_SHOWBASE) << uHashedFieldName;
return uOffset;
}

View File

@ -0,0 +1,45 @@
#pragma once
#include "../common.h"
// used: fnv-1a hash
#include "../utilities/fnv1a.h"
#define SCHEMA_ADD_OFFSET(TYPE, NAME, OFFSET) \
[[nodiscard]] CS_INLINE std::add_lvalue_reference_t<TYPE> NAME() \
{ \
static const std::uint32_t uOffset = OFFSET; \
return *reinterpret_cast<std::add_pointer_t<TYPE>>(reinterpret_cast<std::uint8_t*>(this) + (uOffset)); \
}
#define SCHEMA_ADD_POFFSET(TYPE, NAME, OFFSET) \
[[nodiscard]] CS_INLINE std::add_pointer_t<TYPE> NAME() \
{ \
const static std::uint32_t uOffset = OFFSET; \
return reinterpret_cast<std::add_pointer_t<TYPE>>(reinterpret_cast<std::uint8_t*>(this) + (uOffset)); \
}
#define SCHEMA_ADD_FIELD_OFFSET(TYPE, NAME, FIELD, ADDITIONAL) SCHEMA_ADD_OFFSET(TYPE, NAME, SCHEMA::GetOffset(FNV1A::HashConst(FIELD)) + ADDITIONAL)
#define SCHEMA_ADD_FIELD(TYPE, NAME, FIELD) SCHEMA_ADD_FIELD_OFFSET(TYPE, NAME, FIELD, 0U)
#define SCHEMA_ADD_PFIELD_OFFSET(TYPE, NAME, FIELD, ADDITIONAL) SCHEMA_ADD_POFFSET(TYPE, NAME, SCHEMA::GetOffset(FNV1A::HashConst(FIELD)) + ADDITIONAL)
#define SCHEMA_ADD_PFIELD(TYPE, NAME, FIELD) SCHEMA_ADD_PFIELD_OFFSET(TYPE, NAME, FIELD, 0U)
// @todo: dump enums?
namespace SCHEMA
{
// store the offset of the field in the class
// dump stored data to file
bool Setup(const wchar_t* wszFileName, const char* szModuleName);
/* @section: get */
// get offset of the field in the class
// @note: only client.dll class & fields
[[nodiscard]] std::uint32_t GetOffset(const FNV1A_t uHashedFieldName);
// get foregin offset from other .dll
[[nodiscard]] std::uint32_t GetForeignOffset(const char* szModulenName, const FNV1A_t uHashedClassName, const FNV1A_t uHashedFieldName);
}

View File

@ -0,0 +1,34 @@
#include "schemav2.hpp"
#include "../sdk/interfaces/ischemasystem.h"
#include "../utilities/fnv1a.h"
#include "../utilities/log.h"
std::optional<int32_t> CSchemaManager::GetSchemaOffsetInternal(const char* moduleName, const char* bindingName, const char* fieldName) {
CSchemaSystemTypeScope* typeScope = I::SchemaSystem->FindTypeScopeForModule(moduleName);
if (!typeScope) {
L_PRINT(LOG_ERROR) << CS_XOR("\"schemamgr\" No type scope found for " << moduleName);
return {};
}
SchemaClassInfoData_t* classInfo;
typeScope->FindDeclaredClass(&classInfo, bindingName);
if (!classInfo) {
L_PRINT(LOG_INFO) << CS_XOR("\"schemamgr\" No binding named '{}' has been found in module '{}'.");
return {};
}
uint32_t fieldHash = FNV1A::Hash(fieldName);
for (int i = 0; classInfo->pFields && i < classInfo->nFieldSize; ++i) {
auto& field = classInfo->pFields[i];
if (FNV1A::Hash(field.szName) == fieldHash) {
L_PRINT(LOG_WARNING) << CS_XOR("\"schemamgr\" offset" << bindingName << "field: " << fieldName);
return field.nSingleInheritanceOffset;
}
}
L_PRINT(LOG_ERROR) << CS_XOR("\"schemamgr\" No field named " << fieldName << "in binding: " << bindingName);
return {};
}

View File

@ -0,0 +1,38 @@
#pragma once
#include "pointer/pointer.hpp"
#include <optional>
class CSchemaManager {
public:
static CSchemaManager& Get() {
static CSchemaManager inst;
return inst;
}
static auto GetSchemaOffset(const char* moduleName, const char* bindingName, const char* fieldName) {
return Get().GetSchemaOffsetInternal(moduleName, bindingName, fieldName);
}
private:
std::optional<int32_t> GetSchemaOffsetInternal(const char* moduleName, const char* bindingName, const char* fieldName);
};
#define SCHEMA_EXTENDED(type, name, module_name, binding_name, field_name, extra_offset) \
std::add_lvalue_reference_t<type> name() const { \
static const auto offset = CSchemaManager::GetSchemaOffset(module_name, binding_name, field_name); \
if (offset) return CPointer(this).GetField<type>(offset.value() + extra_offset); \
static type null{}; \
return null; \
}
#define SCHEMA(type, name, binding_name, field_name) SCHEMA_EXTENDED(type, name, CConstants::CLIENT_LIB, binding_name, field_name, 0)
#define PSCHEMA_EXTENDED(type, name, module_name, binding_name, field_name, extra_offset) \
std::add_pointer_t<type> name() const { \
static const auto offset = CSchemaManager::GetSchemaOffset(module_name, binding_name, field_name); \
if (offset) return CPointer(this).GetFieldPtr(offset.value() + extra_offset).Get<std::add_pointer_t<type>>(); \
return nullptr; \
}
#define PSCHEMA(type, name, binding_name, field_name) PSCHEMA_EXTENDED(type, name, CConstants::CLIENT_LIB, binding_name, field_name, 0)

View File

@ -0,0 +1,18 @@
#include "sdk.h"
// used: getmodulebasehandle
#include "../utilities/memory.h"
bool SDK::Setup()
{
bool bSuccess = true;
const void* hTier0Lib = MEM::GetModuleBaseHandle(TIER0_DLL);
if (hTier0Lib == nullptr)
return false;
fnConColorMsg = reinterpret_cast<decltype(fnConColorMsg)>(MEM::GetExportAddress(hTier0Lib, CS_XOR("?ConColorMsg@@YAXAEBVColor@@PEBDZZ")));
bSuccess &= fnConColorMsg != nullptr;
return bSuccess;
}

View File

@ -0,0 +1,51 @@
#pragma once
// used: viewmatrix_t
#include "../sdk/datatypes/matrix.h"
// used: color_t
#include "../sdk/datatypes/color.h"
#pragma region sdk_definitions
// @source: master/public/worldsize.h
// world coordinate bounds
#define MAX_COORD_FLOAT 16'384.f
#define MIN_COORD_FLOAT (-MAX_COORD_FLOAT)
// @source: master/public/vphysics_interface.h
// coordinates are in HL units. 1 unit == 1 inch
#define METERS_PER_INCH 0.0254f
#pragma endregion
class CCSPlayerController;
class C_CSPlayerPawn;
class CUserCmd;
namespace SDK
{
// capture game's exported functions
bool Setup();
inline ViewMatrix_t ViewMatrix = ViewMatrix_t();
inline Vector_t CameraPosition = Vector_t();
inline CCSPlayerController* LocalController = nullptr;
inline C_CSPlayerPawn* LocalPawn = nullptr;
inline CUserCmd* Cmd = nullptr;
inline void(CS_CDECL* fnConColorMsg)(const Color_t&, const char*, ...) = nullptr;
}
class Cheat
{
public:
bool onground = false;
bool alive = false;
bool canShot = false;
bool canShotRevolver = false;
unsigned int tickbase = 0;
QAngle_t viewangles = QAngle_t(0, 0, 0);
};
inline Cheat* cheat = new Cheat();

View File

@ -0,0 +1,55 @@
#include "InlineHook.h"
#include <stdio.h>
#include <cstdint>
#include <iostream>
#include <memoryapi.h>
#include "../cstrike/core/spoofcall/lazy_importer.hpp"
bool detour(BYTE* src, BYTE* dst, const uintptr_t len)
{
if (len < 5) return false;
DWORD curProtection;
LI_FN(VirtualProtect).safe()(src, len, PAGE_EXECUTE_READWRITE, &curProtection);
memset(src, 0x90, len);
uintptr_t relativeAddress = ((uintptr_t)dst - (uintptr_t)src) - 5;
*(BYTE*)src = 0xE9;
*(uintptr_t*)((uintptr_t)src + 1) = relativeAddress;
DWORD temp;
LI_FN(VirtualProtect).safe()(src, len, curProtection, &temp);
return true;
}
BYTE* trampHook(BYTE* src, BYTE* dst, const uintptr_t len)
{
if (len < 5) return 0;
void* gateway = LI_FN(VirtualAlloc).safe()(0, len + 5, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
memcpy(gateway, src, len);
intptr_t gatewayRelativeAddr = ((intptr_t)src - (intptr_t)gateway) - 5;
*(char*)((intptr_t)gateway + len) = 0xE9;
*(intptr_t*)((intptr_t)gateway + len + 1) = gatewayRelativeAddr;
// detour(src, dst, len);
return (BYTE*) gateway;
}
void InlineHook::Hook(void* src, void* dest, const size_t len)
{
const BYTE* src_bytes = (BYTE*) src;
for(int i = 0; i < len; i++)
og_bytes.push_back(src_bytes[i]);
source = (DWORD) src;
original = (DWORD)trampHook((BYTE*) src, (BYTE*) dest, len);
if(original)
bEnabled = true;
}
void InlineHook::Unhook()
{
BYTE* bytes = (BYTE*) source;
int i = 0;
for(const BYTE& b : og_bytes)
bytes[i++] = b;
}

View File

@ -0,0 +1,56 @@
#pragma once
#include <Windows.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <array>
#include <functional>
#include <sstream>
#include <string>
#include <string_view>
#include <chrono>
#include <random>
#include <numeric>
#include <cstdint>
#include <memory>
#include <thread>
#include <type_traits>
#include <regex>
#include <cmath>
#include <fstream>
#include <cassert>
#include <process.h>
#include <DbgHelp.h>
#include <filesystem>
#include <libloaderapi.h>
#include <Psapi.h>
#include <corecrt_math_defines.h>
#include <numbers>
#include <iomanip>
#include <iosfwd>
#include <set>
#include <unordered_set>
#include <list>
#include <TlHelp32.h>
#include <cinttypes>
#include <cstring>
class InlineHook
{
std::vector<BYTE> og_bytes;
DWORD original = 0;
DWORD source = 0;
bool bEnabled = false;
public:
InlineHook(){}
void Hook(void* src, void* dest, const size_t len);
void Unhook();
template<typename T>
T GetOg()
{
return (T)original;
}
};

View File

@ -0,0 +1,60 @@
#include "ShadowVMT.h"
#include <cstdint>
#include <iostream>
#include <memoryapi.h>
#include "../spoofcall/lazy_importer.hpp"
ShadowVMT::ShadowVMT()
: class_base(nullptr), vftbl_len(0), new_vftbl(nullptr), old_vftbl(nullptr)
{
}
ShadowVMT::ShadowVMT(void* base)
: class_base(base), vftbl_len(0), new_vftbl(nullptr), old_vftbl(nullptr)
{
}
ShadowVMT::~ShadowVMT()
{
UnhookAll();
}
bool ShadowVMT::Setup(void* base)
{
if(base != nullptr)
class_base = base;
if(class_base == nullptr)
return false;
old_vftbl = *(std::uintptr_t**)class_base;
vftbl_len = CalcVtableLength(old_vftbl) * sizeof(std::uintptr_t);
if(vftbl_len == 0)
return false;
new_vftbl = new std::uintptr_t[vftbl_len + 1]();
std::memcpy(&new_vftbl[1], old_vftbl, vftbl_len * sizeof(std::uintptr_t));
try {
DWORD old;
LI_FN(VirtualProtect).safe()(class_base, sizeof(uintptr_t), PAGE_READWRITE, &old);
new_vftbl[0] = old_vftbl[-1];
*(std::uintptr_t**)class_base = &new_vftbl[1];
LI_FN(VirtualProtect).safe()(class_base, sizeof(uintptr_t), old, &old);
} catch(...) {
delete[] new_vftbl;
return false;
}
return true;
}
std::size_t ShadowVMT::CalcVtableLength(std::uintptr_t* vftbl_start)
{
MEMORY_BASIC_INFORMATION memInfo = { NULL };
int m_nSize = -1;
do {
m_nSize++;
LI_FN( VirtualQuery).safe()(reinterpret_cast<LPCVOID>(vftbl_start[m_nSize]), &memInfo, sizeof(memInfo));
} while (memInfo.Protect == PAGE_EXECUTE_READ || memInfo.Protect == PAGE_EXECUTE_READWRITE);
return m_nSize;
}

View File

@ -0,0 +1,84 @@
#pragma once
#include <Windows.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <array>
#include <functional>
#include <sstream>
#include <string>
#include <string_view>
#include <chrono>
#include <random>
#include <numeric>
#include <cstdint>
#include <memory>
#include <thread>
#include <type_traits>
#include <regex>
#include <cmath>
#include <fstream>
#include <cassert>
#include <process.h>
#include <DbgHelp.h>
#include <filesystem>
#include <libloaderapi.h>
#include <Psapi.h>
#include <corecrt_math_defines.h>
#include <numbers>
#include <iomanip>
#include <iosfwd>
#include <set>
#include <unordered_set>
#include <list>
#include <TlHelp32.h>
#include <cstring>
class ShadowVMT
{
public:
ShadowVMT();
ShadowVMT(void* base);
~ShadowVMT();
bool Setup(void* class_base = nullptr);
template<typename T>
void HookIndex(int index, T fun)
{
new_vftbl[index + 1] = reinterpret_cast<std::uintptr_t>(fun);
}
void UnhookIndex(int index)
{
new_vftbl[index] = old_vftbl[index];
}
void UnhookAll()
{
try {
if (old_vftbl != nullptr) {
DWORD old;
VirtualProtect(class_base, sizeof(uintptr_t), PAGE_READWRITE, &old);
*(std::uintptr_t**)class_base = old_vftbl;
old_vftbl = nullptr;
VirtualProtect(class_base, sizeof(uintptr_t), old, &old);
}
}
catch (...) {
}
}
template<typename T>
T GetOg(int index)
{
return (T)old_vftbl[index];
}
private:
inline std::size_t CalcVtableLength(std::uintptr_t* vftbl_start);
void* class_base;
std::size_t vftbl_len;
std::uintptr_t* new_vftbl;
std::uintptr_t* old_vftbl;
};

View File

@ -0,0 +1,30 @@
PUBLIC _spoofer_stub
.code
_spoofer_stub PROC
pop r11
add rsp, 8
mov rax, [rsp + 24]
mov r10, [rax]
mov [rsp], r10
mov r10, [rax + 8]
mov [rax + 8], r11
mov [rax + 16], rbx
lea rbx, fixup
mov [rax], rbx
mov rbx, rax
jmp r10
fixup:
sub rsp, 16
mov rcx, rbx
mov rbx, [rcx + 16]
jmp QWORD PTR [rcx + 8]
_spoofer_stub ENDP
END

View File

@ -0,0 +1,120 @@
#include <type_traits>
namespace detail
{
extern "C" void* _spoofer_stub();
template <typename Ret, typename... Args>
static inline auto shellcode_stub_helper(
const void* shell,
Args... args
) -> Ret
{
auto fn = (Ret(*)(Args...))(shell);
return fn(args...);
}
template <std::size_t Argc, typename>
struct argument_remapper
{
// At least 5 params
template<
typename Ret,
typename First,
typename Second,
typename Third,
typename Fourth,
typename... Pack
>
static auto do_call(
const void* shell,
void* shell_param,
First first,
Second second,
Third third,
Fourth fourth,
Pack... pack
) -> Ret
{
return shellcode_stub_helper<
Ret,
First,
Second,
Third,
Fourth,
void*,
void*,
Pack...
>(
shell,
first,
second,
third,
fourth,
shell_param,
nullptr,
pack...
);
}
};
template <std::size_t Argc>
struct argument_remapper<Argc, std::enable_if_t<Argc <= 4>>
{
// 4 or less params
template<
typename Ret,
typename First = void*,
typename Second = void*,
typename Third = void*,
typename Fourth = void*
>
static auto do_call(
const void* shell,
void* shell_param,
First first = First{},
Second second = Second{},
Third third = Third{},
Fourth fourth = Fourth{}
) -> Ret
{
return shellcode_stub_helper<
Ret,
First,
Second,
Third,
Fourth,
void*,
void*
>(
shell,
first,
second,
third,
fourth,
shell_param,
nullptr
);
}
};
}
template <typename Ret, typename... Args>
static inline auto spoof_call(
const void* trampoline,
Ret(*fn)(Args...),
Args... args
) -> Ret
{
struct shell_params
{
const void* trampoline;
void* function;
void* rbx;
};
shell_params p{ trampoline, reinterpret_cast<void*>(fn) };
using mapper = detail::argument_remapper<sizeof...(Args), void>;
return mapper::template do_call<Ret, Args...>((const void*)&detail::_spoofer_stub, &p, args...);
}

View File

@ -0,0 +1,23 @@
#pragma once
#include <cstdint>
#include "Utils.h"
class RetSpoofInvoker {
private:
void* gadgetAddress{ 0 };
public:
void init(std::uintptr_t gadgetAddress) noexcept
{
this->gadgetAddress = reinterpret_cast<void*>(gadgetAddress);
}
template <typename ReturnType, typename... Args>
ReturnType invokeFastcall(std::uintptr_t functionAddress, Args&&... args) const noexcept
{
return detail::shellcode_stub_helper<ReturnType(Args...)>::spoof_call(this->gadgetAddress, reinterpret_cast<void*>(functionAddress), std::forward<Args>(args)...);
}
};
inline RetSpoofInvoker invoker;

View File

@ -0,0 +1,723 @@
/*
* Copyright 2018-2022 Justas Masiulis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// === FAQ === documentation is available at https://github.com/JustasMasiulis/lazy_importer
// * Code doesn't compile with errors about pointer conversion:
// - Try using `nullptr` instead of `NULL` or call `get()` instead of using the overloaded operator()
// * Lazy importer can't find the function I want:
// - Double check that the module in which it's located in is actually loaded
// - Try #define LAZY_IMPORTER_CASE_INSENSITIVE
// This will start using case insensitive comparison globally
// - Try #define LAZY_IMPORTER_RESOLVE_FORWARDED_EXPORTS
// This will enable forwarded export resolution globally instead of needing explicit `forwarded()` calls
#ifndef LAZY_IMPORTER_HPP
#define LAZY_IMPORTER_HPP
#define LI_FN(name) ::li::detail::lazy_function<LAZY_IMPORTER_KHASH(#name), decltype(&name)>()
#define LI_FN_DEF(name) ::li::detail::lazy_function<LAZY_IMPORTER_KHASH(#name), name>()
#define LI_MODULE(name) ::li::detail::lazy_module<LAZY_IMPORTER_KHASH(name)>()
#ifndef LAZY_IMPORTER_CPP_FORWARD
#ifdef LAZY_IMPORTER_NO_CPP_FORWARD
#define LAZY_IMPORTER_CPP_FORWARD(t, v) v
#else
#include <utility>
#define LAZY_IMPORTER_CPP_FORWARD(t, v) std::forward<t>( v )
#endif
#endif
#include <intrin.h>
#ifndef LAZY_IMPORTER_NO_FORCEINLINE
#if defined(_MSC_VER)
#define LAZY_IMPORTER_FORCEINLINE __forceinline
#elif defined(__GNUC__) && __GNUC__ > 3
#define LAZY_IMPORTER_FORCEINLINE inline __attribute__((__always_inline__))
#else
#define LAZY_IMPORTER_FORCEINLINE inline
#endif
#else
#define LAZY_IMPORTER_FORCEINLINE inline
#endif
#ifdef LAZY_IMPORTER_CASE_INSENSITIVE
#define LAZY_IMPORTER_CASE_SENSITIVITY false
#else
#define LAZY_IMPORTER_CASE_SENSITIVITY true
#endif
#define LAZY_IMPORTER_STRINGIZE(x) #x
#define LAZY_IMPORTER_STRINGIZE_EXPAND(x) LAZY_IMPORTER_STRINGIZE(x)
#define LAZY_IMPORTER_KHASH(str) ::li::detail::khash(str, \
::li::detail::khash_impl( __TIME__ __DATE__ LAZY_IMPORTER_STRINGIZE_EXPAND(__LINE__) LAZY_IMPORTER_STRINGIZE_EXPAND(__COUNTER__), 2166136261 ))
namespace li { namespace detail {
namespace win {
struct LIST_ENTRY_T {
const char* Flink;
const char* Blink;
};
struct UNICODE_STRING_T {
unsigned short Length;
unsigned short MaximumLength;
wchar_t* Buffer;
};
struct PEB_LDR_DATA_T {
unsigned long Length;
unsigned long Initialized;
const char* SsHandle;
LIST_ENTRY_T InLoadOrderModuleList;
};
struct PEB_T {
unsigned char Reserved1[2];
unsigned char BeingDebugged;
unsigned char Reserved2[1];
const char* Reserved3[2];
PEB_LDR_DATA_T* Ldr;
};
struct LDR_DATA_TABLE_ENTRY_T {
LIST_ENTRY_T InLoadOrderLinks;
LIST_ENTRY_T InMemoryOrderLinks;
LIST_ENTRY_T InInitializationOrderLinks;
const char* DllBase;
const char* EntryPoint;
union {
unsigned long SizeOfImage;
const char* _dummy;
};
UNICODE_STRING_T FullDllName;
UNICODE_STRING_T BaseDllName;
LAZY_IMPORTER_FORCEINLINE const LDR_DATA_TABLE_ENTRY_T*
load_order_next() const noexcept
{
return reinterpret_cast<const LDR_DATA_TABLE_ENTRY_T*>(
InLoadOrderLinks.Flink);
}
};
struct IMAGE_DOS_HEADER { // DOS .EXE header
unsigned short e_magic; // Magic number
unsigned short e_cblp; // Bytes on last page of file
unsigned short e_cp; // Pages in file
unsigned short e_crlc; // Relocations
unsigned short e_cparhdr; // Size of header in paragraphs
unsigned short e_minalloc; // Minimum extra paragraphs needed
unsigned short e_maxalloc; // Maximum extra paragraphs needed
unsigned short e_ss; // Initial (relative) SS value
unsigned short e_sp; // Initial SP value
unsigned short e_csum; // Checksum
unsigned short e_ip; // Initial IP value
unsigned short e_cs; // Initial (relative) CS value
unsigned short e_lfarlc; // File address of relocation table
unsigned short e_ovno; // Overlay number
unsigned short e_res[4]; // Reserved words
unsigned short e_oemid; // OEM identifier (for e_oeminfo)
unsigned short e_oeminfo; // OEM information; e_oemid specific
unsigned short e_res2[10]; // Reserved words
long e_lfanew; // File address of new exe header
};
struct IMAGE_FILE_HEADER {
unsigned short Machine;
unsigned short NumberOfSections;
unsigned long TimeDateStamp;
unsigned long PointerToSymbolTable;
unsigned long NumberOfSymbols;
unsigned short SizeOfOptionalHeader;
unsigned short Characteristics;
};
struct IMAGE_EXPORT_DIRECTORY {
unsigned long Characteristics;
unsigned long TimeDateStamp;
unsigned short MajorVersion;
unsigned short MinorVersion;
unsigned long Name;
unsigned long Base;
unsigned long NumberOfFunctions;
unsigned long NumberOfNames;
unsigned long AddressOfFunctions; // RVA from base of image
unsigned long AddressOfNames; // RVA from base of image
unsigned long AddressOfNameOrdinals; // RVA from base of image
};
struct IMAGE_DATA_DIRECTORY {
unsigned long VirtualAddress;
unsigned long Size;
};
struct IMAGE_OPTIONAL_HEADER64 {
unsigned short Magic;
unsigned char MajorLinkerVersion;
unsigned char MinorLinkerVersion;
unsigned long SizeOfCode;
unsigned long SizeOfInitializedData;
unsigned long SizeOfUninitializedData;
unsigned long AddressOfEntryPoint;
unsigned long BaseOfCode;
unsigned long long ImageBase;
unsigned long SectionAlignment;
unsigned long FileAlignment;
unsigned short MajorOperatingSystemVersion;
unsigned short MinorOperatingSystemVersion;
unsigned short MajorImageVersion;
unsigned short MinorImageVersion;
unsigned short MajorSubsystemVersion;
unsigned short MinorSubsystemVersion;
unsigned long Win32VersionValue;
unsigned long SizeOfImage;
unsigned long SizeOfHeaders;
unsigned long CheckSum;
unsigned short Subsystem;
unsigned short DllCharacteristics;
unsigned long long SizeOfStackReserve;
unsigned long long SizeOfStackCommit;
unsigned long long SizeOfHeapReserve;
unsigned long long SizeOfHeapCommit;
unsigned long LoaderFlags;
unsigned long NumberOfRvaAndSizes;
IMAGE_DATA_DIRECTORY DataDirectory[16];
};
struct IMAGE_OPTIONAL_HEADER32 {
unsigned short Magic;
unsigned char MajorLinkerVersion;
unsigned char MinorLinkerVersion;
unsigned long SizeOfCode;
unsigned long SizeOfInitializedData;
unsigned long SizeOfUninitializedData;
unsigned long AddressOfEntryPoint;
unsigned long BaseOfCode;
unsigned long BaseOfData;
unsigned long ImageBase;
unsigned long SectionAlignment;
unsigned long FileAlignment;
unsigned short MajorOperatingSystemVersion;
unsigned short MinorOperatingSystemVersion;
unsigned short MajorImageVersion;
unsigned short MinorImageVersion;
unsigned short MajorSubsystemVersion;
unsigned short MinorSubsystemVersion;
unsigned long Win32VersionValue;
unsigned long SizeOfImage;
unsigned long SizeOfHeaders;
unsigned long CheckSum;
unsigned short Subsystem;
unsigned short DllCharacteristics;
unsigned long SizeOfStackReserve;
unsigned long SizeOfStackCommit;
unsigned long SizeOfHeapReserve;
unsigned long SizeOfHeapCommit;
unsigned long LoaderFlags;
unsigned long NumberOfRvaAndSizes;
IMAGE_DATA_DIRECTORY DataDirectory[16];
};
struct IMAGE_NT_HEADERS {
unsigned long Signature;
IMAGE_FILE_HEADER FileHeader;
#ifdef _WIN64
IMAGE_OPTIONAL_HEADER64 OptionalHeader;
#else
IMAGE_OPTIONAL_HEADER32 OptionalHeader;
#endif
};
} // namespace win
struct forwarded_hashes {
unsigned module_hash;
unsigned function_hash;
};
// 64 bit integer where 32 bits are used for the hash offset
// and remaining 32 bits are used for the hash computed using it
using offset_hash_pair = unsigned long long;
LAZY_IMPORTER_FORCEINLINE constexpr unsigned get_hash(offset_hash_pair pair) noexcept { return ( pair & 0xFFFFFFFF ); }
LAZY_IMPORTER_FORCEINLINE constexpr unsigned get_offset(offset_hash_pair pair) noexcept { return static_cast<unsigned>( pair >> 32 ); }
template<bool CaseSensitive = LAZY_IMPORTER_CASE_SENSITIVITY>
LAZY_IMPORTER_FORCEINLINE constexpr unsigned hash_single(unsigned value, char c) noexcept
{
return (value ^ static_cast<unsigned>((!CaseSensitive && c >= 'A' && c <= 'Z') ? (c | (1 << 5)) : c)) * 16777619;
}
LAZY_IMPORTER_FORCEINLINE constexpr unsigned
khash_impl(const char* str, unsigned value) noexcept
{
return (*str ? khash_impl(str + 1, hash_single(value, *str)) : value);
}
LAZY_IMPORTER_FORCEINLINE constexpr offset_hash_pair khash(
const char* str, unsigned offset) noexcept
{
return ((offset_hash_pair{ offset } << 32) | khash_impl(str, offset));
}
template<class CharT = char>
LAZY_IMPORTER_FORCEINLINE unsigned hash(const CharT* str, unsigned offset) noexcept
{
unsigned value = offset;
for(;;) {
char c = *str++;
if(!c)
return value;
value = hash_single(value, c);
}
}
LAZY_IMPORTER_FORCEINLINE unsigned hash(
const win::UNICODE_STRING_T& str, unsigned offset) noexcept
{
auto first = str.Buffer;
const auto last = first + (str.Length / sizeof(wchar_t));
auto value = offset;
for(; first != last; ++first)
value = hash_single(value, static_cast<char>(*first));
return value;
}
LAZY_IMPORTER_FORCEINLINE forwarded_hashes hash_forwarded(
const char* str, unsigned offset) noexcept
{
forwarded_hashes res{ offset, offset };
for(; *str != '.'; ++str)
res.module_hash = hash_single<true>(res.module_hash, *str);
++str;
for(; *str; ++str)
res.function_hash = hash_single(res.function_hash, *str);
return res;
}
// some helper functions
LAZY_IMPORTER_FORCEINLINE const win::PEB_T* peb() noexcept
{
#if defined(_M_X64) || defined(__amd64__)
#if defined(_MSC_VER)
return reinterpret_cast<const win::PEB_T*>(__readgsqword(0x60));
#else
const win::PEB_T* ptr;
__asm__ __volatile__ ("mov %%gs:0x60, %0" : "=r"(ptr));
return ptr;
#endif
#elif defined(_M_IX86) || defined(__i386__)
#if defined(_MSC_VER)
return reinterpret_cast<const win::PEB_T*>(__readfsdword(0x30));
#else
const win::PEB_T* ptr;
__asm__ __volatile__ ("mov %%fs:0x30, %0" : "=r"(ptr));
return ptr;
#endif
#elif defined(_M_ARM) || defined(__arm__)
return *reinterpret_cast<const win::PEB_T**>(_MoveFromCoprocessor(15, 0, 13, 0, 2) + 0x30);
#elif defined(_M_ARM64) || defined(__aarch64__)
return *reinterpret_cast<const win::PEB_T**>(__getReg(18) + 0x60);
#elif defined(_M_IA64) || defined(__ia64__)
return *reinterpret_cast<const win::PEB_T**>(static_cast<char*>(_rdteb()) + 0x60);
#else
#error Unsupported platform. Open an issue and Ill probably add support.
#endif
}
LAZY_IMPORTER_FORCEINLINE const win::PEB_LDR_DATA_T* ldr()
{
return reinterpret_cast<const win::PEB_LDR_DATA_T*>(peb()->Ldr);
}
LAZY_IMPORTER_FORCEINLINE const win::IMAGE_NT_HEADERS* nt_headers(
const char* base) noexcept
{
return reinterpret_cast<const win::IMAGE_NT_HEADERS*>(
base + reinterpret_cast<const win::IMAGE_DOS_HEADER*>(base)->e_lfanew);
}
LAZY_IMPORTER_FORCEINLINE const win::IMAGE_EXPORT_DIRECTORY* image_export_dir(
const char* base) noexcept
{
return reinterpret_cast<const win::IMAGE_EXPORT_DIRECTORY*>(
base + nt_headers(base)->OptionalHeader.DataDirectory->VirtualAddress);
}
LAZY_IMPORTER_FORCEINLINE const win::LDR_DATA_TABLE_ENTRY_T* ldr_data_entry() noexcept
{
return reinterpret_cast<const win::LDR_DATA_TABLE_ENTRY_T*>(
ldr()->InLoadOrderModuleList.Flink);
}
struct exports_directory {
unsigned long _ied_size;
const char* _base;
const win::IMAGE_EXPORT_DIRECTORY* _ied;
public:
using size_type = unsigned long;
LAZY_IMPORTER_FORCEINLINE
exports_directory(const char* base) noexcept : _base(base)
{
const auto ied_data_dir = nt_headers(base)->OptionalHeader.DataDirectory[0];
_ied = reinterpret_cast<const win::IMAGE_EXPORT_DIRECTORY*>(
base + ied_data_dir.VirtualAddress);
_ied_size = ied_data_dir.Size;
}
LAZY_IMPORTER_FORCEINLINE explicit operator bool() const noexcept
{
return reinterpret_cast<const char*>(_ied) != _base;
}
LAZY_IMPORTER_FORCEINLINE size_type size() const noexcept
{
return _ied->NumberOfNames;
}
LAZY_IMPORTER_FORCEINLINE const char* base() const noexcept { return _base; }
LAZY_IMPORTER_FORCEINLINE const win::IMAGE_EXPORT_DIRECTORY* ied() const noexcept
{
return _ied;
}
LAZY_IMPORTER_FORCEINLINE const char* name(size_type index) const noexcept
{
return _base + reinterpret_cast<const unsigned long*>(_base + _ied->AddressOfNames)[index];
}
LAZY_IMPORTER_FORCEINLINE const char* address(size_type index) const noexcept
{
const auto* const rva_table =
reinterpret_cast<const unsigned long*>(_base + _ied->AddressOfFunctions);
const auto* const ord_table = reinterpret_cast<const unsigned short*>(
_base + _ied->AddressOfNameOrdinals);
return _base + rva_table[ord_table[index]];
}
LAZY_IMPORTER_FORCEINLINE bool is_forwarded(
const char* export_address) const noexcept
{
const auto ui_ied = reinterpret_cast<const char*>(_ied);
return (export_address > ui_ied && export_address < ui_ied + _ied_size);
}
};
struct safe_module_enumerator {
using value_type = const detail::win::LDR_DATA_TABLE_ENTRY_T;
value_type* value;
value_type* head;
LAZY_IMPORTER_FORCEINLINE safe_module_enumerator() noexcept
: safe_module_enumerator(ldr_data_entry())
{}
LAZY_IMPORTER_FORCEINLINE
safe_module_enumerator(const detail::win::LDR_DATA_TABLE_ENTRY_T* ldr) noexcept
: value(ldr->load_order_next()), head(value)
{}
LAZY_IMPORTER_FORCEINLINE void reset() noexcept
{
value = head->load_order_next();
}
LAZY_IMPORTER_FORCEINLINE bool next() noexcept
{
value = value->load_order_next();
return value != head && value->DllBase;
}
};
struct unsafe_module_enumerator {
using value_type = const detail::win::LDR_DATA_TABLE_ENTRY_T*;
value_type value;
LAZY_IMPORTER_FORCEINLINE unsafe_module_enumerator() noexcept
: value(ldr_data_entry())
{}
LAZY_IMPORTER_FORCEINLINE void reset() noexcept { value = ldr_data_entry(); }
LAZY_IMPORTER_FORCEINLINE bool next() noexcept
{
value = value->load_order_next();
return true;
}
};
// provides the cached functions which use Derive classes methods
template<class Derived, class DefaultType = void*>
class lazy_base {
protected:
// This function is needed because every templated function
// with different args has its own static buffer
LAZY_IMPORTER_FORCEINLINE static void*& _cache() noexcept
{
static void* value = nullptr;
return value;
}
public:
template<class T = DefaultType>
LAZY_IMPORTER_FORCEINLINE static T safe() noexcept
{
return Derived::template get<T, safe_module_enumerator>();
}
template<class T = DefaultType, class Enum = unsafe_module_enumerator>
LAZY_IMPORTER_FORCEINLINE static T cached() noexcept
{
auto& cached = _cache();
if(!cached)
cached = Derived::template get<void*, Enum>();
return (T)(cached);
}
template<class T = DefaultType>
LAZY_IMPORTER_FORCEINLINE static T safe_cached() noexcept
{
return cached<T, safe_module_enumerator>();
}
};
template<offset_hash_pair OHP>
struct lazy_module : lazy_base<lazy_module<OHP>> {
template<class T = void*, class Enum = unsafe_module_enumerator>
LAZY_IMPORTER_FORCEINLINE static T get() noexcept
{
Enum e;
do {
if(hash(e.value->BaseDllName, get_offset(OHP)) == get_hash(OHP))
return (T)(e.value->DllBase);
} while(e.next());
return {};
}
template<class T = void*, class Ldr>
LAZY_IMPORTER_FORCEINLINE static T in(Ldr ldr) noexcept
{
safe_module_enumerator e(reinterpret_cast<const detail::win::LDR_DATA_TABLE_ENTRY_T*>(ldr));
do {
if(hash(e.value->BaseDllName, get_offset(OHP)) == get_hash(OHP))
return (T)(e.value->DllBase);
} while(e.next());
return {};
}
template<class T = void*, class Ldr>
LAZY_IMPORTER_FORCEINLINE static T in_cached(Ldr ldr) noexcept
{
auto& cached = lazy_base<lazy_module<OHP>>::_cache();
if(!cached)
cached = in(ldr);
return (T)(cached);
}
};
template<offset_hash_pair OHP, class T>
struct lazy_function : lazy_base<lazy_function<OHP, T>, T> {
using base_type = lazy_base<lazy_function<OHP, T>, T>;
template<class... Args>
LAZY_IMPORTER_FORCEINLINE decltype(auto) operator()(Args&&... args) const
{
#ifndef LAZY_IMPORTER_CACHE_OPERATOR_PARENS
return get()(LAZY_IMPORTER_CPP_FORWARD(Args, args)...);
#else
return this->cached()(LAZY_IMPORTER_CPP_FORWARD(Args, args)...);
#endif
}
template<class F = T, class Enum = unsafe_module_enumerator>
LAZY_IMPORTER_FORCEINLINE static F get() noexcept
{
// for backwards compatability.
// Before 2.0 it was only possible to resolve forwarded exports when
// this macro was enabled
#ifdef LAZY_IMPORTER_RESOLVE_FORWARDED_EXPORTS
return forwarded<F, Enum>();
#else
Enum e;
do {
#ifdef LAZY_IMPORTER_HARDENED_MODULE_CHECKS
if(!e.value->DllBase || !e.value->FullDllName.Length)
continue;
#endif
const exports_directory exports(e.value->DllBase);
if(exports) {
auto export_index = exports.size();
while(export_index--)
if(hash(exports.name(export_index), get_offset(OHP)) == get_hash(OHP))
return (F)(exports.address(export_index));
}
} while(e.next());
return {};
#endif
}
template<class F = T, class Enum = unsafe_module_enumerator>
LAZY_IMPORTER_FORCEINLINE static F forwarded() noexcept
{
detail::win::UNICODE_STRING_T name;
forwarded_hashes hashes{ 0, get_hash(OHP) };
Enum e;
do {
name = e.value->BaseDllName;
name.Length -= 8; // get rid of .dll extension
if(!hashes.module_hash || hash(name, get_offset(OHP)) == hashes.module_hash) {
const exports_directory exports(e.value->DllBase);
if(exports) {
auto export_index = exports.size();
while(export_index--)
if(hash(exports.name(export_index), get_offset(OHP)) == hashes.function_hash) {
const auto addr = exports.address(export_index);
if(exports.is_forwarded(addr)) {
hashes = hash_forwarded(
reinterpret_cast<const char*>(addr),
get_offset(OHP));
e.reset();
break;
}
return (F)(addr);
}
}
}
} while(e.next());
return {};
}
template<class F = T>
LAZY_IMPORTER_FORCEINLINE static F forwarded_safe() noexcept
{
return forwarded<F, safe_module_enumerator>();
}
template<class F = T, class Enum = unsafe_module_enumerator>
LAZY_IMPORTER_FORCEINLINE static F forwarded_cached() noexcept
{
auto& value = base_type::_cache();
if(!value)
value = forwarded<void*, Enum>();
return (F)(value);
}
template<class F = T>
LAZY_IMPORTER_FORCEINLINE static F forwarded_safe_cached() noexcept
{
return forwarded_cached<F, safe_module_enumerator>();
}
template<class F = T, bool IsSafe = false, class Module>
LAZY_IMPORTER_FORCEINLINE static F in(Module m) noexcept
{
if(IsSafe && !m)
return {};
const exports_directory exports((const char*)(m));
if(IsSafe && !exports)
return {};
for(unsigned long i{};; ++i) {
if(IsSafe && i == exports.size())
break;
if(hash(exports.name(i), get_offset(OHP)) == get_hash(OHP))
return (F)(exports.address(i));
}
return {};
}
template<class F = T, class Module>
LAZY_IMPORTER_FORCEINLINE static F in_safe(Module m) noexcept
{
return in<F, true>(m);
}
template<class F = T, bool IsSafe = false, class Module>
LAZY_IMPORTER_FORCEINLINE static F in_cached(Module m) noexcept
{
auto& value = base_type::_cache();
if(!value)
value = in<void*, IsSafe>(m);
return (F)(value);
}
template<class F = T, class Module>
LAZY_IMPORTER_FORCEINLINE static F in_safe_cached(Module m) noexcept
{
return in_cached<F, true>(m);
}
template<class F = T>
LAZY_IMPORTER_FORCEINLINE static F nt() noexcept
{
return in<F>(ldr_data_entry()->load_order_next()->DllBase);
}
template<class F = T>
LAZY_IMPORTER_FORCEINLINE static F nt_safe() noexcept
{
return in_safe<F>(ldr_data_entry()->load_order_next()->DllBase);
}
template<class F = T>
LAZY_IMPORTER_FORCEINLINE static F nt_cached() noexcept
{
return in_cached<F>(ldr_data_entry()->load_order_next()->DllBase);
}
template<class F = T>
LAZY_IMPORTER_FORCEINLINE static F nt_safe_cached() noexcept
{
return in_safe_cached<F>(ldr_data_entry()->load_order_next()->DllBase);
}
};
}} // namespace li::detail
#endif // include guard

View File

@ -0,0 +1,456 @@
#pragma once
#ifndef DIRECT_SYSCALL_HPP
#define DIRECT_SYSCALL_HPP
#include <cstdint>
#include <string>
#include <windows.h>
#ifndef SYSCALL_NO_FORCEINLINE
#if defined(_MSC_VER)
#define SYSCALL_FORCEINLINE __forceinline
#endif
#else
#define SYSCALL_FORCEINLINE inline
#endif
#include <intrin.h>
#include <memory>
#include <vector>
#define SYSCALL_HASH_CT(str) \
[]() [[msvc::forceinline]] { \
constexpr uint32_t hash_out{::syscall::fnv1a::hash_ctime(str)}; \
\
return hash_out; \
}()
#define SYSCALL_HASH(str) ::syscall::fnv1a::hash_rtime(str)
#define INVOKE_LAZY_FN(type, export_name, ...) \
[&]() [[msvc::forceinline]] { \
constexpr uint32_t export_hash{::syscall::fnv1a::hash_ctime(#export_name)}; \
\
return syscall::invoke_lazy_import<type>(export_hash, __VA_ARGS__); \
}()
#define INVOKE_SYSCALL(type, export_name, ...) \
[&]() [[msvc::forceinline]] { \
constexpr uint32_t export_hash{::syscall::fnv1a::hash_ctime(#export_name)}; \
\
return syscall::invoke_syscall<type>(export_hash, __VA_ARGS__); \
}()
namespace syscall {
namespace nt {
typedef struct _PEB_LDR_DATA {
ULONG Length;
BOOLEAN Initialized;
PVOID SsHandle;
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
} PEB_LDR_DATA, * PPEB_LDR_DATA;
struct UNICODE_STRING {
uint16_t Length;
uint16_t MaximumLength;
wchar_t* Buffer;
};
typedef struct _LDR_MODULE {
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
PVOID BaseAddress;
PVOID EntryPoint;
ULONG SizeOfImage;
UNICODE_STRING FullDllName;
UNICODE_STRING BaseDllName;
ULONG Flags;
SHORT LoadCount;
SHORT TlsIndex;
LIST_ENTRY HashTableEntry;
ULONG TimeDateStamp;
} LDR_MODULE, * PLDR_MODULE;
typedef struct _PEB_FREE_BLOCK {
_PEB_FREE_BLOCK* Next;
ULONG Size;
} PEB_FREE_BLOCK, * PPEB_FREE_BLOCK;
typedef struct _LDR_DATA_TABLE_ENTRY {
LIST_ENTRY InLoadOrderLinks;
LIST_ENTRY InMemoryOrderLinks;
PVOID Reserved2[2];
PVOID DllBase;
PVOID EntryPoint;
PVOID Reserved3;
UNICODE_STRING FullDllName;
UNICODE_STRING BaseDllName;
PVOID Reserved5[3];
union {
ULONG CheckSum;
PVOID Reserved6;
};
ULONG TimeDateStamp;
} LDR_DATA_TABLE_ENTRY, * PLDR_DATA_TABLE_ENTRY;
typedef struct _RTL_DRIVE_LETTER_CURDIR {
USHORT Flags;
USHORT Length;
ULONG TimeStamp;
UNICODE_STRING DosPath;
} RTL_DRIVE_LETTER_CURDIR, * PRTL_DRIVE_LETTER_CURDIR;
typedef struct _RTL_USER_PROCESS_PARAMETERS {
ULONG MaximumLength;
ULONG Length;
ULONG Flags;
ULONG DebugFlags;
PVOID ConsoleHandle;
ULONG ConsoleFlags;
HANDLE StdInputHandle;
HANDLE StdOutputHandle;
HANDLE StdErrorHandle;
UNICODE_STRING CurrentDirectoryPath;
HANDLE CurrentDirectoryHandle;
UNICODE_STRING DllPath;
UNICODE_STRING ImagePathName;
UNICODE_STRING CommandLine;
PVOID Environment;
ULONG StartingPositionLeft;
ULONG StartingPositionTop;
ULONG Width;
ULONG Height;
ULONG CharWidth;
ULONG CharHeight;
ULONG ConsoleTextAttributes;
ULONG WindowFlags;
ULONG ShowWindowFlags;
UNICODE_STRING WindowTitle;
UNICODE_STRING DesktopName;
UNICODE_STRING ShellInfo;
UNICODE_STRING RuntimeData;
RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20];
} RTL_USER_PROCESS_PARAMETERS, * PRTL_USER_PROCESS_PARAMETERS;
typedef struct _PEB {
BOOLEAN InheritedAddressSpace;
BOOLEAN ReadImageFileExecOptions;
BOOLEAN BeingDebugged;
BOOLEAN Spare;
HANDLE Mutant;
PVOID ImageBaseAddress;
PPEB_LDR_DATA LoaderData;
RTL_USER_PROCESS_PARAMETERS ProcessParameters;
PVOID SubSystemData;
PVOID ProcessHeap;
PVOID FastPebLock;
uintptr_t FastPebLockRoutine;
uintptr_t FastPebUnlockRoutine;
ULONG EnvironmentUpdateCount;
uintptr_t KernelCallbackTable;
PVOID EventLogSection;
PVOID EventLog;
PPEB_FREE_BLOCK FreeList;
ULONG TlsExpansionCounter;
PVOID TlsBitmap;
ULONG TlsBitmapBits[0x2];
PVOID ReadOnlySharedMemoryBase;
PVOID ReadOnlySharedMemoryHeap;
uintptr_t ReadOnlyStaticServerData;
PVOID AnsiCodePageData;
PVOID OemCodePageData;
PVOID UnicodeCaseTableData;
ULONG NumberOfProcessors;
ULONG NtGlobalFlag;
BYTE Spare2[0x4];
LARGE_INTEGER CriticalSectionTimeout;
ULONG HeapSegmentReserve;
ULONG HeapSegmentCommit;
ULONG HeapDeCommitTotalFreeThreshold;
ULONG HeapDeCommitFreeBlockThreshold;
ULONG NumberOfHeaps;
ULONG MaximumNumberOfHeaps;
uintptr_t* ProcessHeaps;
PVOID GdiSharedHandleTable;
PVOID ProcessStarterHelper;
PVOID GdiDCAttributeList;
PVOID LoaderLock;
ULONG OSMajorVersion;
ULONG OSMinorVersion;
ULONG OSBuildNumber;
ULONG OSPlatformId;
ULONG ImageSubSystem;
ULONG ImageSubSystemMajorVersion;
ULONG ImageSubSystemMinorVersion;
ULONG GdiHandleBuffer[0x22];
ULONG PostProcessInitRoutine;
ULONG TlsExpansionBitmap;
BYTE TlsExpansionBitmapBits[0x80];
ULONG SessionId;
} PEB, * PPEB;
}// namespace nt
constexpr uint32_t xor_key_1 = __TIME__[2];
constexpr uint32_t xor_key_2 = __TIME__[4];
constexpr uint32_t xor_key_offset = (xor_key_1 ^ xor_key_2);
namespace fnv1a {
constexpr uint32_t fnv_prime_value = 0x01000193;
SYSCALL_FORCEINLINE consteval uint32_t hash_ctime(const char* input, unsigned val = 0x811c9dc5 ^ ::syscall::xor_key_offset) noexcept
{
return input[0] == CS_XOR('\0') ? val : hash_ctime(input + 1, (val ^ *input) * fnv_prime_value);
}
SYSCALL_FORCEINLINE constexpr uint32_t hash_rtime(const char* input, unsigned val = 0x811c9dc5 ^ ::syscall::xor_key_offset) noexcept
{
return input[0] == CS_XOR('\0') ? val : hash_rtime(input + 1, (val ^ *input) * fnv_prime_value);
}
}// namespace fnv1a
namespace utils {
SYSCALL_FORCEINLINE std::string wide_to_string(wchar_t* buffer) noexcept
{
const auto out{ std::wstring(buffer) };
if (out.empty())
return "";
return std::string(out.begin(), out.end());
}
}// namespace utils
namespace win {
SYSCALL_FORCEINLINE nt::PEB* get_peb() noexcept
{
#if defined(_M_IX86) || defined(__i386__)
return reinterpret_cast<::syscall::nt::PEB*>(__readfsdword(0x30));
#else
return reinterpret_cast<::syscall::nt::PEB*>(__readgsqword(0x60));
#endif
}
template<typename T>
static SYSCALL_FORCEINLINE T get_module_handle_from_hash(const uint32_t& module_hash) noexcept
{
auto peb = ::syscall::win::get_peb();
if (!peb)
return NULL;
auto head = &peb->LoaderData->InLoadOrderModuleList;
for (auto it = head->Flink; it != head; it = it->Flink) {
::syscall::nt::_LDR_DATA_TABLE_ENTRY* ldr_entry = CONTAINING_RECORD(it, nt::LDR_DATA_TABLE_ENTRY,
InLoadOrderLinks);
if (!ldr_entry->BaseDllName.Buffer)
continue;
auto name = ::syscall::utils::wide_to_string(ldr_entry->BaseDllName.Buffer);
if (SYSCALL_HASH(name.data()) == module_hash)
return reinterpret_cast<T>(ldr_entry->DllBase);
}
return NULL;
}
template<typename T>
static SYSCALL_FORCEINLINE T get_module_export_from_table(uintptr_t module_address,
const uint32_t& export_hash) noexcept
{
auto dos_headers = reinterpret_cast<IMAGE_DOS_HEADER*>(module_address);
if (dos_headers->e_magic != IMAGE_DOS_SIGNATURE)
return NULL;
PIMAGE_EXPORT_DIRECTORY export_directory = nullptr;
auto nt_headers32 = reinterpret_cast<PIMAGE_NT_HEADERS32>(module_address + dos_headers->e_lfanew);
auto nt_headers64 = reinterpret_cast<PIMAGE_NT_HEADERS64>(module_address + dos_headers->e_lfanew);
PIMAGE_OPTIONAL_HEADER32 optional_header32 = &nt_headers32->OptionalHeader;
PIMAGE_OPTIONAL_HEADER64 optional_header64 = &nt_headers64->OptionalHeader;
// for 32bit modules.
if (nt_headers32->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
// does not have a export table.
if (optional_header32->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size <= 0U)
return NULL;
export_directory = reinterpret_cast<PIMAGE_EXPORT_DIRECTORY>(module_address + optional_header32->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress);
}
// for 64bit modules.
else if (nt_headers64->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
// does not have a export table.
if (optional_header64->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size <= 0U)
return NULL;
export_directory = reinterpret_cast<PIMAGE_EXPORT_DIRECTORY>(module_address + optional_header64->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress);
}
auto names_rva = reinterpret_cast<uint32_t*>(module_address + export_directory->AddressOfNames);
auto functions_rva = reinterpret_cast<uint32_t*>(module_address + export_directory->AddressOfFunctions);
auto name_ordinals = reinterpret_cast<unsigned short*>(module_address + export_directory->AddressOfNameOrdinals);
uint32_t number_of_names = export_directory->NumberOfNames;
for (size_t i = 0ul; i < number_of_names; i++) {
const char* export_name = reinterpret_cast<const char*>(module_address + names_rva[i]);
if (export_hash == SYSCALL_HASH(export_name))
return static_cast<T>(module_address + functions_rva[name_ordinals[i]]);
}
return NULL;
}
template<typename T>
SYSCALL_FORCEINLINE T force_find_export(const uint32_t& export_hash) noexcept
{
auto peb = ::syscall::win::get_peb();
if (!peb || !export_hash)
return NULL;
auto head = &peb->LoaderData->InLoadOrderModuleList;
for (auto it = head->Flink; it != head; it = it->Flink) {
::syscall::nt::_LDR_DATA_TABLE_ENTRY* ldr_entry = CONTAINING_RECORD(it,
nt::LDR_DATA_TABLE_ENTRY,
InLoadOrderLinks);
if (!ldr_entry->BaseDllName.Buffer)
continue;
auto name = ::syscall::utils::wide_to_string(ldr_entry->BaseDllName.Buffer);
auto export_address = ::syscall::win::get_module_export_from_table<uintptr_t>(
reinterpret_cast<uintptr_t>(ldr_entry->DllBase),
export_hash);
if (!export_address)
continue;
return static_cast<T>(export_address);
}
}
}// namespace win
SYSCALL_FORCEINLINE uint16_t get_return_code_from_export(uintptr_t export_address) noexcept
{
if (!export_address)
return NULL;
return *reinterpret_cast<int*>(static_cast<uintptr_t>(export_address + 12) + 1);
}
SYSCALL_FORCEINLINE int get_syscall_id_from_export(uintptr_t export_address) noexcept
{
if (!export_address)
return NULL;
#if defined(_M_IX86) || defined(__i386__)
return *reinterpret_cast<int*>(static_cast<uintptr_t>(export_address) + 1);
#else
return *reinterpret_cast<int*>(static_cast<uintptr_t>(export_address + 3) + 1);
#endif
}
struct create_function {
void* _allocated_memory = nullptr;
void* _function = nullptr;
uint32_t _export_hash;
public:
SYSCALL_FORCEINLINE ~create_function() noexcept
{
if (this->_allocated_memory) {
VirtualFree(this->_allocated_memory, 0, MEM_RELEASE);
this->_allocated_memory = nullptr;
}
}
SYSCALL_FORCEINLINE create_function(uint32_t export_hash) noexcept
: _export_hash(export_hash)
{
static auto exported_address = ::syscall::win::force_find_export<uintptr_t>(this->_export_hash);
static auto syscall_table_id = ::syscall::get_syscall_id_from_export(exported_address);
if (!exported_address || !syscall_table_id)
return;
std::vector<uint8_t> shellcode = {
#if defined(_M_IX86) || defined(__i386__)
0xB8, 0x00, 0x10, 0x00, 0x00, // mov eax, <syscall_id>
0x64, 0x8B, 0x15, 0xC0, 0x00, 0x00, 0x00,// mov edx, DWORD PTR fs:0xc0 (
0xFF, 0xD2, // call edx
0xC2, 0x04, 0x00 // ret 4
#else
0x49, 0x89, 0xCA, // mov r10, rcx
0xB8, 0x3F, 0x10, 0x00, 0x00, // mov eax, <syscall_id>
0x0F, 0x05, // syscall
0xC3 // ret
#endif
};
#if defined(_M_IX86) || defined(__i386__)
// required for x86 ONLY!
* reinterpret_cast<uint16_t*>(&shellcode[15]) = ::syscall::get_return_code_from_export(exported_address);
*reinterpret_cast<int*>(&shellcode[1]) = syscall_table_id;
#else
* reinterpret_cast<int*>(&shellcode[4]) = syscall_table_id;
#endif
this->_allocated_memory = VirtualAlloc(nullptr,
sizeof(shellcode),
MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE);
if (!this->_allocated_memory) {
return;
}
memcpy(this->_allocated_memory, shellcode.data(), sizeof(shellcode));
*reinterpret_cast<void**>(&this->_function) = this->_allocated_memory;
}
SYSCALL_FORCEINLINE bool is_valid_address() noexcept
{
return this->_function != nullptr;
}
template<typename T, typename... Args>
SYSCALL_FORCEINLINE T invoke_call(Args... arguments) noexcept
{
return reinterpret_cast<T(__stdcall*)(Args...)>(this->_function)(arguments...);
}
};
template<typename T, typename... Args>
SYSCALL_FORCEINLINE T invoke_syscall(uint32_t export_hash, Args... arguments) noexcept
{
static auto syscall_function = ::syscall::create_function(export_hash);
if (!syscall_function.is_valid_address()) {
return NULL;
}
return syscall_function.invoke_call<T>(arguments...);
}
template<typename T, typename... Args>
SYSCALL_FORCEINLINE T invoke_lazy_import(uint32_t export_hash, Args... arguments) noexcept
{
static auto exported_function = ::syscall::win::force_find_export<uintptr_t>(export_hash);
if (exported_function)
return reinterpret_cast<T(__stdcall*)(Args...)>(exported_function)(arguments...);
}
}// namespace syscall
#endif// DIRECT_SYSCALL_HPP

View File

@ -0,0 +1,189 @@
/******************************************************************************
Header: VirtualizerSDKCustomVMsMacros.h
Description: Definition of CustomVM macros
Author/s: Oreans Technologies
(c) 2015 Oreans Technologies
--- File generated automatically from Oreans VM Generator (16/6/2015) ---
******************************************************************************/
// ****************************************************************************
// Declaration of Custom VM macros
// ****************************************************************************
#define PLATFORM_X64 1
#ifdef __cplusplus
extern "C" {
#endif
#if defined(PLATFORM_X32)
void __stdcall VIRTUALIZER_TIGER_WHITE_START_ASM32();
void __stdcall VIRTUALIZER_TIGER_WHITE_END_ASM32();
void __stdcall VIRTUALIZER_TIGER_RED_START_ASM32();
void __stdcall VIRTUALIZER_TIGER_RED_END_ASM32();
void __stdcall VIRTUALIZER_TIGER_BLACK_START_ASM32();
void __stdcall VIRTUALIZER_TIGER_BLACK_END_ASM32();
void __stdcall VIRTUALIZER_FISH_WHITE_START_ASM32();
void __stdcall VIRTUALIZER_FISH_WHITE_END_ASM32();
void __stdcall VIRTUALIZER_FISH_RED_START_ASM32();
void __stdcall VIRTUALIZER_FISH_RED_END_ASM32();
void __stdcall VIRTUALIZER_FISH_BLACK_START_ASM32();
void __stdcall VIRTUALIZER_FISH_BLACK_END_ASM32();
void __stdcall VIRTUALIZER_PUMA_WHITE_START_ASM32();
void __stdcall VIRTUALIZER_PUMA_WHITE_END_ASM32();
void __stdcall VIRTUALIZER_PUMA_RED_START_ASM32();
void __stdcall VIRTUALIZER_PUMA_RED_END_ASM32();
void __stdcall VIRTUALIZER_PUMA_BLACK_START_ASM32();
void __stdcall VIRTUALIZER_PUMA_BLACK_END_ASM32();
void __stdcall VIRTUALIZER_SHARK_WHITE_START_ASM32();
void __stdcall VIRTUALIZER_SHARK_WHITE_END_ASM32();
void __stdcall VIRTUALIZER_SHARK_RED_START_ASM32();
void __stdcall VIRTUALIZER_SHARK_RED_END_ASM32();
void __stdcall VIRTUALIZER_SHARK_BLACK_START_ASM32();
void __stdcall VIRTUALIZER_SHARK_BLACK_END_ASM32();
void __stdcall VIRTUALIZER_DOLPHIN_WHITE_START_ASM32();
void __stdcall VIRTUALIZER_DOLPHIN_WHITE_END_ASM32();
void __stdcall VIRTUALIZER_DOLPHIN_RED_START_ASM32();
void __stdcall VIRTUALIZER_DOLPHIN_RED_END_ASM32();
void __stdcall VIRTUALIZER_DOLPHIN_BLACK_START_ASM32();
void __stdcall VIRTUALIZER_DOLPHIN_BLACK_END_ASM32();
void __stdcall VIRTUALIZER_EAGLE_WHITE_START_ASM32();
void __stdcall VIRTUALIZER_EAGLE_WHITE_END_ASM32();
void __stdcall VIRTUALIZER_EAGLE_RED_START_ASM32();
void __stdcall VIRTUALIZER_EAGLE_RED_END_ASM32();
void __stdcall VIRTUALIZER_EAGLE_BLACK_START_ASM32();
void __stdcall VIRTUALIZER_EAGLE_BLACK_END_ASM32();
void __stdcall VIRTUALIZER_MUTATE_ONLY_START_ASM32();
void __stdcall VIRTUALIZER_MUTATE_ONLY_END_ASM32();
#define VIRTUALIZER_TIGER_WHITE_START VIRTUALIZER_TIGER_WHITE_START_ASM32();
#define VIRTUALIZER_TIGER_WHITE_END VIRTUALIZER_TIGER_WHITE_END_ASM32();
#define VIRTUALIZER_TIGER_RED_START VIRTUALIZER_TIGER_RED_START_ASM32();
#define VIRTUALIZER_TIGER_RED_END VIRTUALIZER_TIGER_RED_END_ASM32();
#define VIRTUALIZER_TIGER_BLACK_START VIRTUALIZER_TIGER_BLACK_START_ASM32();
#define VIRTUALIZER_TIGER_BLACK_END VIRTUALIZER_TIGER_BLACK_END_ASM32();
#define VIRTUALIZER_FISH_WHITE_START VIRTUALIZER_FISH_WHITE_START_ASM32();
#define VIRTUALIZER_FISH_WHITE_END VIRTUALIZER_FISH_WHITE_END_ASM32();
#define VIRTUALIZER_FISH_RED_START VIRTUALIZER_FISH_RED_START_ASM32();
#define VIRTUALIZER_FISH_RED_END VIRTUALIZER_FISH_RED_END_ASM32();
#define VIRTUALIZER_FISH_BLACK_START VIRTUALIZER_FISH_BLACK_START_ASM32();
#define VIRTUALIZER_FISH_BLACK_END VIRTUALIZER_FISH_BLACK_END_ASM32();
#define VIRTUALIZER_PUMA_WHITE_START VIRTUALIZER_PUMA_WHITE_START_ASM32();
#define VIRTUALIZER_PUMA_WHITE_END VIRTUALIZER_PUMA_WHITE_END_ASM32();
#define VIRTUALIZER_PUMA_RED_START VIRTUALIZER_PUMA_RED_START_ASM32();
#define VIRTUALIZER_PUMA_RED_END VIRTUALIZER_PUMA_RED_END_ASM32();
#define VIRTUALIZER_PUMA_BLACK_START VIRTUALIZER_PUMA_BLACK_START_ASM32();
#define VIRTUALIZER_PUMA_BLACK_END VIRTUALIZER_PUMA_BLACK_END_ASM32();
#define VIRTUALIZER_SHARK_WHITE_START VIRTUALIZER_SHARK_WHITE_START_ASM32();
#define VIRTUALIZER_SHARK_WHITE_END VIRTUALIZER_SHARK_WHITE_END_ASM32();
#define VIRTUALIZER_SHARK_RED_START VIRTUALIZER_SHARK_RED_START_ASM32();
#define VIRTUALIZER_SHARK_RED_END VIRTUALIZER_SHARK_RED_END_ASM32();
#define VIRTUALIZER_SHARK_BLACK_START VIRTUALIZER_SHARK_BLACK_START_ASM32();
#define VIRTUALIZER_SHARK_BLACK_END VIRTUALIZER_SHARK_BLACK_END_ASM32();
#define VIRTUALIZER_DOLPHIN_WHITE_START VIRTUALIZER_DOLPHIN_WHITE_START_ASM32();
#define VIRTUALIZER_DOLPHIN_WHITE_END VIRTUALIZER_DOLPHIN_WHITE_END_ASM32();
#define VIRTUALIZER_DOLPHIN_RED_START VIRTUALIZER_DOLPHIN_RED_START_ASM32();
#define VIRTUALIZER_DOLPHIN_RED_END VIRTUALIZER_DOLPHIN_RED_END_ASM32();
#define VIRTUALIZER_DOLPHIN_BLACK_START VIRTUALIZER_DOLPHIN_BLACK_START_ASM32();
#define VIRTUALIZER_DOLPHIN_BLACK_END VIRTUALIZER_DOLPHIN_BLACK_END_ASM32();
#define VIRTUALIZER_EAGLE_WHITE_START VIRTUALIZER_EAGLE_WHITE_START_ASM32();
#define VIRTUALIZER_EAGLE_WHITE_END VIRTUALIZER_EAGLE_WHITE_END_ASM32();
#define VIRTUALIZER_EAGLE_RED_START VIRTUALIZER_EAGLE_RED_START_ASM32();
#define VIRTUALIZER_EAGLE_RED_END VIRTUALIZER_EAGLE_RED_END_ASM32();
#define VIRTUALIZER_EAGLE_BLACK_START VIRTUALIZER_EAGLE_BLACK_START_ASM32();
#define VIRTUALIZER_EAGLE_BLACK_END VIRTUALIZER_EAGLE_BLACK_END_ASM32();
#define VIRTUALIZER_MUTATE_ONLY_START VIRTUALIZER_MUTATE_ONLY_START_ASM32();
#define VIRTUALIZER_MUTATE_ONLY_END VIRTUALIZER_MUTATE_ONLY_END_ASM32();
#endif
#if defined(PLATFORM_X64)
void __stdcall VIRTUALIZER_TIGER_WHITE_START_ASM64();
void __stdcall VIRTUALIZER_TIGER_WHITE_END_ASM64();
void __stdcall VIRTUALIZER_TIGER_RED_START_ASM64();
void __stdcall VIRTUALIZER_TIGER_RED_END_ASM64();
void __stdcall VIRTUALIZER_TIGER_BLACK_START_ASM64();
void __stdcall VIRTUALIZER_TIGER_BLACK_END_ASM64();
void __stdcall VIRTUALIZER_FISH_WHITE_START_ASM64();
void __stdcall VIRTUALIZER_FISH_WHITE_END_ASM64();
void __stdcall VIRTUALIZER_FISH_RED_START_ASM64();
void __stdcall VIRTUALIZER_FISH_RED_END_ASM64();
void __stdcall VIRTUALIZER_FISH_BLACK_START_ASM64();
void __stdcall VIRTUALIZER_FISH_BLACK_END_ASM64();
void __stdcall VIRTUALIZER_PUMA_WHITE_START_ASM64();
void __stdcall VIRTUALIZER_PUMA_WHITE_END_ASM64();
void __stdcall VIRTUALIZER_PUMA_RED_START_ASM64();
void __stdcall VIRTUALIZER_PUMA_RED_END_ASM64();
void __stdcall VIRTUALIZER_PUMA_BLACK_START_ASM64();
void __stdcall VIRTUALIZER_PUMA_BLACK_END_ASM64();
void __stdcall VIRTUALIZER_SHARK_WHITE_START_ASM64();
void __stdcall VIRTUALIZER_SHARK_WHITE_END_ASM64();
void __stdcall VIRTUALIZER_SHARK_RED_START_ASM64();
void __stdcall VIRTUALIZER_SHARK_RED_END_ASM64();
void __stdcall VIRTUALIZER_SHARK_BLACK_START_ASM64();
void __stdcall VIRTUALIZER_SHARK_BLACK_END_ASM64();
void __stdcall VIRTUALIZER_DOLPHIN_WHITE_START_ASM64();
void __stdcall VIRTUALIZER_DOLPHIN_WHITE_END_ASM64();
void __stdcall VIRTUALIZER_DOLPHIN_RED_START_ASM64();
void __stdcall VIRTUALIZER_DOLPHIN_RED_END_ASM64();
void __stdcall VIRTUALIZER_DOLPHIN_BLACK_START_ASM64();
void __stdcall VIRTUALIZER_DOLPHIN_BLACK_END_ASM64();
void __stdcall VIRTUALIZER_EAGLE_WHITE_START_ASM64();
void __stdcall VIRTUALIZER_EAGLE_WHITE_END_ASM64();
void __stdcall VIRTUALIZER_EAGLE_RED_START_ASM64();
void __stdcall VIRTUALIZER_EAGLE_RED_END_ASM64();
void __stdcall VIRTUALIZER_EAGLE_BLACK_START_ASM64();
void __stdcall VIRTUALIZER_EAGLE_BLACK_END_ASM64();
void __stdcall VIRTUALIZER_MUTATE_ONLY_START_ASM64();
void __stdcall VIRTUALIZER_MUTATE_ONLY_END_ASM64();
#define VIRTUALIZER_TIGER_WHITE_START VIRTUALIZER_TIGER_WHITE_START_ASM64();
#define VIRTUALIZER_TIGER_WHITE_END VIRTUALIZER_TIGER_WHITE_END_ASM64();
#define VIRTUALIZER_TIGER_RED_START VIRTUALIZER_TIGER_RED_START_ASM64();
#define VIRTUALIZER_TIGER_RED_END VIRTUALIZER_TIGER_RED_END_ASM64();
#define VIRTUALIZER_TIGER_BLACK_START VIRTUALIZER_TIGER_BLACK_START_ASM64();
#define VIRTUALIZER_TIGER_BLACK_END VIRTUALIZER_TIGER_BLACK_END_ASM64();
#define VIRTUALIZER_FISH_WHITE_START VIRTUALIZER_FISH_WHITE_START_ASM64();
#define VIRTUALIZER_FISH_WHITE_END VIRTUALIZER_FISH_WHITE_END_ASM64();
#define VIRTUALIZER_FISH_RED_START VIRTUALIZER_FISH_RED_START_ASM64();
#define VIRTUALIZER_FISH_RED_END VIRTUALIZER_FISH_RED_END_ASM64();
#define VIRTUALIZER_FISH_BLACK_START VIRTUALIZER_FISH_BLACK_START_ASM64();
#define VIRTUALIZER_FISH_BLACK_END VIRTUALIZER_FISH_BLACK_END_ASM64();
#define VIRTUALIZER_PUMA_WHITE_START VIRTUALIZER_PUMA_WHITE_START_ASM64();
#define VIRTUALIZER_PUMA_WHITE_END VIRTUALIZER_PUMA_WHITE_END_ASM64();
#define VIRTUALIZER_PUMA_RED_START VIRTUALIZER_PUMA_RED_START_ASM64();
#define VIRTUALIZER_PUMA_RED_END VIRTUALIZER_PUMA_RED_END_ASM64();
#define VIRTUALIZER_PUMA_BLACK_START VIRTUALIZER_PUMA_BLACK_START_ASM64();
#define VIRTUALIZER_PUMA_BLACK_END VIRTUALIZER_PUMA_BLACK_END_ASM64();
#define VIRTUALIZER_SHARK_WHITE_START VIRTUALIZER_SHARK_WHITE_START_ASM64();
#define VIRTUALIZER_SHARK_WHITE_END VIRTUALIZER_SHARK_WHITE_END_ASM64();
#define VIRTUALIZER_SHARK_RED_START VIRTUALIZER_SHARK_RED_START_ASM64();
#define VIRTUALIZER_SHARK_RED_END VIRTUALIZER_SHARK_RED_END_ASM64();
#define VIRTUALIZER_SHARK_BLACK_START VIRTUALIZER_SHARK_BLACK_START_ASM64();
#define VIRTUALIZER_SHARK_BLACK_END VIRTUALIZER_SHARK_BLACK_END_ASM64();
#define VIRTUALIZER_DOLPHIN_WHITE_START VIRTUALIZER_DOLPHIN_WHITE_START_ASM64();
#define VIRTUALIZER_DOLPHIN_WHITE_END VIRTUALIZER_DOLPHIN_WHITE_END_ASM64();
#define VIRTUALIZER_DOLPHIN_RED_START VIRTUALIZER_DOLPHIN_RED_START_ASM64();
#define VIRTUALIZER_DOLPHIN_RED_END VIRTUALIZER_DOLPHIN_RED_END_ASM64();
#define VIRTUALIZER_DOLPHIN_BLACK_START VIRTUALIZER_DOLPHIN_BLACK_START_ASM64();
#define VIRTUALIZER_DOLPHIN_BLACK_END VIRTUALIZER_DOLPHIN_BLACK_END_ASM64();
#define VIRTUALIZER_EAGLE_WHITE_START VIRTUALIZER_EAGLE_WHITE_START_ASM64();
#define VIRTUALIZER_EAGLE_WHITE_END VIRTUALIZER_EAGLE_WHITE_END_ASM64();
#define VIRTUALIZER_EAGLE_RED_START VIRTUALIZER_EAGLE_RED_START_ASM64();
#define VIRTUALIZER_EAGLE_RED_END VIRTUALIZER_EAGLE_RED_END_ASM64();
#define VIRTUALIZER_EAGLE_BLACK_START VIRTUALIZER_EAGLE_BLACK_START_ASM64();
#define VIRTUALIZER_EAGLE_BLACK_END VIRTUALIZER_EAGLE_BLACK_END_ASM64();
#define VIRTUALIZER_MUTATE_ONLY_START VIRTUALIZER_MUTATE_ONLY_START_ASM64();
#define VIRTUALIZER_MUTATE_ONLY_END VIRTUALIZER_MUTATE_ONLY_END_ASM64();
#endif
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,394 @@
; ******************************************************************************
; Header: VirtualizerSDK_CustomVMs_masm64.inc
; Description: MASM64 macros definitions
;
; Author/s: Oreans Technologies
; (c) 2015 Oreans Technologies
;
; --- File generated automatically from Oreans VM Generator (16/6/2015) ---
; ******************************************************************************
; ******************************************************************************
; Macros definition
; ******************************************************************************
VIRTUALIZER_TIGER_WHITE_START MACRO
db 0ebh, 10h
dd 20205643h
dd 103
dd 0
dd 20205643h
ENDM
VIRTUALIZER_TIGER_WHITE_END MACRO
db 0ebh, 10h
dd 20205643h
dd 503
dd 0
dd 20205643h
ENDM
VIRTUALIZER_TIGER_RED_START MACRO
db 0ebh, 10h
dd 20205643h
dd 104
dd 0
dd 20205643h
ENDM
VIRTUALIZER_TIGER_RED_END MACRO
db 0ebh, 10h
dd 20205643h
dd 504
dd 0
dd 20205643h
ENDM
VIRTUALIZER_TIGER_BLACK_START MACRO
db 0ebh, 10h
dd 20205643h
dd 105
dd 0
dd 20205643h
ENDM
VIRTUALIZER_TIGER_BLACK_END MACRO
db 0ebh, 10h
dd 20205643h
dd 505
dd 0
dd 20205643h
ENDM
VIRTUALIZER_FISH_WHITE_START MACRO
db 0ebh, 10h
dd 20205643h
dd 107
dd 0
dd 20205643h
ENDM
VIRTUALIZER_FISH_WHITE_END MACRO
db 0ebh, 10h
dd 20205643h
dd 507
dd 0
dd 20205643h
ENDM
VIRTUALIZER_FISH_RED_START MACRO
db 0ebh, 10h
dd 20205643h
dd 109
dd 0
dd 20205643h
ENDM
VIRTUALIZER_FISH_RED_END MACRO
db 0ebh, 10h
dd 20205643h
dd 509
dd 0
dd 20205643h
ENDM
VIRTUALIZER_FISH_BLACK_START MACRO
db 0ebh, 10h
dd 20205643h
dd 111
dd 0
dd 20205643h
ENDM
VIRTUALIZER_FISH_BLACK_END MACRO
db 0ebh, 10h
dd 20205643h
dd 511
dd 0
dd 20205643h
ENDM
VIRTUALIZER_PUMA_WHITE_START MACRO
db 0ebh, 10h
dd 20205643h
dd 113
dd 0
dd 20205643h
ENDM
VIRTUALIZER_PUMA_WHITE_END MACRO
db 0ebh, 10h
dd 20205643h
dd 513
dd 0
dd 20205643h
ENDM
VIRTUALIZER_PUMA_RED_START MACRO
db 0ebh, 10h
dd 20205643h
dd 115
dd 0
dd 20205643h
ENDM
VIRTUALIZER_PUMA_RED_END MACRO
db 0ebh, 10h
dd 20205643h
dd 515
dd 0
dd 20205643h
ENDM
VIRTUALIZER_PUMA_BLACK_START MACRO
db 0ebh, 10h
dd 20205643h
dd 117
dd 0
dd 20205643h
ENDM
VIRTUALIZER_PUMA_BLACK_END MACRO
db 0ebh, 10h
dd 20205643h
dd 517
dd 0
dd 20205643h
ENDM
VIRTUALIZER_SHARK_WHITE_START MACRO
db 0ebh, 10h
dd 20205643h
dd 119
dd 0
dd 20205643h
ENDM
VIRTUALIZER_SHARK_WHITE_END MACRO
db 0ebh, 10h
dd 20205643h
dd 519
dd 0
dd 20205643h
ENDM
VIRTUALIZER_SHARK_RED_START MACRO
db 0ebh, 10h
dd 20205643h
dd 121
dd 0
dd 20205643h
ENDM
VIRTUALIZER_SHARK_RED_END MACRO
db 0ebh, 10h
dd 20205643h
dd 521
dd 0
dd 20205643h
ENDM
VIRTUALIZER_SHARK_BLACK_START MACRO
db 0ebh, 10h
dd 20205643h
dd 123
dd 0
dd 20205643h
ENDM
VIRTUALIZER_SHARK_BLACK_END MACRO
db 0ebh, 10h
dd 20205643h
dd 523
dd 0
dd 20205643h
ENDM
VIRTUALIZER_DOLPHIN_WHITE_START MACRO
db 0ebh, 10h
dd 20205643h
dd 135
dd 0
dd 20205643h
ENDM
VIRTUALIZER_DOLPHIN_WHITE_END MACRO
db 0ebh, 10h
dd 20205643h
dd 535
dd 0
dd 20205643h
ENDM
VIRTUALIZER_DOLPHIN_RED_START MACRO
db 0ebh, 10h
dd 20205643h
dd 137
dd 0
dd 20205643h
ENDM
VIRTUALIZER_DOLPHIN_RED_END MACRO
db 0ebh, 10h
dd 20205643h
dd 537
dd 0
dd 20205643h
ENDM
VIRTUALIZER_DOLPHIN_BLACK_START MACRO
db 0ebh, 10h
dd 20205643h
dd 139
dd 0
dd 20205643h
ENDM
VIRTUALIZER_DOLPHIN_BLACK_END MACRO
db 0ebh, 10h
dd 20205643h
dd 539
dd 0
dd 20205643h
ENDM
VIRTUALIZER_EAGLE_WHITE_START MACRO
db 0ebh, 10h
dd 20205643h
dd 147
dd 0
dd 20205643h
ENDM
VIRTUALIZER_EAGLE_WHITE_END MACRO
db 0ebh, 10h
dd 20205643h
dd 547
dd 0
dd 20205643h
ENDM
VIRTUALIZER_EAGLE_RED_START MACRO
db 0ebh, 10h
dd 20205643h
dd 149
dd 0
dd 20205643h
ENDM
VIRTUALIZER_EAGLE_RED_END MACRO
db 0ebh, 10h
dd 20205643h
dd 549
dd 0
dd 20205643h
ENDM
VIRTUALIZER_EAGLE_BLACK_START MACRO
db 0ebh, 10h
dd 20205643h
dd 151
dd 0
dd 20205643h
ENDM
VIRTUALIZER_EAGLE_BLACK_END MACRO
db 0ebh, 10h
dd 20205643h
dd 551
dd 0
dd 20205643h
ENDM
VIRTUALIZER_MUTATE_ONLY_START MACRO
db 0ebh, 10h
dd 20205643h
dd 16
dd 0
dd 20205643h
ENDM
VIRTUALIZER_MUTATE_ONLY_END MACRO
db 0ebh, 10h
dd 20205643h
dd 17
dd 0
dd 20205643h
ENDM

View File

@ -0,0 +1,226 @@
/**
* @file stb.hh
* @author Cristei Gabriel-Marian (cristei.g772@gmail.com)
* @brief Compile-time String To Bytes (STB)
* @version 1.0
* @date 2023-03-23
*
* Last update: 03/23/2023 (mm/dd/yyyy): [Breaking update]
* Modernize, undo some cancer, change some naming, file structure,
* implement tests directly in file.
*
*/
#ifndef STB_DEFINED
#define STB_DEFINED
#include <cstdint>
#include <array>
namespace stb {
namespace detail {
// detail methods assume null terminator.
template<std::size_t N>
constexpr auto find_first_of_start(std::array<char, N> const& data, std::size_t start, char ch) noexcept {
std::size_t idx = start;
while (data[idx] != ch && idx < N)
++idx;
return idx;
}
template<std::size_t N>
constexpr auto find_first_not_of_start(std::array<char, N> const& data, std::size_t start, char ch) noexcept {
if (start < N && data[start] != ch)
return start;
std::size_t idx = start;
while (data[idx] == ch && idx < N)
++idx;
return idx;
}
template<std::size_t N>
constexpr auto find_last_of(std::array<char, N> const& data, char ch) noexcept {
std::size_t idx = data.size() - 2;
while (data[idx] != ch && idx >= 0)
--idx;
return idx;
}
template<std::size_t N>
constexpr auto find_last_not_of(std::array<char, N> const& data, char ch) noexcept {
std::size_t idx = data.size() - 2;
while (data[idx] == ch && idx >= 0)
--idx;
return idx;
}
constexpr auto char_to_hex(char ch) noexcept {
if (ch >= '0' && ch <= '9')
return ch - '0';
if (ch >= 'A' && ch <= 'F')
return ch - 'A' + 10;
return ch - 'a' + 10;
}
template<typename T, T F = 16>
constexpr T concat_hex(T lhs, T rhs) noexcept {
return F * lhs + rhs;
}
} // namespace detail
template<auto V>
struct consteval_value {
constexpr static decltype(V) value = V;
};
template<std::size_t N>
struct fixed_string: public std::array<char, N + 1> {
using std::array<char, N + 1>::array;
constexpr fixed_string(const char* str) noexcept
: std::array<char, N + 1>() {
for (auto i = 0; i != N; ++i)
(*this)[i] = str[i];
}
};
template<std::size_t N>
fixed_string(const char (&)[N]) noexcept -> fixed_string<N - 1>;
template<char delimiter, char mask, typename element_type, element_type masked>
struct basic_hex_string_array_conversion {
template<fixed_string str>
struct build {
private:
struct parse {
struct result {
std::size_t delimiter_count;
std::size_t start;
std::size_t next;
std::size_t end;
};
constexpr static auto get() noexcept {
std::size_t count = 1;
constexpr std::size_t start = detail::find_first_not_of_start(str, 0, delimiter);
constexpr std::size_t next = detail::find_first_of_start(str, start, delimiter);
constexpr std::size_t end = detail::find_last_not_of(str, delimiter);
bool previous_delimiter = false;
for (auto i = next; i < end; ++i) {
if (str[i] == delimiter) {
if (!previous_delimiter)
++count;
previous_delimiter = true;
} else
previous_delimiter = false;
}
return result {
count,
start,
next,
end};
}
};
constexpr static auto make() noexcept {
constexpr auto data = parse::get();
constexpr auto count = data.delimiter_count;
constexpr auto start = data.start;
constexpr auto next = data.next;
constexpr auto end = data.end;
std::array<element_type, count> result = {};
std::array<std::size_t, count> skips = {};
std::size_t skipped = 0;
std::size_t traversed = start;
bool previous_skip = false;
for (auto i = start; i < end; ++i) {
if (str[i] == delimiter) {
if (!previous_skip)
skips[skipped++] = traversed;
previous_skip = true;
} else
previous_skip = false;
++traversed;
}
bool one_char = str[start + 1] == delimiter;
result[0] = static_cast<element_type>(str[start] == mask ? masked : (one_char ? detail::char_to_hex(str[start]) : detail::concat_hex(detail::char_to_hex(str[start]), detail::char_to_hex(str[start + 1]))));
std::size_t conversions = 1;
for (auto i = next; i < end; ++i) {
for (auto entry : skips) {
if (entry == i && entry < end) {
std::size_t idx = detail::find_first_not_of_start(str, i + 1, delimiter);
one_char = str[idx + 1] == delimiter;
result[conversions++] = static_cast<element_type>(str[idx] == mask ? masked : (one_char ? detail::char_to_hex(str[idx]) : detail::concat_hex(detail::char_to_hex(str[idx]), detail::char_to_hex(str[idx + 1]))));
}
}
}
return result;
}
public:
constexpr static auto value = consteval_value<make()>::value;
};
};
using hex_string_array_conversion = basic_hex_string_array_conversion<' ', '?', int, -1>;
using simple_conversion = hex_string_array_conversion;
} // namespace stb
#ifndef STB_OMIT_TESTS
struct _ignore_me_stb_compliance_tests {
using conv_type = stb::simple_conversion;
constexpr static auto value_1 = conv_type::build<"AA BB CC DD EE FF">::value;
static_assert(value_1[0] == 0xAA);
static_assert(value_1[1] == 0xBB);
static_assert(value_1[2] == 0xCC);
static_assert(value_1[3] == 0xDD);
static_assert(value_1[4] == 0xEE);
static_assert(value_1[5] == 0xFF);
static_assert(value_1.size() == 6);
constexpr static auto value_2 = conv_type::build<" C 0f C a B ef ">::value;
static_assert(value_2[0] == 0x0C);
static_assert(value_2[1] == 0x0F);
static_assert(value_2[2] == 0x0C);
static_assert(value_2[3] == 0x0A);
static_assert(value_2[4] == 0x0B);
static_assert(value_2[5] == 0xEF);
static_assert(value_2.size() == 6);
constexpr static auto value_3 = conv_type::build<"AA bb CC dd ">::value;
static_assert(value_3[0] == 0xAA);
static_assert(value_3[1] == 0xBB);
static_assert(value_3[2] == 0xCC);
static_assert(value_3[3] == 0xDD);
static_assert(value_3.size() == 4);
constexpr static auto value_4 = conv_type::build<" aa bb ee ff">::value;
static_assert(value_4[0] == 0xAA);
static_assert(value_4[1] == 0xBB);
static_assert(value_4[2] == 0xEE);
static_assert(value_4[3] == 0xFF);
static_assert(value_4.size() == 4);
};
#endif
#endif

View File

@ -0,0 +1,129 @@
#pragma once
// File: 'sesame_icons.ttf' (5736 bytes)
// Exported using binary_to_compressed_c.cpp
static const unsigned int sesame_icons_size = 5736;
static const unsigned int sesame_icons_data[5736/4] =
{
0x00000100, 0x80000e00, 0x60000300, 0x4d544646, 0xe7b54b8c, 0x4c160000, 0x1c000000, 0x46454447, 0x30002700, 0x24160000, 0x26000000, 0x322f534f,
0xe0616f59, 0x68010000, 0x60000000, 0x70616d63, 0xfc091d0c, 0xe4010000, 0x42010000, 0x20747663, 0x79022100, 0x28030000, 0x04000000, 0x70736167,
0x0300ffff, 0x1c160000, 0x08000000, 0x66796c67, 0x9cc4ea26, 0x44030000, 0x5c100000, 0x64616568, 0x8660bc19, 0xec000000, 0x36000000, 0x61656868,
0x44037d07, 0x24010000, 0x24000000, 0x78746d68, 0xa000390c, 0xc8010000, 0x1c000000, 0x61636f6c, 0x560d9611, 0x2c030000, 0x16000000, 0x7078616d,
0x53015300, 0x48010000, 0x20000000, 0x656d616e, 0x2d4afe67, 0xa0130000, 0x43020000, 0x74736f70, 0xaa00faff, 0xe4150000, 0x36000000, 0x00000100,
0x00000100, 0x594a76cc, 0xf53c0f5f, 0xe8031f00, 0x00000000, 0x308953db, 0x00000000, 0xdb9353db, 0x57fffdff, 0x3f03e503, 0x08000000, 0x00000200,
0x00000000, 0x00000100, 0x57ff3f03, 0xe8035a00, 0x0000fdff, 0x0100e503, 0x00000000, 0x00000000, 0x00000000, 0x04000000, 0x00000100, 0x22010a00,
0x00000700, 0x02000000, 0x01000000, 0x00000100, 0x2e004000, 0x00000000, 0xe8030400, 0x05009001, 0x8a020000, 0x0000bb02, 0x8a028c00, 0x0000bb02,
0x3100df01, 0x00000201, 0x09050002, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x66500000, 0x80006445, 0x47004100, 0x38ff2003,
0x3f035a00, 0x0000a900, 0x00000100, 0x00000000, 0x00000d03, 0x01002000, 0x2100e803, 0x00000000, 0x0000e803, 0x1900e803, 0x2c002400, 0xfdff2600,
0x3d003600, 0x03000000, 0x03000000, 0x1c000000, 0x00000100, 0x3c000000, 0x01000300, 0x1c000000, 0x20000400, 0x04000000, 0x01000400, 0x47000000,
0x0000ffff, 0xffff4100, 0x0100c2ff, 0x00000000, 0x06010000, 0x00010000, 0x00000000, 0x02010000, 0x02000000, 0x00000000, 0x00000000, 0x00000000,
0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x03000000, 0x07060504, 0x00000908,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x79022100, 0x2a000000,
0x2a002a00, 0x34022401, 0x1204fe02, 0xbc061c05, 0x00002e08, 0x21000200, 0x2a010000, 0x03009a02, 0x2e000700, 0x2f0001b1, 0x0407b23c, 0xb132ed00,
0x3cdc0506, 0x000203b2, 0xb10032ed, 0x3c2f0003, 0x000405b2, 0x07b232ed, 0x3cfc0106, 0x000201b2, 0x113332ed, 0x33271121, 0x01212311, 0xc7c7e809,
0x66fd9a02, 0x00580221, 0x19000400, 0xcf0365ff, 0x48001f03, 0xa1009000, 0x0000ad00, 0x16173601, 0x1617011d, 0x17011e17, 0x17161716, 0x16173216,
0x06071615, 0x010e020f, 0x0f010e07, 0x06070604, 0x2f352627, 0x26272601, 0x2726022f, 0x37343726, 0x37013b36, 0x013e3736, 0x3f333637, 0x36373601,
0x22273407, 0x07010e07, 0x3216010e, 0x07141617, 0x14152206, 0x17011e17, 0x34363716, 0x17323637, 0x32331416, 0x37013e37, 0x23013d36, 0x34262722,
0x013b3637, 0x27263435, 0x27262726, 0x27232622, 0x0e071415, 0x012e2701, 0x16173623, 0x07060714, 0x27060706, 0x37343526, 0x17360736, 0x010e0716,
0x34352622, 0x12fb0136, 0x1f06040c, 0x23673811, 0x02030c3b, 0x0c065902, 0x31050d01, 0x24060230, 0x47772a19, 0x08010111, 0x09140508, 0x7a190104,
0x03135056, 0x0d053536, 0x33060d01, 0x05040332, 0x126ba01a, 0x01010708, 0x010b0604, 0x895a1102, 0x02070318, 0x0d0d063d, 0x1a0d3b06, 0x0317527f,
0x20080403, 0x12030408, 0x185f3a27, 0x06222217, 0x24060d0d, 0x210b1324, 0x02443d36, 0x04050209, 0x0a091706, 0x06174b04, 0x0d030303, 0x050c2427,
0x5a21100b, 0x0c080808, 0x080c0607, 0x051a0312, 0x2d2d0612, 0x0e050501, 0x614e2f44, 0x0401021a, 0x090e0f09, 0x0f010104, 0x38215525, 0x37030c47,
0x01070738, 0x36050c01, 0x56100436, 0x01116f50, 0x0e090401, 0x1a04090f, 0x9268141c, 0x2e010311, 0xca08062e, 0x0c020125, 0x2c0d5979, 0x20080406,
0x0e030408, 0x0e6b4e25, 0x39010104, 0x060e0e06, 0x55140d38, 0x05193337, 0x08200804, 0x44140804, 0x2e2a4117, 0x2501020b, 0x060a0624, 0x08100606,
0x030c0406, 0x1d0d0503, 0x0a030109, 0x601a0e08, 0x1b070504, 0x0607080e, 0x00002406, 0x24000600, 0x99037bff, 0x4900f602, 0x71005d00, 0x9d008700,
0x0000b600, 0x16173601, 0x06071415, 0x07010e07, 0x030f010e, 0x0607011d, 0x0f000607, 0x22262701, 0x1417010f, 0x1715011e, 0x010f0607, 0x3f342627,
0x1f161701, 0x27013f01, 0x36373426, 0x36373637, 0x3e37013b, 0x013e3701, 0x36373637, 0x31223407, 0x07060722, 0x06020f06, 0x3f011f14, 0x27073602,
0x07010e23, 0x14060706, 0x3637011f, 0x36373637, 0x3400013d, 0x0607012f, 0x23012e27, 0x14150622, 0x013f011f, 0x34272627, 0x16173601, 0x07061617,
0x06020f06, 0x37260607, 0x36023f36, 0x32333607, 0x07011e17, 0x07222306, 0x0607010e, 0x26272627, 0x37363736, 0x0e760336, 0x0d0c080d, 0x02060104,
0x06014404, 0x06032928, 0xe2fe0309, 0x0e0d070c, 0x04030202, 0x19020103, 0x8b060617, 0x091d1d8a, 0x040d0c0b, 0x970d0e03, 0x0f0c0798, 0x27223211,
0x0a12101f, 0x50050220, 0x02010b5c, 0x1705564f, 0x22220d01, 0x22223738, 0x40f93131, 0x09112128, 0x708b8b06, 0x0587886f, 0xfe010406, 0x0b5354a9,
0x2702020a, 0x6f100102, 0x0408096f, 0x9f010104, 0x03040808, 0x03050204, 0x17171311, 0x02100a05, 0x131a1902, 0x110ae613, 0x0108040f, 0x220f0704,
0x04d90408, 0x02090808, 0x715b1801, 0xf1020904, 0x0c090c05, 0x091b1a07, 0x0a020e02, 0x280c0390, 0x0a2b2c29, 0xfe030d12, 0x0e060bdf, 0x1103030d,
0x01070b03, 0x07171906, 0x028b8b05, 0x02031e1d, 0x03040303, 0x97010e0e, 0x05090597, 0x0d1f2705, 0x010f0508, 0x322b2602, 0x02282601, 0x2206010b,
0x38370221, 0x67682222, 0x010140f7, 0x8a8a0404, 0x876f6f02, 0x0d080687, 0xfe272707, 0x53540181, 0x01010b0a, 0x01020e07, 0x09086f6f, 0x02031415,
0x04046a02, 0x10050502, 0x0a0a0105, 0x02021717, 0x19050a10, 0x820a0b1a, 0x12050201, 0x02040706, 0x040401d9, 0x1b070a05, 0x0502705b, 0x2c000600,
0xbd0388ff, 0x48000603, 0x61005800, 0x78006b00, 0x00008200, 0x1e173601, 0x17161701, 0x0607011e, 0x0e070607, 0x27222301, 0x3e37012e, 0x37363701,
0x3637013e, 0x2e273635, 0x07262701, 0x07060706, 0x17011e30, 0x1617011e, 0x010e0706, 0x26272627, 0x37013e35, 0x1e17013e, 0x37011f01, 0x23260636,
0x30150622, 0x16010e07, 0x013e3736, 0x16360335, 0x27010e07, 0x3617012e, 0x07141617, 0x3626010e, 0x16173617, 0x14151617, 0x35262706, 0x17361734,
0x06070616, 0x01262726, 0x0f86a9e9, 0x12440d2f, 0x16030103, 0x33252269, 0x05133a7b, 0x04040408, 0x4b58160f, 0x0d15684a, 0xae190a01, 0x4f393a77,
0x072a1f40, 0x0b16070c, 0x0f110201, 0x1f0aa709, 0x1a01060d, 0x11200704, 0x1c16150d, 0x86547113, 0x0d070202, 0x1605030a, 0x9b173e3b, 0x050a1b10,
0x010c0813, 0x030c114e, 0x0f1a0703, 0x08066808, 0x1c050507, 0x0e7c070d, 0x0d020c0e, 0x0502160a, 0x6908fe02, 0x5b11300d, 0x134e1571, 0x1823699a,
0x05022522, 0x05070913, 0x26280501, 0x34304f82, 0xa6742a2f, 0x0a080a16, 0x07221124, 0x1316070d, 0x071d100f, 0x03021d05, 0x0f0d0c1b, 0x130f089c,
0x170e0102, 0xdf5c0f1b, 0x50010585, 0x0305163a, 0x06060b0a, 0x1c0aaefe, 0x04050710, 0x05641d06, 0x05110411, 0x1815010a, 0x02020153, 0x11090606,
0x08070d0c, 0x09093714, 0x04051e07, 0x00110b09, 0x26000700, 0xc8037dff, 0x48001603, 0x76005a00, 0x9c008100, 0xb900ab00, 0x36010000, 0x011e1732,
0x06071617, 0x010f0607, 0x14151617, 0x2f260607, 0x27060701, 0x07010e14, 0x0e222306, 0x27222302, 0x37343526, 0x3e30023e, 0x35363703, 0x37363734,
0x26273436, 0x37362627, 0x37011f36, 0x17363736, 0x07222726, 0x010e0706, 0x32331614, 0x35363700, 0x012e0134, 0x07230607, 0x010e0716, 0x16171617,
0x37320607, 0x17161736, 0x2f363716, 0x23260601, 0x14150622, 0x3637013b, 0x23273707, 0x06070607, 0x06070607, 0x15010e07, 0x36161714, 0x33013e37,
0x01363732, 0x07161736, 0x010e0706, 0x37262223, 0x3607013e, 0x010e0716, 0x27260607, 0x36373634, 0x38072803, 0x082b1d08, 0x12060809, 0x057e7c07,
0x270f1a0d, 0x18180711, 0x067f7902, 0x1e1c1d1d, 0x14130f2d, 0x010c1a0a, 0x03010103, 0x23020403, 0x92920815, 0x03040903, 0x26240c0c, 0x0b7d7f08,
0x120d5a0f, 0x070c0c13, 0x0272fd07, 0x03010102, 0x479cfe0a, 0x02070b1a, 0x03030103, 0x26020201, 0x01010126, 0x2f2e0201, 0x0c0c0c06, 0x735d0101,
0x74b50101, 0xc4212273, 0x2375745d, 0x020d0423, 0x18060f02, 0x0a09060e, 0x2b190f10, 0x07131d1e, 0x08093902, 0x4301030b, 0x0a051431, 0x7b06060c,
0x021109a0, 0x09061f01, 0x0e050112, 0x03130313, 0x1c2d0803, 0x14191e20, 0x067e7c09, 0x141e1411, 0x060b010b, 0x02011818, 0x13047d7b, 0x06082b0e,
0x0d171f11, 0x01020301, 0x02040303, 0x1d2f1e22, 0x0492920b, 0x0e160802, 0x1b1e0a1f, 0x087e7f07, 0x0106200b, 0x04040504, 0x017204fd, 0x18120603,
0x47b9fe33, 0x02010316, 0x0f050501, 0x26260405, 0x01010102, 0x0602302f, 0x0a120606, 0x01b6721c, 0xc4212202, 0x2323015d, 0x22271205, 0x0f190a16,
0x050d0608, 0x1b0f0705, 0x02050e14, 0x08050496, 0x3143050b, 0x08071311, 0x1004a37b, 0x05200409, 0x060a0a06, 0x00130e07, 0xfdff0400, 0xe50357ff,
0x41003f03, 0xab007400, 0x0000b400, 0x32173601, 0x011e1716, 0x15321415, 0x17161714, 0x14161716, 0x14150607, 0x17222306, 0x14222316, 0x07141522,
0x010e0106, 0x2f012e27, 0x060e0701, 0x012e2726, 0x26273427, 0x37360136, 0x2f261700, 0x17010901, 0x3637011e, 0x37013e37, 0x3637013e, 0x36373637,
0x36373637, 0x37013e37, 0x32333634, 0x33363435, 0x2e273436, 0x23262702, 0x17223422, 0x06072634, 0x06070607, 0x07061415, 0x010e0706, 0x06070607,
0x07010e07, 0x0607010e, 0x23010e07, 0x26271422, 0x15010e07, 0x37011f14, 0x3637023e, 0x3e373637, 0x2f370101, 0x14060701, 0x5c033216, 0x0a02060e,
0x092f0701, 0x02010707, 0x07111107, 0x02040306, 0x09040503, 0xdefe1809, 0x120b1e3f, 0x851d1915, 0x1526251e, 0x0a0e0c16, 0x054e1106, 0x015c0601,
0x0112221d, 0x0e0238a6, 0xfefafe0e, 0x0f1a25fb, 0x1d1e070b, 0x1702031a, 0x23250f11, 0x0805130b, 0x09082059, 0x05090110, 0x060c2c04, 0x03040107,
0x04030301, 0x0c052b08, 0x03020616, 0x0a082503, 0x04191d29, 0x18030202, 0x241f180e, 0x08020319, 0x05051906, 0x03030404, 0xb617162c, 0x0333632a,
0x0e0a060e, 0x4afd0905, 0x87242586, 0x03094086, 0x02030936, 0x042e0201, 0x07070605, 0x0d090608, 0x0d217a22, 0x050d0603, 0x04050d04, 0xe2fe1e0a,
0x0101183e, 0x841d180c, 0x1324251e, 0x02040611, 0x104d0501, 0x65150301, 0x13211c01, 0x073ca401, 0xf8fe0b0b, 0x1a25f8fe, 0x0302010a, 0x17251f02,
0x060a0a2b, 0x2e0d0804, 0x03040a53, 0x13122503, 0x1e080620, 0x03110701, 0x0702080d, 0x030f860e, 0x14290d06, 0x03020910, 0x05070424, 0x15181604,
0x0f1a1510, 0x1a04040a, 0x0d121723, 0x03030a1b, 0x03060405, 0xb6161603, 0x0333622a, 0x200f090f, 0xb9fd300c, 0x87242586, 0x00400986, 0x36000400,
0x8203a8ff, 0x7700f402, 0x0901f100, 0x00002101, 0x32373601, 0x3b011f16, 0x013e3701, 0x17163233, 0x011e1716, 0x15010e07, 0x33161707, 0x16363732,
0x16171617, 0x1d010f06, 0x011e1701, 0x0e070607, 0x2f262701, 0x17010f01, 0x06161716, 0x06070607, 0x2b012f26, 0x010e0701, 0x2e272627, 0x35363701,
0x07012f34, 0x0607010e, 0x27262726, 0x36343526, 0x013d013f, 0x37012e27, 0x013e3736, 0x32331617, 0x27343536, 0x36373626, 0x22072616, 0x15010e07,
0x07161714, 0x0607010e, 0x22232627, 0x06070607, 0x011e1415, 0x07060714, 0x17143106, 0x37011f16, 0x17363736, 0x1617011e, 0x14150607, 0x16171617,
0x013e3233, 0x33011e32, 0x3f363732, 0x27263501, 0x013e3726, 0x16173637, 0x3637011f, 0x30353637, 0x3e34012e, 0x27343501, 0x23262726, 0x27060722,
0x2627012e, 0x34353637, 0x23262726, 0x07060722, 0x36172206, 0x16171617, 0x16171617, 0x07060714, 0x27262706, 0x37363726, 0x2617013e, 0x07010e07,
0x17141506, 0x17161716, 0x36373216, 0x34353637, 0x70012627, 0x09070516, 0x2121110f, 0x07090e11, 0x2c0e2e06, 0x04030f26, 0x17020501, 0x26040316,
0x240a0b13, 0x19070412, 0x07191b1b, 0x0a241204, 0x0519150c, 0x0217180a, 0x04040501, 0x12493a0f, 0x2111110b, 0x0c101221, 0x103a4911, 0x17080404,
0x15030a17, 0x0a0b1606, 0x09111018, 0x1b1a1a16, 0x25100605, 0x25130c08, 0x082d0304, 0x3b0e0404, 0x04012171, 0x063c1a19, 0x43010306, 0x181e0603,
0x15060203, 0x0531080d, 0x171a0302, 0x06150d08, 0x1b160505, 0x01430306, 0x1a060603, 0x021c1f1c, 0x61082101, 0x03012108, 0x0726281b, 0x03060501,
0x05034301, 0x0504171c, 0x080d1605, 0x31040431, 0x04160d08, 0x1e180303, 0x01430306, 0x24070402, 0x010c2f14, 0x0404120f, 0x0f0e2261, 0x1216191c,
0x10110c13, 0x46462e17, 0x05201723, 0x41130c03, 0x1f161552, 0x02080c31, 0x341a0805, 0x3a071f07, 0x15070d19, 0x0105ee02, 0x1a1a150a, 0x050d0a15,
0x0c091810, 0x02160615, 0x0817170a, 0x3a0f0504, 0x110c1149, 0x11212111, 0x49110c11, 0x0504103a, 0x18020105, 0x18060a17, 0x24090c16, 0x19080512,
0x08191a1a, 0x09241205, 0x0425130c, 0x02171703, 0x05010401, 0x2d260f04, 0x09071030, 0x2121110f, 0x1a0c1211, 0x050d3c3f, 0x032c0804, 0x0b132604,
0x32442409, 0x1d080801, 0x1e1a0105, 0x01430306, 0x09050602, 0x031a2924, 0x61092001, 0x10110503, 0x24291a03, 0x0401010a, 0x43010206, 0x1a1e0504,
0x0f0d0302, 0x0531090a, 0x0c093105, 0x05050417, 0x03041c17, 0x06020243, 0x07010104, 0x031c2727, 0x09610821, 0x1b030120, 0x05072529, 0x43020206,
0x20170503, 0x08130303, 0x031a1714, 0x0202ad02, 0x120b0c02, 0x48221712, 0x24172e21, 0x2f201124, 0x25191f36, 0x0305232d, 0x151c2705, 0x14091118,
0x020b2d0d, 0x1a330c01, 0x3c11151b, 0x3d000600, 0xc703a3ff, 0x3300e702, 0x9a005100, 0xe600b400, 0x00000101, 0x20053613, 0x16171617, 0x14151617,
0x16171617, 0x14060706, 0x06070607, 0x012e2704, 0x26272627, 0x26342627, 0x36372627, 0x36373637, 0x34353637, 0x36373233, 0x01292605, 0x06070607,
0x06070607, 0x16171617, 0x20211617, 0x34353637, 0x22232627, 0x36052627, 0x16172021, 0x32331432, 0x32161716, 0x15163216, 0x06141614, 0x0e071415,
0x06141502, 0x22230607, 0x20211415, 0x26272627, 0x27342223, 0x2627012e, 0x34352223, 0x37342627, 0x33343536, 0x013e3732, 0x33343637, 0x26043632,
0x22230620, 0x17140607, 0x16323316, 0x37323620, 0x34363736, 0x26272627, 0x17203604, 0x1714011e, 0x1415011e, 0x07011e17, 0x22060706, 0x06071415,
0x20210607, 0x22262726, 0x26273427, 0x26272627, 0x32362627, 0x37363435, 0x26053736, 0x0e070620, 0x16060701, 0x16171617, 0x2025011f, 0x34323437,
0x35363233, 0x01049834, 0x036c016b, 0x0f110a06, 0x0a06010b, 0x050d0c04, 0x0914150c, 0x02022ffd, 0x0b010111, 0x03070e1b, 0x02070402, 0x0d100603,
0x02020407, 0xda020b05, 0xfea0fe06, 0x050a0aa0, 0x02020105, 0x0d090803, 0x01010105, 0x06620163, 0x050c021e, 0xfd040302, 0x5c010b2d, 0x02067601,
0x22050306, 0x03030102, 0x04040603, 0x09030108, 0x04100712, 0xfe88fe03, 0x091010a8, 0x0302020a, 0x01011a04, 0x08040202, 0x02020408, 0x04190101,
0x14020204, 0xfd02d302, 0x0f030348, 0x0d06060d, 0x0202040f, 0x050a02b8, 0x02020b0d, 0xfd050d0b, 0xd402022d, 0x06130101, 0x0a051c05, 0x0502010d,
0x0e0d0308, 0x93fe0520, 0x0c54ddfe, 0x0a010405, 0x03010b18, 0x05030202, 0x18081203, 0x07de0214, 0x05023bfd, 0x02021206, 0x05010302, 0x010a0906,
0x01660165, 0x0e060206, 0x0101e602, 0x09050302, 0x02030b0e, 0x11240201, 0x02070d34, 0x02051109, 0x03010201, 0x0d060101, 0x02050b1d, 0x030f2410,
0x0e0f0e09, 0x02020102, 0x02390502, 0x07070505, 0x150b0101, 0x0102110e, 0x0f030102, 0x18040a1d, 0x02fb0304, 0x1d040106, 0x130b0406, 0x20020504,
0x06110502, 0x01090901, 0x0a041202, 0x01020601, 0x02030505, 0x04031a01, 0x110a0102, 0x02091132, 0x19040402, 0x0a030201, 0x1603033a, 0x16091e09,
0x07030303, 0x04140416, 0xfd030716, 0x03010203, 0x14020203, 0x0b070102, 0x0d150f2a, 0x0c030213, 0x01020f0f, 0x02010207, 0x05191006, 0x0f0f0307,
0x1c040423, 0x3b041607, 0x01010303, 0x19080c12, 0x07070102, 0x03010505, 0x0b1b0402, 0x0000001e, 0x0e000000, 0x0100ae00, 0x00000000, 0x1e000000,
0x01003e00, 0x00000000, 0x0c000100, 0x01007700, 0x00000000, 0x07000200, 0x01009400, 0x00000000, 0x27000300, 0x0100ec00, 0x00000000, 0x0c000400,
0x01002e01, 0x00000000, 0x10000500, 0x01005d01, 0x00000000, 0x0c000600, 0x03008801, 0x09040100, 0x3c000000, 0x03000000, 0x09040100, 0x18000100,
0x03005d00, 0x09040100, 0x0e000200, 0x03008400, 0x09040100, 0x4e000300, 0x03009c00, 0x09040100, 0x18000400, 0x03001401, 0x09040100, 0x20000500,
0x03003b01, 0x09040100, 0x18000600, 0x43006e01, 0x70006f00, 0x72007900, 0x67006900, 0x74006800, 0x28002000, 0x29006300, 0x32002000, 0x32003000,
0x2c003000, 0x73002000, 0x73006500, 0x6d006100, 0x2e006500, 0x6e006f00, 0x00006500, 0x79706f43, 0x68676972, 0x63282074, 0x30322029, 0x202c3032,
0x61736573, 0x6f2e656d, 0x0000656e, 0x00650073, 0x00610073, 0x0065006d, 0x0069005f, 0x006f0063, 0x0073006e, 0x73657300, 0x5f656d61, 0x6e6f6369,
0x52000073, 0x67006500, 0x6c007500, 0x72006100, 0x65520000, 0x616c7567, 0x46000072, 0x6e006f00, 0x46007400, 0x72006f00, 0x65006700, 0x32002000,
0x30002e00, 0x3a002000, 0x73002000, 0x73006500, 0x6d006100, 0x5f006500, 0x63006900, 0x6e006f00, 0x20007300, 0x20003a00, 0x2d003700, 0x2d003800,
0x30003200, 0x30003200, 0x6f460000, 0x6f46746e, 0x20656772, 0x20302e32, 0x6573203a, 0x656d6173, 0x6f63695f, 0x3a20736e, 0x382d3720, 0x3230322d,
0x73000030, 0x73006500, 0x6d006100, 0x5f006500, 0x63006900, 0x6e006f00, 0x00007300, 0x61736573, 0x695f656d, 0x736e6f63, 0x00560000, 0x00720065,
0x00690073, 0x006e006f, 0x00300020, 0x00310030, 0x0030002e, 0x00300030, 0x56000020, 0x69737265, 0x30206e6f, 0x302e3130, 0x00203030, 0x65007300,
0x61007300, 0x65006d00, 0x69005f00, 0x6f006300, 0x73006e00, 0x65730000, 0x656d6173, 0x6f63695f, 0x0000736e, 0x00000200, 0x00000000, 0x320051ff,
0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000a00, 0x02000100, 0x25002400, 0x27002600, 0x29002800, 0x00002a00, 0x01000000,
0x0200ffff, 0x00000100, 0x00000c00, 0x1e001600, 0x01000200, 0x09000100, 0x04000100, 0x02000000, 0x01000000, 0x01000000, 0x00000000, 0x01000000,
0x00000000, 0xdb98a4d5, 0x00000000, 0x308953db, 0x00000000, 0xdb9353db,
};

View File

@ -0,0 +1,446 @@
#pragma once
#include "config.h"
#include "../features.h"
#pragma region variables_combo_entries
using VisualOverlayBox_t = int;
enum EVisualOverlayBox : VisualOverlayBox_t
{
VISUAL_OVERLAY_BOX_NONE = 0,
VISUAL_OVERLAY_BOX_FULL,
VISUAL_OVERLAY_BOX_CORNERS,
VISUAL_OVERLAY_BOX_MAX
};
using VisualChamMaterial_t = int;
enum EVisualsChamMaterials : VisualChamMaterial_t
{
VISUAL_MATERIAL_PRIMARY_WHITE = 0,
glowproperty = 1,
glowproperty2 = 2,
VISUAL_MATERIAL_MAX
};
using MiscDpiScale_t = int;
enum EMiscDpiScale : MiscDpiScale_t
{
MISC_DPISCALE_DEFAULT = 0,
MISC_DPISCALE_125,
MISC_DPISCALE_150,
MISC_DPISCALE_175,
MISC_DPISCALE_200,
MISC_DPISCALE_MAX
};
#pragma endregion
#pragma region variables_multicombo_entries
using MenuAddition_t = unsigned int;
enum EMenuAddition : MenuAddition_t
{
MENU_ADDITION_NONE = 0U,
MENU_ADDITION_DIM_BACKGROUND = 1 << 0,
MENU_ADDITION_BACKGROUND_PARTICLE = 1 << 1,
MENU_ADDITION_GLOW = 1 << 2,
MENU_ADDITION_ALL = MENU_ADDITION_DIM_BACKGROUND | MENU_ADDITION_GLOW
};
using LegitCond_t = unsigned int;
enum LegitCond : LegitCond_t
{
LEGIT_NONE = 0U,
LEGIT_IN_AIR = 1 << 0,
LEGIT_FLASHED = 1 << 1,
LEGIT_IN_SMOKE = 1 << 2,
LEGIT_DELAY_SHOT = 1 << 3
};
using ESPFlags_t = unsigned int;
enum EESPFlags : ESPFlags_t
{
FLAGS_NONE = 0U,
FLAGS_ARMOR = 1 << 0,
FLAGS_DEFUSER = 1 << 1
};
#pragma endregion
struct rage_weapon_t {
};
struct Variables_t
{
#pragma region ragebot
C_ADD_VARIABLE_ARRAY(int, 7, rage_target_select, 0);
C_ADD_VARIABLE_ARRAY(int, 7, rage_minimum_damage, 0);
C_ADD_VARIABLE_ARRAY(int, 7, rage_minimum_hitchance, 0);
C_ADD_VARIABLE(bool, rage_enable, false);
C_ADD_VARIABLE_ARRAY(bool, 7, rage_hitchance, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, rapid_fire, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, rage_penetration, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, rage_safe_point, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, rage_auto_stop, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, rage_early_stop, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, rage_auto_scope, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, remove_weapon_accuracy_spread, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, hitbox_head, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, hitbox_neck, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, hitbox_uppeer_chest, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, hitbox_chest, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, hitbox_stomach, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, hitbox_legs, 0);
C_ADD_VARIABLE_ARRAY(bool, 7, hitbox_feet, 0);
#pragma endregion
#pragma region variables_world
C_ADD_VARIABLE(bool, bNightmode, false);
#pragma endregion
#pragma region variables_visuals
C_ADD_VARIABLE(bool, bVisualOverlay, false);
C_ADD_VARIABLE(bool, bRemoveChamsT, false);
C_ADD_VARIABLE(bool, bRemoveChamsOcclude, false);
C_ADD_VARIABLE(FrameOverlayVar_t, overlayBox, FrameOverlayVar_t(false));
C_ADD_VARIABLE(TextOverlayVar_t, overlayName, TextOverlayVar_t(false, false));
C_ADD_VARIABLE(BarOverlayVar_t, overlayHealthBar, BarOverlayVar_t(false, false, false, 2.1f, Color_t(0, 255, 155), Color_t(255, 0, 155)));
C_ADD_VARIABLE(BarOverlayVar_t, backgroundHealthbar, BarOverlayVar_t(false, false, false, 1.f, Color_t(0, 0, 0, 55), Color_t(0, 0, 0, 55)));
C_ADD_VARIABLE(BarOverlayVar_t, AmmoBar, BarOverlayVar_t(false, false, false, 1.f, Color_t(0, 255, 155), Color_t(255, 0, 155)));
C_ADD_VARIABLE(BarOverlayVar_t, AmmoBarBackground, BarOverlayVar_t(false, false, false, 1.f, Color_t(0, 0, 0, 55), Color_t(0, 0, 0, 55)));
bool full_update = false;
C_ADD_VARIABLE(bool, bVisualChams, false);
C_ADD_VARIABLE(bool, bSkeleton, false);
C_ADD_VARIABLE(int, nVisualChamMaterial, 0);
C_ADD_VARIABLE(bool, bVisualChamsIgnoreZ, false); // invisible chams
C_ADD_VARIABLE(bool, bNoShadow, false);
C_ADD_VARIABLE(ColorPickerVar_t, colVisualChams, ColorPickerVar_t(0, 255, 0));
C_ADD_VARIABLE(ColorPickerVar_t, colVisualChamsIgnoreZ, ColorPickerVar_t(255, 0, 0));
C_ADD_VARIABLE(ColorPickerVar_t, colModulate, ColorPickerVar_t(255, 0, 0));
#pragma endregion
#pragma region legit
C_ADD_VARIABLE(bool, legit_enable, false);
C_ADD_VARIABLE(int, legit_weapon_selection, 0);
C_ADD_VARIABLE(bool, legit_silent_aim, false);
C_ADD_VARIABLE(bool, legit_delay_aim, false);
C_ADD_VARIABLE(int, legit_delay_aim_ms, 0);
C_ADD_VARIABLE(int, legit_target_selection, 0);
C_ADD_VARIABLE(int, legit_target_selection_machinegun, 0);
C_ADD_VARIABLE(int, legit_target_selection_assultrifles, 0);
C_ADD_VARIABLE(int, legit_target_selection_snipers, 0);
C_ADD_VARIABLE(bool, legit_fov_visualize, false);
C_ADD_VARIABLE(ColorPickerVar_t, legit_fov_visualizeclr, ColorPickerVar_t(255, 88, 88));
C_ADD_VARIABLE(int, legit_smooth_pistol, 1);
C_ADD_VARIABLE(int, legit_smooth_machinegun, 1);
C_ADD_VARIABLE(int, legit_smooth_assultrifles, 1);
C_ADD_VARIABLE(int, legit_smooth_snipers, 1);
C_ADD_VARIABLE(int, legit_rcs_shots_pistol, 0);
C_ADD_VARIABLE(int, legit_rcs_shots_machinegun, 0);
C_ADD_VARIABLE(int, legit_rcs_shots_assultrifles, 0);
C_ADD_VARIABLE(int, legit_rcs_shots_snipers, 0);
C_ADD_VARIABLE(bool, legit_rcs_pistol, false);
C_ADD_VARIABLE(bool, legit_rcs_machinegun, false);
C_ADD_VARIABLE(bool, legit_rcs_assultrifles, false);
C_ADD_VARIABLE(bool, legit_rcs_snipers, false);
C_ADD_VARIABLE(bool, PunchRandomization_pistol, false);
C_ADD_VARIABLE(bool, PunchRandomization_machinegun, false);
C_ADD_VARIABLE(bool, PunchRandomization_assultrifles, false);
C_ADD_VARIABLE(bool, PunchRandomization_snipers, false);
C_ADD_VARIABLE(float, punch_y_pistol, 0);
C_ADD_VARIABLE(float, punch_x_pistol, 0);
C_ADD_VARIABLE(float, punch_y_snipers, 0);
C_ADD_VARIABLE(float, punch_x_snipers, 0);
C_ADD_VARIABLE(float, punch_y_machinegun, 0);
C_ADD_VARIABLE(float, punch_x_machinegun, 0);
C_ADD_VARIABLE(float, punch_x_assultrifles, 0);
C_ADD_VARIABLE(float, punch_y_assultrifles, 0);
C_ADD_VARIABLE(bool, legit_rcs_shots_enable_pistol, false);
C_ADD_VARIABLE(bool, legit_rcs_shots_enable_machinegun, false);
C_ADD_VARIABLE(bool, legit_rcs_shots_enable_assultrifles, false);
C_ADD_VARIABLE(bool, legit_rcs_shots_enable_snipers, false);
C_ADD_VARIABLE(float, legit_rcs_smoothx_pistol, 0.f);
C_ADD_VARIABLE(float, legit_rcs_smoothx_machinegun, 0.f);
C_ADD_VARIABLE(float, legit_rcs_smoothx_assultrifles, 0.f);
C_ADD_VARIABLE(float, legit_rcs_smoothx_snipers, 0.f);
C_ADD_VARIABLE(float, legit_rcs_smoothy_pistol, 0.f);
C_ADD_VARIABLE(float, legit_rcs_smoothy_machinegun, 0.f);
C_ADD_VARIABLE(float, legit_rcs_smoothy_assultrifles, 0.f);
C_ADD_VARIABLE(float, legit_rcs_smoothy_snipers, 0.f);
C_ADD_VARIABLE(bool, legit_no_scope, false);
C_ADD_VARIABLE(bool, legit_visibility_check_pistol, true);
C_ADD_VARIABLE(bool, legit_visibility_check_machinegun, true);
C_ADD_VARIABLE(bool, legit_visibility_check_assultrifles, true);
C_ADD_VARIABLE(bool, legit_visibility_check_snipers, true);
C_ADD_VARIABLE(bool, hitbox_head_pistol, false);
C_ADD_VARIABLE(bool, hitbox_head_machinegun, false);
C_ADD_VARIABLE(bool, hitbox_head_assultrifles, false);
C_ADD_VARIABLE(bool, hitbox_head_snipers, false);
C_ADD_VARIABLE(bool, hitbox_neck_pistol, false);
C_ADD_VARIABLE(bool, hitbox_neck_machinegun, false);
C_ADD_VARIABLE(bool, hitbox_neck_assultrifles, false);
C_ADD_VARIABLE(bool, hitbox_neck_snipers, false);
C_ADD_VARIABLE(bool, hitbox_uppeer_chest_pistol, false);
C_ADD_VARIABLE(bool, hitbox_uppeer_chest_machinegun, false);
C_ADD_VARIABLE(bool, hitbox_uppeer_chest_assultrifles, false);
C_ADD_VARIABLE(bool, hitbox_uppeer_chest_snipers, false);
C_ADD_VARIABLE(float, max_lagcompensation_time, 0.f);
C_ADD_VARIABLE(bool, hitbox_chest_pistol, false);
C_ADD_VARIABLE(bool, hitbox_chest_machinegun, false);
C_ADD_VARIABLE(bool, hitbox_chest_assultrifles, false);
C_ADD_VARIABLE(bool, hitbox_chest_snipers, false);
C_ADD_VARIABLE(bool, hitbox_stomach_pistol, false);
C_ADD_VARIABLE(bool, hitbox_stomach_machinegun, false);
C_ADD_VARIABLE(bool, hitbox_stomach_assultrifles, false);
C_ADD_VARIABLE(bool, hitbox_stomach_snipers, false);
C_ADD_VARIABLE(bool, hitbox_leg_l_pistol, false);
C_ADD_VARIABLE(bool, hitbox_leg_l_machinegun, false);
C_ADD_VARIABLE(bool, hitbox_leg_l_assultrifles, false);
C_ADD_VARIABLE(bool, hitbox_leg_l_snipers, false);
C_ADD_VARIABLE(bool, hitbox_leg_r_pistol, false);
C_ADD_VARIABLE(bool, hitbox_leg_r_machinegun, false);
C_ADD_VARIABLE(bool, hitbox_leg_r_assultrifles, false);
C_ADD_VARIABLE(bool, hitbox_leg_r_snipers, false);
C_ADD_VARIABLE(bool, trigger_enable_p, false);
C_ADD_VARIABLE(bool, trigger_on_key, false);
C_ADD_VARIABLE(int, trigger_hitchance_p, 0);
C_ADD_VARIABLE(bool, trigger_enable_a, false);
C_ADD_VARIABLE(int, trigger_hitchance_a, 0);
C_ADD_VARIABLE(bool, trigger_enable_m, false);
C_ADD_VARIABLE(int, trigger_hitchance_m, 0);
C_ADD_VARIABLE(bool, trigger_enable_s, false);
C_ADD_VARIABLE(int, trigger_hitchance_s, 0);
// PISTOL
C_ADD_VARIABLE(int, legit_fov_pistol, 0);
C_ADD_VARIABLE(KeyBind_t, legit_key_pistol, 0);
C_ADD_VARIABLE(KeyBind_t, edge_bug_key, 0);
// MACHINESGUN
C_ADD_VARIABLE(int, legit_fov_machinegun, 0);
C_ADD_VARIABLE(KeyBind_t, legit_key_machinegun, 0);
// ASSULTRIFLES
C_ADD_VARIABLE(int, legit_fov_assultrifles, 0);
C_ADD_VARIABLE(KeyBind_t, legit_key_assultrifles, 0);
// SNIPERS
C_ADD_VARIABLE(int, legit_fov_snipers, 0);
C_ADD_VARIABLE(KeyBind_t, legit_key_snipers, 0);
#pragma endregion
#pragma region antiaim
C_ADD_VARIABLE(bool, bAntiAim, false);
C_ADD_VARIABLE(int, iBaseYawType, 0);
C_ADD_VARIABLE(int, iPitchType, 0);
#pragma endregion
#pragma region rage
C_ADD_VARIABLE(int, rage_weapon_selection, 0);
C_ADD_VARIABLE(bool, rage_silent_aim, false);
C_ADD_VARIABLE(bool, rage_delay_aim, false);
C_ADD_VARIABLE(int, rage_delay_aim_ms, 0);
C_ADD_VARIABLE(int, rage_target_selection, 0);
C_ADD_VARIABLE(int, rage_target_selection_machinegun, 0);
C_ADD_VARIABLE(int, rage_target_selection_assultrifles, 0);
C_ADD_VARIABLE(int, rage_target_selection_snipers, 0);
C_ADD_VARIABLE(bool, rage_fov_visualize, false);
C_ADD_VARIABLE(ColorPickerVar_t, rage_fov_visualizeclr, ColorPickerVar_t(255, 88, 88));
C_ADD_VARIABLE(bool, remove_weapon_accuracy_spread_rage, false);
C_ADD_VARIABLE(int, rage_hitchance_p, 1);
C_ADD_VARIABLE(int, rage_hitchance_m, 1);
C_ADD_VARIABLE(int, rage_hitchance_a, 1);
C_ADD_VARIABLE(float, rage_hitchance_s, 1.f);
C_ADD_VARIABLE(int, rage_rcs_shots_pistol, 0);
C_ADD_VARIABLE(int, rage_rcs_shots_machinegun, 0);
C_ADD_VARIABLE(int, rage_rcs_shots_assultrifles, 0);
C_ADD_VARIABLE(int, rage_rcs_shots_snipers, 0);
C_ADD_VARIABLE(bool, rage_rcs_pistol, false);
C_ADD_VARIABLE(bool, rage_rcs_machinegun, false);
C_ADD_VARIABLE(bool, rage_rcs_assultrifles, false);
C_ADD_VARIABLE(bool, rage_rcs_snipers, false);
C_ADD_VARIABLE(bool, PunchRandomization_rage_pistol, false);
C_ADD_VARIABLE(bool, PunchRandomization_rage_machinegun, false);
C_ADD_VARIABLE(bool, PunchRandomization_rage_assultrifles, false);
C_ADD_VARIABLE(bool, PunchRandomization_rage_snipers, false);
C_ADD_VARIABLE(float, punch_y_rage_pistol, 0);
C_ADD_VARIABLE(float, punch_x_rage_pistol, 0);
C_ADD_VARIABLE(float, punch_y_rage_snipers, 0);
C_ADD_VARIABLE(float, punch_x_rage_snipers, 0);
C_ADD_VARIABLE(float, punch_y_rage_machinegun, 0);
C_ADD_VARIABLE(float, punch_x_rage_machinegun, 0);
C_ADD_VARIABLE(float, punch_x_rage_assultrifles, 0);
C_ADD_VARIABLE(float, punch_y_rage_assultrifles, 0);
C_ADD_VARIABLE(bool, rage_rcs_shots_enable_pistol, false);
C_ADD_VARIABLE(bool, rage_rcs_shots_enable_machinegun, false);
C_ADD_VARIABLE(bool, rage_rcs_shots_enable_assultrifles, false);
C_ADD_VARIABLE(bool, rage_rcs_shots_enable_snipers, false);
C_ADD_VARIABLE(float, rage_rcs_smoothx_pistol, 0.f);
C_ADD_VARIABLE(float, rage_rcs_smoothx_machinegun, 0.f);
C_ADD_VARIABLE(float, rage_rcs_smoothx_assultrifles, 0.f);
C_ADD_VARIABLE(float, rage_rcs_smoothx_snipers, 0.f);
C_ADD_VARIABLE(float, rage_rcs_smoothy_pistol, 0.f);
C_ADD_VARIABLE(float, rage_rcs_smoothy_machinegun, 0.f);
C_ADD_VARIABLE(float, rage_rcs_smoothy_assultrifles, 0.f);
C_ADD_VARIABLE(float, rage_rcs_smoothy_snipers, 0.f);
C_ADD_VARIABLE(bool, rage_no_scope, false);
C_ADD_VARIABLE(bool, rage_visibility_check_pistol, true);
C_ADD_VARIABLE(bool, rage_visibility_check_machinegun, true);
C_ADD_VARIABLE(bool, rage_visibility_check_assultrifles, true);
C_ADD_VARIABLE(bool, rage_visibility_check_snipers, true);
C_ADD_VARIABLE(bool, hitbox_head_rage_pistol, false);
C_ADD_VARIABLE(bool, hitbox_head_rage_machinegun, false);
C_ADD_VARIABLE(bool, hitbox_head_rage_assultrifles, false);
C_ADD_VARIABLE(bool, hitbox_head_rage_snipers, false);
C_ADD_VARIABLE(bool, hitbox_neck_rage_pistol, false);
C_ADD_VARIABLE(bool, hitbox_neck_rage_machinegun, false);
C_ADD_VARIABLE(bool, hitbox_neck_rage_assultrifles, false);
C_ADD_VARIABLE(bool, hitbox_neck_rage_snipers, false);
// ... Repeat the same pattern for other hitbox variables
C_ADD_VARIABLE(bool, trigger_enable_r, false);
C_ADD_VARIABLE(bool, trigger_on_key_r, false);
C_ADD_VARIABLE(int, trigger_hitchance_r, 0);
// PISTOL
C_ADD_VARIABLE(int, rage_fov_pistol, 0);
C_ADD_VARIABLE(KeyBind_t, rage_key_pistol, 0);
// MACHINESGUN
C_ADD_VARIABLE(int, rage_fov_machinegun, 0);
C_ADD_VARIABLE(KeyBind_t, rage_key_machinegun, 0);
// ASSULTRIFLES
C_ADD_VARIABLE(int, rage_fov_assultrifles, 0);
C_ADD_VARIABLE(KeyBind_t, rage_key_assultrifles, 0);
// SNIPERS
C_ADD_VARIABLE(int, rage_fov_snipers, 0);
C_ADD_VARIABLE(KeyBind_t, rage_key_snipers, 0);
#pragma endregion
#pragma region variables_misc
C_ADD_VARIABLE(bool, bAntiUntrusted, true);
C_ADD_VARIABLE(bool, bWatermark, true);
C_ADD_VARIABLE(bool, bFOV, false);
C_ADD_VARIABLE(bool, bSetViewModelFOV, false);
C_ADD_VARIABLE(bool, bAutostrafe, false);
C_ADD_VARIABLE(bool, bAutostrafeAssistance, false);
C_ADD_VARIABLE(bool, bAutoBHop, false);
C_ADD_VARIABLE(bool, bThirdperson, false);
C_ADD_VARIABLE(float, flThirdperson, 90.0f);
C_ADD_VARIABLE(float, flSetViewModelFOV, 40.0f);
C_ADD_VARIABLE(float, fFOVAmount, 30.0f);
C_ADD_VARIABLE(bool, bThirdpersonNoInterp, true);
C_ADD_VARIABLE(int, nAutoBHopChance, 100);
C_ADD_VARIABLE(unsigned int, bAutostrafeMode, 0);
C_ADD_VARIABLE(float, autostrafe_smooth, 99);
C_ADD_VARIABLE(bool, edge_bug, false);
#pragma endregion
#pragma region variables_menu
C_ADD_VARIABLE(unsigned int, nMenuKey, VK_INSERT);
C_ADD_VARIABLE(unsigned int, nPanicKey, VK_END);
C_ADD_VARIABLE(int, nDpiScale, 0);
C_ADD_VARIABLE(KeyBind_t, OverlayKey, 0);
C_ADD_VARIABLE(int, OverlayKeyCurrent, 0);
C_ADD_VARIABLE(int, OverlayKeyStyle, 0);
/*
* color navigation:
* [definition N][purpose]
* 1. primitive:
* - primtv 0 (text)
* - primtv 1 (background)
* - primtv 2 (disabled)
* - primtv 3 (control bg)
* - primtv 4 (border)
* - primtv 5 (hover)
*
* 2. accents:
* - accent 0 (main)
* - accent 1 (dark)
* - accent 2 (darker)
*/
C_ADD_VARIABLE(unsigned int, legit_conditions, LEGIT_NONE);
C_ADD_VARIABLE(unsigned int, pEspFlags, FLAGS_NONE);
C_ADD_VARIABLE(TextOverlayVar_t, HKFlag, TextOverlayVar_t(true, false));
C_ADD_VARIABLE(TextOverlayVar_t, KitFlag, TextOverlayVar_t(true, false));
C_ADD_VARIABLE(unsigned int, bMenuAdditional, MENU_ADDITION_ALL);
C_ADD_VARIABLE(float, flAnimationSpeed, 1.f);
C_ADD_VARIABLE(TextOverlayVar_t, Weaponesp, TextOverlayVar_t(false, true));
C_ADD_VARIABLE(ColorPickerVar_t, colSkeleton, ColorPickerVar_t(88, 88, 88)); // (text)
C_ADD_VARIABLE(ColorPickerVar_t, colSkeletonOutline, ColorPickerVar_t(0, 0, 0)); // (text)
C_ADD_VARIABLE(ColorPickerVar_t, colPrimtv0, ColorPickerVar_t(255, 255, 255)); // (text)
C_ADD_VARIABLE(ColorPickerVar_t, colPrimtv1, ColorPickerVar_t(50, 55, 70)); // (background)
C_ADD_VARIABLE(ColorPickerVar_t, colPrimtv2, ColorPickerVar_t(190, 190, 190)); // (disabled)
C_ADD_VARIABLE(ColorPickerVar_t, colPrimtv3, ColorPickerVar_t(20, 20, 30)); // (control bg)
C_ADD_VARIABLE(ColorPickerVar_t, colPrimtv4, ColorPickerVar_t(0, 0, 0)); // (border)
C_ADD_VARIABLE(ColorPickerVar_t, colAccent0, ColorPickerVar_t(85, 90, 160)); // (main)
C_ADD_VARIABLE(ColorPickerVar_t, colAccent1, ColorPickerVar_t(100, 105, 175)); // (dark)
C_ADD_VARIABLE(ColorPickerVar_t, colAccent2, ColorPickerVar_t(115, 120, 190)); // (darker)
#pragma endregion
};
inline Variables_t Vars = {};

View File

@ -0,0 +1,522 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Developer|x64">
<Configuration>Developer</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Distrib|x64">
<Configuration>Distrib</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Publish|x64">
<Configuration>Publish</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DAC639DD-46A6-B878-4FBE-434FBB1C1FDA}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<Keyword>Win32Proj</Keyword>
<RootNamespace>cstrike</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Publish|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Distrib|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Developer|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Publish|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Distrib|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Developer|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<TargetName>test</TargetName>
<TargetExt>.dll</TargetExt>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Publish|x64'">
<LinkIncremental>true</LinkIncremental>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<TargetName>test</TargetName>
<TargetExt>.dll</TargetExt>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Distrib|x64'">
<LinkIncremental>false</LinkIncremental>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<TargetName>1</TargetName>
<TargetExt>.dll</TargetExt>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Developer|x64'">
<LinkIncremental>false</LinkIncremental>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<TargetName>1</TargetName>
<TargetExt>.dll</TargetExt>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<TargetName>cstrike</TargetName>
<TargetExt>.dll</TargetExt>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<PreprocessorDefinitions>NOMINMAX;_DEBUG;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies;$(SolutionDir)dependencies\freetype\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>false</SupportJustMyCode>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<ConformanceMode>true</ConformanceMode>
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AssemblerOutput>All</AssemblerOutput>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;freetype_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies\freetype\binary;C:\Users\gusta\Desktop\trabalho\cs2\base\cstrike\core\spoofcall;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<EntryPointSymbol>CoreEntryPoint</EntryPointSymbol>
<AddModuleNamesToAssembly>call.asm;%(AddModuleNamesToAssembly)</AddModuleNamesToAssembly>
<FixedBaseAddress>true</FixedBaseAddress>
<Profile>true</Profile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
</Link>
<ProjectReference>
<UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Publish|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<PreprocessorDefinitions>NOMINMAX;NDEBUG;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies;$(SolutionDir)dependencies\freetype\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>false</SupportJustMyCode>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<ConformanceMode>true</ConformanceMode>
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AssemblerOutput>All</AssemblerOutput>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;freetype_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies\freetype\binary;C:\Users\gusta\Desktop\trabalho\cs2\base\cstrike\core\spoofcall;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<EntryPointSymbol>CoreEntryPoint</EntryPointSymbol>
<AddModuleNamesToAssembly>call.asm;%(AddModuleNamesToAssembly)</AddModuleNamesToAssembly>
<FixedBaseAddress>false</FixedBaseAddress>
<Profile>true</Profile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
</Link>
<ProjectReference>
<UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Distrib|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<PreprocessorDefinitions>NOMINMAX;NDEBUG;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies;$(SolutionDir)dependencies\freetype\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>false</SupportJustMyCode>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp20</LanguageStandard>
<ConformanceMode>true</ConformanceMode>
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
<LanguageStandard_C>stdc17</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;freetype_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies\freetype\binary;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<EntryPointSymbol>CoreEntryPoint</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Developer|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<PreprocessorDefinitions>NOMINMAX;_DEBUG;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies;$(SolutionDir)dependencies\freetype\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<SupportJustMyCode>false</SupportJustMyCode>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp20</LanguageStandard>
<ConformanceMode>true</ConformanceMode>
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ScanSourceForModuleDependencies>true</ScanSourceForModuleDependencies>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<AdditionalDependencies>d3d11.lib;freetype_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies\freetype\binary;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<EntryPointSymbol>CoreEntryPoint</EntryPointSymbol>
</Link>
<ProjectReference>
<UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<PreprocessorDefinitions>NOMINMAX;NDEBUG;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies;$(SolutionDir)dependencies\freetype\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>
</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpplatest</LanguageStandard>
<ConformanceMode>true</ConformanceMode>
<ExternalWarningLevel>Level3</ExternalWarningLevel>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>d3d11.lib;freetype.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies\freetype\binary;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<EntryPointSymbol>CoreEntryPoint</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\dependencies\imgui\imconfig.h" />
<ClInclude Include="..\dependencies\imgui\imgui.h" />
<ClInclude Include="..\dependencies\imgui\imgui_freetype.h" />
<ClInclude Include="..\dependencies\imgui\imgui_impl_dx11.h" />
<ClInclude Include="..\dependencies\imgui\imgui_impl_win32.h" />
<ClInclude Include="..\dependencies\imgui\imgui_internal.h" />
<ClInclude Include="..\dependencies\imgui\imgui_edited.hpp" />
<ClInclude Include="..\dependencies\imgui\imstb_rectpack.h" />
<ClInclude Include="..\dependencies\imgui\imgui_settings.h" />
<ClInclude Include="..\dependencies\imgui\imstb_textedit.h" />
<ClInclude Include="..\dependencies\imgui\imstb_truetype.h" />
<ClInclude Include="..\dependencies\imgui_notify.h" />
<ClInclude Include="..\dependencies\json.hpp" />
<ClInclude Include="..\dependencies\minhook\buffer.h" />
<ClInclude Include="..\dependencies\minhook\hde\hde32.h" />
<ClInclude Include="..\dependencies\minhook\hde\hde64.h" />
<ClInclude Include="..\dependencies\minhook\hde\pstdint.h" />
<ClInclude Include="..\dependencies\minhook\hde\table32.h" />
<ClInclude Include="..\dependencies\minhook\hde\table64.h" />
<ClInclude Include="..\dependencies\minhook\minhook.h" />
<ClInclude Include="..\dependencies\minhook\trampoline.h" />
<ClInclude Include="..\dependencies\stb_image.h" />
<ClInclude Include="..\dependencies\stb_sprintf.h" />
<ClInclude Include="..\dependencies\xorstr.h" />
<ClInclude Include="..\resources\fa_solid_900.h" />
<ClInclude Include="..\resources\font_awesome_5.h" />
<ClInclude Include="..\resources\game_icons.h" />
<ClInclude Include="..\resources\smallest_pixel.h" />
<ClInclude Include="common.h" />
<ClInclude Include="core.h" />
<ClInclude Include="core\Bgs.h" />
<ClInclude Include="core\BlurShaders\blur_x.h" />
<ClInclude Include="core\BlurShaders\blur_y.h" />
<ClInclude Include="core\BlurShaders\default_vs.h" />
<ClInclude Include="core\config.h" />
<ClInclude Include="core\convars.h" />
<ClInclude Include="core\csig\sigscan.hpp" />
<ClInclude Include="core\fnv1a.hpp" />
<ClInclude Include="core\gui.hpp" />
<ClInclude Include="core\Header.h" />
<ClInclude Include="core\hooks.h" />
<ClInclude Include="core\ImFont.h" />
<ClInclude Include="core\imfonts.h" />
<ClInclude Include="core\interfaces.h" />
<ClInclude Include="core\memaddon.hpp" />
<ClInclude Include="core\memory\memadd.h" />
<ClInclude Include="core\memory\cmodule.hpp" />
<ClInclude Include="core\menu.h" />
<ClInclude Include="core\pointer\pointer.hpp" />
<ClInclude Include="core\schema.h" />
<ClInclude Include="core\schemav2.hpp" />
<ClInclude Include="core\sdk.h" />
<ClInclude Include="core\silentvmt\InlineHook.h" />
<ClInclude Include="core\silentvmt\ShadowVMT.h" />
<ClInclude Include="core\spoofcall\callstack.h" />
<ClInclude Include="core\spoofcall\invoker.h" />
<ClInclude Include="core\spoofcall\lazy_importer.hpp" />
<ClInclude Include="core\spoofcall\syscall.h" />
<ClInclude Include="core\spoofcall\virtualization\VirtualizerSDK64.h" />
<ClInclude Include="core\spoofcall\Utils.h" />
<ClInclude Include="core\stb.hh" />
<ClInclude Include="core\stdafx.h" />
<ClInclude Include="core\ui_icons.hpp" />
<ClInclude Include="core\variables.h" />
<ClInclude Include="features.h" />
<ClInclude Include="features\antiaim\antiaim.hpp" />
<ClInclude Include="features\enginepred\pred.h" />
<ClInclude Include="features\lagcomp\lagcomp.h" />
<ClInclude Include="features\legit\legit.h" />
<ClInclude Include="features\misc.h" />
<ClInclude Include="features\misc\movement.h" />
<ClInclude Include="features\penetration\penetration.h" />
<ClInclude Include="features\rage\rage.h" />
<ClInclude Include="features\skins\ccsinventorymanager.hpp" />
<ClInclude Include="features\skins\ccsplayerinventory.hpp" />
<ClInclude Include="features\skins\skin_changer.hpp" />
<ClInclude Include="features\visuals.h" />
<ClInclude Include="features\visuals\chams.h" />
<ClInclude Include="features\visuals\overlay.h" />
<ClInclude Include="font.h" />
<ClInclude Include="multidrop.h" />
<ClInclude Include="sdk\const.h" />
<ClInclude Include="sdk\datatypes\buf\strtools.h" />
<ClInclude Include="sdk\datatypes\buf\utlbuffer.h" />
<ClInclude Include="sdk\datatypes\buf\wchartypes.h" />
<ClInclude Include="sdk\datatypes\byteswap.h" />
<ClInclude Include="sdk\datatypes\cinterlockedint.hpp" />
<ClInclude Include="sdk\datatypes\color.h" />
<ClInclude Include="sdk\datatypes\cstronghandle.hpp" />
<ClInclude Include="sdk\datatypes\datamap.h" />
<ClInclude Include="sdk\datatypes\K3V.h" />
<ClInclude Include="sdk\datatypes\matrix.h" />
<ClInclude Include="sdk\datatypes\qangle.h" />
<ClInclude Include="sdk\datatypes\quaternion.h" />
<ClInclude Include="sdk\datatypes\repfieldcontainer.h" />
<ClInclude Include="sdk\datatypes\resourcebinding_t.hpp" />
<ClInclude Include="sdk\datatypes\resourceutils.h" />
<ClInclude Include="sdk\datatypes\stronghandle.hpp" />
<ClInclude Include="sdk\datatypes\transform.h" />
<ClInclude Include="sdk\datatypes\usercmd.h" />
<ClInclude Include="sdk\datatypes\utlfixedmemory.h" />
<ClInclude Include="sdk\datatypes\utllinkedlist.h" />
<ClInclude Include="sdk\datatypes\utlmap.h" />
<ClInclude Include="sdk\datatypes\utlmemory.h" />
<ClInclude Include="sdk\datatypes\utlrbtree.h" />
<ClInclude Include="sdk\datatypes\utlstring.h" />
<ClInclude Include="sdk\datatypes\utlstringtoken.h" />
<ClInclude Include="sdk\datatypes\utlthash.h" />
<ClInclude Include="sdk\datatypes\utlvector.h" />
<ClInclude Include="sdk\datatypes\vector.h" />
<ClInclude Include="sdk\datatypes\viewsetup.h" />
<ClInclude Include="sdk\entity.h" />
<ClInclude Include="sdk\entity_handle.h" />
<ClInclude Include="sdk\interfaces\ccsgoinput.h" />
<ClInclude Include="sdk\interfaces\cgameentitysystem.h" />
<ClInclude Include="sdk\interfaces\events.h" />
<ClInclude Include="sdk\interfaces\idebugoverlay.h" />
<ClInclude Include="sdk\interfaces\iengineclient.h" />
<ClInclude Include="sdk\interfaces\ienginecvar.h" />
<ClInclude Include="sdk\interfaces\igameresourceservice.h" />
<ClInclude Include="sdk\interfaces\iglobalvars.h" />
<ClInclude Include="sdk\interfaces\iinputsystem.h" />
<ClInclude Include="sdk\interfaces\imaterialsystem.h" />
<ClInclude Include="sdk\interfaces\imemalloc.h" />
<ClInclude Include="sdk\interfaces\inetworkclientservice.h" />
<ClInclude Include="sdk\interfaces\ischemasystem.h" />
<ClInclude Include="sdk\interfaces\iswapchaindx11.h" />
<ClInclude Include="sdk\interfaces\itrace.h" />
<ClInclude Include="sdk\interfaces\iviewrender.h" />
<ClInclude Include="texture.h" />
<ClInclude Include="utilities\crt.h" />
<ClInclude Include="utilities\detourhook.h" />
<ClInclude Include="utilities\draw.h" />
<ClInclude Include="utilities\easing.h" />
<ClInclude Include="utilities\fnv1a.h" />
<ClInclude Include="utilities\inputsystem.h" />
<ClInclude Include="utilities\log.h" />
<ClInclude Include="utilities\math.h" />
<ClInclude Include="utilities\memory.h" />
<ClInclude Include="utilities\notify.h" />
<ClInclude Include="utilities\pe64.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\dependencies\imgui\imgui.cpp" />
<ClCompile Include="..\dependencies\imgui\imgui_edited.cpp" />
<ClCompile Include="..\dependencies\imgui\imgui_demo.cpp" />
<ClCompile Include="..\dependencies\imgui\imgui_draw.cpp" />
<ClCompile Include="..\dependencies\imgui\imgui_freetype.cpp" />
<ClCompile Include="..\dependencies\imgui\imgui_impl_dx11.cpp" />
<ClCompile Include="..\dependencies\imgui\imgui_impl_win32.cpp" />
<ClCompile Include="..\dependencies\imgui\imgui_tables.cpp" />
<ClCompile Include="..\dependencies\imgui\imgui_widgets.cpp" />
<ClCompile Include="..\dependencies\minhook\buffer.c" />
<ClCompile Include="..\dependencies\minhook\hde\hde32.c" />
<ClCompile Include="..\dependencies\minhook\hde\hde64.c" />
<ClCompile Include="..\dependencies\minhook\hook.c" />
<ClCompile Include="..\dependencies\minhook\trampoline.c" />
<ClCompile Include="core.cpp" />
<ClCompile Include="core\config.cpp" />
<ClCompile Include="core\convars.cpp" />
<ClCompile Include="core\csig\sigscan.cpp" />
<ClCompile Include="core\gui.cpp" />
<ClCompile Include="core\hooks.cpp" />
<ClCompile Include="core\interfaces.cpp" />
<ClCompile Include="core\memory\memadd.cpp" />
<ClCompile Include="core\memory\cmodule.cpp" />
<ClCompile Include="core\menu.cpp" />
<ClCompile Include="core\pointer\pointer.cpp" />
<ClCompile Include="core\schema.cpp" />
<ClCompile Include="core\schemav2.cpp" />
<ClCompile Include="core\sdk.cpp" />
<ClCompile Include="core\silentvmt\InlineHook.cpp" />
<ClCompile Include="core\silentvmt\ShadowVMT.cpp" />
<ClCompile Include="core\spoofcall\callstack.cpp" />
<ClCompile Include="core\variables.cpp" />
<ClCompile Include="features.cpp" />
<ClCompile Include="features\antiaim\antiaim.cpp" />
<ClCompile Include="features\enginepred\pred.cpp" />
<ClCompile Include="features\lagcomp\lagcomp.cpp" />
<ClCompile Include="features\legit\legit.cpp" />
<ClCompile Include="features\misc.cpp" />
<ClCompile Include="features\misc\movement.cpp" />
<ClCompile Include="features\penetration\penetration.cpp" />
<ClCompile Include="features\rage\rage.cpp" />
<ClCompile Include="features\skins\ccsinventorymanager.cpp" />
<ClCompile Include="features\skins\ccsplayerinventory.cpp" />
<ClCompile Include="features\skins\skin_changer.cpp" />
<ClCompile Include="features\visuals.cpp" />
<ClCompile Include="features\visuals\chams.cpp" />
<ClCompile Include="features\visuals\overlay.cpp" />
<ClCompile Include="icons\iconscs2.c" />
<ClCompile Include="sdk\datatypes\buf\strtools.cpp" />
<ClCompile Include="sdk\datatypes\buf\utlbuffer.cpp" />
<ClCompile Include="sdk\datatypes\K3V.cpp" />
<ClCompile Include="sdk\datatypes\matrix.cpp" />
<ClCompile Include="sdk\datatypes\qangle.cpp" />
<ClCompile Include="sdk\datatypes\vector.cpp" />
<ClCompile Include="sdk\entity.cpp" />
<ClCompile Include="sdk\entity_handle.cpp" />
<ClCompile Include="sdk\interfaces\ccsgoinput.cpp" />
<ClCompile Include="sdk\interfaces\events.cpp" />
<ClCompile Include="sdk\interfaces\iengineclient.cpp" />
<ClCompile Include="sdk\interfaces\itrace.cpp" />
<ClCompile Include="utilities\draw.cpp" />
<ClCompile Include="utilities\inputsystem.cpp" />
<ClCompile Include="utilities\log.cpp" />
<ClCompile Include="utilities\math.cpp" />
<ClCompile Include="utilities\memory.cpp" />
<ClCompile Include="utilities\notify.cpp" />
</ItemGroup>
<ItemGroup>
<MASM Include="core\spoofcall\virtualization\VirtualizerSDK64.asm">
<FileType>Document</FileType>
</MASM>
<None Include="core\spoofcall\virtualization\VirtualizerSDK64.inc" />
</ItemGroup>
<ItemGroup>
<MASM Include="core\spoofcall\SpoofCall.asm" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
</Project>

View File

@ -0,0 +1,498 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="core">
<UniqueIdentifier>{4E40957C-3A77-960D-E363-7C10CF79120F}</UniqueIdentifier>
</Filter>
<Filter Include="dependencies">
<UniqueIdentifier>{8CAD9F58-7810-2FFD-2196-67B30DD8FA7F}</UniqueIdentifier>
</Filter>
<Filter Include="dependencies\imgui">
<UniqueIdentifier>{F6B312BD-E297-D312-4BF8-CD6537FBBD94}</UniqueIdentifier>
</Filter>
<Filter Include="dependencies\minhook">
<UniqueIdentifier>{D08C9B77-BC1B-2541-653A-393C51A835E7}</UniqueIdentifier>
</Filter>
<Filter Include="dependencies\minhook\hde">
<UniqueIdentifier>{500251C1-3C27-A041-6572-85D151F69E5F}</UniqueIdentifier>
</Filter>
<Filter Include="features">
<UniqueIdentifier>{04AE61E7-F07A-BCF2-1994-AA9A05C0F180}</UniqueIdentifier>
</Filter>
<Filter Include="features\misc">
<UniqueIdentifier>{5F23839A-CBE3-FED0-941E-484E009E43AD}</UniqueIdentifier>
</Filter>
<Filter Include="features\visuals">
<UniqueIdentifier>{9A07E0F7-8600-FF49-AF32-E4CE9B8ADE55}</UniqueIdentifier>
</Filter>
<Filter Include="resources">
<UniqueIdentifier>{202B5BA7-8C95-0F1E-D5D3-C0C3417DED72}</UniqueIdentifier>
</Filter>
<Filter Include="sdk">
<UniqueIdentifier>{67A9880B-D3B2-887C-5C2E-9F7CC836947C}</UniqueIdentifier>
</Filter>
<Filter Include="sdk\datatypes">
<UniqueIdentifier>{85931A81-F153-96B7-BA8E-DF34260EDB93}</UniqueIdentifier>
</Filter>
<Filter Include="sdk\interfaces">
<UniqueIdentifier>{7A23D2D0-66F1-C5D6-4F85-36FD3BF2A13B}</UniqueIdentifier>
</Filter>
<Filter Include="utilities">
<UniqueIdentifier>{212A0ED3-8D94-C249-D6D2-73EF427CA09E}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\dependencies\imgui\imconfig.h">
<Filter>dependencies\imgui</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\imgui\imgui.h">
<Filter>dependencies\imgui</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\imgui\imgui_freetype.h">
<Filter>dependencies\imgui</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\imgui\imgui_impl_dx11.h">
<Filter>dependencies\imgui</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\imgui\imgui_impl_win32.h">
<Filter>dependencies\imgui</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\imgui\imgui_internal.h">
<Filter>dependencies\imgui</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\imgui\imstb_rectpack.h">
<Filter>dependencies\imgui</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\imgui\imstb_textedit.h">
<Filter>dependencies\imgui</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\imgui\imstb_truetype.h">
<Filter>dependencies\imgui</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\imgui_notify.h">
<Filter>dependencies</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\json.hpp">
<Filter>dependencies</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\minhook\buffer.h">
<Filter>dependencies\minhook</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\minhook\hde\hde32.h">
<Filter>dependencies\minhook\hde</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\minhook\hde\hde64.h">
<Filter>dependencies\minhook\hde</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\minhook\hde\pstdint.h">
<Filter>dependencies\minhook\hde</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\minhook\hde\table32.h">
<Filter>dependencies\minhook\hde</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\minhook\hde\table64.h">
<Filter>dependencies\minhook\hde</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\minhook\minhook.h">
<Filter>dependencies\minhook</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\minhook\trampoline.h">
<Filter>dependencies\minhook</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\stb_image.h">
<Filter>dependencies</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\stb_sprintf.h">
<Filter>dependencies</Filter>
</ClInclude>
<ClInclude Include="..\dependencies\xorstr.h">
<Filter>dependencies</Filter>
</ClInclude>
<ClInclude Include="..\resources\fa_solid_900.h">
<Filter>resources</Filter>
</ClInclude>
<ClInclude Include="..\resources\font_awesome_5.h">
<Filter>resources</Filter>
</ClInclude>
<ClInclude Include="..\resources\game_icons.h">
<Filter>resources</Filter>
</ClInclude>
<ClInclude Include="..\resources\smallest_pixel.h">
<Filter>resources</Filter>
</ClInclude>
<ClInclude Include="common.h" />
<ClInclude Include="core.h" />
<ClInclude Include="core\config.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="core\convars.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="core\hooks.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="core\interfaces.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="core\menu.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="core\schema.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="core\sdk.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="core\variables.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="features.h" />
<ClInclude Include="features\misc.h">
<Filter>features</Filter>
</ClInclude>
<ClInclude Include="features\misc\movement.h">
<Filter>features\misc</Filter>
</ClInclude>
<ClInclude Include="features\visuals.h">
<Filter>features</Filter>
</ClInclude>
<ClInclude Include="features\visuals\chams.h">
<Filter>features\visuals</Filter>
</ClInclude>
<ClInclude Include="features\visuals\overlay.h">
<Filter>features\visuals</Filter>
</ClInclude>
<ClInclude Include="sdk\const.h">
<Filter>sdk</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\color.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\matrix.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\qangle.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\quaternion.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\transform.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\usercmd.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\utlfixedmemory.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\utllinkedlist.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\utlmap.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\utlmemory.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\utlrbtree.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\utlstring.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\utlthash.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\utlvector.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\vector.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\datatypes\viewsetup.h">
<Filter>sdk\datatypes</Filter>
</ClInclude>
<ClInclude Include="sdk\entity.h">
<Filter>sdk</Filter>
</ClInclude>
<ClInclude Include="sdk\entity_handle.h">
<Filter>sdk</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\ccsgoinput.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\cgameentitysystem.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\idebugoverlay.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\iengineclient.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\ienginecvar.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\igameresourceservice.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\iglobalvars.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\iinputsystem.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\imaterialsystem.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\imemalloc.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\inetworkclientservice.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\ischemasystem.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\iswapchaindx11.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\interfaces\iviewrender.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="utilities\crt.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\detourhook.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\draw.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\easing.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\fnv1a.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\inputsystem.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\log.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\math.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\memory.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\notify.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="utilities\pe64.h">
<Filter>utilities</Filter>
</ClInclude>
<ClInclude Include="core\BlurShaders\blur_x.h" />
<ClInclude Include="core\BlurShaders\blur_y.h" />
<ClInclude Include="core\BlurShaders\default_vs.h" />
<ClInclude Include="core\gui.hpp" />
<ClInclude Include="core\ui_icons.hpp" />
<ClInclude Include="core\Bgs.h" />
<ClInclude Include="core\Header.h" />
<ClInclude Include="core\ImFont.h" />
<ClInclude Include="core\imfonts.h" />
<ClInclude Include="multidrop.h" />
<ClInclude Include="core\memaddon.hpp" />
<ClInclude Include="core\fnv1a.hpp" />
<ClInclude Include="core\pointer\pointer.hpp" />
<ClInclude Include="core\csig\sigscan.hpp" />
<ClInclude Include="core\memory\cmodule.hpp" />
<ClInclude Include="core\memory\memadd.h" />
<ClInclude Include="core\stb.hh" />
<ClInclude Include="core\schemav2.hpp" />
<ClInclude Include="sdk\datatypes\resourcebinding_t.hpp" />
<ClInclude Include="sdk\datatypes\cstronghandle.hpp" />
<ClInclude Include="sdk\datatypes\cinterlockedint.hpp" />
<ClInclude Include="sdk\datatypes\K3V.h" />
<ClInclude Include="sdk\datatypes\stronghandle.hpp" />
<ClInclude Include="sdk\datatypes\resourceutils.h" />
<ClInclude Include="sdk\datatypes\byteswap.h" />
<ClInclude Include="sdk\datatypes\datamap.h" />
<ClInclude Include="sdk\datatypes\buf\utlbuffer.h" />
<ClInclude Include="sdk\datatypes\buf\strtools.h" />
<ClInclude Include="sdk\datatypes\buf\wchartypes.h" />
<ClInclude Include="features\legit\legit.h" />
<ClInclude Include="sdk\interfaces\itrace.h" />
<ClInclude Include="core\silentvmt\InlineHook.h" />
<ClInclude Include="core\silentvmt\ShadowVMT.h" />
<ClInclude Include="features\lagcomp\lagcomp.h" />
<ClInclude Include="sdk\interfaces\events.h" />
<ClInclude Include="sdk\datatypes\utlstringtoken.h" />
<ClInclude Include="features\penetration\penetration.h" />
<ClInclude Include="features\enginepred\pred.h" />
<ClInclude Include="core\spoofcall\Utils.h" />
<ClInclude Include="core\spoofcall\virtualization\VirtualizerSDK64.h" />
<ClInclude Include="core\stdafx.h" />
<ClInclude Include="core\spoofcall\invoker.h" />
<ClInclude Include="core\spoofcall\syscall.h" />
<ClInclude Include="core\spoofcall\lazy_importer.hpp" />
<ClInclude Include="core\spoofcall\callstack.h" />
<ClInclude Include="features\rage\rage.h" />
<ClInclude Include="features\skins\skin_changer.hpp" />
<ClInclude Include="features\skins\ccsplayerinventory.hpp" />
<ClInclude Include="features\skins\ccsinventorymanager.hpp" />
<ClInclude Include="..\dependencies\imgui\imgui_edited.hpp" />
<ClInclude Include="..\dependencies\imgui\imgui_settings.h" />
<ClInclude Include="font.h" />
<ClInclude Include="texture.h" />
<ClInclude Include="features\antiaim\antiaim.hpp" />
<ClInclude Include="sdk\datatypes\repfieldcontainer.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\dependencies\imgui\imgui.cpp">
<Filter>dependencies\imgui</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\imgui\imgui_demo.cpp">
<Filter>dependencies\imgui</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\imgui\imgui_draw.cpp">
<Filter>dependencies\imgui</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\imgui\imgui_freetype.cpp">
<Filter>dependencies\imgui</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\imgui\imgui_impl_dx11.cpp">
<Filter>dependencies\imgui</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\imgui\imgui_impl_win32.cpp">
<Filter>dependencies\imgui</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\imgui\imgui_tables.cpp">
<Filter>dependencies\imgui</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\imgui\imgui_widgets.cpp">
<Filter>dependencies\imgui</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\minhook\buffer.c">
<Filter>dependencies\minhook</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\minhook\hde\hde32.c">
<Filter>dependencies\minhook\hde</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\minhook\hde\hde64.c">
<Filter>dependencies\minhook\hde</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\minhook\hook.c">
<Filter>dependencies\minhook</Filter>
</ClCompile>
<ClCompile Include="..\dependencies\minhook\trampoline.c">
<Filter>dependencies\minhook</Filter>
</ClCompile>
<ClCompile Include="core.cpp" />
<ClCompile Include="core\config.cpp">
<Filter>core</Filter>
</ClCompile>
<ClCompile Include="core\convars.cpp">
<Filter>core</Filter>
</ClCompile>
<ClCompile Include="core\hooks.cpp">
<Filter>core</Filter>
</ClCompile>
<ClCompile Include="core\interfaces.cpp">
<Filter>core</Filter>
</ClCompile>
<ClCompile Include="core\menu.cpp">
<Filter>core</Filter>
</ClCompile>
<ClCompile Include="core\schema.cpp">
<Filter>core</Filter>
</ClCompile>
<ClCompile Include="core\sdk.cpp">
<Filter>core</Filter>
</ClCompile>
<ClCompile Include="features.cpp" />
<ClCompile Include="features\misc.cpp">
<Filter>features</Filter>
</ClCompile>
<ClCompile Include="features\misc\movement.cpp">
<Filter>features\misc</Filter>
</ClCompile>
<ClCompile Include="features\visuals.cpp">
<Filter>features</Filter>
</ClCompile>
<ClCompile Include="features\visuals\chams.cpp">
<Filter>features\visuals</Filter>
</ClCompile>
<ClCompile Include="features\visuals\overlay.cpp">
<Filter>features\visuals</Filter>
</ClCompile>
<ClCompile Include="sdk\datatypes\matrix.cpp">
<Filter>sdk\datatypes</Filter>
</ClCompile>
<ClCompile Include="sdk\datatypes\qangle.cpp">
<Filter>sdk\datatypes</Filter>
</ClCompile>
<ClCompile Include="sdk\datatypes\vector.cpp">
<Filter>sdk\datatypes</Filter>
</ClCompile>
<ClCompile Include="sdk\entity.cpp">
<Filter>sdk</Filter>
</ClCompile>
<ClCompile Include="utilities\draw.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="utilities\inputsystem.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="utilities\log.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="utilities\math.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="utilities\memory.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="utilities\notify.cpp">
<Filter>utilities</Filter>
</ClCompile>
<ClCompile Include="sdk\entity_handle.cpp" />
<ClCompile Include="core\gui.cpp" />
<ClCompile Include="core\pointer\pointer.cpp" />
<ClCompile Include="core\csig\sigscan.cpp" />
<ClCompile Include="core\memory\cmodule.cpp" />
<ClCompile Include="core\memory\memadd.cpp" />
<ClCompile Include="core\schemav2.cpp" />
<ClCompile Include="icons\iconscs2.c" />
<ClCompile Include="sdk\datatypes\K3V.cpp" />
<ClCompile Include="sdk\datatypes\buf\utlbuffer.cpp" />
<ClCompile Include="sdk\datatypes\buf\strtools.cpp" />
<ClCompile Include="core\variables.cpp" />
<ClCompile Include="features\legit\legit.cpp" />
<ClCompile Include="sdk\interfaces\itrace.cpp" />
<ClCompile Include="core\silentvmt\ShadowVMT.cpp" />
<ClCompile Include="core\silentvmt\InlineHook.cpp" />
<ClCompile Include="features\lagcomp\lagcomp.cpp" />
<ClCompile Include="sdk\interfaces\events.cpp" />
<ClCompile Include="features\penetration\penetration.cpp" />
<ClCompile Include="features\enginepred\pred.cpp" />
<ClCompile Include="core\spoofcall\callstack.cpp" />
<ClCompile Include="features\rage\rage.cpp" />
<ClCompile Include="features\skins\skin_changer.cpp" />
<ClCompile Include="features\skins\ccsplayerinventory.cpp" />
<ClCompile Include="features\skins\ccsinventorymanager.cpp" />
<ClCompile Include="sdk\interfaces\iengineclient.cpp" />
<ClCompile Include="..\dependencies\imgui\imgui_edited.cpp" />
<ClCompile Include="features\antiaim\antiaim.cpp" />
<ClCompile Include="sdk\interfaces\ccsgoinput.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="core\spoofcall\virtualization\VirtualizerSDK64.inc" />
</ItemGroup>
<ItemGroup>
<MASM Include="core\spoofcall\SpoofCall.asm" />
<MASM Include="core\spoofcall\virtualization\VirtualizerSDK64.asm" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommand>C:\Program Files %28x86%29\Steam\steamapps\common\Counter-Strike Global Offensive\game\bin\win64\cs2.exe</LocalDebuggerCommand>
<LocalDebuggerAttach>true</LocalDebuggerAttach>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Publish|x64'">
<LocalDebuggerCommand>C:\Program Files %28x86%29\Steam\steamapps\common\Counter-Strike Global Offensive\game\bin\win64\cs2.exe</LocalDebuggerCommand>
<LocalDebuggerAttach>true</LocalDebuggerAttach>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Distrib|x64'">
<LocalDebuggerCommand>C:\Program Files %28x86%29\Steam\steamapps\common\Counter-Strike Global Offensive\game\bin\win64\cs2.exe</LocalDebuggerCommand>
<LocalDebuggerAttach>true</LocalDebuggerAttach>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Developer|x64'">
<LocalDebuggerCommand>C:\Program Files %28x86%29\Steam\steamapps\common\Counter-Strike Global Offensive\game\bin\win64\cs2.exe</LocalDebuggerCommand>
<LocalDebuggerAttach>true</LocalDebuggerAttach>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,64 @@
#include "features.h"
// used: draw callbacks
#include "utilities/draw.h"
// used: notify
#include "utilities/notify.h"
// used: cheat variables
#include "core/variables.h"
// used: menu
#include "core/menu.h"
// used: features callbacks
#include "features/visuals.h"
#include "features/misc.h"
#include "features/legit/legit.h"
// used: interfaces
#include "core/interfaces.h"
#include "sdk/interfaces/iengineclient.h"
#include "sdk/interfaces/cgameentitysystem.h"
#include "sdk/datatypes/usercmd.h"
#include "sdk/entity.h"
#include <Windows.h>
#include "../cstrike/sdk/interfaces/iinputsystem.h"
#include "../cstrike/utilities/inputsystem.h"
#include "features/visuals/overlay.h"
#include "features/skins/skin_changer.hpp"
std::vector<KeyBind_t*> g_keybinds;
//[181.214.231.239:27042
bool F::Setup()
{
if (!VISUALS::Setup())
{
L_PRINT(LOG_ERROR) << CS_XOR("failed to setup visuals");
return false;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("features VISUALS completed");
return true;
}
void F::OnKeyBindUpdate() {
if (IPT::GetBindState(C_GET(KeyBind_t, Vars.OverlayKey)) || C_GET(KeyBind_t, Vars.OverlayKey).bEnable) {
const KeyBind_t& overlayKeyBind = C_GET(KeyBind_t, Vars.OverlayKey);
L_PRINT(LOG_INFO) << CS_XOR("[Keybind] GotBindState | key: ") <<
overlayKeyBind.uKey << "| name: " <<
overlayKeyBind.szName << "| states ";
if (overlayKeyBind.nMode == EKeyBindMode::HOLD) {
C_SET(bool, Vars.bVisualOverlay, true);
}
else if (overlayKeyBind.nMode == EKeyBindMode::TOGGLE) {
C_SET(bool, Vars.bVisualOverlay, !C_GET(bool, Vars.bVisualOverlay));
}
}
}
bool F::OnDrawObject(void* pAnimatableSceneObjectDesc, void* pDx11, material_data_t* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2)
{
return VISUALS::OnDrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "common.h"
class CUserCmd;
class CCSPlayerController;
class material_data_t;
class CCSGOInput;
namespace F
{
bool Setup();
void OnKeyBindUpdate();
bool OnDrawObject(void* pAnimatableSceneObjectDesc, void* pDx11, material_data_t* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2);
}

View File

@ -0,0 +1,71 @@
#include "antiaim.hpp"
#include <ctime>
#include <cmath>
#include "../../core/variables.h"
void F::ANTIAIM::RunAA(CUserCmd* pCmd)
{
if (!C_GET(bool, Vars.bAntiAim))
return;
if (!I::Engine->IsConnected() || !I::Engine->IsInGame()) // Checking if you are connected and in game
return;
if (!SDK::LocalController || !SDK::LocalController->IsPawnAlive()) // Checking if your spectating and alive
return;
if (pCmd->m_nButtons.m_nValue & ECommandButtons::IN_USE || pCmd->m_nButtons.m_nValue & ECommandButtons::IN_ATTACK) // Checking if you are not pressing e or attacking
return;
if (int32_t nMoveType = SDK::LocalController->GetMoveType(); nMoveType == MOVETYPE_NOCLIP || nMoveType == MOVETYPE_LADDER)
return;
C_CSPlayerPawn* pLocalPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(SDK::LocalController->GetPawnHandle());
if (pLocalPawn == nullptr)
return;
if (SDK::LocalController->IsThrowingGrenade(SDK::LocalController->GetPlayerWeapon(SDK::LocalPawn)))
return;
float flPitch = 0;
float flYaw = 0;
switch (C_GET(int, Vars.iBaseYawType))
{
case 0:
break;
case 1:
flYaw += -180.f; // Backwards
break;
case 2:
flYaw += 180.f; // Forwards
break;
default:
break;
}
switch (C_GET(int, Vars.iPitchType))
{
case 0:
break;
case 1: // Down
flPitch = 120.f;
break;
case 2: // Up
flPitch = -120.f;
break;
case 3: // Zero
flPitch = 0.f;
break;
default:
break;
}
pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue.x = flPitch;
pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue.y += flYaw;
pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue.y = MATH::AngleNormalize(pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue.y);
pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue.x = MATH::AngleNormalize(pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue.x);
pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue.z = 0.f;
}

View File

@ -0,0 +1,15 @@
#pragma once
#include "../../sdk/datatypes/qangle.h"
#include "../../sdk/entity.h"
#include "../../sdk/interfaces/cgameentitysystem.h"
#include "../../sdk/interfaces/iengineclient.h"
#include "../../sdk/interfaces/ccsgoinput.h"
#include "../../core/sdk.h"
#include "../../core/interfaces.h"
#include "../../sdk/datatypes/usercmd.h"
namespace F::ANTIAIM
{
inline QAngle_t angStoredViewBackup{};
void RunAA(CUserCmd* pCmd);
}

View File

@ -0,0 +1,76 @@
#include "pred.h"
#include "../../core/config.h"
#include "../../core/variables.h"
#include "../../sdk/datatypes/usercmd.h"
#include "../../core/sdk.h"
#include "../../sdk/entity.h"
#include "../../sdk/interfaces/iengineclient.h"
#include "../../sdk/interfaces/iglobalvars.h"
#include "../../sdk/interfaces/cgameentitysystem.h"
#include "../../sdk/datatypes/qangle.h"
#include "../../sdk/datatypes/vector.h"
#include "../cstrike/sdk/interfaces/ccsgoinput.h"
#include "../cstrike/sdk/interfaces/ienginecvar.h"
#include "../lagcomp/lagcomp.h"
#include "../cstrike/sdk/interfaces/events.h"
#include "../penetration/penetration.h"
#include <mutex>
#include <array>
static float old_current_time = 0.f;
static float old_frame_time = 0.f;
static std::int32_t prediction_seed = 0;
static std::uint32_t predicted_flags = 0;
void F::PREDICTION::impl::start(CUserCmd* cmd)
{
if (!SDK::LocalController || !SDK::LocalPawn) {
return;
}
auto controller = SDK::LocalController;
if (!controller)
return;
auto local = SDK::LocalPawn;
if (!local)
return;
predicted_flags = local->GetFlags();
// random_seed
old_current_time = I::GlobalVars->flCurtime;
old_frame_time = I::GlobalVars->flFrameTime;
I::GlobalVars->flCurtime = controller->m_nTickBase() * I::GlobalVars->flIntervalPerTick;
I::GlobalVars->flCurtime2 = controller->m_nTickBase() * I::GlobalVars->flIntervalPerTick;
I::GlobalVars->flFrameTime = I::GlobalVars->flIntervalPerTick;
I::GlobalVars->flFrameTime2 = I::GlobalVars->flIntervalPerTick;
}
void F::PREDICTION::impl::end()
{
if (!SDK::LocalController || !SDK::LocalPawn) {
return;
}
auto controller = SDK::LocalController;
if (!controller)
return;
auto local = SDK::LocalPawn;
if (!local)
return;
I::GlobalVars->flCurtime = old_current_time;
I::GlobalVars->flCurtime2 = old_current_time;
I::GlobalVars->flFrameTime = old_current_time;
I::GlobalVars->flFrameTime2 = old_current_time;
}
std::uint32_t F::PREDICTION::impl::Flags()
{
return predicted_flags;
}

View File

@ -0,0 +1,34 @@
#pragma once
#include "../../common.h"
#include <memory>
// used: draw system
#include "../../utilities/draw.h"
#include "../../sdk/datatypes/vector.h"
#include "../../sdk/datatypes/transform.h"
#include "../../sdk/datatypes/qangle.h"
#include "../cstrike/core/config.h"
class CCSPlayerController;
class C_BaseEntity;
class C_CSPlayerPawn;
class CBaseHandle;
class CEntityInstance;
class CUserCmd;
class CBaseUserCmdPB;
class QAngle_t;
class IGameEvent;
class CCSWeaponBaseVData;
namespace F::PREDICTION
{
class impl {
public:
void start(CUserCmd* cmd);
void end();
std::uint32_t Flags();
};
const auto prediction = std::make_unique<impl>();
}

View File

@ -0,0 +1,755 @@
#include "legit.h"
#include "../../core/config.h"
#include "../../core/variables.h"
#include "../../sdk/datatypes/usercmd.h"
#include "../../core/sdk.h"
#include "../../sdk/entity.h"
#include "../../sdk/interfaces/iengineclient.h"
#include "../../sdk/interfaces/iglobalvars.h"
#include "../../sdk/interfaces/cgameentitysystem.h"
#include "../../sdk/datatypes/qangle.h"
#include "../../sdk/datatypes/vector.h"
#include "../cstrike/sdk/interfaces/ccsgoinput.h"
#include "../cstrike/sdk/interfaces/ienginecvar.h"
#include "../lagcomp/lagcomp.h"
#include "../cstrike/sdk/interfaces/events.h"
#include "../penetration/penetration.h"
#include "../cstrike/sdk/interfaces/itrace.h"
#include "../cstrike/core/spoofcall/syscall.h"
#include <iostream>
#include <memoryapi.h>
#include <mutex>
#include <array>
#include "../../core/spoofcall/virtualization/VirtualizerSDK64.h"
#include "../../utilities/inputsystem.h"
float lasttargettime = 0.f;
static std::vector <std::uint32_t> e_hitboxes;
static ImDrawList* g_pBackgroundDrawList = nullptr;
float kill_delay = 0.f;
struct LegitTarget {
C_CSPlayerPawn* player;
Vector_t finalPoint;
int hitgroup;
LegitTarget(C_CSPlayerPawn* player, const QAngle_t& finalAngle, const int hitroup)
: player(player), finalPoint(finalPoint), hitgroup(hitroup) {}
};
std::vector<LegitTarget> sortedTargets;
std::vector<C_CSPlayerPawn*> validTargets;
float get_next_primary_attack(C_CSPlayerPawn* local) noexcept {
if (!I::GlobalVars)
return std::numeric_limits<float>::max();
const auto tick = local->ActiveWeapon()->m_nNextPrimaryAttackTick();
const auto ratio = local->ActiveWeapon()->m_nNextPrimaryAttackTick();
return (tick + ratio) * I::GlobalVars->flIntervalPerTick;
}
void F::LEGIT::impl::SetupTarget(C_CSPlayerPawn* pLocal)
{
if (!D::pDrawListActive)
return;
if (!I::Engine->IsInGame()) return;
CCSPlayerController* pLocalController = CCSPlayerController::GetLocalPlayerController();
if (!pLocalController)
return;
pLocal = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(pLocalController->GetPawnHandle());
if (!pLocal)
return;
VIRTUALIZER_DOLPHIN_BLACK_START
const std::lock_guard<std::mutex> guard{ g_cachedEntitiesMutex };
// reset valid targets before increamenting it
legit->Reset(reset::entity);
for (const auto& it : g_cachedEntities) {
C_BaseEntity* pEntity = I::GameResourceService->pGameEntitySystem->Get(it.m_handle);
if (pEntity == nullptr)
continue;
CBaseHandle hEntity = pEntity->GetRefEHandle();
if (hEntity != it.m_handle) continue;
switch (it.m_type) {
case CachedEntity_t::PLAYER_CONTROLLER:
CCSPlayerController* CPlayer = I::GameResourceService->pGameEntitySystem->Get<CCSPlayerController>(hEntity);
if (CPlayer == nullptr)
break;
C_CSPlayerPawn* player = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(CPlayer->GetPawnHandle());
if (!player)
continue;
if (player->GetHealth() <= 0 || !pLocal->IsOtherEnemy(player) || player->GetGameSceneNode()->IsDormant() || player->m_bGunGameImmunity())
continue;
validTargets.push_back(player);
continue;
}
}
VIRTUALIZER_DOLPHIN_BLACK_END
}
bool F::LEGIT::impl::valid(C_CSPlayerPawn* player, C_CSPlayerPawn* pLocal, bool check) {
if (!player)
return false;
bool a1 = check ? true : player->Visible(pLocal, TRACE_TYPE::AIMBOT, legit_data.legit_visibility_check);
bool Invalid = player->GetLifeState() == ELifeState::LIFE_DISCARDBODY || player->GetLifeState() == ELifeState::LIFE_DEAD || player->GetLifeState() == ELifeState::LIFE_DYING;
if (Invalid || player->GetHealth() <= 0 || !a1 || !pLocal->IsOtherEnemy(player) || player->GetGameSceneNode()->IsDormant() || player->m_bGunGameImmunity())
return false;
return true;
}
// math calculations after Quarention update and shit
// qangle conversions are a mess here tho
QAngle_t NormalizeAngle(QAngle_t& angle) noexcept {
angle.Clamp();
return angle;
}
QAngle_t ToAngle(const Vector_t& vec) noexcept {
return QAngle_t{
M_RAD2DEG(std::atan2(-vec.z, std::hypot(vec.x, vec.y))),
M_RAD2DEG(std::atan2(vec.y, vec.x)),
0.00f
}.Clamp();
}
static Vector_t get_target_angle(C_CSPlayerPawn* localplayer, Vector_t position)
{
Vector_t eye_position = localplayer->GetEyePosition();
Vector_t angle = position;
angle.x = position.x - eye_position.x;
angle.y = position.y - eye_position.y;
angle.z = position.z - eye_position.z;
angle.Normalizes();
MATH::vec_angles(angle, &angle);
angle.clamp();
return angle;
}
QAngle_t CalculateRelativeAngle(const Vector_t& source, const Vector_t& dest, const QAngle_t& view_angles) noexcept {
QAngle_t delta = ToAngle(dest - source);
delta -= view_angles;
delta = NormalizeAngle(delta);
return delta;
}
float DistanceToCrosshair(C_CSPlayerPawn* target, const Vector_t& hitboxPos)
{
auto center = ImGui::GetIO().DisplaySize * 0.5f;
ImVec2 out;
auto screenPos = D::WorldToScreen(hitboxPos, out);
if (screenPos) {
ImVec2 crosshairPos = center;
ImVec2 hitboxScreenPos = out;
float deltaX = crosshairPos.x - hitboxScreenPos.x;
float deltaY = crosshairPos.y - hitboxScreenPos.y;
return std::sqrt(deltaX * deltaX + deltaY * deltaY);
}
return FLT_MAX;
}
Vector_t CalculateHitboxAngle(Vector_t source, Vector_t destination, QAngle_t viewAngles) {
Vector_t delta = source - destination;
Vector_t angles;
angles.x = M_RAD2DEG(atanf(delta.z / std::hypotf(delta.x, delta.y))) - viewAngles.x;
angles.y = M_RAD2DEG(atanf(delta.y / delta.x)) - viewAngles.y;
angles.z = 0.0f;
return angles;
}
void F::LEGIT::impl::ScanTarget(C_CSPlayerPawn* pLocal, QAngle_t viewangles)
{
if (!pLocal)
return;
if (!I::Engine->IsConnected() || !I::Engine->IsInGame()) return;
// Clear sortedTarget before any interaction
sortedTargets.clear();
QAngle_t final_ang;
// Check if there are valid targets
if (!validTargets.empty()) {
if (legit_data.legit_target_selection == 0) {
std::sort(validTargets.begin(), validTargets.end(), [this, pLocal](C_CSPlayerPawn* a, C_CSPlayerPawn* b) {
// Calculate distances
float distA_crosshair = DistanceToCrosshair(pLocal, a->GetEyePosition());
float distB_crosshair = DistanceToCrosshair(pLocal, b->GetEyePosition());
return (distA_crosshair < distB_crosshair);
});
}
else {
std::sort(validTargets.begin(), validTargets.end(), [this, pLocal](C_CSPlayerPawn* a, C_CSPlayerPawn* b) {
float distA_player = pLocal->GetEyePosition().DistTo(a->GetEyePosition());
float distB_player = pLocal->GetEyePosition().DistTo(b->GetEyePosition());
return (distA_player < distB_player);
});
}
// Add the closest visible target to sortedTarget
for (C_CSPlayerPawn* target : validTargets) {
if (valid(target, pLocal)) {
sortedTargets.emplace_back(target, final_ang, 0);
break;
}
else {
sortedTargets.clear();
continue;
}
continue;
}
// Scan hitboxes, etc.
if (!sortedTargets.empty()) {
auto target = sortedTargets.front().player;
if (!target) {
sortedTargets.front().finalPoint.Invalidate();
sortedTargets.clear();
return;
}
// sanity
if (!valid(target, pLocal)) {
sortedTargets.front().finalPoint.Invalidate();
sortedTargets.clear();
return;
}
int bestIndex = -1;
float closest_dist = FLT_MAX;
auto best_fov = legit_data.legit_fov;
auto eyepos = pLocal->GetEyePosition();
auto endeyepos = target->GetEyePosition();
float dist = pLocal->GetEyePosition().DistTo(target->GetEyePosition());
float hitbox_scale = {};
Vector_t hitbox_pos = {};
Vector4D_t hitbox_rot = {};
Vector_t best_point = {};
// prefer hitbox closest to crosshair ( since we legit hacking )
for (std::uint32_t i : e_hitboxes) {
target->CalculateHitboxData(i, hitbox_pos, hitbox_rot, hitbox_scale);
float cross_dist = DistanceToCrosshair(target, hitbox_pos);
if (cross_dist < closest_dist) {
closest_dist = cross_dist;
bestIndex = i;
continue;
}
continue;
}
if (bestIndex != -1) { // store best aimpoint info
sortedTargets.front().hitgroup = target->GetHitGroup(bestIndex);
target->CalculateHitboxData(bestIndex, sortedTargets.front().finalPoint, hitbox_rot, hitbox_scale);
}
}
else
return;
}
}
// setup config hitboxes
void F::LEGIT::impl::Scan() {
/* emplace menu hitboxes which will be used for hitscan*/
if (legit_data.hitbox_head) {
e_hitboxes.emplace_back(HEAD);
}
if (legit_data.hitbox_chest) {
e_hitboxes.emplace_back(CHEST);
e_hitboxes.emplace_back(RIGHT_CHEST);
e_hitboxes.emplace_back(LEFT_CHEST);
}
if (legit_data.hitbox_stomach) {
e_hitboxes.emplace_back(STOMACH);
e_hitboxes.emplace_back(CENTER);
e_hitboxes.emplace_back(PELVIS);
}
if (legit_data.hitbox_leg_l) {
e_hitboxes.emplace_back(L_LEG);
}
if (legit_data.hitbox_leg_r) {
e_hitboxes.emplace_back(R_LEG);
}
return;
}
void F::LEGIT::impl::Reset(reset type) {
switch (type) {
case reset::entity:
sortedTargets.clear();
validTargets.clear();
break;
case reset::aimbot:
e_hitboxes.clear();
break;
}
return;
}
float CalculateFactor(float distance, float maxDistance, float minFactor, float maxFactor)
{
// Ensure distance is within valid range
if (distance > maxDistance)
distance = maxDistance;
// Calculate the factor based on the distance
float factor = minFactor + (maxFactor - minFactor) * (1 - distance / maxDistance);
return factor;
}
QAngle_t PerformSmooth(QAngle_t currentAngles, const QAngle_t& targetAngles, float smoothFactor, C_CSPlayerPawn* pLocal, Vector_t hitboxPos)
{
QAngle_t smoothedAngles;
float effectiveSmoothFactor = 0.f;
if (smoothFactor == 0)
effectiveSmoothFactor = 1 * 10.0f;
else
effectiveSmoothFactor = smoothFactor * 10.0f;
// Calculate the difference between target and current angles
QAngle_t angleDiff = targetAngles - currentAngles;
// Calculate the distance between the crosshair and the final point
float distance = DistanceToCrosshair(pLocal, hitboxPos);
// Calculate intelligent acceleration and deceleration factors based on distance
float accelFactor = CalculateFactor(distance, effectiveSmoothFactor, 0.1f, 1.0f);
float decelFactor = CalculateFactor(distance, effectiveSmoothFactor, 0.1f, 1.0f);
// Apply acceleration and deceleration
smoothedAngles.x = currentAngles.x + (angleDiff.x / effectiveSmoothFactor) * (accelFactor + (1));
smoothedAngles.y = currentAngles.y + (angleDiff.y / effectiveSmoothFactor) * (accelFactor + (1));
// Ensure angles are within valid range
smoothedAngles.Clamp();
return smoothedAngles;
}
bool F::LEGIT::impl::Ready(C_CSPlayerPawn* pLocal) {
if (!pLocal)
return false;
auto ActiveWeapon = pLocal->ActiveWeapon();
if (!ActiveWeapon)
return false;
auto data = ActiveWeapon->datawep();
if (!data)
return false;
if (ActiveWeapon->clip1() <= 0)
return false;
return true;
}
void F::LEGIT::impl::Events(IGameEvent* ev, events type) {
if (!C_GET(bool, Vars.legit_enable))
return;
if (!I::Engine->IsConnected() || !I::Engine->IsInGame())
return;
if (!SDK::LocalController)
return;
switch (type) {
case player_death: {
auto controller = SDK::LocalController;
if (!controller)
break;
const auto event_controller = ev->get_player_controller(CS_XOR("attacker"));
if (!event_controller)
return;
if (event_controller->GetIdentity()->GetIndex() == controller->GetIdentity()->GetIndex()) {
const std::int64_t value{ ev->get_int(CS_XOR("dmg_health")) };
auto delay = C_GET(int, Vars.legit_delay_aim_ms) * 50.f;
kill_delay = I::GlobalVars->nTickCount + delay;
// reset targets
sortedTargets.clear();
}
}
break;
case round_start: {
kill_delay = 0;
legit->Reset(reset::entity);
}
break;
}
}
void F::LEGIT::impl::Triggerbot(CUserCmd* cmd, C_BaseEntity* localent, C_BaseEntity* playerent, C_CSPlayerPawn* local, C_CSPlayerPawn* player, CCSWeaponBaseVData* vdata)
{
VIRTUALIZER_MUTATE_ONLY_START;
if (!legit_data.trigger_enable)
return;
if (!SDK::LocalController)
return;
auto weapon = local->ActiveWeapon();
if (!weapon)
return;
auto data = weapon->datawep();
if (!data)
return;
if (!cmd)
return;
auto base = cmd->m_csgoUserCmd.m_pBaseCmd;
if (!base)
return;
if (C_GET(bool, Vars.trigger_on_key) && !LI_FN(GetAsyncKeyState).safe()(legit_data.legit_key))
return;
bool should_trigger = player->InsideCrosshair(local, base->m_pViewangles->m_angValue, data->m_flRange());
if (should_trigger) {
if (cheat->canShot)
cmd->m_nButtons.m_nValue |= IN_ATTACK;
}
//F::AUTOWALL::c_auto_wall::data_t pendata;
//F::AUTOWALL::g_auto_wall->pen(pendata, vecStart, vecEnd, playerent, localent, local, player, vdata, pen_dmg, valid);
// check do we can shoot
VIRTUALIZER_MUTATE_ONLY_END;
}
void adjust_recoil(C_CSPlayerPawn* player, CUserCmd* pCmd) noexcept {
if (!player || !pCmd) return;
auto cache = player->m_aimPunchCache();
static QAngle_t prev = QAngle_t(0.f, 0.f, 0.f);
auto pred_punch = cache.m_Size < 0x81 ? cache.m_Data[cache.m_Size - 1] * 2.f : player->m_aimPunchAngle() * 2.f;
auto delta = cache.m_Size > 0 && cache.m_Size < 0x81 ? prev - pred_punch : QAngle_t(0, 0, 0);
if (cache.m_Size > 0 && cache.m_Size < 0x81) {
if (delta != QAngle_t(0, 0, 0)) {
pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue += delta;
pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue.Clamp();
}
prev = pred_punch;
}
}
void F::LEGIT::impl::Run(CUserCmd* cmd) {
if (!C_GET(bool, Vars.legit_enable))
return;
if (!I::Engine->IsConnected() || !I::Engine->IsInGame())
return;
if (!SDK::LocalController || !SDK::LocalPawn)
return;
if (!cmd)
return;
auto pCmd = cmd->m_csgoUserCmd.m_pBaseCmd;
if (!pCmd)
return;
/* store vars */
pLocal = SDK::LocalPawn;
if (!pLocal || !pCmd)
return;
if (pLocal->GetHealth() <= 0)
return;
auto viewangles = pCmd->m_pViewangles->m_angValue;
// reset hitboxes
legit->Reset(reset::aimbot);
legit->SetupAdaptiveWeapon(pLocal);
// hitbox menu selection
legit->Scan();
// run target selection
legit->SetupTarget(pLocal);
// stop aimbot for now, no targets/hitboxes found
if (validTargets.empty() || e_hitboxes.empty())
return;
legit->ScanTarget(pLocal, viewangles);
if (sortedTargets.empty() || !sortedTargets.front().finalPoint.IsValid())
return;
// no ammo or not valid weapon
if (!legit->Ready(pLocal))
return;
auto weapon_data = pLocal->ActiveWeapon();
if (!weapon_data)
return;
auto vdata = weapon_data->datawep();
if (!vdata)
return;
// check if grabbed ent valid & pass this to the penetration sys
auto entity = I::GameResourceService->pGameEntitySystem->Get(sortedTargets.front().player->GetRefEHandle());
if (!entity)
return;
auto localent = I::GameResourceService->pGameEntitySystem->Get(pLocal->GetRefEHandle());
if (!localent)
return;
// start angle calculation
auto vec = get_target_angle(pLocal, sortedTargets.front().finalPoint);
vec.clamp();
QAngle_t angle; angle.ToVec3(vec);
// legit conditions
if (C_GET(unsigned int, Vars.legit_conditions) & LEGIT_DELAY_SHOT && kill_delay >= I::GlobalVars->nTickCount)
return;
if (C_GET(unsigned int, Vars.legit_conditions) & LEGIT_IN_AIR && (!pLocal->IsValidMoveType() || !(pLocal->GetFlags() & FL_ONGROUND)))
return;
if (C_GET(unsigned int, Vars.legit_conditions) & LEGIT_FLASHED && pLocal->GetFlashDuration() > 0.f) // flashed
return;
//TODO:
//fix autowall damge when visible
//
// store aimbot data
auto rcs_shots = legit_data.legit_rcs_shots_enable ? legit_data.legit_rcs_shots : 0;
int smooth = legit_data.legit_smooth;
auto fov = std::hypotf(viewangles.x - vec.x, viewangles.y - vec.y); //std::hypotf(viewangles->angValue.x - finalAngle.x, viewangles->angValue.y - finalAngle.y); //GetFov(a1, a2);
const float best_fov = (float)legit_data.legit_fov;
float server_time = (float)SDK::LocalController->m_nTickBase() * 0.015;
bool can_shoot = (pLocal->ActiveWeapon()->m_flNextPrimaryAttackTickRatio() <= server_time);
float pen_dmg = 0.f;
bool can_hit = false;
// run penetration system:
// F::AUTOWALL::c_auto_wall::data_t data;
// F::AUTOWALL::g_auto_wall->pen(data, vecStart, vecEnd, entity, localent, pLocal, sortedTargets.front().player, vdata, pen_dmg, can_hit);
legit->Triggerbot(cmd, localent, entity, pLocal, sortedTargets.front().player, vdata);
if (fov > best_fov)
return;
// calculate aimpunch & compensate it
static auto prev = QAngle_t(0.f, 0.f, 0.f);
auto cache = pLocal->m_aimPunchCache();
auto pred_punch = cache.m_Data[cache.m_Size - 1];
auto delta = prev - pred_punch * 2.f;
if (cache.m_Size > 0 && cache.m_Size <= 0xFFFF) {
pred_punch = cache.m_Data[cache.m_Size - 1];
prev = pred_punch;
}
// maybe peform some delta randomizations
if (legit_data.PunchRandomization) {
delta.x *= MATH::fnRandomFloat(0.3f, 0.7f);
delta.y *= MATH::fnRandomFloat(0.3f, 0.7f);
}
// store best_point with compensated aimpunch
auto best_point = angle + delta * 2.f;
if (LI_FN(GetAsyncKeyState).safe()(legit_data.legit_key)) {
// psilent
if (C_GET(bool, Vars.legit_silent_aim) || (C_GET(bool, Vars.legit_no_scope) && vdata->m_WeaponType() == WEAPONTYPE_SNIPER_RIFLE && !pLocal->IsScoped())) {
}
else {
QAngle_t smoothedAnglesRCS = PerformSmooth(viewangles, best_point, static_cast<float>(smooth), pLocal, vec);
if (smooth == 0) {
viewangles = best_point;
viewangles.Clamp();
}
else {
viewangles = smoothedAnglesRCS;
viewangles.Clamp();
}
}
}
}
void F::LEGIT::impl::SetupAdaptiveWeapon(C_CSPlayerPawn* pLocal) {
if (!pLocal)
return;
if (!C_GET(bool, Vars.legit_enable))
return;
auto ActiveWeapon = pLocal->ActiveWeapon();
if (!ActiveWeapon)
return;
auto data = ActiveWeapon->datawep();
if (!data)
return;
switch (data->m_WeaponType()) {
case WEAPONTYPE_PISTOL:
legit_data.trigger_enable = C_GET(bool, Vars.trigger_enable_p);
legit_data.trigger_hc = C_GET(int, Vars.trigger_hitchance_p);
legit_data.legit_fov = C_GET(int, Vars.legit_fov_pistol);
legit_data.legit_key = C_GET(KeyBind_t, Vars.legit_key_pistol).uKey;
legit_data.legit_key_style = 0; // You may need to set the appropriate value
legit_data.legit_target_selection = C_GET(int, Vars.legit_target_selection);
legit_data.legit_fov_visualize = C_GET(bool, Vars.legit_fov_visualize);
legit_data.remove_weapon_accuracy_spread = C_GET(bool, Vars.remove_weapon_accuracy_spread);
legit_data.legit_smooth = C_GET(int, Vars.legit_smooth_pistol);
legit_data.legit_rcs_shots = C_GET(int, Vars.legit_rcs_shots_pistol);
legit_data.legit_rcs = C_GET(bool, Vars.legit_rcs_pistol);
legit_data.PunchRandomization = C_GET(bool, Vars.PunchRandomization_pistol);
legit_data.legit_rcs_shots_enable = C_GET(bool, Vars.legit_rcs_shots_enable_pistol);
legit_data.legit_rcs_smoothx = C_GET(float, Vars.legit_rcs_smoothx_pistol);
legit_data.legit_rcs_smoothy = C_GET(float, Vars.legit_rcs_smoothy_pistol);
legit_data.legit_visibility_check = C_GET(bool, Vars.legit_visibility_check_pistol);
legit_data.hitbox_head = C_GET(bool, Vars.hitbox_head_pistol);
legit_data.hitbox_neck = C_GET(bool, Vars.hitbox_neck_pistol);
legit_data.hitbox_uppeer_chest = C_GET(bool, Vars.hitbox_uppeer_chest_pistol);
legit_data.hitbox_chest = C_GET(bool, Vars.hitbox_chest_pistol);
legit_data.hitbox_stomach = C_GET(bool, Vars.hitbox_stomach_pistol);
legit_data.hitbox_leg_l = C_GET(bool, Vars.hitbox_leg_l_pistol);
legit_data.hitbox_leg_r = C_GET(bool, Vars.hitbox_leg_r_pistol);
legit_data.punch_x = C_GET(bool, Vars.punch_x_pistol);
legit_data.punch_y = C_GET(bool, Vars.punch_y_pistol);
break;
case WEAPONTYPE_MACHINEGUN:
legit_data.trigger_enable = C_GET(bool, Vars.trigger_enable_m);
legit_data.trigger_hc = C_GET(int, Vars.trigger_hitchance_m);
legit_data.legit_fov = C_GET(int, Vars.legit_fov_machinegun);
legit_data.legit_key = C_GET(KeyBind_t, Vars.legit_key_machinegun).uKey;
legit_data.legit_key_style = 0; // Set the appropriate value
legit_data.legit_target_selection = C_GET(int, Vars.legit_target_selection_machinegun);
legit_data.legit_fov_visualize = C_GET(bool, Vars.legit_fov_visualize);
legit_data.remove_weapon_accuracy_spread = C_GET(bool, Vars.remove_weapon_accuracy_spread);
legit_data.legit_smooth = C_GET(int, Vars.legit_smooth_machinegun);
legit_data.legit_rcs_shots = C_GET(int, Vars.legit_rcs_shots_machinegun);
legit_data.legit_rcs = C_GET(bool, Vars.legit_rcs_machinegun);
legit_data.PunchRandomization = C_GET(bool, Vars.PunchRandomization_machinegun);
legit_data.legit_rcs_shots_enable = C_GET(bool, Vars.legit_rcs_shots_enable_machinegun);
legit_data.legit_rcs_smoothx = C_GET(float, Vars.legit_rcs_smoothx_machinegun);
legit_data.legit_rcs_smoothy = C_GET(float, Vars.legit_rcs_smoothy_machinegun);
legit_data.legit_visibility_check = C_GET(bool, Vars.legit_visibility_check_machinegun);
legit_data.hitbox_head = C_GET(bool, Vars.hitbox_head_machinegun);
legit_data.hitbox_neck = C_GET(bool, Vars.hitbox_neck_machinegun);
legit_data.hitbox_uppeer_chest = C_GET(bool, Vars.hitbox_uppeer_chest_machinegun);
legit_data.hitbox_chest = C_GET(bool, Vars.hitbox_chest_machinegun);
legit_data.hitbox_stomach = C_GET(bool, Vars.hitbox_stomach_machinegun);
legit_data.hitbox_leg_l = C_GET(bool, Vars.hitbox_leg_l_machinegun);
legit_data.hitbox_leg_r = C_GET(bool, Vars.hitbox_leg_r_machinegun);
legit_data.punch_x = C_GET(bool, Vars.punch_x_machinegun);
legit_data.punch_y = C_GET(bool, Vars.punch_y_machinegun);
break;
case WEAPONTYPE_RIFLE:
legit_data.trigger_enable = C_GET(bool, Vars.trigger_enable_a);
legit_data.trigger_hc = C_GET(int, Vars.trigger_hitchance_a);
legit_data.legit_fov = C_GET(int, Vars.legit_fov_assultrifles);
legit_data.legit_key = C_GET(KeyBind_t, Vars.legit_key_assultrifles).uKey;
legit_data.legit_key_style = 0; // Set the appropriate value
legit_data.legit_target_selection = C_GET(int, Vars.legit_target_selection_assultrifles);
legit_data.legit_fov_visualize = C_GET(bool, Vars.legit_fov_visualize);
legit_data.remove_weapon_accuracy_spread = C_GET(bool, Vars.remove_weapon_accuracy_spread);
legit_data.legit_smooth = C_GET(int, Vars.legit_smooth_assultrifles);
legit_data.legit_rcs_shots = C_GET(int, Vars.legit_rcs_shots_assultrifles);
legit_data.legit_rcs = C_GET(bool, Vars.legit_rcs_assultrifles);
legit_data.PunchRandomization = C_GET(bool, Vars.PunchRandomization_assultrifles);
legit_data.legit_rcs_shots_enable = C_GET(bool, Vars.legit_rcs_shots_enable_assultrifles);
legit_data.legit_rcs_smoothx = C_GET(float, Vars.legit_rcs_smoothx_assultrifles);
legit_data.legit_rcs_smoothy = C_GET(float, Vars.legit_rcs_smoothy_assultrifles);
legit_data.legit_visibility_check = C_GET(bool, Vars.legit_visibility_check_assultrifles);
legit_data.hitbox_head = C_GET(bool, Vars.hitbox_head_assultrifles);
legit_data.hitbox_neck = C_GET(bool, Vars.hitbox_neck_assultrifles);
legit_data.hitbox_uppeer_chest = C_GET(bool, Vars.hitbox_uppeer_chest_assultrifles);
legit_data.hitbox_chest = C_GET(bool, Vars.hitbox_chest_assultrifles);
legit_data.hitbox_stomach = C_GET(bool, Vars.hitbox_stomach_assultrifles);
legit_data.hitbox_leg_l = C_GET(bool, Vars.hitbox_leg_l_assultrifles);
legit_data.hitbox_leg_r = C_GET(bool, Vars.hitbox_leg_r_assultrifles);
legit_data.punch_x = C_GET(bool, Vars.punch_x_assultrifles);
legit_data.punch_y = C_GET(bool, Vars.punch_y_assultrifles);
break;
case WEAPONTYPE_SNIPER_RIFLE:
legit_data.trigger_enable = C_GET(bool, Vars.trigger_enable_s);
legit_data.trigger_hc = C_GET(int, Vars.trigger_hitchance_s);
legit_data.legit_fov = C_GET(int, Vars.legit_fov_snipers);
legit_data.legit_key = C_GET(KeyBind_t, Vars.legit_key_snipers).uKey;
legit_data.legit_key_style = 0; // Set the appropriate value
legit_data.legit_target_selection = C_GET(int, Vars.legit_target_selection_snipers);
legit_data.legit_fov_visualize = C_GET(bool, Vars.legit_fov_visualize);
legit_data.remove_weapon_accuracy_spread = C_GET(bool, Vars.remove_weapon_accuracy_spread);
legit_data.legit_smooth = C_GET(int, Vars.legit_smooth_snipers);
legit_data.legit_rcs_shots = C_GET(int, Vars.legit_rcs_shots_snipers);
legit_data.legit_rcs = C_GET(bool, Vars.legit_rcs_snipers);
legit_data.PunchRandomization = C_GET(bool, Vars.PunchRandomization_snipers);
legit_data.legit_rcs_shots_enable = C_GET(bool, Vars.legit_rcs_shots_enable_snipers);
legit_data.legit_rcs_smoothx = C_GET(float, Vars.legit_rcs_smoothx_snipers);
legit_data.legit_rcs_smoothy = C_GET(float, Vars.legit_rcs_smoothy_snipers);
legit_data.legit_visibility_check = C_GET(bool, Vars.legit_visibility_check_snipers);
legit_data.hitbox_head = C_GET(bool, Vars.hitbox_head_snipers);
legit_data.hitbox_neck = C_GET(bool, Vars.hitbox_neck_snipers);
legit_data.hitbox_uppeer_chest = C_GET(bool, Vars.hitbox_uppeer_chest_snipers);
legit_data.hitbox_chest = C_GET(bool, Vars.hitbox_chest_snipers);
legit_data.hitbox_stomach = C_GET(bool, Vars.hitbox_stomach_snipers);
legit_data.hitbox_leg_l = C_GET(bool, Vars.hitbox_leg_l_snipers);
legit_data.hitbox_leg_r = C_GET(bool, Vars.hitbox_leg_r_snipers);
legit_data.punch_x = C_GET(bool, Vars.punch_x_snipers);
legit_data.punch_y = C_GET(bool, Vars.punch_y_snipers);
break;
}
}

View File

@ -0,0 +1,108 @@
#pragma once
#include "../../common.h"
#include <memory>
// used: draw system
#include "../../utilities/draw.h"
#include "../../sdk/datatypes/vector.h"
#include "../../sdk/datatypes/transform.h"
#include "../../sdk/datatypes/qangle.h"
#include "../cstrike/core/config.h"
class CCSPlayerController;
class C_BaseEntity;
class C_CSPlayerPawn;
class CBaseHandle;
class CEntityInstance;
class CUserCmd;
class CBaseUserCmdPB;
class QAngle_t;
class IGameEvent;
class C_CSWeaponBase;
class CCSWeaponBaseVData;
namespace F::LEGIT
{
enum events {
round_start = 1,
player_death = 2,
};
class impl {
public:
enum reset {
entity,
aimbot,
recoil
};
enum scan_mode {
single, /* only 1 hitbox */
adaptive /* multiple bones pushed in the same time */
};
enum hitboxes {
scan_head,
scan_neck,
scan_chest,
scan_pelvis
};
struct aim_info {
int legit_fov;
int legit_key;
int legit_key_style;
int legit_target_selection;
bool legit_fov_visualize;
bool remove_weapon_accuracy_spread;
int legit_smooth;
int legit_rcs_shots;
bool legit_rcs;
bool PunchRandomization;
bool legit_rcs_shots_enable;
float legit_rcs_smoothx;
float legit_rcs_smoothy;
bool legit_enable;
bool legit_visibility_check;
bool hitbox_head;
bool hitbox_neck;
bool hitbox_uppeer_chest;
bool hitbox_chest;
bool hitbox_stomach;
bool hitbox_leg_l;
bool hitbox_leg_r;
float punch_y;
float punch_x;
bool trigger_enable;
int trigger_hc;
}legit_data;
struct target_info {
float target_fov;
Vector_t best_target_pos;
C_CSPlayerPawn* m_target;
};
/* void inits */
bool valid( C_CSPlayerPawn* pawn, C_CSPlayerPawn* pLocal, bool check = false);
void Scan();
void Triggerbot(CUserCmd* cmd, C_BaseEntity* localent, C_BaseEntity* playerent, C_CSPlayerPawn* local, C_CSPlayerPawn* player, CCSWeaponBaseVData* vdata);
void SetupTarget(C_CSPlayerPawn* pawn);
void SetupAdaptiveWeapon(C_CSPlayerPawn* pawn);
void ScanTarget(C_CSPlayerPawn* pLocal, QAngle_t viewangles);
bool Hitchance(C_CSPlayerPawn* pLocal, C_CSPlayerPawn* ent, C_CSWeaponBase* weapon, QAngle_t vAimpoint, int iChance);
void Reset(reset type);
void Run(CUserCmd* cmd);
bool Ready(C_CSPlayerPawn* pLocal);
void Events(IGameEvent* event_listener, events type);
/* init class */
aim_info aimbot_info;
target_info target_info;
C_CSPlayerPawn* pLocal;
};
const auto legit = std::make_unique<impl>();
}

View File

@ -0,0 +1,15 @@
#include "misc.h"
// used: movement callback
#include "misc/movement.h"
#include "legit/legit.h"
#include "../utilities/log.h"
#include "lagcomp/lagcomp.h"
#include "../cstrike/sdk/datatypes/qangle.h"
#include "../cstrike/sdk/entity.h"
#include "../cstrike/sdk/datatypes/usercmd.h"
#include "enginepred/pred.h"
#include "../sdk/interfaces/events.h"
#include "rage/rage.h"

View File

@ -0,0 +1,9 @@
#pragma once
class CUserCmd;
class CCSPlayerController;
class C_CSPlayerPawn;
class QAngle_t;
class CCSGOInput;
namespace F::MISC
{
}

View File

@ -0,0 +1,638 @@
#include "movement.h"
// used: sdk
#include <iostream>
// used: sdk entity
#include "../../sdk/entity.h"
// used: cusercmd
#include "../../sdk/datatypes/usercmd.h"
#include "../../sdk/interfaces/ccsgoinput.h"
#include "../../sdk/datatypes/qangle.h"
// used: convars
#include "../../core/convars.h"
#include "../../sdk/interfaces/ienginecvar.h"
#include "../cstrike/features/enginepred/pred.h"
// used: cheat variables
#include "../../core/variables.h"
#include <array>
#include "../../core/sdk.h"
#include "../../sdk/interfaces/itrace.h"
#include "../cstrike/sdk/interfaces/cgameentitysystem.h"
#include "../antiaim/antiaim.hpp"
struct MovementData {
QAngle_t angCorrectionView{};
} _move_data;
enum DIR : int {
FORWARDS = 0,
BACKWARDS = 180,
LEFT = 90,
RIGHT = -90
};
enum MODE : int {
legit = 0,
rage = 1
};
void AngleQangles(const QAngle_t& angles, QAngle_t* forward, QAngle_t* right, QAngle_t* up)
{
float angle;
float sr, sp, sy, cr, cp, cy;
// Convert angles from degrees to radians
angle = angles.y * (MATH::_PI / 180.0);
sy = sin(angle);
cy = cos(angle);
angle = angles.x * (MATH::_PI / 180.0);
sp = sin(angle);
cp = cos(angle);
angle = angles.z * (MATH::_PI / 180.0);
sr = sin(angle);
cr = cos(angle);
if (forward)
{
forward->x = cp * cy;
forward->y = cp * sy;
forward->z = -sp;
}
if (right)
{
right->x = (-1 * sr * sp * cy + -1 * cr * -sy);
right->y = (-1 * sr * sp * sy + -1 * cr * cy);
right->z = -1 * sr * cp;
}
if (up)
{
up->x = (cr * sp * cy + -sr * -sy);
up->y = (cr * sp * sy + -sr * cy);
up->z = cr * cp;
}
}
void F::MISC::MOVEMENT::movment_fix(CUserCmd* pCmd, QAngle_t angle)
{
QAngle_t wish_angle;
wish_angle = pCmd->m_csgoUserCmd.m_pBaseCmd->m_pViewangles->m_angValue;
int revers = wish_angle.x > 89.f ? -1 : 1;
wish_angle.Clamp();
QAngle_t view_fwd, view_right, view_up, cmd_fwd, cmd_right, cmd_up;
auto viewangles = angle;
AngleQangles(wish_angle, &view_fwd, &view_right, &view_up);
AngleQangles(viewangles, &cmd_fwd, &cmd_right, &cmd_up);
const float v8 = sqrtf((view_fwd.x * view_fwd.x) + (view_fwd.y * view_fwd.y));
const float v10 = sqrtf((view_right.x * view_right.x) + (view_right.y * view_right.y));
const float v12 = sqrtf(view_up.z * view_up.z);
const Vector_t norm_view_fwd((1.f / v8) * view_fwd.x, (1.f / v8) * view_fwd.y, 0.f);
const Vector_t norm_view_right((1.f / v10) * view_right.x, (1.f / v10) * view_right.y, 0.f);
const Vector_t norm_view_up(0.f, 0.f, (1.f / v12) * view_up.z);
const float v14 = sqrtf((cmd_fwd.x * cmd_fwd.x) + (cmd_fwd.y * cmd_fwd.y));
const float v16 = sqrtf((cmd_right.x * cmd_right.x) + (cmd_right.y * cmd_right.y));
const float v18 = sqrtf(cmd_up.z * cmd_up.z);
const Vector_t norm_cmd_fwd((1.f / v14) * cmd_fwd.x, (1.f / v14) * cmd_fwd.y, 0.f);
const Vector_t norm_cmd_right((1.f / v16) * cmd_right.x, (1.f / v16) * cmd_right.y, 0.f);
const Vector_t norm_cmd_up(0.f, 0.f, (1.f / v18) * cmd_up.z);
const float v22 = norm_view_fwd.x * pCmd->m_csgoUserCmd.m_pBaseCmd->m_flForwardMove;
const float v26 = norm_view_fwd.y * pCmd->m_csgoUserCmd.m_pBaseCmd->m_flForwardMove;
const float v28 = norm_view_fwd.z * pCmd->m_csgoUserCmd.m_pBaseCmd->m_flForwardMove;
const float v24 = norm_view_right.x * pCmd->m_csgoUserCmd.m_pBaseCmd->m_flSideMove;
const float v23 = norm_view_right.y * pCmd->m_csgoUserCmd.m_pBaseCmd->m_flSideMove;
const float v25 = norm_view_right.z * pCmd->m_csgoUserCmd.m_pBaseCmd->m_flSideMove;
const float v30 = norm_view_up.x * pCmd->m_csgoUserCmd.m_pBaseCmd->m_flUpMove;
const float v27 = norm_view_up.z * pCmd->m_csgoUserCmd.m_pBaseCmd->m_flUpMove;
const float v29 = norm_view_up.y * pCmd->m_csgoUserCmd.m_pBaseCmd->m_flUpMove;
pCmd->m_csgoUserCmd.m_pBaseCmd->m_flForwardMove = ((((norm_cmd_fwd.x * v24) + (norm_cmd_fwd.y * v23)) + (norm_cmd_fwd.z * v25))
+ (((norm_cmd_fwd.x * v22) + (norm_cmd_fwd.y * v26)) + (norm_cmd_fwd.z * v28)))
+ (((norm_cmd_fwd.y * v30) + (norm_cmd_fwd.x * v29)) + (norm_cmd_fwd.z * v27));
pCmd->m_csgoUserCmd.m_pBaseCmd->m_flSideMove = ((((norm_cmd_right.x * v24) + (norm_cmd_right.y * v23)) + (norm_cmd_right.z * v25))
+ (((norm_cmd_right.x * v22) + (norm_cmd_right.y * v26)) + (norm_cmd_right.z * v28)))
+ (((norm_cmd_right.x * v29) + (norm_cmd_right.y * v30)) + (norm_cmd_right.z * v27));
pCmd->m_csgoUserCmd.m_pBaseCmd->m_flUpMove = ((((norm_cmd_up.x * v23) + (norm_cmd_up.y * v24)) + (norm_cmd_up.z * v25))
+ (((norm_cmd_up.x * v26) + (norm_cmd_up.y * v22)) + (norm_cmd_up.z * v28)))
+ (((norm_cmd_up.x * v30) + (norm_cmd_up.y * v29)) + (norm_cmd_up.z * v27));
pCmd->m_csgoUserCmd.m_pBaseCmd->m_flForwardMove = revers * ((((norm_cmd_fwd.x * v24) + (norm_cmd_fwd.y * v23)) + (norm_cmd_fwd.z * v25)) + (((norm_cmd_fwd.x * v22) + (norm_cmd_fwd.y * v26)) + (norm_cmd_fwd.z * v28)));
pCmd->m_csgoUserCmd.m_pBaseCmd->m_flSideMove = ((((norm_cmd_right.x * v24) + (norm_cmd_right.y * v23)) + (norm_cmd_right.z * v25)) + (((norm_cmd_right.x * v22) + (norm_cmd_right.y * v26)) + (norm_cmd_right.z * v28)));
pCmd->m_csgoUserCmd.m_pBaseCmd->m_flForwardMove = std::clamp(pCmd->m_csgoUserCmd.m_pBaseCmd->m_flForwardMove, -1.f, 1.f);
pCmd->m_csgoUserCmd.m_pBaseCmd->m_flSideMove = std::clamp(pCmd->m_csgoUserCmd.m_pBaseCmd->m_flSideMove, -1.f, 1.f);
}
void F::MISC::MOVEMENT::ProcessMovement(CUserCmd* pCmd, CCSPlayerController* pLocalController, C_CSPlayerPawn* pLocalPawn)
{
if (!pLocalController)
return;
if (!pLocalPawn)
return;
if (pLocalPawn->GetHealth() <= 0)
return;
if (pCmd == nullptr)
return;
CBaseUserCmdPB* base = pCmd->m_csgoUserCmd.m_pBaseCmd;
if (base == nullptr)
return;
// check if player is in noclip or on ladder or in water
if (const int32_t nMoveType = pLocalPawn->GetMoveType(); nMoveType == MOVETYPE_NOCLIP || nMoveType == MOVETYPE_LADDER || pLocalPawn->GetWaterLevel() >= WL_WAIST)
return;
EdgeBug(pLocalController, pLocalPawn, pCmd);
if (pLocalPawn->IsValidMoveType()) {
AutoStrafe(pCmd, base, pLocalPawn, C_GET(int, Vars.bAutostrafeMode));
BunnyHop(pCmd, base, pLocalPawn);
movment_fix(pCmd, F::ANTIAIM::angStoredViewBackup);
}
for (int i = 0; i < pCmd->m_csgoUserCmd.m_inputHistoryField.m_pRep->m_nAllocatedSize; i++)
{
CCSGOInputHistoryEntryPB* pInputEntry = pCmd->GetInputHistoryEntry(i);
if (pInputEntry == nullptr)
continue;
if (pInputEntry->m_pViewCmd == nullptr)
continue;
_move_data.angCorrectionView = pInputEntry->m_pViewCmd->m_angValue;
ValidateUserCommand(pCmd, base, pInputEntry);
}
}
void rotate_movement(float yaw, const QAngle_t& angles, float& fmove, float& smove) {
float rotation = M_DEG2RAD(angles.y - yaw);
float cos_rot = std::cos(rotation);
float sin_rot = std::sin(rotation);
float new_forwardmove = (cos_rot * fmove) - (sin_rot * smove);
float new_sidemove = (sin_rot * fmove) + (cos_rot * smove);
fmove = new_forwardmove;
smove = new_sidemove;
}
void F::MISC::MOVEMENT::EdgeBug(CCSPlayerController* controler, C_CSPlayerPawn* localPlayer, CUserCmd* cmd) {
if (!C_GET(bool, Vars.edge_bug))
return;
if (!controler || !localPlayer || localPlayer->GetHealth() <= 0)
return;
C_CSPlayerPawn* pred = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(controler->m_hPredictedPawn());
if (!pred)
return;
static bool bhopWasEnabled = true;
bool JumpDone;
bool unduck = true;
float max_radius = MATH::_PI * 2;
float step = max_radius / 128;
float xThick = 23;
bool valid = GetAsyncKeyState(C_GET(KeyBind_t, Vars.edge_bug_key).uKey);
if (!valid) {
return;
}
if (valid) {
I::Cvar->Find(FNV1A::Hash(CS_XOR("sv_min_jump_landing_sound")))->value.fl = 63464578.f;
}
else {
I::Cvar->Find(FNV1A::Hash(CS_XOR("sv_min_jump_landing_sound")))->value.fl = 260;
}
static bool edgebugging = false;
static int edgebugging_tick = 0;
if (!edgebugging) {
int flags = localPlayer->GetFlags();
float z_velocity = floor(localPlayer->m_vecVelocity().z);
for (int i = 0; i < 64; i++) {
if (z_velocity < -7 && floor(localPlayer->m_vecVelocity().z) == -7 && !(flags & FL_ONGROUND) && localPlayer->GetMoveType() != MOVETYPE_NOCLIP) {
edgebugging_tick = cmd->m_csgoUserCmd.m_pBaseCmd->m_nTickCount + i;
edgebugging = true;
break;
}
else {
z_velocity = floor(localPlayer->m_vecVelocity().z);
flags = localPlayer->GetFlags();
}
}
}
else {
cmd->m_csgoUserCmd.m_pBaseCmd->m_flSideMove = 0.f;
cmd->m_csgoUserCmd.m_pBaseCmd->m_flForwardMove = 0.f;
cmd->m_csgoUserCmd.m_pBaseCmd->m_flUpMove = 0.f;
cmd->m_csgoUserCmd.m_pBaseCmd->m_nMousedX = 0.f;
cmd->m_nButtons.m_nValue |= IN_DUCK;
if ((localPlayer->GetFlags() & 0x1)) {
cmd->m_nButtons.m_nValue &= ~IN_JUMP;
}
Vector_t pos = localPlayer->GetSceneOrigin();
for (float a = 0.f; a < max_radius; a += step) {
Vector_t pt;
pt.x = (xThick * cos(a)) + pos.x;
pt.y = (xThick * sin(a)) + pos.y;
pt.z = pos.z;
Vector_t pt2 = pt;
pt2.z -= 8192;
trace_filter_t filter = {};
I::Trace->Init(filter, localPlayer, 0x1400B, 3, 7);
game_trace_t trace = {};
ray_t ray = {};
I::Trace->TraceShape(ray, &pt, &pt2, filter, trace);
if (trace.Fraction != 1.0f && trace.Fraction != 0.0f) {
JumpDone = true;
cmd->m_nButtons.m_nValue |= IN_DUCK;
}
}
if (cmd->m_csgoUserCmd.m_pBaseCmd->m_nTickCount > edgebugging_tick) {
edgebugging = false;
edgebugging_tick = 0;
}
}
trace_filter_t filter = {};
I::Trace->Init(filter, localPlayer, 0x1400B, 3, 7);
Vector_t pos = localPlayer->GetSceneOrigin();
if (pred->m_bInLanding()) {
for (float a = 0.f; a < max_radius; a += step) {
Vector_t pt;
pt.x = (xThick * cos(a)) + pos.x;
pt.y = (xThick * sin(a)) + pos.y;
pt.z = pos.z;
Vector_t pt2 = pt;
pt2.z -= 8192;
game_trace_t trace = {};
ray_t ray = {};
I::Trace->TraceShape(ray, &pt, &pt2, filter, trace);
if (trace.Fraction != 1.0f && trace.Fraction != 0.0f) {
JumpDone = true;
cmd->m_csgoUserCmd.m_pBaseCmd->m_flSideMove = 0.f;
cmd->m_csgoUserCmd.m_pBaseCmd->m_flForwardMove = 0.f;
cmd->m_csgoUserCmd.m_pBaseCmd->m_flUpMove = 0.f;
cmd->m_csgoUserCmd.m_pBaseCmd->m_nMousedX = 0.f;
cmd->m_nButtons.m_nValue |= IN_DUCK;
if ((localPlayer->GetFlags() & 0x1)) {
cmd->m_nButtons.m_nValue &= ~IN_JUMP;
}
}
}
}
if (cmd->m_csgoUserCmd.m_pBaseCmd->m_nTickCount > edgebugging_tick) {
edgebugging = false;
edgebugging_tick = 0;
}
}
void F::MISC::MOVEMENT::AutoStrafe(CUserCmd* pCmd, CBaseUserCmdPB* pUserCmd, C_CSPlayerPawn* pLocalPawn, int type)
{
static uint64_t last_pressed = 0;
static uint64_t last_buttons = 0;
if (!C_GET(bool, Vars.bAutostrafe))
return;
auto& cmd = I::Input->arrCommands[I::Input->nSequenceNumber % 150];
bool strafe_assist = C_GET(bool, Vars.bAutostrafeAssistance);
const auto current_buttons = cmd.m_nButtons.m_nValue;
auto yaw = MATH::normalize_yaw(pUserCmd->m_pViewangles->m_angValue.y);
const auto check_button = [&](const uint64_t button)
{
if (current_buttons & button && (!(last_buttons & button) || button & IN_MOVELEFT && !(last_pressed & IN_MOVERIGHT) || button &
IN_MOVERIGHT && !(last_pressed & IN_MOVELEFT) || button & IN_FORWARD && !(last_pressed & IN_BACK) ||
button & IN_BACK && !(last_pressed & IN_FORWARD)))
{
if (strafe_assist)
{
if (button & IN_MOVELEFT)
last_pressed &= ~IN_MOVERIGHT;
else if (button & IN_MOVERIGHT)
last_pressed &= ~IN_MOVELEFT;
else if (button & IN_FORWARD)
last_pressed &= ~IN_BACK;
else if (button & IN_BACK)
last_pressed &= ~IN_FORWARD;
}
last_pressed |= button;
}
else if (!(current_buttons & button))
last_pressed &= ~button;
};
check_button(IN_MOVELEFT);
check_button(IN_MOVERIGHT);
check_button(IN_FORWARD);
check_button(IN_BACK);
last_buttons = current_buttons;
const auto velocity = pLocalPawn->GetAbsVelocity();
bool wasdstrafe = C_GET(unsigned int, Vars.bAutostrafeMode) == 0;
bool viewanglestrafe = C_GET(unsigned int, Vars.bAutostrafeMode) == 1;
float smoothing = C_GET(float, Vars.autostrafe_smooth);
/*const auto weapon = pLocalPawn->get_weapon_services_ptr()->get_h_active_weapon().get();
const auto js = weapon && (cfg.weapon_config.is_scout && cfg.weapon_config.cur.scout_jumpshot && pLocalPawn->get_vec_abs_velocity().length_2d() < 50.f);
const auto throwing_nade = weapon && weapon->is_grenade() && ticks_to_time(local_player->get_tickbase()) >= weapon->get_throw_time() && weapon->get_throw_time() != 0.f;
if (js)
return;*/
if (pLocalPawn->GetFlags() & FL_ONGROUND)
return;
auto rotate_movement = [](CUserCmd& cmd, float target_yaw)
{ auto pUserCmd = cmd.m_csgoUserCmd.m_pBaseCmd;
const float rot = M_DEG2RAD(pUserCmd->m_pViewangles->m_angValue.y - target_yaw);
const float new_forward = std::cos(rot) * pUserCmd->m_flForwardMove - std::sin(rot) * pUserCmd->m_flSideMove;
const float new_side = std::sin(rot) * pUserCmd->m_flForwardMove + std::cos(rot) * pUserCmd->m_flSideMove;
cmd.m_nButtons.m_nValue &= ~(IN_BACK | IN_FORWARD | IN_MOVELEFT | IN_MOVERIGHT);
pUserCmd->m_flForwardMove = std::clamp(new_forward, -1.f, 1.f);
pUserCmd->m_flSideMove = std::clamp(new_side * -1.f, -1.f, 1.f);
if (pUserCmd->m_flForwardMove > 0.f)
cmd.m_nButtons.m_nValue |= IN_FORWARD;
else if (pUserCmd->m_flForwardMove < 0.f)
cmd.m_nButtons.m_nValue |= IN_BACK;
if (pUserCmd->m_flSideMove > 0.f)
cmd.m_nButtons.m_nValue |= IN_MOVELEFT;
else if (pUserCmd->m_flSideMove < 0.f)
cmd.m_nButtons.m_nValue |= IN_MOVERIGHT;
};
if (wasdstrafe)
{
auto offset = 0.f;
if (last_pressed & IN_MOVELEFT)
offset += 90.f;
if (last_pressed & IN_MOVERIGHT)
offset -= 90.f;
if (last_pressed & IN_FORWARD)
offset *= 0.5f;
else if (last_pressed & IN_BACK)
offset = -offset * 0.5f + 180.f;
yaw += offset;
pUserCmd->m_flForwardMove = 0.f;
pUserCmd->m_flSideMove = 0.f;
rotate_movement(cmd, MATH::normalize_yaw(yaw));
if (!viewanglestrafe && offset == 0.f)
return;
}
if (pUserCmd->m_flSideMove != 0.0f || pUserCmd->m_flForwardMove != 0.0f)
return;
auto velocity_angle = M_RAD2DEG(std::atan2f(velocity.y, velocity.x));
if (velocity_angle < 0.0f)
velocity_angle += 360.0f;
if (velocity_angle < 0.0f)
velocity_angle += 360.0f;
velocity_angle -= floorf(velocity_angle / 360.0f + 0.5f) * 360.0f;
const auto speed = velocity.Length2D();
const auto ideal = std::clamp(M_RAD2DEG(std::atan2(15.f, speed)), 0.f, 45.f);
const auto correct = (100.f - smoothing) * 0.02f * (ideal + ideal);
pUserCmd->m_flForwardMove = 0.f;
const auto velocity_delta = MATH::normalize_yaw(yaw - velocity_angle);
/*if (throwing_nade && fabsf(velocity_delta) <=20.f)
{
auto &wish_angle = antiaim::wish_angles[globals::current_cmd->command_number % 150];
wish_angle.y = math::normalize_yaw(yaw);
globals::current_cmd->forwardmove = 450.f;
antiaim::fix_movement(globals::current_cmd);
return;
}*/
if (fabsf(velocity_delta) > 170.f && speed > 80.f || velocity_delta > correct && speed > 80.f)
{
yaw = correct + velocity_angle;
pUserCmd->m_flSideMove = -1.f;
rotate_movement(cmd, MATH::normalize_yaw(yaw));
return;
}
const bool side_switch = I::Input->nSequenceNumber % 2 == 0;
if (-correct <= velocity_delta || speed <= 80.f)
{
if (side_switch)
{
yaw = yaw - ideal;
pUserCmd->m_flSideMove = -1.f;
}
else
{
yaw = ideal + yaw;
pUserCmd->m_flSideMove = 1.f;
}
rotate_movement(cmd, MATH::normalize_yaw(yaw));
}
else
{
yaw = velocity_angle - correct;
pUserCmd->m_flSideMove = 1.f;
rotate_movement(cmd, MATH::normalize_yaw(yaw));
}
}
std::array<bool, 150> onground_tick = {};
std::array<bool, 150> remove_tick = {};
bool pressed_jump = false;
void F::MISC::MOVEMENT::BunnyHop(CUserCmd* pCmd, CBaseUserCmdPB* pUserCmd, C_CSPlayerPawn* pLocalPawn)
{
bool bWasLastTimeOnGround{};
pressed_jump = pCmd->m_nButtons.m_nValue & IN_JUMP;
if (!C_GET(bool, Vars.bAutoBHop) || CONVAR::sv_autobunnyhopping->value.i1)
return;
if (pLocalPawn->GetFlags() & FL_ONGROUND)
pCmd->m_nButtons.m_nValue &= ~IN_JUMP;
bWasLastTimeOnGround = pLocalPawn->GetFlags() & FL_ONGROUND;
const float velocity = pLocalPawn->m_vecVelocity().Length2D();
bool bShouldJump = true;
if (velocity > 300.f && Vars.nAutoBHopChance < 0.8) bShouldJump = false;
if (!pLocalPawn->GetFlags() & FL_ONGROUND && !bWasLastTimeOnGround)
pCmd->m_nButtons.m_nValue &= ~IN_JUMP;
bWasLastTimeOnGround = pLocalPawn->GetFlags() & FL_ONGROUND;
/*CSubtickMoveStep* subtick_pressed = pUserCmd->AddSubTickMove();
subtick_pressed->m_nCachedBits = 7;
subtick_pressed->nButton = IN_JUMP;
subtick_pressed->bPressed = true;
subtick_pressed->flWhen = 0.999f;
CSubtickMoveStep* subtick_release = pUserCmd->AddSubTickMove();
subtick_release->m_nCachedBits = 7;
subtick_release->nButton = IN_JUMP;
subtick_release->bPressed = false;
subtick_release->flWhen = 0.999f;*/
}
void F::MISC::MOVEMENT::ValidateUserCommand(CUserCmd* pCmd, CBaseUserCmdPB* pUserCmd, CCSGOInputHistoryEntryPB* pInputEntry)
{
if (pUserCmd == nullptr)
return;
// clamp angle to avoid untrusted angle
if (C_GET(bool, Vars.bAntiUntrusted))
{
if (pInputEntry->m_pViewCmd->m_angValue.IsValid())
{
pInputEntry->m_pViewCmd->m_angValue.Clamp();
pInputEntry->m_pViewCmd->m_angValue.z = 0.f;
}
else
{
pInputEntry->m_pViewCmd->m_angValue = {};
}
}
//MovementCorrection(pUserCmd, pInputEntry, _move_data.angCorrectionView);
// correct movement buttons while player move have different to buttons values
// clear all of the move buttons states
pCmd->m_nButtons.m_nValue &= (~IN_FORWARD | ~IN_BACK | ~IN_LEFT | ~IN_RIGHT);
// re-store buttons by active forward/side moves
if (pUserCmd->m_flForwardMove > 0.0f)
pCmd->m_nButtons.m_nValue |= IN_FORWARD;
else if (pUserCmd->m_flForwardMove < 0.0f)
pCmd->m_nButtons.m_nValue |= IN_BACK;
if (pUserCmd->m_flSideMove > 0.0f)
pCmd->m_nButtons.m_nValue |= IN_RIGHT;
else if (pUserCmd->m_flSideMove < 0.0f)
pCmd->m_nButtons.m_nValue |= IN_LEFT;
if (!pInputEntry->m_pViewCmd->m_angValue.IsZero())
{
float flDeltaX = std::remainderf(pInputEntry->m_pViewCmd->m_angValue.x - _move_data.angCorrectionView.x, 360.f);
float flDeltaY = std::remainderf(pInputEntry->m_pViewCmd->m_angValue.y - _move_data.angCorrectionView.y, 360.f);
float flPitch = CONVAR::m_pitch->value.fl;
float flYaw = CONVAR::m_yaw->value.fl;
float flSensitivity = CONVAR::sensitivity->value.fl;
if (flSensitivity == 0.0f)
flSensitivity = 1.0f;
pUserCmd->m_nMousedX = static_cast<short>(flDeltaX / (flSensitivity * flPitch));
pUserCmd->m_nMousedY = static_cast<short>(-flDeltaY / (flSensitivity * flYaw));
}
}
void F::MISC::MOVEMENT::MovementCorrection(CBaseUserCmdPB* pUserCmd, CCSGOInputHistoryEntryPB* pInputEntry, const QAngle_t& angDesiredViewPoint)
{
if (pUserCmd == nullptr)
return;
Vector_t vecForward = {}, vecRight = {}, vecUp = {};
angDesiredViewPoint.ToDirections(&vecForward, &vecRight, &vecUp);
// we don't attempt on forward/right roll, and on up pitch/yaw
vecForward.z = vecRight.z = vecUp.x = vecUp.y = 0.0f;
vecForward.NormalizeInPlace();
vecRight.NormalizeInPlace();
vecUp.NormalizeInPlace();
Vector_t vecOldForward = {}, vecOldRight = {}, vecOldUp = {};
pInputEntry->m_pViewCmd->m_angValue.ToDirections(&vecOldForward, &vecOldRight, &vecOldUp);
// we don't attempt on forward/right roll, and on up pitch/yaw
vecOldForward.z = vecOldRight.z = vecOldUp.x = vecOldUp.y = 0.0f;
vecOldForward.NormalizeInPlace();
vecOldRight.NormalizeInPlace();
vecOldUp.NormalizeInPlace();
const float flPitchForward = vecForward.x * pUserCmd->m_flForwardMove;
const float flYawForward = vecForward.y * pUserCmd->m_flForwardMove;
const float flPitchSide = vecRight.x * pUserCmd->m_flSideMove;
const float flYawSide = vecRight.y * pUserCmd->m_flSideMove;
const float flRollUp = vecUp.z * pUserCmd->m_flUpMove;
// solve corrected movement speed
pUserCmd->m_flForwardMove = vecOldForward.x * flPitchSide + vecOldForward.y * flYawSide + vecOldForward.x * flPitchForward + vecOldForward.y * flYawForward + vecOldForward.z * flRollUp;
pUserCmd->m_flSideMove = vecOldRight.x * flPitchSide + vecOldRight.y * flYawSide + vecOldRight.x * flPitchForward + vecOldRight.y * flYawForward + vecOldRight.z * flRollUp;
pUserCmd->m_flUpMove = vecOldUp.x * flYawSide + vecOldUp.y * flPitchSide + vecOldUp.x * flYawForward + vecOldUp.y * flPitchForward + vecOldUp.z * flRollUp;
}

View File

@ -0,0 +1,29 @@
#pragma once
class CUserCmd;
class CBaseUserCmdPB;
class CCSGOInputHistoryEntryPB;
class CBasePlayerController;
class CCSPlayerController;
class C_CSPlayerPawn;
class CSubtickMoveStep;
class QAngle_t;
namespace F::MISC::MOVEMENT
{
void EdgeBug(CCSPlayerController* controler, C_CSPlayerPawn* localPlayer, CUserCmd* cmd);
void movment_fix(CUserCmd* pCmd, QAngle_t angle);
void ProcessMovement(CUserCmd* pCmd, CCSPlayerController* pLocalController, C_CSPlayerPawn* pLocalPawn);
void BunnyHop(CUserCmd* pCmd, CBaseUserCmdPB* pUserCmd, C_CSPlayerPawn* pLocalPawn);
void AutoStrafe(CUserCmd* pCmd, CBaseUserCmdPB* pUserCmd, C_CSPlayerPawn* pLocalPawn, int type);
void MovementCorrection(CBaseUserCmdPB* pUserCmd, CCSGOInputHistoryEntryPB* pInputHistory, const QAngle_t& angDesiredViewPoint);
// will call MovementCorrection && validate user's angView to avoid untrusted ban
void ValidateUserCommand(CUserCmd* pCmd, CBaseUserCmdPB* pUserCmd, CCSGOInputHistoryEntryPB* pInputHistory);
}

View File

@ -0,0 +1,392 @@
#include "penetration.h"
#include "../../core/variables.h"
#include "../../sdk/datatypes/usercmd.h"
#include "../../core/sdk.h"
#include "../../sdk/entity.h"
#include "../../sdk/interfaces/iengineclient.h"
#include "../../sdk/interfaces/iglobalvars.h"
#include "../../sdk/interfaces/cgameentitysystem.h"
#include "../../sdk/datatypes/qangle.h"
#include "../../sdk/datatypes/vector.h"
#include "../../sdk/entity_handle.h"
#include "../cstrike/sdk/interfaces/ienginecvar.h"
#include <mutex>
#include <array>
#include "../cstrike/sdk/interfaces/itrace.h"
static constexpr std::uint32_t PENMASK = 0x1C300Bu; // mask_shot_hull | contents_hitbox?
namespace F::AUTOWALL {
void F::AUTOWALL::c_auto_wall::pen(data_t& data, const Vector_t local_pos, const Vector_t target_pos, C_BaseEntity* target, C_BaseEntity* local, C_CSPlayerPawn* localpawn, C_CSPlayerPawn* targetpawn,
CCSWeaponBaseVData* wpn_data, float &dmg, bool &valid) {
data.m_local = local;
data.m_target = target;
data.m_local_pawn = localpawn;
data.m_target_pawn = targetpawn;
data.m_wpn_data = wpn_data;
data.m_pos.at(F::AUTOWALL::c_auto_wall::data_t::e_pos::e_local) = local_pos;
data.m_pos.at(F::AUTOWALL::c_auto_wall::data_t::e_pos::e_target) = target_pos;
FireBullet(data, data.m_dmg, data.m_can_hit);
}
void F::AUTOWALL::c_auto_wall::ScaleDamage(data_t& data, const int hitgroup, C_CSPlayerPawn* player)
{
if (!player)
return;
auto WeaponServices = player->GetItemServices();
if (!WeaponServices)
return;
// ida: server.dll; 80 78 42 00 74 08 F3 0F 59 35 ?? ?? ?? ?? 80 BE 04 0D 00 00 00
static CConVar* mp_damage_scale_ct_head = I::Cvar->Find(
FNV1A::HashConst("mp_damage_scale_ct_head")),
* mp_damage_scale_t_head = I::Cvar->Find(
FNV1A::HashConst("mp_damage_scale_t_head")),
* mp_damage_scale_ct_body = I::Cvar->Find(
FNV1A::HashConst("mp_damage_scale_ct_body")),
* mp_damage_scale_t_body = I::Cvar->Find(
FNV1A::HashConst("mp_damage_scale_t_body"));
const auto damage_scale_ct_head = mp_damage_scale_ct_head->value.fl,
damage_scale_t_head = mp_damage_scale_t_head->value.fl,
damage_scale_ct_body = mp_damage_scale_ct_body->value.fl,
damage_scale_t_body = mp_damage_scale_t_body->value.fl;
const bool is_ct = player->GetTeam() == 3, is_t = player->GetTeam() == 2;
float head_damage_scale = is_ct ? damage_scale_ct_head : is_t ? damage_scale_t_head : 1.0f;
const float body_damage_scale = is_ct ? damage_scale_ct_body : is_t ? damage_scale_t_body : 1.0f;
// william: magic values u can see here: ida: server.dll; F3 0F 10 35 ?? ?? ?? ?? 0F 29 7C 24 30 44 0F 29 44 24
// xref: mp_heavybot_damage_reduction_scale
if (WeaponServices->m_bHasHeavyArmor()) {
head_damage_scale *= 0.5f;
}
// todo: mb missed some hitgroups, anyway this is a calculation of all important hitgroups
switch (hitgroup) {
case HitGroup_t::HITGROUP_HEAD:
data.m_dmg *= data.m_wpn_data->m_flHeadshotMultiplier() * head_damage_scale;
break;
case HitGroup_t::HITGROUP_CHEST:
case HitGroup_t::HITGROUP_LEFTARM:
case HitGroup_t::HITGROUP_RIGHTARM:
case HitGroup_t::HITGROUP_NECK:
data.m_dmg *= body_damage_scale;
break;
case HitGroup_t::HITGROUP_STOMACH:
data.m_dmg *= 1.25f * body_damage_scale;
break;
case HitGroup_t::HITGROUP_LEFTLEG:
case HitGroup_t::HITGROUP_RIGHTLEG:
data.m_dmg *= 0.75f * body_damage_scale;
break;
default:
break;
}
if (!player->hasArmour(hitgroup))
return;
float heavy_armor_bonus = 1.0f, armor_bonus = 0.5f, armor_ratio = data.m_wpn_data->m_flArmorRatio() * 0.5f;
if (WeaponServices->m_bHasHeavyArmor()) {
heavy_armor_bonus = 0.25f;
armor_bonus = 0.33f;
armor_ratio *= 0.20f;
}
float damage_to_health = data.m_dmg * armor_ratio;
const float damage_to_armor = (data.m_dmg - damage_to_health) * (heavy_armor_bonus * armor_bonus);
if (damage_to_armor > static_cast<float>(player->GetArmorValue())) {
damage_to_health = data.m_dmg - static_cast<float>(player->GetArmorValue()) / armor_bonus;
}
data.m_dmg = damage_to_health;
}
bool F::AUTOWALL::c_auto_wall::FireBullet(data_t& data, float &dmg, bool &valid)
{
// L_PRINT(LOG_INFO) << "0";
CS_ASSERT(data.m_local != nullptr || data.m_target != nullptr || data.m_wpn_data != nullptr || data.m_local_pawn != nullptr || data.m_target_pawn != nullptr);
if (!data.m_local || !data.m_target || !data.m_wpn_data)
return false;
// L_PRINT(LOG_INFO) << "1";
trace_data_t trace_data = { };
trace_data.m_arr_pointer = &trace_data.m_arr;
void* data_pointer = &trace_data;
//L_PRINT(LOG_INFO) << "created trace_data | trace_data_pointer:" << L::AddFlags(LOG_MODE_INT_SHOWBASE | LOG_MODE_INT_FORMAT_HEX) << reinterpret_cast<uintptr_t>(data_pointer);
//L_PRINT(LOG_INFO) << "created trace_data | pointer:" << L::AddFlags(LOG_MODE_INT_SHOWBASE | LOG_MODE_INT_FORMAT_HEX) << reinterpret_cast<uintptr_t>(trace_data.m_arr_pointer);
const Vector_t direction =
data.m_pos.at(data_t::e_pos::e_target) - data.m_pos.at(data_t::e_pos::e_local),
end_pos = direction * data.m_wpn_data->m_flRange();
trace_filter_t filter = {};
I::Trace->Init(filter, data.m_local_pawn,PENMASK, 3, 7);
void* filter_pointer = &filter;
/* L_PRINT(LOG_INFO) << "created filter_data | filter_pointer:" << L::AddFlags(LOG_MODE_INT_SHOWBASE | LOG_MODE_INT_FORMAT_HEX) << reinterpret_cast<uintptr_t>(filter_pointer);
L_PRINT(LOG_INFO) << "creating trace | filter > layer:" << filter.layer << "mask:" << filter.trace_mask;
L_PRINT(LOG_INFO) << "creating trace | endpos:" << end_pos;
*/
I::Trace->CreateTrace(&trace_data, data.m_pos.at(data_t::e_pos::e_local), end_pos, filter, 4);
struct handle_bullet_data_t {
handle_bullet_data_t(const float dmg_mod, const float pen, const float range_mod, const float range,
const int pen_count, const bool failed) :
m_dmg(dmg_mod),
m_pen(pen),
m_range_mod(range_mod),
m_range(range),
m_pen_count(pen_count),
m_failed(failed) {}
float m_dmg{ }, m_pen{ }, m_range_mod{ }, m_range{ };
int m_pen_count{ };
bool m_failed{ };
}
handle_bullet_data(static_cast<float>(data.m_wpn_data->m_nDamage()), data.m_wpn_data->m_flPenetration(), data.m_wpn_data->m_flRange(),
data.m_wpn_data->m_flRangeModifier(), 4, false);
// L_PRINT(LOG_INFO) << "Initialized handlebulletpen data";
float corrected_dmg = static_cast<float>(data.m_wpn_data->m_nDamage());
float flTraceLength = 0.f;
auto flMaxRange = data.m_wpn_data->m_flRange();
if (trace_data.m_num_update > 0) {
for (int i{ }; i < trace_data.m_num_update; i++) {
auto* value = reinterpret_cast<UpdateValueT* const>(
reinterpret_cast<std::uintptr_t>(trace_data.m_pointer_update_value)
+ i * sizeof(UpdateValueT));
game_trace_t game_trace = { };
I::Trace->InitializeTraceInfo(&game_trace);
I::Trace->get_trace_info(
&trace_data, &game_trace, 0.0f,
reinterpret_cast<void*>(
reinterpret_cast<std::uintptr_t>(trace_data.m_arr.data())
+ sizeof(trace_arr_element_t) * (value->handleIdx & 0x7fffu)));
/*
L_PRINT(LOG_INFO) << "game_trace: entryindex:" << game_trace.HitEntity->GetRefEHandle().GetEntryIndex();
L_PRINT(LOG_INFO) << "game_trace: m_target_pawn entryindex:" << data.m_target_pawn->GetRefEHandle().GetEntryIndex();
L_PRINT(LOG_INFO) << "game_trace: m_target entryindex:" << data.m_target->GetRefEHandle().GetEntryIndex();
*/
flMaxRange -= flTraceLength;
// we didn't hit anything, stop tracing shoot
if (game_trace.Fraction == 1.0f)
{
break;
}
// calculate the damage based on the distance the bullet traveled
flTraceLength += game_trace.Fraction * flMaxRange;
corrected_dmg *= std::powf(data.m_wpn_data->m_flRangeModifier(), flTraceLength / 500.f);
// check is actually can shoot through
if (flTraceLength > 3000.f)
break;
if (game_trace.HitEntity && game_trace.HitEntity->GetRefEHandle().GetEntryIndex() == data.m_target_pawn->GetRefEHandle().GetEntryIndex()) {
ScaleDamage2(game_trace.HitboxData->m_hitgroup, data.m_target_pawn, data.m_wpn_data->m_flArmorRatio(), data.m_wpn_data->m_flHeadshotMultiplier(), &corrected_dmg);
dmg = corrected_dmg;//data.m_dmg > 0.f ? data.m_dmg : handle_bullet_data.m_dmg;
valid = true;
return true;
}
else
valid = false;
if (I::Trace->handle_bullet_penetration(&trace_data, &handle_bullet_data, value, false))
return false;
corrected_dmg = handle_bullet_data.m_dmg;
}
}
return false;
}
void F::AUTOWALL::c_auto_wall::ScaleDamage2(const int iHitGroup, C_CSPlayerPawn* pCSPlayer, const float flWeaponArmorRatio, const float flWeaponHeadShotMultiplier, float* pflDamageToScale)
{
// @ida CCSPlayer::TraceAttack(): server.dll -> "55 8B EC 83 E4 F8 81 EC ? ? ? ? 56 8B 75 08 57 8B F9 C6"
auto WeaponServices = pCSPlayer->GetItemServices();
if (!WeaponServices)
return;
const bool bHeavyArmor = WeaponServices->m_bHasHeavyArmor();
// ida: server.dll; 80 78 42 00 74 08 F3 0F 59 35 ?? ?? ?? ?? 80 BE 04 0D 00 00 00
static CConVar* mp_damage_scale_ct_head = I::Cvar->Find(
FNV1A::HashConst("mp_damage_scale_ct_head")),
* mp_damage_scale_t_head = I::Cvar->Find(
FNV1A::HashConst("mp_damage_scale_t_head")),
* mp_damage_scale_ct_body = I::Cvar->Find(
FNV1A::HashConst("mp_damage_scale_ct_body")),
* mp_damage_scale_t_body = I::Cvar->Find(
FNV1A::HashConst("mp_damage_scale_t_body"));
const auto damage_scale_ct_head = mp_damage_scale_ct_head->value.fl,
damage_scale_t_head = mp_damage_scale_t_head->value.fl,
damage_scale_ct_body = mp_damage_scale_ct_body->value.fl,
damage_scale_t_body = mp_damage_scale_t_body->value.fl;
float flHeadDamageScale = (pCSPlayer->GetTeam() == TEAM_CT ? damage_scale_ct_head : damage_scale_t_head);
const float flBodyDamageScale = (pCSPlayer->GetTeam() == TEAM_CT ? damage_scale_ct_body : damage_scale_t_body);
if (bHeavyArmor) flHeadDamageScale *= 0.5f;
switch (iHitGroup)
{
case HITGROUP_HEAD:
*pflDamageToScale *= flWeaponHeadShotMultiplier * flHeadDamageScale;
break;
case HITGROUP_CHEST:
case HITGROUP_LEFTARM:
case HITGROUP_RIGHTARM:
case HITGROUP_NECK:
*pflDamageToScale *= flBodyDamageScale;
break;
case HITGROUP_STOMACH:
*pflDamageToScale *= 1.25f * flBodyDamageScale;
break;
case HITGROUP_LEFTLEG:
case HITGROUP_RIGHTLEG:
*pflDamageToScale *= 0.75f * flBodyDamageScale;
break;
default:
break;
}
if (pCSPlayer->hasArmour(iHitGroup))
{
// @ida CCSPlayer::OnTakeDamage(): server.dll -> "80 BF ? ? ? ? ? F3 0F 10 5C 24 ? F3 0F 10 35"
const int iArmor = pCSPlayer->GetArmorValue();
float flHeavyArmorBonus = 1.0f, flArmorBonus = 0.5f, flArmorRatio = flWeaponArmorRatio * 0.5f;
if (bHeavyArmor)
{
flHeavyArmorBonus = 0.25f;
flArmorBonus = 0.33f;
flArmorRatio *= 0.20f;
}
float flDamageToHealth = *pflDamageToScale * flArmorRatio;
if (const float flDamageToArmor = (*pflDamageToScale - flDamageToHealth) * (flHeavyArmorBonus * flArmorBonus); flDamageToArmor > static_cast<float>(iArmor))
flDamageToHealth = *pflDamageToScale - static_cast<float>(iArmor) / flArmorBonus;
*pflDamageToScale = flDamageToHealth;
}
}
/* bool F::AUTOWALL::c_auto_wall::FireBullet(data_t& data, float& dmg, bool& valid)
{
CS_ASSERT(data.m_local != nullptr || data.m_target != nullptr || data.m_wpn_data != nullptr || data.m_local_pawn != nullptr || data.m_target_pawn != nullptr);
if (!data.m_local || !data.m_target || !data.m_wpn_data)
return false;
trace_data_t trace_data = { };
trace_data.m_arr_pointer = &trace_data.m_arr;
Vector_t direction =
data.m_pos.at(data_t::e_pos::e_target) - data.m_pos.at(data_t::e_pos::e_local),
end_pos = direction * data.m_wpn_data->m_flRange();
int pen_count = 4;
float flTraceLength = 0.f;
float flMaxRange = data.m_wpn_data->m_flRange();
// set our current damage to what our gun's initial damage reports it will do
data.m_dmg = static_cast<float>(data.m_wpn_data->m_nDamage());
trace_filter_t filter = {};
I::Trace->Init(filter, data.m_local_pawn, MASK_SHOT_HULL | CONTENTS_HITBOX, 3, 7);
I::Trace->CreateTrace(&trace_data, data.m_pos.at(data_t::e_pos::e_local), end_pos, filter, 4);
struct handle_bullet_data_t {
handle_bullet_data_t(const float dmg_mod, const float pen, const float range_mod, const float range,
const int pen_count, const bool failed) :
m_dmg(dmg_mod),
m_pen(pen),
m_range_mod(range_mod),
m_range(range),
m_pen_count(pen_count),
m_failed(failed) {}
float m_dmg{ }, m_pen{ }, m_range_mod{ }, m_range{ };
int m_pen_count{ };
bool m_failed{ };
}
handle_bullet_data(static_cast<float>(data.m_wpn_data->m_nDamage()), data.m_wpn_data->m_flPenetration(), data.m_wpn_data->m_flRange(),
data.m_wpn_data->m_flRangeModifier(), 4, false);
if (trace_data.m_num_update > 0) {
for (int i{ }; i < trace_data.m_num_update; i++) {
auto* value = reinterpret_cast<UpdateValueT* const>(
reinterpret_cast<std::uintptr_t>(trace_data.m_pointer_update_value)
+ i * sizeof(UpdateValueT));
game_trace_t game_trace = { };
I::Trace->InitializeTraceInfo(&game_trace);
I::Trace->get_trace_info(
&trace_data, &game_trace, 0.0f,
reinterpret_cast<void*>(
reinterpret_cast<std::uintptr_t>(trace_data.m_arr.data())
+ sizeof(trace_arr_element_t) * (value->handleIdx & 0x7fffu)));
flMaxRange -= flTraceLength;
game_trace_t trace = {};
ray_t ray = {};
I::Trace->TraceShape(ray, &data.m_pos.at(data_t::e_pos::e_local), &end_pos, filter, trace);
I::Trace->ClipTraceToPlayers(data.m_pos.at(data_t::e_pos::e_local), end_pos, &filter, &trace, 0.F, 60.F, (1.F / (data.m_pos.at(data_t::e_pos::e_local) - end_pos).Length()) * (trace.m_end_pos - data.m_pos.at(data_t::e_pos::e_local)).Length());
if (trace.Fraction == 1.f)
break;
// calculate the damage based on the distance the bullet traveled
flTraceLength += trace.Fraction * flMaxRange;
data.m_dmg *= std::powf(data.m_wpn_data->m_flRangeModifier(), flTraceLength / 500.f);
// check is actually can shoot through
if (flTraceLength > 3000.f)
break;
L_PRINT(LOG_INFO) << "idx:" << trace.HitEntity->GetRefEHandle().GetEntryIndex() << " dmg:" << data.m_dmg;
if (trace.HitEntity->GetRefEHandle().GetEntryIndex() == data.m_target_pawn->GetRefEHandle().GetEntryIndex())
{
ScaleDamage2(game_trace.HitboxData->m_hitgroup, data.m_target_pawn, data.m_wpn_data->m_flArmorRatio(), data.m_wpn_data->m_flHeadshotMultiplier(), &data.m_dmg);
L_PRINT(LOG_INFO) << "dmg:" << data.m_dmg;
return true;
}
// check if the bullet can no longer continue penetrating materials
if (I::Trace->handle_bullet_penetration(&trace_data, &handle_bullet_data, value, false))
return false;
pen_count = handle_bullet_data.m_pen_count;
data.m_dmg = handle_bullet_data.m_dmg;
}
}
return false;
}*/
std::unique_ptr<c_auto_wall> g_auto_wall{};
}

View File

@ -0,0 +1,64 @@
#pragma once
#include "../../common.h"
#include <memory>
// used: draw system
#include "../../utilities/draw.h"
#include "../../sdk/datatypes/vector.h"
#include "../../sdk/datatypes/transform.h"
#include "../../sdk/datatypes/qangle.h"
#include "../cstrike/core/config.h"
#include <array>
class C_BaseEntity;
class CCSWeaponBaseVData;
class Vector_t;
class C_CSPlayerPawn;
class CCSPlayerController;
class CBaseHandle;
class CEntityInstance;
class CUserCmd;
class CBaseUserCmdPB;
class QAngle_t;
class IGameEvent;
namespace F::AUTOWALL {
class c_auto_wall {
public:
struct data_t {
enum e_pos { e_local, e_target };
data_t() = default;
CS_INLINE data_t(const Vector_t local_pos, const Vector_t target_pos,
C_BaseEntity* target,
C_BaseEntity* local,
C_CSPlayerPawn* localpawn, C_CSPlayerPawn* targetpawn,
CCSWeaponBaseVData* wpn_data, const bool fire_bullet) noexcept :
m_pos{ local_pos, target_pos },
m_target(target),
m_local(local),
m_local_pawn(localpawn),
m_target_pawn(targetpawn),
m_wpn_data(wpn_data),
m_can_hit(fire_bullet){}
std::array< Vector_t, static_cast<int>(sizeof(e_pos)) > m_pos{ };
C_BaseEntity* m_target{ }, * m_local{ };
C_CSPlayerPawn* m_local_pawn{};
C_CSPlayerPawn* m_target_pawn{};
CCSWeaponBaseVData* m_wpn_data{ };
bool m_can_hit{ };
float m_dmg{ };
} m_data;
void pen(data_t& data, const Vector_t local_pos, const Vector_t target_pos, C_BaseEntity* target, C_BaseEntity* local, C_CSPlayerPawn* localpawn, C_CSPlayerPawn* targetpawn,
CCSWeaponBaseVData* wpn_data, float &dmg, bool &valid);
void ScaleDamage(data_t& data, const int hitgroup, C_CSPlayerPawn* entity);
bool FireBullet(data_t& data, float &dmg, bool &valid);
void ScaleDamage2(const int iHitGroup, C_CSPlayerPawn* pCSPlayer, const float flWeaponArmorRatio, const float flWeaponHeadShotMultiplier, float* pflDamageToScale);
public:
[[nodiscard]] CS_INLINE auto get_data(data_t& data) const noexcept { return data; }
};
extern std::unique_ptr<c_auto_wall> g_auto_wall;
}

View File

@ -0,0 +1,336 @@
#include "post_processing.hpp"
// WIP
#define SAFE_RELEASE(p) \
{ \
if (p) { \
(p)->Release(); \
(p) = nullptr; \
} \
}
static inline ID3D11Device* pDevice; // DO NOT RELEASE!
static inline ID3D11DeviceContext* pDeviceContext;
static inline ID3D11RenderTargetView* pRenderTarget; // DO NOT RELEASE!
static inline IDXGISwapChain* pSwapChain;
[[nodiscard]] static ID3D11Texture2D* createTexture(int width,
int height) noexcept {
D3D11_TEXTURE2D_DESC desc = {};
desc.Width = width;
desc.Height = height;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.SampleDesc.Count = 1;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
ID3D11Texture2D* texture = nullptr;
pDevice->CreateTexture2D(&desc, nullptr, &texture);
return texture;
}
static void copyBackbufferToTexture(ID3D11Texture2D* texture) noexcept {
pSwapChain->GetBuffer(0, __uuidof(texture),
reinterpret_cast<void**>(&texture));
}
static void setRenderTarget(ID3D11Texture2D* rtTexture) noexcept {
ID3D11RenderTargetView* rtv = nullptr;
pDevice->CreateRenderTargetView(rtTexture, nullptr, &rtv);
pDeviceContext->OMSetRenderTargets(1, &rtv, nullptr);
rtv->Release();
}
class ShaderProgram {
public:
~ShaderProgram() {
if (pixelShader) pixelShader->Release();
}
void use(float uniform, int location) const noexcept {
pDeviceContext->PSSetShader(pixelShader, nullptr, 0);
pDeviceContext->PSSetConstantBuffers(location, 1, &constBuffer);
}
void init(const BYTE* pixelShaderSrc, size_t size) noexcept {
if (initialized) return;
initialized = true;
pDevice->CreatePixelShader(pixelShaderSrc, size, nullptr, &pixelShader);
}
private:
ID3D11PixelShader* pixelShader = nullptr;
ID3D11Buffer* constBuffer = nullptr;
bool initialized = false;
};
class BlurEffect {
public:
static void draw(ImDrawList* drawList, float alpha) noexcept {
instance()._draw(drawList, alpha);
}
static void draws(ImDrawList* drawList, const ImVec2& p_min,
const ImVec2& p_max, float alpha) noexcept {
instance()._draws(drawList, p_min, p_max, alpha);
}
static void clearTextures() noexcept {
SAFE_RELEASE(instance().pBlurTexture1);
SAFE_RELEASE(instance().pBlurTexture2);
}
private:
ID3D11RenderTargetView* pRTBackup = nullptr;
ID3D11Texture2D* pBlurTexture1 = nullptr;
ID3D11Texture2D* pBlurTexture2 = nullptr;
ID3D11RasterizerState* pRasterStateWithScissorDisabled = nullptr;
ID3D11RasterizerState* pOriginalRasterState = nullptr;
ID3D11RenderTargetView* pBlurTexture1RTV = nullptr;
ID3D11RenderTargetView* pBlurTexture2RTV = nullptr;
ID3D11Buffer* pVSConstantBuffer = nullptr;
ID3D11ShaderResourceView* pBlurTexture1SRV = nullptr;
ID3D11ShaderResourceView* pBlurTexture2SRV = nullptr;
ShaderProgram blurShaderX;
ShaderProgram blurShaderY;
int backbufferWidth = 0;
int backbufferHeight = 0;
static constexpr auto blurDownsample = 2;
BlurEffect() = default;
BlurEffect(const BlurEffect&) = delete;
~BlurEffect() {
SAFE_RELEASE(pRTBackup);
SAFE_RELEASE(pRasterStateWithScissorDisabled);
SAFE_RELEASE(pOriginalRasterState);
SAFE_RELEASE(pBlurTexture1);
SAFE_RELEASE(pBlurTexture2);
SAFE_RELEASE(pBlurTexture1RTV);
SAFE_RELEASE(pBlurTexture2RTV);
SAFE_RELEASE(pBlurTexture1SRV);
SAFE_RELEASE(pBlurTexture2SRV);
SAFE_RELEASE(pVSConstantBuffer);
}
static BlurEffect& instance() noexcept {
static BlurEffect blurEffect;
return blurEffect;
}
static void begin(const ImDrawList*, const ImDrawCmd*) noexcept {
instance()._begin();
}
static void firstPass(const ImDrawList*, const ImDrawCmd*) noexcept {
instance()._firstPass();
}
static void secondPass(const ImDrawList*, const ImDrawCmd*) noexcept {
instance()._secondPass();
}
static void end(const ImDrawList*, const ImDrawCmd*) noexcept {
instance()._end();
}
void createTextures() noexcept {
if (const auto [width, height] = ImGui::GetIO().DisplaySize;
backbufferWidth != static_cast<int>(width) ||
backbufferHeight != static_cast<int>(height)) {
clearTextures();
backbufferWidth = static_cast<int>(width);
backbufferHeight = static_cast<int>(height);
}
if (!pBlurTexture1)
pBlurTexture1 = createTexture(backbufferWidth / blurDownsample,
backbufferHeight / blurDownsample);
if (!pBlurTexture2)
pBlurTexture2 = createTexture(backbufferWidth / blurDownsample,
backbufferHeight / blurDownsample);
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc = {};
rtvDesc.Format =
DXGI_FORMAT_R8G8B8A8_UNORM; // Match this with your texture format.
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtvDesc.Texture2D.MipSlice = 0;
pDevice->CreateRenderTargetView(pBlurTexture1, &rtvDesc, &pBlurTexture1RTV);
pDevice->CreateRenderTargetView(pBlurTexture2, &rtvDesc, &pBlurTexture2RTV);
}
void createShaders() noexcept {
blurShaderX.init(reinterpret_cast<const BYTE*>(gaussian_blur_x),
sizeof(gaussian_blur_x));
blurShaderY.init(reinterpret_cast<const BYTE*>(gaussian_blur_y),
sizeof(gaussian_blur_y));
}
void _begin() noexcept {
pDeviceContext->OMGetRenderTargets(1, &pRTBackup, nullptr);
copyBackbufferToTexture(pBlurTexture1);
D3D11_SAMPLER_DESC sampDesc = {};
sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
sampDesc.MaxLOD = D3D11_FLOAT32_MAX;
ID3D11SamplerState* samplerState;
pDevice->CreateSamplerState(&sampDesc, &samplerState);
pDeviceContext->PSSetSamplers(0, 1, &samplerState);
pDeviceContext->RSGetState(&pOriginalRasterState);
D3D11_RASTERIZER_DESC rasterDesc = {};
rasterDesc.FillMode = D3D11_FILL_SOLID; // Solid fill mode
rasterDesc.CullMode = D3D11_CULL_BACK; // Cull back-facing triangles
rasterDesc.ScissorEnable = FALSE; // Disable scissor test
rasterDesc.DepthClipEnable = TRUE; // Enable depth clipping
HRESULT hr = pDevice->CreateRasterizerState(
&rasterDesc, &pRasterStateWithScissorDisabled);
if (FAILED(hr)) {
printf("Failed CreateRasterizerState\n");
}
pDeviceContext->RSSetState(pRasterStateWithScissorDisabled);
D3D11_BUFFER_DESC cbDesc = {};
cbDesc.Usage = D3D11_USAGE_DEFAULT;
cbDesc.ByteWidth = sizeof(VSConstants);
cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
pDevice->CreateBuffer(&cbDesc, nullptr, &pVSConstantBuffer);
float aspectRatio = static_cast<float>(backbufferWidth) /
static_cast<float>(backbufferHeight);
DirectX::XMMATRIX projection = DirectX::XMMatrixOrthographicOffCenterLH(
-1.0f / aspectRatio, 1.0f / aspectRatio, -1.0f, 1.0f, 0.0f, 1.0f);
VSConstants vsConsts = {};
vsConsts.projection = XMMatrixTranspose(
projection); // HLSL expects matrices to be transposed
pDeviceContext->UpdateSubresource(pVSConstantBuffer, 0, nullptr, &vsConsts,
0, 0);
pDeviceContext->VSSetConstantBuffers(0, 1, &pVSConstantBuffer);
}
void _firstPass() noexcept {
blurShaderX.use(2.0f / (backbufferWidth / blurDownsample), 0);
pDeviceContext->OMSetRenderTargets(1, &pBlurTexture2RTV, nullptr);
}
void _secondPass() noexcept {
blurShaderY.use(2.0f / (backbufferHeight / blurDownsample), 0);
pDeviceContext->OMSetRenderTargets(1, &pBlurTexture1RTV, nullptr);
pDevice->CreateShaderResourceView(pBlurTexture2, nullptr,
&pBlurTexture2SRV);
}
void _end() noexcept {
pDeviceContext->OMSetRenderTargets(1, &pRTBackup, nullptr);
pRTBackup->Release();
pDeviceContext->PSSetShader(nullptr, nullptr, 0);
pDeviceContext->RSSetState(pOriginalRasterState);
if (pRasterStateWithScissorDisabled)
pRasterStateWithScissorDisabled->Release();
}
void _draw(ImDrawList* drawList, float alpha) noexcept {
createTextures();
createShaders();
if (!pBlurTexture1RTV || !pBlurTexture2RTV) return;
drawList->AddCallback(&begin, nullptr);
for (int i = 0; i < 8; ++i) {
drawList->AddCallback(&firstPass, nullptr);
pDevice->CreateShaderResourceView(pBlurTexture1, nullptr,
&pBlurTexture1SRV);
drawList->AddImage(
(ImTextureID)pBlurTexture1SRV, ImVec2(-1.0f, -1.0f),
ImVec2(1.0f, 1.0f)); // Assuming blurTexture1SRV is the Shader
// Resource View for blurTexture1
drawList->AddCallback(&secondPass, nullptr);
drawList->AddImage((ImTextureID)pBlurTexture2SRV, ImVec2(-1.0f, -1.0f),
ImVec2(1.0f, 1.0f)); // And similarly for blurTexture2
}
drawList->AddCallback(&end, nullptr);
drawList->AddCallback(ImDrawCallback_ResetRenderState, nullptr);
drawList->AddImage(
reinterpret_cast<ImTextureID>(pBlurTexture1SRV), {0.0f, 0.0f},
{backbufferWidth * 1.0f, backbufferHeight * 1.0f}, {0.0f, 0.0f},
{1.0f, 1.0f}, IM_COL32(255, 255, 255, 255 * alpha));
if (pOriginalRasterState) pOriginalRasterState->Release();
}
void _draws(ImDrawList* drawList, const ImVec2& p_min, const ImVec2& p_max,
float alpha) noexcept {
createTextures();
createShaders();
if (!pBlurTexture1RTV || !pBlurTexture2RTV) return;
drawList->AddCallback(&begin, nullptr);
for (int i = 0; i < 8; ++i) {
drawList->AddCallback(&firstPass, nullptr);
pDevice->CreateShaderResourceView(pBlurTexture1, nullptr,
&pBlurTexture1SRV);
drawList->AddImage(reinterpret_cast<ImTextureID>(pBlurTexture1SRV), p_min,
p_max, {1.0f, 1.0f});
drawList->AddCallback(&secondPass, nullptr);
pDevice->CreateShaderResourceView(pBlurTexture2, nullptr,
&pBlurTexture2SRV);
drawList->AddImage(reinterpret_cast<ImTextureID>(pBlurTexture2SRV), p_min,
p_max, {1.0f, 1.0f});
}
drawList->AddCallback(&end, nullptr);
drawList->AddCallback(ImDrawCallback_ResetRenderState, nullptr);
drawList->AddImage(
reinterpret_cast<ImTextureID>(pBlurTexture2SRV), p_min, p_max,
ImVec2((float)backbufferWidth * 1, (float)backbufferHeight * 1),
ImVec2((float)backbufferWidth * 1, (float)backbufferHeight * 1),
IM_COL32(255, 255, 255, 255 * alpha));
}
};
void PostProcessing::setDevice(ID3D11Device* device,
ID3D11DeviceContext* deviceContext,
ID3D11RenderTargetView* renderTarget,
IDXGISwapChain* swapChain) noexcept {
pDevice = device;
pDeviceContext = deviceContext;
pRenderTarget = renderTarget;
pSwapChain = swapChain;
}
void PostProcessing::clearBlurTextures() noexcept {
BlurEffect::clearTextures();
}
void PostProcessing::onDeviceReset() noexcept { BlurEffect::clearTextures(); }
void PostProcessing::performFullscreenBlur(ImDrawList* drawList,
float alpha) noexcept {
BlurEffect::draw(drawList, alpha);
}
void PostProcessing::performBlur(ImDrawList* drawList, const ImVec2& p_min,
const ImVec2& p_max, float alpha) noexcept {
BlurEffect::draws(drawList, p_min, p_max, alpha);
}

View File

@ -0,0 +1,30 @@
#pragma once
// WIP
#define IMGUI_DEFINE_MATH_OPERATORS
#include <DirectXMath.h>
#include <d3d11.h>
#include <dxgi1_2.h>
#include <imgui.h>
#include <algorithm>
#include <exception>
#include <memory>
#include "../../sdk/shaders/build/gaussian_blur.hpp"
struct VSConstants {
DirectX::XMMATRIX projection;
};
namespace PostProcessing {
void setDevice(ID3D11Device* device, ID3D11DeviceContext* deviceContext,
ID3D11RenderTargetView* renderTarget,
IDXGISwapChain* swapChain) noexcept;
void clearBlurTextures() noexcept;
void onDeviceReset() noexcept;
void performFullscreenBlur(ImDrawList* drawList, float alpha) noexcept;
void performBlur(ImDrawList* drawList, const ImVec2& p_min, const ImVec2& p_max,
float alpha) noexcept;
} // namespace PostProcessing

View File

@ -0,0 +1,163 @@
#pragma once
#include "../../common.h"
#include <memory>
// used: draw system
#include "../../utilities/draw.h"
#include "../../sdk/datatypes/vector.h"
#include "../../sdk/datatypes/transform.h"
#include "../../sdk/datatypes/qangle.h"
#include "../cstrike/core/config.h"
class CCSPlayerController;
class C_BaseEntity;
class C_CSPlayerPawn;
class CBaseHandle;
class CEntityInstance;
class CUserCmd;
class CBaseUserCmdPB;
class QAngle_t;
class CCSGOInput;
class IGameEvent;
class C_CSWeaponBase;
class CCSWeaponBaseVData;
class scan_data;
class scan_point;
class scanned_target;
#define MAX_STUDIO_BONES 1024
#include <array>
namespace F::RAGE
{
enum events {
round_start = 1,
player_death = 2,
};
class impl {
public:
enum reset {
entity,
aimbot
};
enum scan_mode {
single, /* only 1 hitbox */
adaptive /* multiple bones pushed in the same time */
};
enum hitboxes {
scan_head,
scan_neck,
scan_chest,
scan_pelvis
};
enum stop_mode {
slow = 0,
early = 1
};
enum silent_info {
skipping = 0,
on_tick = 1,
};
struct aim_info {
int minimum_damage;
int rage_hitchance;
int rage_target_select;
int rage_enable;
bool auto_stop;
bool penetration;
bool remove_weapon_accuracy_spread;
bool hitbox_head;
bool hitbox_neck;
bool hitbox_uppeer_chest;
bool hitbox_chest;
bool hitbox_stomach;
bool hitbox_legs;
bool hitbox_feets;
bool rapid_fire;
bool failed_hitchance = false;
bool do_rapid_fire;
bool accurate;
}rage_data;
enum command_msg {
none = 0,
rapid_fire = 1,
teleport = 2,
silent = 3,
};
enum response_msg {
empty = 0,
validated_view_angles = 1,
};
struct SubTickData {
QAngle_t best_point = QAngle_t(0, 0, 0);
Vector_t best_point_vec = Vector_t(0, 0, 0);
command_msg command = command_msg::none;
response_msg response = response_msg::empty;
void reset() {
best_point.Reset();
best_point_vec = Vector_t(0, 0, 0);
command = command_msg::none;
response = response_msg::empty;
}
}sub_tick_data;
float GetSpread(C_CSWeaponBase* weapon);
float GetInaccuracy(C_CSPlayerPawn* pLocal, C_CSWeaponBase* weapon);
float HitchanceFast(C_CSPlayerPawn* pLocal, C_CSWeaponBase* weapon);
void Hitchance(C_CSPlayerPawn* pLocal, C_CSPlayerPawn* record, C_CSWeaponBase* weapon, QAngle_t vAimpoint);
void AutomaticStop(C_CSPlayerPawn* pLocal, C_CSWeaponBase* weapon, CUserCmd* cmd, stop_mode mode = slow);
void SortTarget();
/* void inits */
bool valid(C_CSPlayerPawn* pawn, C_CSPlayerPawn* pLocal, bool check = false);
void ScanPoint(C_CSPlayerPawn* pLocal, CUserCmd* cmd, C_CSPlayerPawn* record, scan_data& data, const Vector_t& shoot_pos, bool optimized);
std::vector <scan_point> get_points(C_CSPlayerPawn* pLocal, C_CSPlayerPawn* record, uint32_t hitbox, bool from_aim);
void Scan();
void Triggerbot(CUserCmd* cmd, C_BaseEntity* localent, C_BaseEntity* playerent, C_CSPlayerPawn* local, C_CSPlayerPawn* player, CCSWeaponBaseVData* vdata);
void BuildSeed();
void SetupTarget(C_CSPlayerPawn* pawn);
void SetupAdaptiveWeapon(C_CSPlayerPawn* pawn);
void ScanTarget(C_CSPlayerPawn* pLocal, CUserCmd* cmd, QAngle_t viewangles);
Vector_t eye_pos;
float ScaleDamage(C_CSPlayerPawn* target, C_CSPlayerPawn* pLocal, C_CSWeaponBase* weapon, Vector_t aim_point, float& dmg, bool& canHit);
bool CanHit(Vector_t start, Vector_t end, C_CSPlayerPawn* pLocal, C_CSPlayerPawn* record, int box);
void Reset(reset type);
void Run(C_CSPlayerPawn* pLocal, CCSGOInput* pInput, CUserCmd* cmd);
bool Ready(C_CSPlayerPawn* pLocal);
void Events(IGameEvent* event_listener, events type);
bool IsAccurate(scan_data& data, CUserCmd* cmd, C_CSPlayerPawn* local);
bool Attack(CUserCmd* cmd, C_CSPlayerPawn* pLocal, scan_data& data);
void AjustRecoil(C_CSPlayerPawn* player, CUserCmd* pCmd);
/* init class */
aim_info aimbot_info;
silent_info silent_info;
inline static std::vector<std::pair<float, float>> m_computed_seeds;
};
const auto rage = std::make_unique<impl>();
}
namespace F::LAGCOMP
{
class impl {
public:
/* void inits */
void Initialize();
void Start(CUserCmd* cmd) noexcept;
void Render() noexcept;
};
const auto lagcomp = std::make_unique<impl>();
}

View File

@ -0,0 +1,11 @@
#include "ccsinventorymanager.hpp"
#include "../cstrike/utilities/memory.h"
#include "../cstrike/core/interfaces.h"
#include "../cstrike/core/hooks.h"
CCSInventoryManager* CCSInventoryManager::GetInstance() {
if (!H::fnGetInventoryManager) return nullptr;
return H::fnGetInventoryManager();
}

View File

@ -0,0 +1,17 @@
#pragma once
#include "../cstrike/utilities/memory.h"
class CCSPlayerInventory;
class CCSInventoryManager {
public:
static CCSInventoryManager* GetInstance();
auto EquipItemInLoadout(int iTeam, int iSlot, uint64_t iItemID) {
return MEM::CallVFunc<bool, 54u>( this, iTeam, iSlot, iItemID);
}
auto GetLocalInventory() {
return MEM::CallVFunc<CCSPlayerInventory*, 57u>(this);
}
};

View File

@ -0,0 +1,127 @@
#include "ccsplayerinventory.hpp"
#include "../cstrike/sdk/entity.h"
#include "../cstrike/utilities/memory.h"
#include "../cstrike/core/hooks.h"
static CGCClientSharedObjectTypeCache* CreateBaseTypeCache(
CCSPlayerInventory* pInventory) {
if (H::fnGetClientSystem() == nullptr) {
L_PRINT(LOG_ERROR) << "failed to get client sys";
return nullptr;
}
CGCClientSystem* pGCClientSystem = H::fnGetClientSystem();
L_PRINT(LOG_ERROR) << "1";
if (!pGCClientSystem) return nullptr;
CGCClient* pGCClient = pGCClientSystem->GetCGCClient();
if (!pGCClient) return nullptr;
L_PRINT(LOG_ERROR) << "2";
CGCClientSharedObjectCache* pSOCache =
pGCClient->FindSOCache(pInventory->GetOwner());
if (!pSOCache) return nullptr;
L_PRINT(LOG_ERROR) << "3";
return pSOCache->CreateBaseTypeCache(k_EEconTypeItem);
}
CCSPlayerInventory* CCSPlayerInventory::GetInstance() {
CCSInventoryManager* pInventoryManager = CCSInventoryManager::GetInstance();
if (!pInventoryManager) return nullptr;
return pInventoryManager->GetLocalInventory();
}
bool CCSPlayerInventory::AddEconItem(CEconItem* pItem) {
// Helper function to aid in adding items.
if (!pItem) return false;
CGCClientSharedObjectTypeCache* pSOTypeCache = ::CreateBaseTypeCache(this);
if (!pSOTypeCache || !pSOTypeCache->AddObject((CSharedObject*)pItem))
return false;
SOCreated(GetOwner(), (CSharedObject*)pItem, eSOCacheEvent_Incremental);
return true;
}
void CCSPlayerInventory::RemoveEconItem(CEconItem* pItem) {
// Helper function to aid in removing items.
if (!pItem) return;
CGCClientSharedObjectTypeCache* pSOTypeCache = ::CreateBaseTypeCache(this);
if (!pSOTypeCache) return;
const CUtlVector<CEconItem*>& pSharedObjects =
pSOTypeCache->GetVecObjects<CEconItem*>();
if (!pSharedObjects.Find(pItem)) return;
SODestroyed(GetOwner(), (CSharedObject*)pItem, eSOCacheEvent_Incremental);
pSOTypeCache->RemoveObject((CSharedObject*)pItem);
pItem->Destruct();
}
std::pair<uint64_t, uint32_t> CCSPlayerInventory::GetHighestIDs() {
uint64_t maxItemID = 0;
uint32_t maxInventoryID = 0;
CGCClientSharedObjectTypeCache* pSOTypeCache = ::CreateBaseTypeCache(this);
if (pSOTypeCache) {
const CUtlVector<CEconItem*>& vecItems =
pSOTypeCache->GetVecObjects<CEconItem*>();
for (CEconItem* it : vecItems) {
if (!it) continue;
// Checks if item is default.
if ((it->m_ulID & 0xF000000000000000) != 0) continue;
maxItemID = std::max(maxItemID, it->m_ulID);
maxInventoryID = std::max(maxInventoryID, it->m_unInventory);
}
}
return std::make_pair(maxItemID, maxInventoryID);
}
C_EconItemView* CCSPlayerInventory::GetItemViewForItem(uint64_t itemID) {
C_EconItemView* pEconItemView = nullptr;
const CUtlVector<C_EconItemView*>& pItems = GetItemVector();
for (C_EconItemView* it : pItems) {
if (it && it->m_iItemID() == itemID) {
pEconItemView = it;
break;
}
}
return pEconItemView;
}
CEconItem* CCSPlayerInventory::GetSOCDataForItem(uint64_t itemID) {
CEconItem* pSOCData = nullptr;
L_PRINT(LOG_INFO) << "ID WE WANT: " << (int)itemID;
CGCClientSharedObjectTypeCache* pSOTypeCache = ::CreateBaseTypeCache(this);
if (pSOTypeCache) {
L_PRINT(LOG_INFO) << "got pSOTypeCache";
const CUtlVector<CEconItem*>& vecItems =
pSOTypeCache->GetVecObjects<CEconItem*>();
for (CEconItem* it : vecItems) {
if (it && (int)it->m_ulID == (int)itemID) {
L_PRINT(LOG_INFO) << "got m_unDefIndex: " << it->m_unDefIndex;
L_PRINT(LOG_INFO) << "got m_ulID: " << (int)it->m_ulID;
L_PRINT(LOG_INFO) << "got m_ulOriginalID: " << (int)it->m_ulOriginalID;
pSOCData = it;
return pSOCData;
break;
}
}
}
return pSOCData;
}

View File

@ -0,0 +1,49 @@
#pragma once
#include <utility>
#include "../cstrike/sdk/entity.h"
#include "../cstrike/sdk/datatypes/utlvector.h"
#include "ccsinventorymanager.hpp"
#include <cstdint>
class CCSPlayerInventory {
public:
static CCSPlayerInventory* GetInstance();
auto SOCreated(SOID_t owner, CSharedObject* pObject, ESOCacheEvent eEvent) {
return MEM::CallVFunc<void, 0u>(this, owner, pObject, eEvent);
}
auto SOUpdated(SOID_t owner, CSharedObject* pObject, ESOCacheEvent eEvent) {
return MEM::CallVFunc<void, 1u>(this, owner, pObject, eEvent);
}
auto SODestroyed(SOID_t owner, CSharedObject* pObject, ESOCacheEvent eEvent) {
return MEM::CallVFunc<void, 2u>(this, owner, pObject, eEvent);
}
auto GetItemInLoadout(int iClass, int iSlot) {
return MEM::CallVFunc<C_EconItemView*,8u>(this, iClass, iSlot);
}
bool AddEconItem(CEconItem* pItem);
void RemoveEconItem(CEconItem* pItem);
std::pair<uint64_t, uint32_t> GetHighestIDs();
C_EconItemView* GetItemViewForItem(uint64_t itemID);
CEconItem* GetSOCDataForItem(uint64_t itemID);
auto GetOwner() {
return *reinterpret_cast<SOID_t*>((uintptr_t)(this) + 0x10);
}
auto& GetItemVector() {
return *reinterpret_cast<CUtlVector<C_EconItemView*>*>(
(uintptr_t)(this) + 0x20);
}
};

View File

@ -0,0 +1,482 @@
#include <vector>
#include "skin_changer.hpp"
#include "../cstrike/sdk/interfaces/iengineclient.h"
#include "../../core/config.h"
#include "../../core/variables.h"
#include "../../sdk/datatypes/usercmd.h"
#include "../../core/sdk.h"
#include "../../sdk/entity.h"
#include "../../sdk/interfaces/iglobalvars.h"
#include "../../sdk/interfaces/cgameentitysystem.h"
#include "../cstrike/sdk/interfaces/iengineclient.h"
#include "../../sdk/datatypes/qangle.h"
#include "../../sdk/datatypes/vector.h"
#include "../cstrike/sdk/interfaces/inetworkclientservice.h"
#include "../cstrike/sdk/interfaces/ccsgoinput.h"
#include "../misc/movement.h"
#include "../cstrike/sdk/interfaces/ccsgoinput.h"
#include "../cstrike/sdk/interfaces/ienginecvar.h"
#include "../lagcomp/lagcomp.h"
#include "../cstrike/sdk/interfaces/events.h"
#include "../penetration/penetration.h"
#include "../cstrike/sdk/interfaces/itrace.h"
#include "../cstrike/core/spoofcall/syscall.h"
#include <iostream>
#include <memoryapi.h>
#include <mutex>
#include <array>
#include "../cstrike/sdk/interfaces/iengineclient.h"
#include "../../core/spoofcall/virtualization/VirtualizerSDK64.h"
#include "../../utilities/inputsystem.h"
#include "ccsinventorymanager.hpp"
#include "ccsplayerinventory.hpp"
#include "../cstrike/core/hooks.h"
static std::vector<uint64_t> g_vecAddedItemsIDs;
static int glove_frame = 0;
struct GloveInfo {
int itemId;
uint64_t itemHighId;
uint64_t itemLowId;
int itemDefId;
};
static GloveInfo addedGloves;
// Define a struct to hold glove information
struct material_info
{
skin_changer::material_record* p_mat_records;
uint32_t ui32_count;
};
void invalidate_glove_material(C_BaseViewModel* viewmodel)
{
material_info* p_mat_info = reinterpret_cast<material_info*>(reinterpret_cast<uint8_t*>(viewmodel) + 0xf80);
for (uint32_t i = 0; i < p_mat_info->ui32_count; i++)
{
if (p_mat_info->p_mat_records[i].identifer == skin_changer::material_magic_number__gloves)
{
p_mat_info->p_mat_records[i].ui32_type_index = 0xffffffff;
break;
}
}
}
void skin_changer::OnGlove(CCSPlayerInventory* pInventory, C_CSPlayerPawn* pLocalPawn, C_BaseViewModel* pViewModel, C_EconItemView* GlovesItem, CEconItemDefinition* GlovesDefinition) {
if (!pLocalPawn) return;
if (pLocalPawn->GetHealth() <= 0)
return;
if (!pViewModel)
return;
if (!GlovesItem)
return;
if (!GlovesDefinition) return;
if (addedGloves.itemId == 0)
return;
if (glove_frame)
{
invalidate_glove_material(pViewModel);
GlovesItem->m_bInitialized() = true;
pLocalPawn->m_bNeedToReApplyGloves() = true;
glove_frame--;
}
if (GlovesItem->m_iItemID() != addedGloves.itemId) {
glove_frame = 2;
GlovesItem->m_bDisallowSOC() = false;
GlovesItem->m_iItemID() = addedGloves.itemId;
GlovesItem->m_iItemIDHigh() = addedGloves.itemHighId;
GlovesItem->m_iItemIDLow() = addedGloves.itemLowId;
GlovesItem->m_iAccountID() = uint32_t(pInventory->GetOwner().m_id);
GlovesItem->m_iItemDefinitionIndex() = addedGloves.itemDefId;
GlovesItem->m_bDisallowSOC() = false;
pViewModel->GetGameSceneNode()->SetMeshGroupMask(1);
}
}
void skin_changer::OnFrameStageNotify(int frameStage) {
if (frameStage != 6) return;
CCSPlayerInventory* pInventory = CCSPlayerInventory::GetInstance();
if (!pInventory) return;
CGameEntitySystem* pEntitySystem = I::GameResourceService->pGameEntitySystem;
if (!pEntitySystem) return;
const uint64_t steamID = pInventory->GetOwner().m_id;
CCSPlayerController* pLocalPlayerController = CCSPlayerController::GetLocalPlayerController();
if (!pLocalPlayerController) return;
C_CSPlayerPawn* pLocalPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(pLocalPlayerController->GetPawnHandle());
if (!pLocalPawn) return;
if (pLocalPawn->GetHealth() <= 0)
return;
CCSPlayer_ViewModelServices* pViewModelServices = pLocalPawn->GetViewModelServices();
if (!pViewModelServices) return;
C_CSGOViewModel* pViewModel = I::GameResourceService->pGameEntitySystem->Get<C_CSGOViewModel>(pViewModelServices->m_hViewModel());
if (!pViewModel)
return;
C_EconItemView* pGloves = &pLocalPawn->m_EconGloves();
CEconItemDefinition* pGlovesDefinition = pGloves->GetStaticData();
skin_changer::OnGlove(pInventory, pLocalPawn, pViewModel, pGloves, pGlovesDefinition);
int highestIndex = pEntitySystem->GetHighestEntityIndex();
for (int i = 64 + 1; i <= highestIndex; ++i) {
C_BaseEntity* pEntity = pEntitySystem->Get(i);
if (!pEntity || !pEntity->IsWeapon()) continue;
C_CSWeaponBase* pWeapon = reinterpret_cast<C_CSWeaponBase*>(pEntity);
if (pWeapon->GetOriginalOwnerXuid() != steamID) continue;
CAttributeManager* pAttributeContainer = &pWeapon->m_AttributeManager();
if (!pAttributeContainer) continue;
C_EconItemView* pWeaponItemView = &pAttributeContainer->m_Item();
if (!pWeaponItemView) continue;
CEconItemDefinition* pWeaponDefinition =
pWeaponItemView->GetStaticData();
if (!pWeaponDefinition) continue;
CGameSceneNode* pWeaponSceneNode = pWeapon->GetGameSceneNode();
if (!pWeaponSceneNode) continue;
// No idea how to check this faster with the new loadout system.
C_EconItemView* pWeaponInLoadoutItemView = nullptr;
if (pWeaponDefinition->IsWeapon()) {
for (int i = 0; i <= 56; ++i) {
C_EconItemView* pItemView = pInventory->GetItemInLoadout(
pWeapon->m_iOriginalTeamNumber(), i);
if (!pItemView) continue;
if (pItemView->m_iItemDefinitionIndex() ==
pWeaponDefinition->m_nDefIndex) {
pWeaponInLoadoutItemView = pItemView;
break;
}
}
}
else {
pWeaponInLoadoutItemView = pInventory->GetItemInLoadout(
pWeapon->m_iOriginalTeamNumber(),
pWeaponDefinition->GetLoadoutSlot());
}
if (!pWeaponInLoadoutItemView)
continue;
// Check if skin is added by us.
auto it = std::find(g_vecAddedItemsIDs.cbegin(), g_vecAddedItemsIDs.cend(), pWeaponInLoadoutItemView->m_iItemID());
if (it == g_vecAddedItemsIDs.cend()) continue;
CEconItemDefinition* pWeaponInLoadoutDefinition = pWeaponInLoadoutItemView->GetStaticData();
if (!pWeaponInLoadoutDefinition) continue;
// Example: Will not equip FiveSeven skin on CZ. Not applies for knives.
const bool isKnife = pWeaponInLoadoutDefinition->IsKnife(false, pWeaponInLoadoutDefinition->m_pszItemBaseName);
L_PRINT(LOG_INFO) << "applying skin on:" << pWeaponInLoadoutDefinition->m_pszItemBaseName;
pWeaponItemView->m_bDisallowSOC() = false;
pWeaponInLoadoutItemView->m_bDisallowSOC() = false;
pWeaponItemView->m_iItemID() = pWeaponInLoadoutItemView->m_iItemID();
pWeaponItemView->m_iItemIDHigh() = pWeaponInLoadoutItemView->m_iItemIDHigh();
pWeaponItemView->m_iItemIDLow() = pWeaponInLoadoutItemView->m_iItemIDLow();
pWeaponItemView->m_iAccountID() = uint32_t(pInventory->GetOwner().m_id);
pWeaponItemView->m_iItemDefinitionIndex() = pWeaponInLoadoutDefinition->m_nDefIndex;
// pWeaponItemView->m_bIsStoreItem() = true;
//pWeaponItemView->m_bIsTradeItem() = true;
// Displays nametag and stattrak on the gun.
// Found by: https://www.unknowncheats.me/forum/members/2377851.html
/* if (!pWeapon->m_bUIWeapon()) {
pWeapon->AddStattrakEntity();
pWeapon->AddNametagEntity();
}*/
CBaseHandle hWeapon = pWeapon->GetRefEHandle();
if (isKnife) {
if (pViewModel && (pViewModel->m_hWeapon().GetEntryIndex() == hWeapon.GetEntryIndex() || pViewModel->m_hWeapon() == hWeapon)) {
pWeaponItemView->m_iItemDefinitionIndex() = pWeaponInLoadoutDefinition->m_nDefIndex;
const char* knifeModel = pWeaponInLoadoutDefinition->GetModelName();
CGameSceneNode* pViewModelSceneNode = pViewModel->GetGameSceneNode();
if (pViewModelSceneNode) {
pWeaponSceneNode->SetMeshGroupMask(2);
pViewModelSceneNode->SetMeshGroupMask(2);
}
pWeapon->SetModel(knifeModel);
pViewModel->SetModel(knifeModel);
pViewModel->pAnimationGraphInstance->pAnimGraphNetworkedVariables = nullptr;
}
}
else {
// Use legacy weapon models only for skins that require them.
// Probably need to cache this if you really care that much about
// performance
const char* model = pWeaponInLoadoutDefinition->GetModelName();
pWeapon->SetModel(model);
if (pViewModel && pViewModel->m_hWeapon() == hWeapon)
{
pViewModel->SetModel(model);
}
pWeaponSceneNode->SetMeshGroupMask(2);
if (pViewModel && pViewModel->m_hWeapon().GetEntryIndex() == hWeapon.GetEntryIndex()) {
CGameSceneNode* pViewModelSceneNode = pViewModel->GetGameSceneNode();
pViewModelSceneNode->SetMeshGroupMask(2);
}
}
}
}
#include "../cstrike/sdk/interfaces/ccsgoinput.h"
void skin_changer::OnEquipItemInLoadout(int team, int slot, uint64_t itemID) {
auto it =
std::find(g_vecAddedItemsIDs.begin(), g_vecAddedItemsIDs.end(), itemID);
if (it == g_vecAddedItemsIDs.end()) return;
CCSInventoryManager* pInventoryManager = CCSInventoryManager::GetInstance();
if (!pInventoryManager) return;
CCSPlayerInventory* pInventory = CCSPlayerInventory::GetInstance();
if (!pInventory) return;
C_EconItemView* pItemViewToEquip = pInventory->GetItemViewForItem(*it);
if (!pItemViewToEquip) return;
C_EconItemView* pItemInLoadout = pInventory->GetItemInLoadout(team, slot);
if (!pItemInLoadout) return;
CEconItemDefinition* pItemInLoadoutStaticData = pItemInLoadout->GetStaticData();
if (!pItemInLoadoutStaticData)
return;
// Equip default item. If you would have bought Deagle and you previously
// had R8 equipped it will now give you a Deagle.
const uint64_t defaultItemID = (std::uint64_t(0xF) << 60) | pItemViewToEquip->m_iItemDefinitionIndex();
pInventoryManager->EquipItemInLoadout(team, slot, defaultItemID);
CEconItem* pItemInLoadoutSOCData = pItemInLoadout->GetSOCData(nullptr);
if (!pItemInLoadoutSOCData)
return;
CEconItemDefinition* toequipdata = pItemViewToEquip->GetStaticData();
if (!toequipdata)
return;
if (toequipdata->IsWeapon() && !toequipdata->IsKnife(false, pItemInLoadoutStaticData->m_pszItemTypeName) && !toequipdata->IsGlove(false, pItemInLoadoutStaticData->m_pszItemTypeName)) {
pInventory->SOUpdated(pInventory->GetOwner(), (CSharedObject*)pItemInLoadoutSOCData, eSOCacheEvent_Incremental);
return;
}
else if (toequipdata->IsGlove(false, pItemInLoadoutStaticData->m_pszItemTypeName)) {
const uint64_t steamID = pInventory->GetOwner().m_id;
CCSPlayerController* pLocalPlayerController = CCSPlayerController::GetLocalPlayerController();
if (!pLocalPlayerController) return;
C_CSPlayerPawn* pLocalPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(pLocalPlayerController->GetPawnHandle());
if (!pLocalPawn) return;
if (pLocalPawn->GetHealth() <= 0)
return;
CCSPlayer_ViewModelServices* pViewModelServices = pLocalPawn->GetViewModelServices();
if (!pViewModelServices) return;
C_BaseViewModel* pViewModel = I::GameResourceService->pGameEntitySystem->Get<C_BaseViewModel>(pViewModelServices->m_hViewModel());
if (!pViewModel)
return;
// Create a struct to store glove information
addedGloves.itemId = pItemViewToEquip->m_iItemID();
addedGloves.itemHighId = pItemViewToEquip->m_iItemIDHigh();
addedGloves.itemLowId = pItemViewToEquip->m_iItemIDLow();
addedGloves.itemDefId = pItemViewToEquip->m_iItemDefinitionIndex();
C_EconItemView* pGloves = &pLocalPawn->m_EconGloves();
if (!pGloves)
return;
CEconItemDefinition* pGlovesDefinition = pGloves->GetStaticData();
if (!pGlovesDefinition)
return;
skin_changer::OnGlove(pInventory, pLocalPawn, pViewModel, pGloves, pGlovesDefinition);
pLocalPawn->m_bNeedToReApplyGloves() = true;
pInventory->SOUpdated(pInventory->GetOwner(), (CSharedObject*)pItemInLoadoutSOCData, eSOCacheEvent_Incremental);
return;
}
else if (toequipdata->IsKnife(false, pItemInLoadoutStaticData->m_pszItemTypeName)) {
pInventory->SOUpdated(pInventory->GetOwner(), (CSharedObject*)pItemInLoadoutSOCData, eSOCacheEvent_Incremental);
return;
}
}
void skin_changer::OnSetModel(C_BaseModelEntity* pEntity, const char*& model) {
// When you're lagging you may see the default knife for one second and this
// function fixes that.
if (!I::Engine->IsConnected() || !I::Engine->IsInGame())
return;
CCSPlayerController* pLocalPlayerController = CCSPlayerController::GetLocalPlayerController();
if (!pLocalPlayerController) return;
C_CSPlayerPawn* pLocalPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(pLocalPlayerController->GetPawnHandle());
if (!pLocalPawn) return;
if (pLocalPawn->GetHealth() <= 0)
return;
if (!pEntity || !pEntity->IsViewModel()) return;
C_BaseViewModel* pViewModel = (C_BaseViewModel*)pEntity;
if (!pViewModel)
return;
CCSPlayerInventory* pInventory = CCSPlayerInventory::GetInstance();
if (!pInventory) return;
const uint64_t steamID = pInventory->GetOwner().m_id;
C_CSWeaponBase* pWeapon = I::GameResourceService->pGameEntitySystem->Get<C_CSWeaponBase>(pViewModel->m_hWeapon());
if (!pWeapon) return;
if (!pWeapon || !pWeapon->IsWeapon() ||
pWeapon->GetOriginalOwnerXuid() != steamID)
return;
CAttributeManager* pAttributeContainer = &pWeapon->m_AttributeManager();
if (!pAttributeContainer) return;
C_EconItemView* pWeaponItemView = &pAttributeContainer->m_Item();
if (!pWeaponItemView) return;
CEconItemDefinition* pWeaponDefinition = pWeaponItemView->GetStaticData();
if (!pWeaponDefinition) return;
C_EconItemView* pWeaponInLoadoutItemView = pInventory->GetItemInLoadout(
pWeapon->m_iOriginalTeamNumber(), pWeaponDefinition->GetLoadoutSlot());
if (!pWeaponInLoadoutItemView) return;
// Check if skin is added by us.
auto it = std::find(g_vecAddedItemsIDs.cbegin(), g_vecAddedItemsIDs.cend(),
pWeaponInLoadoutItemView->m_iItemID());
if (it == g_vecAddedItemsIDs.cend()) return;
CEconItemDefinition* pWeaponInLoadoutDefinition =
pWeaponInLoadoutItemView->GetStaticData();
if (!pWeaponInLoadoutDefinition)// ||
return;
model = pWeaponInLoadoutDefinition->GetModelName();
}
void skin_changer::AddEconItemToList(CEconItem* pItem) {
g_vecAddedItemsIDs.emplace_back(pItem->m_ulID);
}
void skin_changer::Shutdown() {
CCSPlayerInventory* pInventory = CCSPlayerInventory::GetInstance();
if (!pInventory) return;
for (uint64_t id : g_vecAddedItemsIDs) {
pInventory->RemoveEconItem(pInventory->GetSOCDataForItem(id));
}
}
void skin_changer::OnRoundReset(IGameEvent* pEvent) {
if (!pEvent || g_vecAddedItemsIDs.empty()) return;
const char* eventName = pEvent->GetName();
if (!eventName) return;
CCSPlayerController* pLocalPlayerController = CCSPlayerController::GetLocalPlayerController();
if (!pLocalPlayerController )
return;
C_CSPlayerPawn* pLocalPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(pLocalPlayerController->GetPawnHandle());
if (!pLocalPawn) return;
}
void skin_changer::OnPreFireEvent(IGameEvent* pEvent) {
if (!pEvent) return;
const char* eventName = pEvent->GetName();
if (!eventName) return;
const auto pControllerWhoKilled = pEvent->get_player_controller("attacker");
if (pControllerWhoKilled == nullptr)
return;
const auto pControllerWhoDied = pEvent->get_player_controller("userid");
if (pControllerWhoDied == nullptr)
return;
if (pControllerWhoKilled->GetIdentity()->GetIndex() == pControllerWhoDied->GetIdentity()->GetIndex())
return;
CCSPlayerController* pLocalPlayerController = CCSPlayerController::GetLocalPlayerController();
if (!pLocalPlayerController || pControllerWhoKilled->GetIdentity()->GetIndex() != pLocalPlayerController->GetIdentity()->GetIndex())
return;
C_CSPlayerPawn* pLocalPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(pLocalPlayerController->GetPawnHandle());
if (!pLocalPawn) return;
CPlayer_WeaponServices* pWeaponServices = pLocalPawn->GetWeaponServices();
if (!pWeaponServices) return;
C_CSWeaponBase* pActiveWeapon = pLocalPawn->ActiveWeapon();
if (!pActiveWeapon) return;
CAttributeManager* pAttributeContainer = &pActiveWeapon->m_AttributeManager();
if (!pAttributeContainer) return;
C_EconItemView* pWeaponItemView = &pAttributeContainer->m_Item();
if (!pWeaponItemView) return;
CEconItemDefinition* pWeaponDefinition = pWeaponItemView->GetStaticData();
if (!pWeaponDefinition || !pWeaponDefinition->IsKnife(true, pWeaponDefinition->m_pszItemTypeName)) return;
const std::string_view token_name = CS_XOR("weapon");
CUtlStringToken token(token_name.data());
pEvent->SetString(token, pWeaponDefinition->GetSimpleWeaponName());
}

View File

@ -0,0 +1,41 @@
#pragma once
class IGameEvent;
class CEconItem;
class C_BaseModelEntity;
class CCSPlayerInventory;
class C_CSPlayerPawn;
class CEconItemDefinition;
class C_BaseViewModel;
class C_EconItemView;
namespace skin_changer {
enum material_magic_number : uint32_t
{
material_magic_number__gloves = 0xf143b82a,
material_magic_number__unknown1 = 0x1b52829c,
material_magic_number__unknown2 = 0xa6ebe9b9,
material_magic_number__unknown3 = 0x423b2ed4,
material_magic_number__unknown4 = 0xc8d7255e
};
struct material_record
{
uint32_t ui32_unknwonstatic;
material_magic_number identifer;
uint32_t ui32_handle;
uint32_t ui32_type_index;
};
void OnFrameStageNotify(int frameStage);
void OnGlove(CCSPlayerInventory* pInventory, C_CSPlayerPawn* pLocalPawn, C_BaseViewModel* pViewModel, C_EconItemView* GlovesItem, CEconItemDefinition* GlovesDefinition) ;
void OnPreFireEvent(IGameEvent* pEvent);
void OnRoundReset(IGameEvent* pEvent);
void OnEquipItemInLoadout(int team, int slot, uint64_t itemID);
void OnSetModel(C_BaseModelEntity* pEntity, const char*& model);
void AddEconItemToList(CEconItem* pItem);
void Shutdown();
} // namespace skin_changer

View File

@ -0,0 +1,31 @@
#include "visuals.h"
// used: source sdk
#include "../sdk/interfaces/iengineclient.h"
#include "../sdk/entity.h"
// used: overlay
#include "visuals/overlay.h"
#include "visuals/chams.h"
#include "../core/sdk.h"
using namespace F;
bool F::VISUALS::Setup()
{
if (!ams::chams->initialize())
{
L_PRINT(LOG_ERROR) << CS_XOR("failed to initialize DrawObject chams | swapping to K3V");
return true;
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("chams initialization completed");
return true;
}
bool F::VISUALS::OnDrawObject(void* pAnimatableSceneObjectDesc, void* pDx11, material_data_t* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2)
{
return ams::chams->draw_object(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
}

View File

@ -0,0 +1,10 @@
#pragma once
class material_data_t;
namespace F::VISUALS
{
bool Setup();
void OnFrame(const int nStage);
bool OnDrawObject(void* pAnimatableSceneObjectDesc, void* pDx11, material_data_t* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2);
}

View File

@ -0,0 +1,500 @@
#include "chams.h"
// used: game's interfaces
#include "../../core/interfaces.h"
#include "../../sdk/interfaces/imaterialsystem.h"
#include "../../sdk/interfaces/igameresourceservice.h"
#include "../../sdk/interfaces/cgameentitysystem.h"
#include "../../core/sdk.h"
#include "../../sdk/entity.h"
#include "../cstrike/sdk/datatypes/resourceutils.h"
#include "../cstrike/sdk/datatypes/buf/utlbuffer.h"
#include <iostream>
// used: original call in hooked function
#include "../../core/hooks.h"
// used: cheat variables
#include"../cstrike/sdk/interfaces/imaterialsystem.h"
#include "../../core/variables.h"
#include <stdexcept>
inline bool(CS_FASTCALL* fnLoadBuffer)(CUtlBuffer*) = nullptr;
// custom material
struct custom_material_data_t {
material2_t* m_material;
material2_t* m_material_z;
};
// material list.
enum material_list_t {
material_white,
material_default,
material_illum,
material_size
};
// array
static custom_material_data_t array_materials[material_size]; // material max
material2_t* create_material_glow2_visible(const char* m_name) {
const char szVmatBuffer[] = R"#(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d}
format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "solidcolor.vfx"
F_SELF_ILLUM = 1
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
F_IGNOREZ = 0
F_DISABLE_Z_WRITE = 0
F_DISABLE_Z_BUFFERING = 0
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tRoughness = resource:"materials/default/default_normal_tga_b3f4ec4c.vtex"
g_tMetalness = resource:"materials/default/default_normal_tga_b3f4ec4c.vtex"
g_tSelfIllumMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
TextureAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
g_tAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
g_vColorTint = [ 20.000000, 20.000000, 20.000000, 20.000000 ]
g_flSelfIllumScale = [ 5.000000, 5.000000, 5.000000, 5.000000 ]
g_flSelfIllumBrightness = [ 5.000000, 5.000000, 5.000000, 5.000000 ]
g_vSelfIllumTint = [ 10.000000, 10.000000, 10.000000, 10.000000 ]
} )#";
auto buffer = new unsigned char[0x100 + sizeof(CKeyValues3)];
CRT::MemorySet(buffer, 0, sizeof(buffer));
CKeyValues3* kv3 = (CKeyValues3*)(buffer + 0x100);
KV3IVD_t kv3ID;
kv3ID.szName = m_name;
kv3ID.unk0 = 0x469806E97412167C;
kv3ID.unk1 = 0xE73790B53EE6F2AF;
if (!MEM::load_key_value(kv3, nullptr, szVmatBuffer, &kv3ID, nullptr))
throw;
material2_t** custom_material;
MEM::fnCreateMaterial(nullptr, &custom_material, m_name, kv3, 0, 1);
return *custom_material;
}
material2_t* create_material_glow2_invisible(const char* m_name) {
const char szVmatBuffer[] = R"#(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d}
format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "solidcolor.vfx"
F_SELF_ILLUM = 1
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
F_IGNOREZ = 1
F_DISABLE_Z_WRITE = 1
F_DISABLE_Z_BUFFERING = 1
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tRoughness = resource:"materials/default/default_normal_tga_b3f4ec4c.vtex"
g_tMetalness = resource:"materials/default/default_normal_tga_b3f4ec4c.vtex"
g_tSelfIllumMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
TextureAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
g_tAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
g_vColorTint = [ 20.000000, 20.000000, 20.000000, 20.000000 ]
g_flSelfIllumScale = [ 5.000000, 5.000000, 5.000000, 5.000000 ]
g_flSelfIllumBrightness = [ 5.000000, 5.000000, 5.000000, 5.000000 ]
g_vSelfIllumTint = [ 10.000000, 10.000000, 10.000000, 10.000000 ]
} )#";
auto buffer = new unsigned char[0x100 + sizeof(CKeyValues3)];
CRT::MemorySet(buffer, 0, sizeof(buffer));
CKeyValues3* kv3 = (CKeyValues3*)(buffer + 0x100);
KV3IVD_t kv3ID;
kv3ID.szName = m_name;
kv3ID.unk0 = 0x469806E97412167C;
kv3ID.unk1 = 0xE73790B53EE6F2AF;
if (!MEM::load_key_value(kv3, nullptr, szVmatBuffer, &kv3ID, nullptr))
throw;
material2_t** custom_material;
MEM::fnCreateMaterial(nullptr, &custom_material, m_name, kv3, 0, 1);
return *custom_material;
}
material2_t* create_material_default_visible(const char* m_name) {
const char szVmatBuffer[] = R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "csgo_complex.vfx"
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
g_vColorTint = [1, 1, 1, 1]
TextureAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tTintMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
})";
auto buffer = new unsigned char[0x100 + sizeof(CKeyValues3)];
CRT::MemorySet(buffer, 0, sizeof(buffer));
CKeyValues3* kv3 = (CKeyValues3*)(buffer + 0x100);
KV3IVD_t kv3ID;
kv3ID.szName = m_name;
kv3ID.unk0 = 0x469806E97412167C;
kv3ID.unk1 = 0xE73790B53EE6F2AF;
if (!MEM::load_key_value(kv3, nullptr, szVmatBuffer, &kv3ID, nullptr))
throw;
material2_t** custom_material;
MEM::fnCreateMaterial(nullptr, &custom_material, m_name, kv3, 0, 1);
return *custom_material;
}
material2_t* create_material_default_invisible(const char* m_name) {
const char szVmatBuffer[] = R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "csgo_complex.vfx"
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
F_DISABLE_Z_BUFFERING = 1
g_vColorTint = [1, 1, 1, 1]
TextureAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tTintMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
})";
auto buffer = new unsigned char[0x100 + sizeof(CKeyValues3)];
CRT::MemorySet(buffer, 0, sizeof(buffer));
CKeyValues3* kv3 = (CKeyValues3*)(buffer + 0x100);
KV3IVD_t kv3ID;
kv3ID.szName = m_name;
kv3ID.unk0 = 0x469806E97412167C;
kv3ID.unk1 = 0xE73790B53EE6F2AF;
if (!MEM::load_key_value(kv3, nullptr, szVmatBuffer, &kv3ID, nullptr))
throw;
material2_t** custom_material;
MEM::fnCreateMaterial(nullptr, &custom_material, m_name, kv3, 0, 1);
return *custom_material;
}
material2_t* create_material_flat_visible(const char* m_name) {
const char szVmatBuffer[] = R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "csgo_unlitgeneric.vfx"
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
F_BLEND_MODE = 1
g_vColorTint = [1, 1, 1, 1]
TextureAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tTintMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
})";
auto buffer = new unsigned char[0x100 + sizeof(CKeyValues3)];
CRT::MemorySet(buffer, 0, sizeof(buffer));
CKeyValues3* kv3 = (CKeyValues3*)(buffer + 0x100);
KV3IVD_t kv3ID;
kv3ID.szName = m_name;
kv3ID.unk0 = 0x469806E97412167C;
kv3ID.unk1 = 0xE73790B53EE6F2AF;
if (!MEM::load_key_value(kv3, nullptr, szVmatBuffer, &kv3ID, nullptr))
throw;
material2_t** custom_material;
MEM::fnCreateMaterial(nullptr, &custom_material, m_name, kv3, 0, 1);
return *custom_material;
}
material2_t* create_material_flat_invisible(const char* m_name) {
const char szVmatBuffer[] = R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "csgo_unlitgeneric.vfx"
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
F_BLEND_MODE = 1
F_DISABLE_Z_BUFFERING = 1
g_vColorTint = [1, 1, 1, 1]
TextureAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tTintMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
})";
auto buffer = new unsigned char[0x100 + sizeof(CKeyValues3)];
CRT::MemorySet(buffer, 0, sizeof(buffer));
CKeyValues3* kv3 = (CKeyValues3*)(buffer + 0x100);
KV3IVD_t kv3ID;
kv3ID.szName = m_name;
kv3ID.unk0 = 0x469806E97412167C;
kv3ID.unk1 = 0xE73790B53EE6F2AF;
if (!MEM::load_key_value(kv3, nullptr, szVmatBuffer, &kv3ID, nullptr))
throw;
material2_t** custom_material;
MEM::fnCreateMaterial(nullptr, &custom_material, m_name, kv3, 0, 1);
return *custom_material;
}
material2_t* create_material_illum_visible(const char* m_name) {
const char szVmatBuffer[] = R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "csgo_complex.vfx"
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"
g_vColorTint = [ 20.000000, 20.000000, 20.000000, 20.000000 ]
g_flSelfIllumScale = [ 5.000000, 5.000000, 5.000000, 5.000000 ]
g_flSelfIllumBrightness = [ 5.000000, 5.000000, 5.000000, 5.000000 ]
g_vSelfIllumTint = [ 10.000000, 10.000000, 10.000000, 10.000000 ]
F_SELF_ILLUM = 1
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
})";
auto buffer = new unsigned char[0x100 + sizeof(CKeyValues3)];
CRT::MemorySet(buffer, 0, sizeof(buffer));
CKeyValues3* kv3 = (CKeyValues3*)(buffer + 0x100);
KV3IVD_t kv3ID;
kv3ID.szName = m_name;
kv3ID.unk0 = 0x469806E97412167C;
kv3ID.unk1 = 0xE73790B53EE6F2AF;
if (!MEM::load_key_value(kv3, nullptr, szVmatBuffer, &kv3ID, nullptr))
throw;
material2_t** custom_material;
MEM::fnCreateMaterial(nullptr, &custom_material, m_name, kv3, 0, 1);
return *custom_material;
}
material2_t* create_material_illum_invisible(const char* m_name) {
const char szVmatBuffer[] = R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "csgo_complex.vfx"
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"
g_vColorTint = [ 20.000000, 20.000000, 20.000000, 20.000000 ]
g_flSelfIllumScale = [ 5.000000, 5.000000, 5.000000, 5.000000 ]
g_flSelfIllumBrightness = [ 5.000000, 5.000000, 5.000000, 5.000000 ]
g_vSelfIllumTint = [ 10.000000, 10.000000, 10.000000, 10.000000 ]
F_SELF_ILLUM = 1
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
F_DISABLE_Z_BUFFERING = 1
})";
auto buffer = new unsigned char[0x100 + sizeof(CKeyValues3)];
CRT::MemorySet(buffer, 0, sizeof(buffer));
CKeyValues3* kv3 = (CKeyValues3*)(buffer + 0x100);
KV3IVD_t kv3ID;
kv3ID.szName = m_name;
kv3ID.unk0 = 0x469806E97412167C;
kv3ID.unk1 = 0xE73790B53EE6F2AF;
if (!MEM::load_key_value(kv3, nullptr, szVmatBuffer, &kv3ID, nullptr))
throw;
material2_t** custom_material;
MEM::fnCreateMaterial(nullptr, &custom_material, m_name, kv3, 0, 1);
return *custom_material;
}
// other functions.
bool ams::chams_t::initialize() {
// first we have to check if this shit is alr initialized
if (this->m_initialized) {
return this->m_initialized;
}
// only initialize this for moment, later we're gonna init more
array_materials[material_list_t::material_white] = custom_material_data_t{
.m_material = CreateMaterial(CS_XOR("primary_white"), CS_XOR("materials/dev/primary_white.vmat"), CS_XOR("csgo_unlitgeneric.vfx"), true, true, false),
.m_material_z = CreateMaterial(CS_XOR("primary_white_invisible"), CS_XOR("materials/dev/primary_white.vmat"), CS_XOR("csgo_unlitgeneric.vfx"), true, true, true)
};
array_materials[material_list_t::material_default] = custom_material_data_t{
.m_material = CreateMaterial(CS_XOR("primary_white"), CS_XOR("materials/dev/primary_white.vmat"), CS_XOR("csgo_unlitgeneric.vfx"), true, true, false),
.m_material_z = CreateMaterial(CS_XOR("primary_white_invisible"), CS_XOR("materials/dev/primary_white.vmat"), CS_XOR("csgo_unlitgeneric.vfx"), true, true, true)
};
array_materials[material_list_t::material_illum] = custom_material_data_t{
.m_material = CreateMaterial(CS_XOR("primary_white"), CS_XOR("materials/dev/primary_white.vmat"), CS_XOR("csgo_unlitgeneric.vfx"), true, true, false),
.m_material_z = CreateMaterial(CS_XOR("primary_white_invisible"), CS_XOR("materials/dev/primary_white.vmat"), CS_XOR("csgo_unlitgeneric.vfx"), true, true, true)
};
// we initialized by now
this->m_initialized = true;
// iterate.
for (auto& [m_visible, m_invisible] : array_materials) {
if (m_visible == nullptr || m_invisible == nullptr)
this->m_initialized = false;
}
// finish and return value
return this->m_initialized;
}
void ams::chams_t::destroy() {
// nothing to destroy boss
}
bool ams::chams_t::draw_object(void* animatable_object, void* dx11, material_data_t* arr_material_data, int data_count,
void* scene_view, void* scene_layer, void* unk1, void* unk2) {
// check if we initialized.
if (!this->m_initialized) {
return false;
}
if (!C_GET(bool, Vars.bVisualChams))
{
return false;
}
if (!SDK::LocalPawn)
return false;
// no chams enable.
// return false
// no data on material
if (arr_material_data == nullptr) {
return false;
}
// no data on scene object.
if (arr_material_data->m_scene_animable == nullptr) {
return false;
}
// owner.
CBaseHandle m_owner = arr_material_data->m_scene_animable->m_owner;
// get entity.
auto m_entity = I::GameResourceService->pGameEntitySystem ->Get< C_BaseEntity >(m_owner);
if (m_entity == nullptr) {
return false;
}
// schema info
SchemaClassInfoData_t* m_class_info;
m_entity->GetSchemaClassInfo(&m_class_info);
if (m_class_info == nullptr) {
return false;
}
// compare string.
if (CRT::StringCompare(m_class_info->szName, CS_XOR("C_CSPlayerPawn")) != 0)
return false;
// get pawn.
auto m_pawn = I::GameResourceService->pGameEntitySystem->Get< C_CSPlayerPawn>(m_owner);
if (m_pawn == nullptr) {
return false;
}
// other entity
if (!m_pawn->IsOtherEnemy(SDK::LocalPawn)) {
return false;
}
// it is alive
if (m_pawn->GetHealth() <= 0) {
return false;
}
// we passed to everythign.
// please render material.
return this->override_material(animatable_object, dx11, arr_material_data, data_count,
scene_view, scene_layer, unk1, unk2);
}
material2_t* ams::chams_t::CreateMaterial(const char* szName, const char* szMaterialVMAT, const char* szShaderType, bool bBlendMode, bool bTranslucent, bool bDisableZBuffering)
{
material_data_t* pData = reinterpret_cast<material_data_t*>(static_cast<std::byte*>(MEM_STACKALLOC(0x200)) + 0x50);
material2_t** pMatPrototype;
I::MaterialSystem2->find_or_create_from_resource(&pMatPrototype, szMaterialVMAT);
if (pMatPrototype == nullptr)
return nullptr;
// @note: SetCreateDataByMaterial failed on release build idk why
#ifdef _DEBUG
I::MaterialSystem2->set_create_data_by_material(pData, &pMatPrototype);
pData->set_shader_type(szShaderType);
pData->set_material_function(CS_XOR("F_DISABLE_Z_BUFFERING"), bDisableZBuffering ? 1 : 0);
pData->set_material_function(CS_XOR("F_BLEND_MODE"), bBlendMode ? 1 : 0);
pData->set_material_function(CS_XOR("F_TRANSLUCENT"), bTranslucent ? 1 : 0);
material2_t** pMaterial;
I::MaterialSystem2->create_material(&pMaterial, szName, pData);
return *pMaterial;
#endif
return *pMatPrototype;
}
bool ams::chams_t::override_material(void* animatable_object, void* dx11, material_data_t* arr_material_data, int data_count,
void* scene_view, void* scene_layer, void* unk1, void* unk2) {
const auto original = H::hkDrawObject.GetOriginal();
const custom_material_data_t customMaterial = array_materials[C_GET(int, Vars.nVisualChamMaterial)];
if (C_GET(bool, Vars.bVisualChamsIgnoreZ))
{
arr_material_data->m_material = customMaterial.m_material_z;
arr_material_data->m_color = C_GET(ColorPickerVar_t, Vars.colVisualChamsIgnoreZ).colValue;
I::MaterialSystem2->set_color(arr_material_data, C_GET(ColorPickerVar_t, Vars.colVisualChamsIgnoreZ).colValue);
original(animatable_object, dx11, arr_material_data, data_count, scene_view, scene_layer, unk1, unk2);
}
arr_material_data->m_material = customMaterial.m_material;
arr_material_data->m_color = C_GET(ColorPickerVar_t, Vars.colVisualChams).colValue;
I::MaterialSystem2->set_color(arr_material_data, C_GET(ColorPickerVar_t, Vars.colVisualChams).colValue);
original(animatable_object, dx11, arr_material_data, data_count, scene_view, scene_layer, unk1, unk2);
return true;
}

View File

@ -0,0 +1,33 @@
#pragma once
#pragma once
#include "../../common.h"
#include <memory>
#include "../cstrike/sdk/datatypes/stronghandle.hpp"
#pragma once
class material_data_t;
class material2_t;
namespace ams {
class chams_t {
public:
bool initialize();
void destroy();
public:
bool draw_object(void* animatable_object, void* dx11, material_data_t* arr_material_data, int data_count,
void* scene_view, void* scene_layer, void* unk1, void* unk2);
bool override_material(void* animatable_object, void* dx11, material_data_t* arr_material_data, int data_count,
void* scene_view, void* scene_layer, void* unk1, void* unk2);
public:
material2_t* CreateMaterial(const char* szName, const char* szMaterialVMAT, const char* szShaderType, bool bBlendMode, bool bTranslucent, bool bDisableZBuffering);
material2_t* create_material(const char* m_name, const char* material_vmat, const char* shader_type, bool blend_mode,
bool transfluscent, bool disable_buffering);
private:
bool m_initialized = false;
};
const auto chams = std::make_unique<chams_t>();
}

View File

@ -0,0 +1,183 @@
#pragma once
#include "../../common.h"
// used: draw system
#include "../../utilities/draw.h"
#include "../../sdk/datatypes/vector.h"
#include "../../sdk/datatypes/transform.h"
class CCSPlayerController;
class C_BaseEntity;
class C_CSPlayerPawn;
class CBaseHandle;
class CEntityInstance;
namespace F::VISUALS::OVERLAY
{
enum EAlignSide : std::uint8_t
{
SIDE_LEFT = 0U,
SIDE_TOP,
SIDE_RIGHT,
SIDE_BOTTOM,
SIDE_MAX
};
enum EAlignDirection : std::uint8_t
{
DIR_LEFT = 0U,
DIR_TOP,
DIR_RIGHT,
DIR_BOTTOM,
DIR_MAX = 4U // @todo: rework stuff based on this cuz one component can have only 3 possible directions at same time. vertical side: left & right + top | bottom, horizontal side: top & bottom + left | right
};
class CBaseComponent
{
public:
[[nodiscard]] virtual ImVec2 GetBasePosition(const ImVec4& box) const;
[[nodiscard]] virtual bool IsDirectional() const
{
return false;
}
virtual void Render(ImDrawList* pDrawList, const ImVec2& vecPosition) = 0;
EAlignSide nSide = SIDE_TOP;
ImVec2 vecOffset = {};
ImVec2 vecSize = {};
};
class CBaseDirectionalComponent : public CBaseComponent
{
public:
[[nodiscard]] ImVec2 GetBasePosition(const ImVec4& box) const final;
[[nodiscard]] bool IsDirectional() const final
{
return true;
}
EAlignDirection nDirection = DIR_TOP;
};
class CBarComponent : public CBaseComponent
{
public:
CBarComponent(const bool bIsMenuItem, const EAlignSide nAlignSide, const ImVec4& vecBox, const float max_limit, const float flProgressFactor, const std::size_t uOverlayVarIndex, const float alphaMultiplier = 1.f);
void Render(ImDrawList* pDrawList, const ImVec2& vecPosition) final;
private:
bool bIsMenuItem = false;
float alphaMultiplier = 1.f;
// bar progress
float flProgressFactor = 0.0f;
//maxlimit
float max_limit = 0.0f;
std::string value_sz;
int value;
// hovered state for context menu
bool bIsHovered = false;
// config variables
std::size_t uOverlayVarIndex = 0ULL;
};
class CTextComponent : public CBaseDirectionalComponent
{
public:
CTextComponent(const bool bIsMenuItem, const bool bIcon, const EAlignSide nAlignSide, const EAlignDirection nAlignDirection, const ImFont* pFont, const char* szText, const std::size_t uOverlayVarIndex, const float alphaM = 1.f);
~CTextComponent();
void Render(ImDrawList* pDrawList, const ImVec2& vecPosition) final;
private:
float alphaMultiplier = 1.f;
bool bIsMenuItem = false;
bool bIcon = false;
// font & text for displaying
const ImFont* pFont = nullptr;
char* szText = nullptr;
// hovered state for context menu
bool bIsHovered = false;
// config variables
std::size_t uOverlayVarIndex = 0ULL;
};
/*
* overlay component auto-positioning system
* @note: was designed to support the reordering of components that can be implemented with minimal effort
*
* currently supported next sides and sub-directions:
*
* DIR_TOP
* ^
* |
* DIR_LEFT <-o-> DIR_RIGHT
* DIR_LEFT <-o *---------* o-> DIR_RIGHT
* | | | |
* v | | v
* DIR_BOTTOM | | DIR_BOTTOM
* | |
* DIR_TOP | | DIR_TOP
* ^ | | ^
* | | | |
* o *---------* o
* DIR_LEFT <-o-> DIR_RIGHT
* |
* v
* DIR_BOTTOM
*/
struct Context_t
{
/* @section: special case components */
/// add the box component to overlay
/// @remarks: current implementation expects this to be first component, it's an immediate rendering component
/// @return: if the box component is hovered
bool AddBoxComponent(ImDrawList* pDrawList, const ImVec4& vecBox, const int nType, float flThickness, float flRounding, const Color_t& colPrimary, const Color_t& colOutline , const float alpha = 1.f);
/// add the frame component to overlay
/// @remarks: current implementation expects this to be added after components that should be inside it, it's an immediate rendering component
/// @returns: size constraints of the added frame
ImVec4 AddFrameComponent(ImDrawList* pDrawList, const ImVec2& vecScreen, const EAlignSide nSide, const Color_t& colBackground, const float flRounding, const ImDrawFlags nRoundingCorners);
/* @section: common components */
/// add new component to overlay
/// @param[in] pComponent pointer to the one of supported component types
void AddComponent(CBaseComponent* pComponent);
/* @section: get */
/// @returns: size of the all directional components currently assigned to @a'nSide'
[[nodiscard]] ImVec2 GetTotalDirectionalSize(const EAlignSide nSide) const;
// calculate final position of components and render them
void Render(ImDrawList* pDrawList, const ImVec4& vecBox) const;
private:
// storage of all components
std::vector<CBaseComponent*> vecComponents = {};
// additional spacing between components
float flComponentSpacing = 1.0f;
// summary padding of all align sides
float arrSidePaddings[SIDE_MAX] = {};
// summary padding for all align directions of all align sides
float arrSideDirectionPaddings[SIDE_MAX][DIR_MAX] = {};
};
/* @section: callbacks */
void OnFrameStageNotify(CCSPlayerController* pLocalController);
/* @section: main */
// draw box, bars, text infos, etc at player position
void Render();
void CalculateBoundingBoxes();
void CalculateSkeleton(Context_t ctx, CCSPlayerController* pPlayerController, C_CSPlayerPawn* pPlayer, const ImVec4& out);
void OnPlayer(CCSPlayerController* pEntity, const ImVec4& out);
bool IsValid(CCSPlayerController* pEntity);
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.2 KiB

Some files were not shown because too many files have changed in this diff Show More