good
This commit is contained in:
61
examples/raze-internal-cs2-main/src/api/hook/hook.hpp
Normal file
61
examples/raze-internal-cs2-main/src/api/hook/hook.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "../../sdk/virtual.hpp"
|
||||
|
||||
#include <funchook/src/funchook.h>
|
||||
|
||||
#define HOOK_FUNCTION(hook) hook, #hook
|
||||
|
||||
inline funchook_t *g_funchookCtx = nullptr;
|
||||
inline bool g_isShuttingDown = false;
|
||||
|
||||
template <typename T>
|
||||
class CHook {
|
||||
|
||||
public:
|
||||
std::add_pointer_t<T> m_pOriginal;
|
||||
// Template has been used to avoid casts.
|
||||
template <typename OriginalT, typename HookT>
|
||||
void Hook(OriginalT _pOriginalFn, HookT &pHookFn, const char *szHookName) {
|
||||
if (this->m_pOriginal) {
|
||||
LOG("%s tried rehooking.\n", szHookName);
|
||||
return;
|
||||
}
|
||||
|
||||
void *pOriginalFn = static_cast<void *>(_pOriginalFn);
|
||||
if (!pOriginalFn) {
|
||||
LOG("%s tried hooking null.\n", szHookName);
|
||||
return;
|
||||
}
|
||||
|
||||
this->m_pOriginal =
|
||||
reinterpret_cast<decltype(this->m_pOriginal)>(pOriginalFn);
|
||||
int rv = funchook_prepare(g_funchookCtx,
|
||||
reinterpret_cast<void **>(&this->m_pOriginal),
|
||||
reinterpret_cast<void *>(pHookFn));
|
||||
|
||||
if (rv == FUNCHOOK_ERROR_SUCCESS) {
|
||||
LOG("%s hooked successfully. [ %p -> %p ]\n", szHookName,
|
||||
pOriginalFn, pHookFn);
|
||||
} else {
|
||||
this->m_pOriginal = nullptr;
|
||||
LOG("%s hook failed. [ %s ]\n", szHookName,
|
||||
funchook_error_message(g_funchookCtx));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename HookT>
|
||||
void HookVirtual(void *pClass, int index, HookT &pHookFn,
|
||||
const char *szHookName) {
|
||||
this->Hook(vmt::GetVMethod(index, pClass), pHookFn, szHookName);
|
||||
}
|
||||
|
||||
// Shorthand for calling original.
|
||||
template <typename... Args>
|
||||
auto operator()(Args &&...args) {
|
||||
return std::invoke(this->m_pOriginal, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
};
|
||||
213
examples/raze-internal-cs2-main/src/api/module/module.hpp
Normal file
213
examples/raze-internal-cs2-main/src/api/module/module.hpp
Normal file
@@ -0,0 +1,213 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <array>
|
||||
|
||||
// Windows API
|
||||
#include <Windows.h>
|
||||
#include <Psapi.h>
|
||||
|
||||
#include "../../sdk/source2-sdk/interface.hpp"
|
||||
#include "../../utils/console/console.hpp"
|
||||
#include "../../defines.hpp"
|
||||
namespace pattern
|
||||
{
|
||||
__forceinline std::uint8_t* ResolveRelativeAddress(
|
||||
std::uint8_t* nAddressBytes, std::uint32_t nRVAOffset,
|
||||
std::uint32_t nRIPOffset)
|
||||
{
|
||||
std::uint32_t nRVA =
|
||||
*reinterpret_cast<std::uint32_t*>(nAddressBytes + nRVAOffset);
|
||||
std::uint64_t nRIP =
|
||||
reinterpret_cast<std::uint64_t>(nAddressBytes) + nRIPOffset;
|
||||
|
||||
return reinterpret_cast<std::uint8_t*>(nRVA + nRIP);
|
||||
}
|
||||
} // namespace pattern
|
||||
// Pointer arithmetic utility class.
|
||||
struct UTILPtr
|
||||
{
|
||||
public:
|
||||
template <typename T>
|
||||
UTILPtr(T val)
|
||||
{
|
||||
m_val = (uintptr_t) (val);
|
||||
}
|
||||
|
||||
template <typename T = void*>
|
||||
T Get(const char* variableName = nullptr)
|
||||
{
|
||||
#ifdef SDK_ENABLE_LOGGING
|
||||
if (variableName) LOG("%s found at -> %llX\n", variableName, m_val);
|
||||
#endif
|
||||
|
||||
return (T) (m_val);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Get(T& dst, const char* variableName = nullptr)
|
||||
{
|
||||
dst = Get<T>(variableName);
|
||||
}
|
||||
|
||||
UTILPtr& AddOffset(int offset)
|
||||
{
|
||||
if (m_val) m_val += offset;
|
||||
return *this;
|
||||
}
|
||||
UTILPtr& ToAbsolute(int preOffset, int postOffset)
|
||||
{
|
||||
if (m_val)
|
||||
{
|
||||
AddOffset(preOffset);
|
||||
m_val = m_val + sizeof(int) + *(int*) (m_val);
|
||||
AddOffset(postOffset);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
UTILPtr& Dereference(int dereferences)
|
||||
{
|
||||
if (m_val)
|
||||
while (dereferences-- != 0) m_val = *(uintptr_t*) (m_val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool IsValid( )
|
||||
{
|
||||
return m_val != 0;
|
||||
}
|
||||
|
||||
private:
|
||||
uintptr_t m_val;
|
||||
};
|
||||
|
||||
class CModule
|
||||
{
|
||||
public:
|
||||
// CS2TODO: Maybe write a simple caching system
|
||||
|
||||
CModule(CModule&&) = delete;
|
||||
CModule(const CModule&) = delete;
|
||||
|
||||
explicit CModule(const char* name) : m_name(name)
|
||||
{
|
||||
this->Load( );
|
||||
}
|
||||
|
||||
void Load( )
|
||||
{
|
||||
this->InitializeHandle( );
|
||||
this->InitializeBounds( );
|
||||
}
|
||||
|
||||
UTILPtr GetProcAddress(const char* procName) const
|
||||
{
|
||||
UTILPtr rv = 0;
|
||||
if (this->IsLoaded( ))
|
||||
{
|
||||
#ifdef IS_WINDOWS
|
||||
rv = ::GetProcAddress(static_cast<HMODULE>(this->m_handle),
|
||||
procName);
|
||||
#endif
|
||||
}
|
||||
|
||||
LOG("GetProcAddress('%s', '%s') returned -> %p\n", this->GetName( ),
|
||||
procName, rv.Get<void*>( ));
|
||||
return rv;
|
||||
}
|
||||
UTILPtr FindInterface(const char* version) const
|
||||
{
|
||||
UTILPtr rv = 0;
|
||||
if (this->IsLoaded( ))
|
||||
{
|
||||
UTILPtr pCreateInterface = this->GetProcAddress("CreateInterface");
|
||||
if (!pCreateInterface.IsValid( )) return rv;
|
||||
|
||||
InterfaceReg* s_pInterfaceRegs = pCreateInterface.ToAbsolute(3, 0)
|
||||
.Dereference(1)
|
||||
.Get<InterfaceReg*>( );
|
||||
|
||||
for (; s_pInterfaceRegs;
|
||||
s_pInterfaceRegs = s_pInterfaceRegs->m_pNext)
|
||||
{
|
||||
if (strcmp(version, s_pInterfaceRegs->m_pName) == 0)
|
||||
{
|
||||
rv = s_pInterfaceRegs->m_CreateFn( );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
template <size_t N>
|
||||
UTILPtr FindPattern(const std::array<int, N>& signature) const
|
||||
{
|
||||
UTILPtr rv = 0;
|
||||
if (this->IsLoaded( ))
|
||||
{
|
||||
const int* pSigData = signature.data( );
|
||||
uint8_t* pBytes = reinterpret_cast<uint8_t*>(this->m_start);
|
||||
for (size_t i = 0; i < this->m_end - N; ++i)
|
||||
{
|
||||
bool found = true;
|
||||
for (size_t j = 0; j < N; ++j)
|
||||
{
|
||||
if (pBytes[i + j] != pSigData[j] && pSigData[j] != -1)
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
rv = reinterpret_cast<uintptr_t>(&pBytes[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!rv.IsValid( ))
|
||||
{
|
||||
MessageBoxA(0, 0, "Invalid signature:!\n", 0);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
const char* GetName( ) const
|
||||
{
|
||||
return this->m_name;
|
||||
}
|
||||
bool IsLoaded( ) const
|
||||
{
|
||||
return this->m_handle != 0;
|
||||
}
|
||||
|
||||
private:
|
||||
void InitializeHandle( )
|
||||
{
|
||||
#ifdef IS_WINDOWS
|
||||
this->m_handle = static_cast<void*>(GetModuleHandle(this->GetName( )));
|
||||
#endif
|
||||
|
||||
LOG("Module '%s' found at -> %p\n", this->GetName( ), this->m_handle);
|
||||
}
|
||||
void InitializeBounds( )
|
||||
{
|
||||
if (!this->IsLoaded( )) return;
|
||||
|
||||
#ifdef IS_WINDOWS
|
||||
MODULEINFO mi;
|
||||
BOOL status = GetModuleInformation(GetCurrentProcess( ),
|
||||
static_cast<HMODULE>(this->m_handle),
|
||||
&mi, sizeof(mi));
|
||||
if (status != 0)
|
||||
{
|
||||
this->m_start = reinterpret_cast<uintptr_t>(this->m_handle);
|
||||
this->m_end = static_cast<uintptr_t>(mi.SizeOfImage);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void* m_handle = nullptr;
|
||||
uintptr_t m_start = 0, m_end = 0;
|
||||
const char* m_name = "";
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <Windows.h>
|
||||
|
||||
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
|
||||
#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
|
||||
116
examples/raze-internal-cs2-main/src/defines.hpp
Normal file
116
examples/raze-internal-cs2-main/src/defines.hpp
Normal file
@@ -0,0 +1,116 @@
|
||||
#pragma once
|
||||
|
||||
#include "sdk/defines.hpp"
|
||||
|
||||
// Uncomment this for vulkan support, add '-vulkan' into your launch
|
||||
// parameters and lastly include both 'imgui_impl_vulkan' files.
|
||||
//
|
||||
// Vulkan SDK is needed only for building!
|
||||
// #define SDK_ENABLE_VULKAN_SUPPORT
|
||||
|
||||
// Pretty self-explanatory.
|
||||
#define SDK_ENABLE_LOGGING
|
||||
|
||||
// Prints schema offsets in console.
|
||||
// #define SDK_ENABLE_SCHEMA_FIELD_OFFSET_LOGGING
|
||||
|
||||
// Helper
|
||||
#define SDK_SIG(sig) \
|
||||
stb::simple_conversion::build<stb::fixed_string{sig}>::value
|
||||
|
||||
// Modules
|
||||
#define CLIENT_DLL "client.dll"
|
||||
#define ENGINE2_DLL "engine2.dll"
|
||||
#define SCHEMASYSTEM_DLL "schemasystem.dll"
|
||||
#define INPUTSYSTEM_DLL "inputsystem.dll"
|
||||
#define SDL3_DLL "SDL3.dll"
|
||||
#define TIER0_DLL "tier0.dll"
|
||||
#define NAVSYSTEM_DLL "navsystem.dll"
|
||||
#define RENDERSYSTEMVULKAN_DLL "rendersystemvulkan.dll"
|
||||
#define LOCALIZE_DLL "localize.dll"
|
||||
#define PARTICLES_DLL "particles.dll"
|
||||
#define SCENESYSTEM_DLL "scenesystem.dll"
|
||||
#define MATERIALSYSTEM_DLL "materialsystem2.dll"
|
||||
#define GPAPI_DLL "navsystem.dll"
|
||||
|
||||
// Interfaces
|
||||
#define GAME_RESOURCE_SERVICE_CLIENT "GameResourceServiceClientV001"
|
||||
#define SOURCE2_CLIENT "Source2Client002"
|
||||
#define SCHEMA_SYSTEM "SchemaSystem_001"
|
||||
#define INPUT_SYSTEM_VERSION "InputSystemVersion001"
|
||||
#define SOURCE2_ENGINE_TO_CLIENT "Source2EngineToClient001"
|
||||
#define ENGINE_CVAR "VEngineCvar007"
|
||||
#define LOCALIZE "Localize_001"
|
||||
#define MATERIAL_SYSTEM "VMaterialSystem2_001"
|
||||
|
||||
// Signatures
|
||||
#define GET_HIGHEST_ENTITY_INDEX SDK_SIG("33 DB E8 ? ? ? ? 8B 08")
|
||||
#define GET_BASE_ENTITY SDK_SIG("81 FA FE 7F 00 00 77 36")
|
||||
#define PRINT_SCHEMA_DETAILED_CLASS_LAYOUT \
|
||||
SDK_SIG("48 89 5C 24 ? 48 89 6C 24 ? 48 89 4C 24 ?")
|
||||
#define GET_GC_CLIENT_SYSTEM SDK_SIG("E8 ? ? ? ? 48 85 C0 0F 84 ? ? ? ? 48 8D 0D ? ? ? ? FF 15 ? ? ? ? 48 83 38 00 74 6A 48 85 F6 0F 84")
|
||||
#define CREATE_BASE_TYPE_CACHE SDK_SIG("E8 ? ? ? ? 33 C9 8B D1")
|
||||
#define FIND_SO_CACHE SDK_SIG("E8 ? ? ? ? 48 8B F0 48 85 C0 74 0E 4C 8B C3")
|
||||
#define GET_LOCAL_PLAYER_CONTROLLER SDK_SIG("E8 ? ? ? ? 48 85 C0 74 15 8B CB E8 ? ? ? ? 48 8B D0 41 B0 01")
|
||||
#define SET_DYNAMIC_ATTRIBUTE_VALUE_UINT \
|
||||
SDK_SIG( \
|
||||
"E9 ? ? ? ? CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC 49 8B C0 48 " \
|
||||
"8B CA 48 8B D0")
|
||||
#define COMPUTE_HITBOX_SURROUNDING_BOX SDK_SIG("E8 ? ? ? ? E9 ? ? ? ? 48 8B CB E8 ? ? ? ? E9 ? ? ? ? 48 8B 4B 08")
|
||||
#define MOUSE_INPUT_ENABLED \
|
||||
SDK_SIG("40 53 48 83 EC 20 80 B9 ? ? ? ? ? 48 8B D9 75 78")
|
||||
#define GET_MATRICES_FOR_VIEW SDK_SIG("40 53 48 81 EC ? ? ? ? 49 8B C1")
|
||||
#define CREATMOVE_SIG SDK_SIG("48 8B C4 4C 89 40 18 48 89 48 08 55 53 57 41 54 48 8D A8")
|
||||
// new
|
||||
#define GET_WEAPON_DATA \
|
||||
SDK_SIG( \
|
||||
"48 81 EC ? ? ? ? 48 85 C9 75 ? 33 C0 48 81 C4 ? ? ? ? C3 48 89 9C " \
|
||||
"24")
|
||||
#define GET_BONE_FLAGS SDK_SIG("85 D2 78 16 3B 91")
|
||||
#define GET_BONE_PARENT SDK_SIG("85 D2 78 17 3B 91 78")
|
||||
#define GET_BONE_NAME SDK_SIG("85 D2 78 25 3B 91")
|
||||
#define GET_BONE_INDEX SDK_SIG("E8 ? ? ? ? 85 C0 78 ? 4C 8D 4D")
|
||||
#define GET_HITBOX_SET SDK_SIG("E8 ? ? ? ? 48 85 C0 0F 85 ? ? ? ? 44 8D 48 07")
|
||||
// chams
|
||||
|
||||
#define C_CSGO_INPUT SDK_SIG("48 8B 0D ? ? ? ? 4C 8D 8F ? ? ? ? 45 33 FF")
|
||||
#define SET_MATERIAL \
|
||||
SDK_SIG( \
|
||||
"48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 54 41 56 41 57 48 83 EC ? 0F " \
|
||||
"B6 01 45 0F B6 F9 8B 2A 48 8B F9")
|
||||
#define FIND_VAR SDK_SIG("48 89 5C 24 ? 57 48 81 EC ? ? ? ? 33 C0 8B DA")
|
||||
#define DRAW_OBJECT SDK_SIG("48 8B C4 48 89 50 10 53")
|
||||
#define SET_MATERIAL_SHADER \
|
||||
SDK_SIG("E8 ? ? ? ? 48 8D 05 ? ? ? ? C7 44 24 20 9B 01 F3 D1")
|
||||
|
||||
#define CREATE_MATERIAL \
|
||||
SDK_SIG( \
|
||||
"48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 56 48 81 EC ? ? ? ? 48 8D 0D")
|
||||
#define LOAD_KEY_VALUES SDK_SIG("40 53 48 83 EC ? 48 C7 C0 ? ? ? ?")
|
||||
#define SET_TYPE SDK_SIG("E8 ? ? ? ? 4C 89 7B 30")
|
||||
#define FREE_ALLOC_KV3 SDK_SIG("E8 ? ? ? ? 48 8B 43 08 FF 4B 14")
|
||||
/* TRACE */
|
||||
#define GET_HANDLE_FROM_ENTITY \
|
||||
SDK_SIG( \
|
||||
"48 85 C9 74 ? 48 8B 41 ? 48 85 C0 74 ? 44 8B 40 ? BA ? ? ? ? 8B 48 " \
|
||||
"? " \
|
||||
"41 8B C0 83 E1")
|
||||
#define TRACE_SHAPE SDK_SIG("E8 ? ? ? ? 80 7D ? ? 75 ? F3 0F 10 45")
|
||||
|
||||
#define ENGINE_TRACE SDK_SIG("4C 8B 3D ? ? ? ? 24 C9 0C 49 66 0F 7F 45 ?")
|
||||
#define GLOBAL_VARS SDK_SIG("48 89 0D ? ? ? ? 48 89 41")
|
||||
#define GET_SURFACE_DATA SDK_SIG("E8 ? ? ? ? 48 85 C0 74 ? 44 38 60")
|
||||
#define SET_VIEW_ANGLE SDK_SIG("F2 41 0F 10 00 4C 63 CA")
|
||||
#define FRAMESTAGE_NOTIFY SDK_SIG("48 89 5C 24 ? 56 48 83 EC 30 8B 05")
|
||||
|
||||
#define UPDATE_3D_PARAMS SDK_SIG("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 70 8B 05 AB D8 08 01")
|
||||
#define UPDATE_COLOR_TO_SCENE SDK_SIG("E8 ? ? ? ? 48 8B 4C 24 ? 33 D2 4C 8B 54 24 ? 4C 8B 5C 24 ? 8B 00 4C 89 77 18")
|
||||
#define HK_SETUP_LIGHT SDK_SIG("E8 ? ? ? ? 4C 8B 8F")
|
||||
#define SKYBOX_COLOR_UPDATE SDK_SIG("48 8B C4 48 89 58 18 48 89 70 20 55 57 41 54 41 55")
|
||||
#define TEST_SOSAL SDK_SIG("40 53 48 83 EC 30 48 8B D9 49 BA ? ? ? ? ? ? ? ? 0F B6 CA 44")
|
||||
|
||||
//
|
||||
// Internal
|
||||
#ifdef DISTRIBUTION_BUILD
|
||||
#undef SDK_ENABLE_LOGGING
|
||||
#endif
|
||||
26
examples/raze-internal-cs2-main/src/entry/dllmain.cpp
Normal file
26
examples/raze-internal-cs2-main/src/entry/dllmain.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <Windows.h>
|
||||
|
||||
#include "../utils/console/console.hpp"
|
||||
|
||||
void Initialize( );
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
|
||||
//console::Initialize( );
|
||||
|
||||
HANDLE hThread = CreateThread(
|
||||
NULL, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(Initialize),
|
||||
NULL, 0, NULL);
|
||||
if (hThread != NULL)
|
||||
{
|
||||
CloseHandle(hThread);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
37
examples/raze-internal-cs2-main/src/entry/main.cpp
Normal file
37
examples/raze-internal-cs2-main/src/entry/main.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
#include "../sdk/interfaces/interfaces.hpp"
|
||||
#include "../sdk/memory/memory.hpp"
|
||||
#include "../hooks/hooks.hpp"
|
||||
#include "../src/game/chams/chams.hpp"
|
||||
#include "../utils/external/config.hpp"
|
||||
|
||||
void Initialize() {
|
||||
|
||||
config::refresh();
|
||||
|
||||
if (config::exists(0)) {
|
||||
/*MessageBoxA(
|
||||
NULL,
|
||||
"[Config.hpp] Config File Found! Loading config...",
|
||||
"Information",
|
||||
MB_OK | MB_ICONINFORMATION
|
||||
);*/
|
||||
config::load(0);
|
||||
}
|
||||
else {
|
||||
/*MessageBoxA(
|
||||
NULL,
|
||||
"[Config.hpp] Config File Found! Loading config...",
|
||||
"Information",
|
||||
MB_OK | MB_ICONINFORMATION
|
||||
);*/
|
||||
config::create(L"config.json");
|
||||
config::save(0);
|
||||
}
|
||||
|
||||
memory::Initialize();
|
||||
interfaces::Initialize();
|
||||
chams::init();
|
||||
hooks::Initialize();
|
||||
}
|
||||
111
examples/raze-internal-cs2-main/src/game/bunnyhop/bunnyhop.cpp
Normal file
111
examples/raze-internal-cs2-main/src/game/bunnyhop/bunnyhop.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
#include "bunnyhop.h"
|
||||
#include "../../sdk/interfaces/interfaces.hpp"
|
||||
#include "../../sdk/source2-sdk/types/chandle.hpp"
|
||||
bool bWasLastTimeOnGround;
|
||||
static auto last_jumped = false;
|
||||
static auto should_jump = false;
|
||||
#define CheckIfNonValidNumber(x) \
|
||||
(fpclassify(x) == FP_INFINITE || fpclassify(x) == FP_NAN || \
|
||||
fpclassify(x) == FP_SUBNORMAL)
|
||||
float normalize_yaw(float f)
|
||||
{
|
||||
while (f < -180.0f) f += 360.0f;
|
||||
|
||||
while (f > 180.0f) f -= 360.0f;
|
||||
|
||||
return f;
|
||||
}
|
||||
float get_delta(float hspeed, float maxspeed, float airaccelerate)
|
||||
{
|
||||
auto term = (30.0 - (airaccelerate * maxspeed / 66.0)) / hspeed;
|
||||
|
||||
if (term < 1.0f && term > -1.0f)
|
||||
{
|
||||
return acos(term);
|
||||
}
|
||||
|
||||
return 0.f;
|
||||
}
|
||||
void bunnyhop::run(CUserCmd* cmd, QAngle_t* viewangle)
|
||||
{
|
||||
if (!bBunnyHop) return;
|
||||
static float old_yaw{};
|
||||
CCSPlayerController* lcontroller =
|
||||
CGameEntitySystem::GetLocalPlayerController( );
|
||||
if (!lcontroller) return;
|
||||
C_CSPlayerPawn* localplayer = lcontroller->m_hPawn( ).Get<C_CSPlayerPawn>( );
|
||||
if (!localplayer || localplayer->m_iHealth( ) <= 0) return;
|
||||
|
||||
constexpr MoveType bad_mts[ ] = { movetype_observer, movetype_noclip,
|
||||
movetype_observer, movetype_ladder };
|
||||
const auto bad_mt = std::ranges::find(bad_mts, localplayer->m_MoveType( )) !=
|
||||
std::end(bad_mts);
|
||||
if (bad_mt) return;
|
||||
if (localplayer->m_fFlags( ).has_flag(fl_onground))
|
||||
{
|
||||
old_yaw = 0.f;
|
||||
return;
|
||||
}
|
||||
|
||||
Vector velocity = localplayer->m_vecVelocity( );
|
||||
velocity.z = 0.f;
|
||||
|
||||
auto forwardmove = cmd->pBase.pBase->flForwardMove;
|
||||
auto sidemove = cmd->pBase.pBase->flSideMove;
|
||||
|
||||
if (velocity.Length_2D( ) < 500.0f && !forwardmove && !sidemove) return;
|
||||
|
||||
Vector view_angle = { viewangle->x, viewangle->y, viewangle->z };
|
||||
|
||||
int button = cmd->buttonStates.nButtonState1;
|
||||
float yaw_add = 01.f;
|
||||
bool back = button & IN_BACK;
|
||||
bool forward = button & IN_FORWARD;
|
||||
bool right = button & IN_MOVELEFT;
|
||||
bool left = button & IN_MOVERIGHT;
|
||||
|
||||
if (back)
|
||||
{
|
||||
yaw_add = -1 / 2;
|
||||
if (right)
|
||||
yaw_add -= 1;
|
||||
else if (left)
|
||||
yaw_add += 1;
|
||||
}
|
||||
else if (right)
|
||||
{
|
||||
yaw_add = 1 / 2;
|
||||
if (back)
|
||||
yaw_add += 1;
|
||||
else if (forward)
|
||||
yaw_add -= 1;
|
||||
}
|
||||
else if (left)
|
||||
{
|
||||
yaw_add = -1 / 2;
|
||||
if (back)
|
||||
yaw_add -= 1;
|
||||
else if (forward)
|
||||
yaw_add += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
yaw_add = 1.f;
|
||||
}
|
||||
|
||||
view_angle.y += yaw_add;
|
||||
|
||||
cmd->pBase.pBase->flForwardMove = 0;
|
||||
cmd->pBase.pBase->flSideMove = 0;
|
||||
|
||||
auto yaw = math::normalize_yaw(
|
||||
view_angle.y - M_DEG2RAD(atan2(localplayer->m_vecVelocity( ).y,
|
||||
localplayer->m_vecVelocity( ).x)));
|
||||
|
||||
if (yaw < 0.f) cmd->pBase.pBase->flSideMove = -1;
|
||||
if (yaw > 0.f) cmd->pBase.pBase->flSideMove = 1;
|
||||
|
||||
(*viewangle).y = math::normalize_yaw(view_angle.y - yaw);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "../../sdk/source2-sdk/classes/cusercmd.h"
|
||||
|
||||
namespace bunnyhop {
|
||||
void run(CUserCmd* cmd, QAngle_t* viewangle);
|
||||
inline bool bBunnyHop;
|
||||
|
||||
|
||||
}
|
||||
211
examples/raze-internal-cs2-main/src/game/chams/chams.cpp
Normal file
211
examples/raze-internal-cs2-main/src/game/chams/chams.cpp
Normal file
@@ -0,0 +1,211 @@
|
||||
#include "chams.hpp"
|
||||
#include "../../sdk/source2-sdk/memory_classes/utlbuffer.hpp"
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
CMaterial2* visible;
|
||||
CMaterial2* invisible;
|
||||
CGameEntitySystem entitysystem;
|
||||
|
||||
bool chams::init( )
|
||||
{
|
||||
/* TODO */
|
||||
if (chams_init)
|
||||
return chams_init;
|
||||
|
||||
chams::invisibleforblackC = chams::create_invisible_for_black("invisible_for_black");
|
||||
chams::visibleforblackC = chams::create_visible_for_black("visible_for_black");
|
||||
chams::visibleC = chams::create_visible("visible");
|
||||
chams::invisibleC = chams::create_invisible("invisible");
|
||||
chams::bloomC = chams::create_bloom("bloom");
|
||||
chams_init = true;
|
||||
return chams_init;
|
||||
}
|
||||
|
||||
CMaterial2* chams::create_bloom(const char* name)
|
||||
{
|
||||
std::string vmat_buffer =
|
||||
R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
shader = "csgo_complex.vfx"
|
||||
|
||||
F_SELF_ILLUM = 1
|
||||
F_PAINT_VERTEX_COLORS = 1
|
||||
F_TRANSLUCENT = 1
|
||||
F_DISABLE_Z_BUFFERING = 1
|
||||
|
||||
g_vColorTint = [ 1.000000, 1.000000, 1.000000, 1.000000 ]
|
||||
g_flSelfIllumScale = [ 3.000000, 3.000000, 3.000000, 3.000000 ]
|
||||
g_flSelfIllumBrightness = [ 3.000000, 3.000000, 3.000000, 3.000000 ]
|
||||
g_vSelfIllumTint = [ 8.000000, 8.000000, 8.000000, 8.000000 ]
|
||||
|
||||
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tSelfIllumMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
TextureAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
g_tAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
|
||||
})";
|
||||
|
||||
|
||||
CUtlBuffer buff(0, static_cast<int>(vmat_buffer.size( )) + 10, 1);
|
||||
buff.PutString(vmat_buffer.data( ));
|
||||
KeyValues3 kv;
|
||||
kv.set_type(kv_basic_array, kv_basic_table);
|
||||
kv.load_from_buffer(&buff, name);
|
||||
CMaterial2** custom_material;
|
||||
interfaces::pMaterialSystem->CreateMaterial(&custom_material, name, &kv);
|
||||
|
||||
return *custom_material;
|
||||
}
|
||||
|
||||
CMaterial2* chams::create_visible(const char* name)
|
||||
{
|
||||
std::string vmat_buffer =
|
||||
R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
shader = "csgo_complex.vfx"
|
||||
|
||||
F_SELF_ILLUM = 1
|
||||
F_PAINT_VERTEX_COLORS = 1
|
||||
F_TRANSLUCENT = 1
|
||||
|
||||
g_vColorTint = [ 1.000000, 1.000000, 1.000000, 1.000000 ]
|
||||
g_flSelfIllumScale = [ 3.000000, 3.000000, 3.000000, 3.000000 ]
|
||||
g_flSelfIllumBrightness = [ 3.000000, 3.000000, 3.000000, 3.000000 ]
|
||||
g_vSelfIllumTint = [ 8.000000, 8.000000, 8.000000, 8.000000 ]
|
||||
|
||||
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tSelfIllumMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
TextureAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
g_tAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
|
||||
})";
|
||||
|
||||
|
||||
CUtlBuffer buff(0, static_cast<int>(vmat_buffer.size()) + 10, 1);
|
||||
buff.PutString(vmat_buffer.data());
|
||||
KeyValues3 kv;
|
||||
kv.set_type(kv_basic_array, kv_basic_table);
|
||||
kv.load_from_buffer(&buff, name);
|
||||
CMaterial2** custom_material;
|
||||
interfaces::pMaterialSystem->CreateMaterial(&custom_material, name, &kv);
|
||||
|
||||
return *custom_material;
|
||||
}
|
||||
|
||||
CMaterial2* chams::create_visible_for_black(const char* name)
|
||||
{
|
||||
std::string vmat_buffer =
|
||||
R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
shader = "csgo_effects.vfx"
|
||||
|
||||
g_flFresnelExponent = 7.0
|
||||
g_flFresnelFalloff = 10.0
|
||||
g_flFresnelMax = 0.1
|
||||
g_flFresnelMin = 2.0
|
||||
F_DISABLE_Z_BUFFERING = 0
|
||||
|
||||
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask1 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask2 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask3 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tSceneDepth = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
|
||||
g_flToolsVisCubemapReflectionRoughness = 5.0
|
||||
|
||||
g_flBeginMixingRoughness = 4.0
|
||||
|
||||
g_vColorTint = [ 0.350000, 0.350000, 0.350000, 0.800000 ]
|
||||
|
||||
})";
|
||||
|
||||
|
||||
CUtlBuffer buff(0, static_cast<int>(vmat_buffer.size()) + 10, 1);
|
||||
buff.PutString(vmat_buffer.data());
|
||||
KeyValues3 kv;
|
||||
kv.set_type(kv_basic_array, kv_basic_table);
|
||||
kv.load_from_buffer(&buff, name);
|
||||
CMaterial2** custom_material;
|
||||
interfaces::pMaterialSystem->CreateMaterial(&custom_material, name, &kv);
|
||||
|
||||
return *custom_material;
|
||||
}
|
||||
|
||||
CMaterial2* chams::create_invisible_for_black(const char* name)
|
||||
{
|
||||
std::string vmat_buffer =
|
||||
R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
shader = "csgo_effects.vfx"
|
||||
|
||||
g_flFresnelExponent = 7.0
|
||||
g_flFresnelFalloff = 10.0
|
||||
g_flFresnelMax = 0.1
|
||||
g_flFresnelMin = 2.0
|
||||
F_DISABLE_Z_BUFFERING = 1
|
||||
|
||||
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask1 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask2 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tMask3 = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tSceneDepth = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
|
||||
g_flToolsVisCubemapReflectionRoughness = 5.0
|
||||
|
||||
g_flBeginMixingRoughness = 4.0
|
||||
|
||||
g_vColorTint = [ 0.350000, 0.350000, 0.350000, 0.800000 ]
|
||||
|
||||
})";
|
||||
|
||||
|
||||
CUtlBuffer buff(0, static_cast<int>(vmat_buffer.size()) + 10, 1);
|
||||
buff.PutString(vmat_buffer.data());
|
||||
KeyValues3 kv;
|
||||
kv.set_type(kv_basic_array, kv_basic_table);
|
||||
kv.load_from_buffer(&buff, name);
|
||||
CMaterial2** custom_material;
|
||||
interfaces::pMaterialSystem->CreateMaterial(&custom_material, name, &kv);
|
||||
|
||||
return *custom_material;
|
||||
}
|
||||
|
||||
|
||||
CMaterial2* chams::create_invisible(const char* name)
|
||||
{
|
||||
std::string vmat_buffer =
|
||||
R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
|
||||
{
|
||||
shader = "csgo_complex.vfx"
|
||||
|
||||
F_SELF_ILLUM = 1
|
||||
F_PAINT_VERTEX_COLORS = 1
|
||||
F_TRANSLUCENT = 1
|
||||
F_DISABLE_Z_BUFFERING = 1
|
||||
|
||||
g_vColorTint = [ 1.000000, 1.000000, 1.000000, 1.000000 ]
|
||||
g_flSelfIllumScale = [ 5.000000, 5.000000, 5.000000, 5.000000 ]
|
||||
g_flSelfIllumBrightness = [ 3.000000, 3.000000, 3.000000, 3.000000 ]
|
||||
g_vSelfIllumTint = [ 8.000000, 8.000000, 8.000000, 8.000000 ]
|
||||
|
||||
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
g_tSelfIllumMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
|
||||
TextureAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
g_tAmbientOcclusion = resource:"materials/debug/particleerror.vtex"
|
||||
|
||||
})";
|
||||
|
||||
|
||||
CUtlBuffer buff(0, static_cast<int>(vmat_buffer.size()) + 10, 1);
|
||||
buff.PutString(vmat_buffer.data());
|
||||
KeyValues3 kv;
|
||||
kv.set_type(kv_basic_array, kv_basic_table);
|
||||
kv.load_from_buffer(&buff, name);
|
||||
CMaterial2** custom_material;
|
||||
interfaces::pMaterialSystem->CreateMaterial(&custom_material, name, &kv);
|
||||
|
||||
return *custom_material;
|
||||
}
|
||||
34
examples/raze-internal-cs2-main/src/game/chams/chams.hpp
Normal file
34
examples/raze-internal-cs2-main/src/game/chams/chams.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include "../../sdk/interfaces/interfaces.hpp"
|
||||
|
||||
namespace chams
|
||||
{
|
||||
inline bool bChams;
|
||||
inline bool bChams_team;
|
||||
inline bool bChams_weapon;
|
||||
inline bool bChams_hands;
|
||||
inline bool bChams_ignoreZ;
|
||||
inline bool bChams_bloom;
|
||||
bool init();
|
||||
CMaterial2* create_visible(const char* name);
|
||||
CMaterial2* create_invisible_for_black(const char* name);
|
||||
CMaterial2* create_visible_for_black(const char* name);
|
||||
CMaterial2* create_invisible(const char* name);
|
||||
CMaterial2* create_bloom(const char* name);
|
||||
inline CMaterial2* invisibleforblackC{};
|
||||
inline CMaterial2* visibleforblackC{};
|
||||
inline CMaterial2* visibleC{};
|
||||
inline CMaterial2* invisibleC{};
|
||||
inline CMaterial2* bloomC{};
|
||||
inline bool chams_init = false;
|
||||
inline bool player = false;
|
||||
inline bool weapon = false;
|
||||
inline bool hands = false;
|
||||
inline bool invisible = false;
|
||||
inline bool bloom = false;
|
||||
inline int bloom_value = 50;
|
||||
inline int visible_value = 50;
|
||||
inline int invisible_value = 50;
|
||||
inline int weapon_value = 50;
|
||||
inline int hands_value = 50;
|
||||
}
|
||||
526
examples/raze-internal-cs2-main/src/game/esp/esp.cpp
Normal file
526
examples/raze-internal-cs2-main/src/game/esp/esp.cpp
Normal file
@@ -0,0 +1,526 @@
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include "../render/render.hpp"
|
||||
#include "esp.hpp"
|
||||
|
||||
#include "../../sdk/interfaces/interfaces.hpp"
|
||||
|
||||
static CCSPlayerController* g_pLocalPlayerController = nullptr;
|
||||
static C_CSPlayerPawn* g_pLocalPlayerPawn = nullptr;
|
||||
|
||||
// Cache example:
|
||||
struct CachedEntity_t
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
UNKNOWN = 0, PLAYER_CONTROLLER, BASE_WEAPON
|
||||
};
|
||||
|
||||
CHandle m_handle;
|
||||
Type m_type = PLAYER_CONTROLLER;
|
||||
|
||||
BBox_t m_bbox;
|
||||
bool m_draw = true;
|
||||
};
|
||||
static std::vector<CachedEntity_t> g_cachedEntities;
|
||||
static std::mutex g_cachedEntitiesMutex;
|
||||
|
||||
static CachedEntity_t::Type GetEntityType(C_BaseEntity* pEntity);
|
||||
static void RenderPlayerESP(CCSPlayerController* pPlayerController,
|
||||
const BBox_t& bBox);
|
||||
|
||||
static void RenderWeaponESP(C_CSWeaponBase* pWeapon, const BBox_t& bBox);
|
||||
static void RenderWeaponName(C_CSWeaponBase* pWeapon, const BBox_t& bBox);
|
||||
|
||||
void FillRGBA(int x, int y, int w, int h, ImColor color)
|
||||
{
|
||||
visuals::g_pBackgroundDrawList->AddRectFilled(ImVec2(x, y), ImVec2(x + w, y + h), color);
|
||||
}
|
||||
|
||||
VOID DrawBox(int x, int y, int w, int h, int lw, ImColor color)
|
||||
{
|
||||
FillRGBA(x, y, w, lw, color); // top
|
||||
FillRGBA(x, y + lw, lw, h - lw, color); // left
|
||||
FillRGBA(x + w - lw, y + lw, lw, h - lw, color); // right
|
||||
FillRGBA(x + lw, y + h - lw, w - lw * 2, lw, color); // bottom
|
||||
}
|
||||
|
||||
VOID DrawHeader(INT x, INT y, INT w, ImColor color, INT HealthBarWidth)
|
||||
{
|
||||
INT i = 0;
|
||||
INT xCoord = x;
|
||||
INT yCoord = y;
|
||||
|
||||
// Male Male :)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
FillRGBA(x - i, y + i, w, 1, ImColor(0, 0, 0, 255));
|
||||
FillRGBA(x - i, y + i, HealthBarWidth + 2, 1, color);
|
||||
|
||||
FillRGBA(x - 3, y + 3, HealthBarWidth + 2, 1, ImColor((INT) (color.Value.x / 1.5f),
|
||||
(INT) (color.Value.y / 1.5f), (INT) (color.Value.z / 1.5f), 255));
|
||||
|
||||
FillRGBA(x - 4, y + 4, HealthBarWidth + 2, 1, ImColor((INT) (color.Value.x / 1.5f),
|
||||
(INT) (color.Value.y / 1.5f), (INT) (color.Value.z / 1.5f), 255));
|
||||
}
|
||||
|
||||
// Oben
|
||||
if (visuals::esp_glow)
|
||||
visuals::g_pBackgroundDrawList->AddShadowRect(ImVec2(x, y), ImVec2(x + w, y + 1), ImColor(255, 255, 255, 255), 35.f, ImVec2(0, 0));
|
||||
|
||||
FillRGBA(x, y, w, 1, ImColor(255, 255, 255, 255));
|
||||
|
||||
// Unten
|
||||
if (visuals::esp_glow)
|
||||
visuals::g_pBackgroundDrawList->AddShadowRect(ImVec2((x + 1) - 5, y + 5), ImVec2(((x + 1) - 5) + w, (y + 5) + 1), ImColor(255, 255, 255, 255), 35.f, ImVec2(0, 0));
|
||||
|
||||
FillRGBA((x + 1) - 5, y + 5, w, 1, ImColor(255, 255, 255, 255));
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
// Schräg links
|
||||
if (visuals::esp_glow)
|
||||
visuals::g_pBackgroundDrawList->AddShadowRect(ImVec2(x, y), ImVec2(x + 1, y + 1), ImColor(255, 255, 255, 255), 15.f, ImVec2(0, 0));
|
||||
|
||||
FillRGBA(x, y, 1, 1, ImColor(255, 255, 255, 255));
|
||||
x--;
|
||||
y++;
|
||||
}
|
||||
|
||||
x = xCoord;
|
||||
y = yCoord;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
// Schräg rechts
|
||||
if (i != 0)
|
||||
{
|
||||
if (visuals::esp_glow)
|
||||
visuals::g_pBackgroundDrawList->AddShadowRect(ImVec2(x + w, y), ImVec2(x + w + 1, y + 1), ImColor(255, 255, 255, 255), 15.f, ImVec2(0, 0));
|
||||
|
||||
FillRGBA(x + w, y, 1, 1, ImColor(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
x--;
|
||||
y++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VOID DrawBoxHealth(int x, int y, int w, int h, int lw, ImColor color, int targetId, int damageDealt, int animTimer, int index)
|
||||
{
|
||||
FillRGBA(x, y, w, lw, ImColor(0, 0, 0, 255)); // top
|
||||
FillRGBA(x, y + lw, lw, h - lw, ImColor(0, 0, 0, 255)); // left
|
||||
FillRGBA(x + w - lw, y + lw, lw, h - lw, ImColor(0, 0, 0, 255)); // right
|
||||
FillRGBA(x + lw, y + h - lw, w - lw * 2, lw, ImColor(0, 0, 0, 255)); // fill
|
||||
|
||||
if (color.Value.w == 0)
|
||||
color.Value.x = 50, color.Value.y = 50; color.Value.z = 50;
|
||||
|
||||
FillRGBA(x + lw, y + lw, w - (lw * 2), h - (lw * 2), color);
|
||||
}
|
||||
|
||||
void DrawOutlinedRect(int x0, int y0, int x1, int y1, ImColor color)
|
||||
{
|
||||
int BoxWidth = x1 - x0;
|
||||
int BoxHeight = y1 - y0;
|
||||
|
||||
if (BoxWidth < 10)
|
||||
BoxWidth = 10;
|
||||
|
||||
if (BoxHeight < 15)
|
||||
BoxHeight = 15;
|
||||
|
||||
visuals::g_pBackgroundDrawList->AddRectFilled(ImVec2(x0, y0), ImVec2(x0 + (BoxWidth / 5), y0 + 1), color); //left top
|
||||
visuals::g_pBackgroundDrawList->AddRectFilled(ImVec2(x0, y0), ImVec2(x0 + 1, y0 + (BoxHeight / 6)), color); //left top
|
||||
|
||||
visuals::g_pBackgroundDrawList->AddRectFilled(ImVec2(x1 - (BoxWidth / 5) + 1, y0), ImVec2(x1, y0 + 1), color); //right top
|
||||
visuals::g_pBackgroundDrawList->AddRectFilled(ImVec2(x1, y0), ImVec2(x1 + 1, y0 + (BoxHeight / 6)), color); //right top
|
||||
|
||||
visuals::g_pBackgroundDrawList->AddRectFilled(ImVec2(x0, y1), ImVec2(x0 + (BoxWidth / 5), y1 + 1), color); //left bottom
|
||||
visuals::g_pBackgroundDrawList->AddRectFilled(ImVec2(x0, y1 - (BoxHeight / 6) + 1), ImVec2(x0 + 1, y1 + 1), color); //left bottom
|
||||
|
||||
visuals::g_pBackgroundDrawList->AddRectFilled(ImVec2(x1 - (BoxWidth / 5) + 1, y1), ImVec2(x1, y1 + 1), color); //right bottom
|
||||
visuals::g_pBackgroundDrawList->AddRectFilled(ImVec2(x1, y1 - (BoxHeight / 6) + 1), ImVec2(x1 + 1, y1 + 1), color); //right bottom
|
||||
}
|
||||
|
||||
void DrawHealthBox(C_CSPlayerPawn* pPlayerPawn, int x, int y, int w)
|
||||
{
|
||||
int CurHealth = pPlayerPawn->m_iHealth( );
|
||||
if (CurHealth > 100)
|
||||
CurHealth = 100;
|
||||
|
||||
int iHealthWidth = (CurHealth * (w * 0.5 * 0.1) * 0.2);
|
||||
int iHealthMaxWidth = (100 * (w * 0.5 * 0.1) * 0.2);
|
||||
DrawHeader(x, y, iHealthMaxWidth + 2, ImColor(255, 255, 255, 255), iHealthWidth);
|
||||
}
|
||||
|
||||
void visuals::Render( )
|
||||
{
|
||||
if (!interfaces::pEngine->IsInGame( ))
|
||||
return;
|
||||
|
||||
g_pLocalPlayerController = CGameEntitySystem::GetLocalPlayerController( );
|
||||
if (!g_pLocalPlayerController)
|
||||
return;
|
||||
|
||||
g_pLocalPlayerPawn = g_pLocalPlayerController->m_hPawn( ).Get<C_CSPlayerPawn>( );
|
||||
if (!g_pLocalPlayerPawn)
|
||||
return;
|
||||
|
||||
CGameEntitySystem* pEntitySystem = CGameEntitySystem::GetInstance( );
|
||||
if (!pEntitySystem)
|
||||
return;
|
||||
|
||||
//int highestIndex = pEntitySystem->GetHighestEntityIndex();
|
||||
for (int i = 1; i <= 64; ++i)
|
||||
{
|
||||
C_BaseEntity* pEntity = pEntitySystem->GetBaseEntity(i);
|
||||
if (!pEntity)
|
||||
continue;
|
||||
|
||||
SchemaClassInfoData_t* pClassInfo = pEntity->Schema_DynamicBinding( );
|
||||
if (pClassInfo == nullptr)
|
||||
continue;
|
||||
|
||||
if (std::string_view{ pClassInfo->GetName( ) }.find("CCSPlayerController") == std::string::npos)
|
||||
continue;
|
||||
|
||||
CCSPlayerController* pPlayerController = reinterpret_cast<CCSPlayerController*>(pEntity);
|
||||
if (!pPlayerController->m_bPawnIsAlive( ))
|
||||
continue;
|
||||
|
||||
C_CSPlayerPawn* pPawn = pPlayerController->m_hPawn( ).Get<C_CSPlayerPawn>( );
|
||||
if (!pPawn)
|
||||
continue;
|
||||
|
||||
const bool isLocalPlayer = pPlayerController->m_bIsLocalPlayerController( );
|
||||
const bool isEnemy = pPawn->IsEnemyWithTeam(g_pLocalPlayerController->m_iTeamNum( ));
|
||||
if (g_pLocalPlayerController->m_iTeamNum( ) == pPawn->m_iTeamNum( ) || !isEnemy)
|
||||
continue;
|
||||
|
||||
BBox_t objBBox{};
|
||||
if (!pPawn->GetBoundingBox(objBBox, false))
|
||||
continue;
|
||||
|
||||
CCollisionProperty* pCollision = pPawn->m_pCollision( );
|
||||
if (pCollision == nullptr)
|
||||
continue;
|
||||
|
||||
CGameSceneNode* pGameSceneNode = pPawn->m_pGameSceneNode( );
|
||||
if (pGameSceneNode == nullptr)
|
||||
continue;
|
||||
|
||||
// Firstly, get the skeleton
|
||||
CSkeletonInstance* pSkeleton = reinterpret_cast<CSkeletonInstance*>(pGameSceneNode);
|
||||
if (pSkeleton == nullptr)
|
||||
continue;
|
||||
|
||||
// Now the bones
|
||||
Matrix2x4_t* pBoneCache = pSkeleton->m_bone_cache;
|
||||
if (pBoneCache == nullptr)
|
||||
continue;
|
||||
|
||||
ImVec2 vScreen{};
|
||||
if (!math::WorldToScreen(pGameSceneNode->m_vecAbsOrigin( ), vScreen))
|
||||
continue;
|
||||
|
||||
// Get the bone's position
|
||||
Vector vecPos = pBoneCache->GetOrigin(6);
|
||||
Vector vTop = (Vector(pGameSceneNode->m_vecAbsOrigin( ).x, pGameSceneNode->m_vecAbsOrigin( ).y, vecPos.z + 7.0f));
|
||||
|
||||
ImVec2 vTopScreen{};
|
||||
if (!math::WorldToScreen(vTop, vTopScreen))
|
||||
continue;
|
||||
|
||||
float h = (vScreen.y - vTopScreen.y);
|
||||
float w = h / 4.5f;
|
||||
|
||||
if (visuals::esp_box)
|
||||
{
|
||||
int r_x = vTopScreen.x - w;
|
||||
w *= 2;
|
||||
int frame_w = w;
|
||||
int frame_ww = frame_w;
|
||||
frame_ww /= 3;
|
||||
frame_w /= 2.3;
|
||||
|
||||
ImColor colorShit = ImColor(15, 15, 15, 255);
|
||||
ImColor colorShit1 = ImColor(0, 0, 0, 255);
|
||||
|
||||
int calc_x = r_x + (w - frame_ww);
|
||||
int calc_y = vTopScreen.y + (h - frame_w);
|
||||
|
||||
if (visuals::esp_glow)
|
||||
{
|
||||
g_pBackgroundDrawList->AddShadowRect(ImVec2(r_x, vTopScreen.y - 1), ImVec2(r_x + frame_ww, (vTopScreen.y - 1) + 1), ImColor(255, 255, 255, 255), 30.f, ImVec2(0, 0));
|
||||
g_pBackgroundDrawList->AddShadowRect(ImVec2(r_x - 1, vTopScreen.y), ImVec2((r_x - 1) + 1, vTopScreen.y + frame_w), ImColor(255, 255, 255, 255), 30.f, ImVec2(0, 0));
|
||||
|
||||
g_pBackgroundDrawList->AddShadowRect(ImVec2(calc_x, vTopScreen.y - 1), ImVec2(calc_x + frame_ww + 1, vTopScreen.y - 1 + 1), ImColor(255, 255, 255, 255), 30.f, ImVec2(0, 0));
|
||||
g_pBackgroundDrawList->AddShadowRect(ImVec2(r_x + w + 1, vTopScreen.y), ImVec2(r_x + w + 1 + 1, vTopScreen.y + frame_w), ImColor(255, 255, 255, 255), 30.f, ImVec2(0, 0));
|
||||
|
||||
g_pBackgroundDrawList->AddShadowRect(ImVec2(r_x, vTopScreen.y + h + 1), ImVec2(r_x + frame_ww, vTopScreen.y + h + 1 + 1), ImColor(255, 255, 255, 255), 30.f, ImVec2(0, 0));
|
||||
g_pBackgroundDrawList->AddShadowRect(ImVec2(r_x - 1, calc_y), ImVec2(r_x - 1 + 1, calc_y + frame_w + 1), ImColor(255, 255, 255, 255), 30.f, ImVec2(0, 0));
|
||||
|
||||
g_pBackgroundDrawList->AddShadowRect(ImVec2(calc_x + 1, vTopScreen.y + h + 1), ImVec2(calc_x + 1 + frame_ww, vTopScreen.y + h + 1 + 1), ImColor(255, 255, 255, 255), 30.f, ImVec2(0, 0));
|
||||
g_pBackgroundDrawList->AddShadowRect(ImVec2(r_x + w + 1, calc_y), ImVec2(r_x + w + 1 + 1, calc_y + frame_w + 1), ImColor(255, 255, 255, 255), 30.f, ImVec2(0, 0));
|
||||
}
|
||||
|
||||
//top left
|
||||
FillRGBA(r_x, vTopScreen.y, frame_ww, 1, colorShit);
|
||||
FillRGBA(r_x, vTopScreen.y, 1, frame_w, colorShit);
|
||||
|
||||
FillRGBA(r_x, vTopScreen.y - 1, frame_ww, 1, colorShit1);
|
||||
FillRGBA(r_x - 1, vTopScreen.y, 1, frame_w, colorShit1);
|
||||
|
||||
//top right
|
||||
FillRGBA(calc_x, vTopScreen.y, frame_ww, 1, colorShit);
|
||||
FillRGBA(r_x + w, vTopScreen.y, 1, frame_w, colorShit);
|
||||
|
||||
FillRGBA(calc_x, vTopScreen.y - 1, frame_ww + 1, 1, colorShit1);
|
||||
FillRGBA(r_x + w + 1, vTopScreen.y, 1, frame_w, colorShit1);
|
||||
|
||||
//bottom left
|
||||
FillRGBA(r_x, vTopScreen.y + h, frame_ww, 1, colorShit);
|
||||
FillRGBA(r_x, calc_y, 1, frame_w, colorShit);
|
||||
|
||||
FillRGBA(r_x, vTopScreen.y + h + 1, frame_ww, 1, colorShit1);
|
||||
FillRGBA(r_x - 1, calc_y, 1, frame_w + 1, colorShit1);
|
||||
|
||||
//bottom right
|
||||
FillRGBA(calc_x + 1, vTopScreen.y + h, frame_ww, 1, colorShit);
|
||||
FillRGBA(r_x + w, calc_y, 1, frame_w, colorShit);
|
||||
|
||||
FillRGBA(calc_x + 1, vTopScreen.y + h + 1, frame_ww, 1, colorShit1);
|
||||
FillRGBA(r_x + w + 1, calc_y, 1, frame_w + 1, colorShit1);
|
||||
}
|
||||
|
||||
if (visuals::esp_health)
|
||||
DrawHealthBox(pPawn, vScreen.x - w * 0.5, vScreen.y + 6, w);
|
||||
|
||||
if (visuals::esp_name)
|
||||
{
|
||||
std::string szName = std::string{ pPlayerController->m_sSanitizedPlayerName( ) };
|
||||
if (szName.size( ) > 0)
|
||||
{
|
||||
const ImVec2 min = { objBBox.x, objBBox.y };
|
||||
const ImVec2 max = { objBBox.w, objBBox.h };
|
||||
const ImVec2 vecTextSize = visuals::pixel_font->CalcTextSizeA(12, FLT_MAX, -1.0f, szName.c_str( ));
|
||||
ImVec2 textPos = ImFloor({ (min.x + max.x - vecTextSize.x) / 2.f + 2, min.y - 12.f });
|
||||
|
||||
textPos.y -= 3.f;
|
||||
|
||||
if (visuals::esp_glow)
|
||||
g_pBackgroundDrawList->AddShadowRect(textPos, textPos + vecTextSize, ImColor(255, 255, 255, 185), 60.f, ImVec2(0, 0));
|
||||
|
||||
render::text_outline(g_pBackgroundDrawList, textPos - ImVec2(1.f, 1.f), IM_COL32(0, 0, 0, 255), szName.c_str( ));
|
||||
render::text_outline(g_pBackgroundDrawList, textPos, IM_COL32(255, 255, 255, 255), szName.c_str( ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void visuals::CalculateBoundingBoxes( )
|
||||
{
|
||||
if (!interfaces::pEngine->IsInGame( )) return;
|
||||
|
||||
const std::lock_guard<std::mutex> guard{ g_cachedEntitiesMutex };
|
||||
|
||||
for (auto& it : g_cachedEntities)
|
||||
{
|
||||
C_BaseEntity* pEntity = it.m_handle.Get( );
|
||||
if (!pEntity) continue;
|
||||
|
||||
// Additional sanity check.
|
||||
CHandle hEntity = pEntity->GetRefEHandle( );
|
||||
if (hEntity != it.m_handle) continue;
|
||||
|
||||
switch (it.m_type)
|
||||
{
|
||||
case CachedEntity_t::PLAYER_CONTROLLER:
|
||||
{
|
||||
C_CSPlayerPawn* pPlayerPawn = ((CCSPlayerController*) pEntity)
|
||||
->m_hPawn( )
|
||||
.Get<C_CSPlayerPawn>( );
|
||||
if (pPlayerPawn)
|
||||
it.m_draw = pPlayerPawn->GetBoundingBox(it.m_bbox, false);
|
||||
|
||||
} break;
|
||||
case CachedEntity_t::BASE_WEAPON:
|
||||
it.m_draw = pEntity->GetBoundingBox(it.m_bbox, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void visuals::CacheCurrentEntities( )
|
||||
{
|
||||
|
||||
if (!interfaces::pEngine->IsInGame( )) return;
|
||||
|
||||
CGameEntitySystem* pEntitySystem = CGameEntitySystem::GetInstance( );
|
||||
if (!pEntitySystem) return;
|
||||
|
||||
int highestIndex = pEntitySystem->GetHighestEntityIndex( );
|
||||
for (int i = 1; i <= highestIndex; ++i)
|
||||
{
|
||||
C_BaseEntity* pEntity = pEntitySystem->GetBaseEntity(i);
|
||||
if (!pEntity) continue;
|
||||
|
||||
OnAddEntity(pEntity, pEntity->GetRefEHandle( ));
|
||||
}
|
||||
}
|
||||
|
||||
void visuals::OnAddEntity(CEntityInstance* pInst, CHandle handle)
|
||||
{
|
||||
C_BaseEntity* pEntity = (C_BaseEntity*) pInst;
|
||||
if (!pEntity) return;
|
||||
|
||||
if (handle.GetEntryIndex( ) >= 16384) return;
|
||||
|
||||
auto it = std::find_if(g_cachedEntities.begin( ), g_cachedEntities.end( ),
|
||||
[handle](const CachedEntity_t& i)
|
||||
{
|
||||
return i.m_handle.GetEntryIndex( ) ==
|
||||
handle.GetEntryIndex( );
|
||||
});
|
||||
|
||||
if (it == g_cachedEntities.end( ))
|
||||
{
|
||||
CachedEntity_t cachedEntity{};
|
||||
cachedEntity.m_handle = handle;
|
||||
cachedEntity.m_type = ::GetEntityType(pEntity);
|
||||
if (cachedEntity.m_type != CachedEntity_t::UNKNOWN)
|
||||
g_cachedEntities.emplace_back(cachedEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
it->m_handle = handle;
|
||||
it->m_type = ::GetEntityType(pEntity);
|
||||
}
|
||||
}
|
||||
|
||||
void visuals::OnRemoveEntity(CEntityInstance* pInst, CHandle handle)
|
||||
{
|
||||
C_BaseEntity* pEntity = (C_BaseEntity*) pInst;
|
||||
if (!pEntity) return;
|
||||
|
||||
auto it = std::find_if(
|
||||
g_cachedEntities.begin( ), g_cachedEntities.end( ),
|
||||
[handle](const CachedEntity_t& i)
|
||||
{
|
||||
return i.m_handle == handle;
|
||||
});
|
||||
if (it == g_cachedEntities.end( )) return;
|
||||
|
||||
it->m_draw = false;
|
||||
it->m_type = CachedEntity_t::UNKNOWN;
|
||||
}
|
||||
|
||||
static CachedEntity_t::Type GetEntityType(C_BaseEntity* pEntity)
|
||||
{
|
||||
if (pEntity->IsBasePlayerController( ))
|
||||
return CachedEntity_t::PLAYER_CONTROLLER;
|
||||
else if (pEntity->IsBasePlayerWeapon( ))
|
||||
return CachedEntity_t::BASE_WEAPON;
|
||||
|
||||
return CachedEntity_t::UNKNOWN;
|
||||
}
|
||||
|
||||
static void RenderPlayerESP(CCSPlayerController* pPlayerController, const BBox_t& bBox)
|
||||
{
|
||||
using namespace visuals;
|
||||
|
||||
if (!pPlayerController->m_bPawnIsAlive( ))
|
||||
return;
|
||||
|
||||
C_CSPlayerPawn* pPawn = pPlayerController->m_hPawn( ).Get<C_CSPlayerPawn>( );
|
||||
if (!pPawn)
|
||||
return;
|
||||
|
||||
const bool isLocalPlayer = pPlayerController->m_bIsLocalPlayerController( );
|
||||
const bool isEnemy = pPawn->IsEnemyWithTeam(g_pLocalPlayerController->m_iTeamNum( ));
|
||||
|
||||
if (g_pLocalPlayerController->m_iTeamNum( ) == pPawn->m_iTeamNum( ))
|
||||
return;
|
||||
|
||||
const ImVec2 min = { bBox.x, bBox.y };
|
||||
const ImVec2 max = { bBox.w, bBox.h };
|
||||
|
||||
if (esp_box)
|
||||
{
|
||||
render::corner_outline(g_pBackgroundDrawList, min.x, min.y, max.x,
|
||||
max.y, ImColor(255, 255, 255),
|
||||
ImColor(56, 57, 72));
|
||||
}
|
||||
|
||||
if (esp_name)
|
||||
{
|
||||
const char* szName = pPlayerController->m_sSanitizedPlayerName( );
|
||||
if (szName && strlen(szName) > 0)
|
||||
{
|
||||
const ImVec2 textSize = ImGui::CalcTextSize(szName);
|
||||
const ImVec2 textPos = ImFloor(
|
||||
{ (min.x + max.x - textSize.x) / 2.f + 2, min.y - textSize.y - 2.f });
|
||||
|
||||
render::text_outline(g_pBackgroundDrawList, textPos,
|
||||
IM_COL32(255, 255, 255, 255),
|
||||
szName);
|
||||
}
|
||||
}
|
||||
if (esp_health)
|
||||
{
|
||||
const int hp = std::min(pPawn->m_iHealth( ), 100);
|
||||
|
||||
const ImVec2 barMin = ImVec2{ min.x, max.y + 5 };
|
||||
const ImVec2 barMax = ImVec2{ max.x, max.y + 5 };
|
||||
|
||||
const float w = ((barMax.x - barMin.x) * hp) / 100.f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void RenderWeaponESP(C_CSWeaponBase* pWeapon, const BBox_t& bBox)
|
||||
{
|
||||
using namespace visuals;
|
||||
|
||||
if (pWeapon->m_hOwnerEntity( ).IsValid( )) return;
|
||||
|
||||
if (fWeaponMaxDistance != 0.f &&
|
||||
g_pLocalPlayerPawn->DistanceToSquared(pWeapon) >=
|
||||
fWeaponMaxDistance * fWeaponMaxDistance)
|
||||
return;
|
||||
|
||||
const ImVec2 min = { bBox.x, bBox.y };
|
||||
const ImVec2 max = { bBox.w, bBox.h };
|
||||
|
||||
}
|
||||
|
||||
static void RenderWeaponName(C_CSWeaponBase* pWeapon, const BBox_t& bBox)
|
||||
{
|
||||
// Function to avoid spaghetti code.
|
||||
C_AttributeContainer* pAttributeContainer = pWeapon->m_AttributeManager( );
|
||||
if (!pAttributeContainer) return;
|
||||
|
||||
C_EconItemView* pItemView = pAttributeContainer->m_Item( );
|
||||
if (!pItemView) return;
|
||||
|
||||
CEconItemDefinition* pItemStaticData = pItemView->GetStaticData( );
|
||||
if (!pItemStaticData) return;
|
||||
|
||||
const char* szWeaponName =
|
||||
interfaces::pLocalize->FindSafe(pItemStaticData->m_pszItemBaseName);
|
||||
if (!szWeaponName || strlen(szWeaponName) < 1) return;
|
||||
|
||||
const ImVec2 min = { bBox.x, bBox.y };
|
||||
const ImVec2 max = { bBox.w, bBox.h };
|
||||
|
||||
const ImVec2 textSize = ImGui::CalcTextSize(szWeaponName);
|
||||
const ImVec2 textPos = ImFloor(
|
||||
{ (min.x + max.x - textSize.x) / 2.f, max.y + textSize.y - 12.f });
|
||||
visuals::g_pBackgroundDrawList->AddText(textPos + ImVec2{ 1, 1 },
|
||||
IM_COL32(0, 0, 0, 255), szWeaponName);
|
||||
visuals::g_pBackgroundDrawList->AddText(textPos, IM_COL32(255, 255, 255, 255),
|
||||
szWeaponName);
|
||||
}
|
||||
40
examples/raze-internal-cs2-main/src/game/esp/esp.hpp
Normal file
40
examples/raze-internal-cs2-main/src/game/esp/esp.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <imgui/imgui.h>
|
||||
#include <imgui/imgui_internal.h>
|
||||
#include "../../sdk/source2-sdk/types/chandle.hpp"
|
||||
#include <d3d11.h>
|
||||
|
||||
class CEntityInstance;
|
||||
|
||||
namespace visuals {
|
||||
void Render();
|
||||
inline ImFont* pixel_font;
|
||||
inline ImFont* menu_font;
|
||||
inline ImFont* esp_font;
|
||||
void CalculateBoundingBoxes();
|
||||
void CacheCurrentEntities();
|
||||
void OnAddEntity(CEntityInstance* pInst, CHandle handle);
|
||||
void OnRemoveEntity(CEntityInstance* pInst, CHandle handle);
|
||||
|
||||
//inline bool bBoxes, bName, bHealthbar, bIgnoreTeammates, bActiveWeaponName,
|
||||
// bDroppedWeaponBoxes, bDroppedWeaponName, bIgnoreEnemies, bIgnoreSelf,
|
||||
// money, armor, zoom, blind, reload, defuse, icon;
|
||||
inline float fWeaponMaxDistance;
|
||||
inline bool esp_enable;
|
||||
inline bool esp_box;
|
||||
inline bool esp_name;
|
||||
inline bool esp_health;
|
||||
inline bool nightmode;
|
||||
inline bool esp_glow;
|
||||
|
||||
inline ID3D11ShaderResourceView* BG = nullptr;
|
||||
inline ID3D11ShaderResourceView* legitBot = nullptr;
|
||||
inline ID3D11ShaderResourceView* _visuals = nullptr;
|
||||
inline ID3D11ShaderResourceView* _misc = nullptr;
|
||||
inline ID3D11ShaderResourceView* _skins = nullptr;
|
||||
inline ID3D11ShaderResourceView* _configs = nullptr;
|
||||
inline ID3D11ShaderResourceView* check_box = nullptr;
|
||||
|
||||
inline ImDrawList* g_pBackgroundDrawList = nullptr;
|
||||
} // namespace esp
|
||||
225
examples/raze-internal-cs2-main/src/game/external_aim/aim.cpp
Normal file
225
examples/raze-internal-cs2-main/src/game/external_aim/aim.cpp
Normal file
@@ -0,0 +1,225 @@
|
||||
#include "aim.h"
|
||||
#include "../../sdk/interfaces/interfaces.hpp"
|
||||
#include "random"
|
||||
#include "windows.h"
|
||||
#include <iostream>
|
||||
#include "../../sdk/source2-sdk/classes/cusercmd.h"
|
||||
|
||||
class MemoryManagement {
|
||||
public:
|
||||
template <class T>
|
||||
T ReadMem(uintptr_t addr) {
|
||||
T x;
|
||||
ReadProcessMemory(GetCurrentProcess(), (LPBYTE*)addr, &x, sizeof(x), NULL);
|
||||
return x;
|
||||
}
|
||||
|
||||
bool ReadRawMem(uintptr_t addr, void* buffer, size_t size) {
|
||||
SIZE_T bytesRead;
|
||||
if (ReadProcessMemory(GetCurrentProcess(), reinterpret_cast<LPCVOID>(addr), buffer, size, &bytesRead)) {
|
||||
return bytesRead == size;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
MemoryManagement MemMan;
|
||||
|
||||
inline Vector CalculateAngle(
|
||||
Vector& localPosition,
|
||||
Vector& enemyPosition,
|
||||
Vector& viewAngles) noexcept
|
||||
{
|
||||
return (enemyPosition - localPosition).ToAngle() - viewAngles;
|
||||
};
|
||||
|
||||
inline Vector calculateBestAngle(Vector angle, Vector configFov) {
|
||||
Vector newAngle{};
|
||||
|
||||
float calcFov = std::hypot(angle.x + configFov.x, angle.y + configFov.y);
|
||||
float fov = configFov.z;
|
||||
|
||||
if (calcFov < fov) {
|
||||
calcFov = fov;
|
||||
newAngle = angle;
|
||||
}
|
||||
return newAngle;
|
||||
}
|
||||
|
||||
static CCSPlayerController* g_pLocalPlayerController = nullptr;
|
||||
static C_CSPlayerPawn* g_pLocalPlayerPawn = nullptr;
|
||||
|
||||
QAngle_t GetRecoil(CBaseUserCmdPB* pCmd, C_CSPlayerPawn* pLocal)
|
||||
{
|
||||
static QAngle_t OldPunch;//get last tick AimPunch angles
|
||||
if (pLocal->GetShotsFired() >= 1)//only update aimpunch while shooting
|
||||
{
|
||||
QAngle_t viewAngles = pCmd->pViewangles->angValue;
|
||||
QAngle_t delta = viewAngles - (viewAngles + (OldPunch - (pLocal->GetAimPuchAngle() * 2.f)));//get current AimPunch angles delta
|
||||
|
||||
return pLocal->GetAimPuchAngle() * 2.0f;//return correct aimpunch delta
|
||||
}
|
||||
else
|
||||
{
|
||||
return QAngle_t{ 0, 0 ,0 };//return 0 if is not shooting
|
||||
}
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
|
||||
void aim::aimBot(C_CSPlayerPawn* enemyPlayer, uintptr_t boneArray, CUserCmd* pCmd, CBaseUserCmdPB* pBaseCmd) {
|
||||
if (!interfaces::pEngine->IsInGame())
|
||||
return;
|
||||
|
||||
g_pLocalPlayerController = CGameEntitySystem::GetLocalPlayerController();
|
||||
if (!g_pLocalPlayerController)
|
||||
return;
|
||||
|
||||
g_pLocalPlayerPawn = g_pLocalPlayerController->m_hPawn().Get<C_CSPlayerPawn>();
|
||||
if (!g_pLocalPlayerPawn)
|
||||
return;
|
||||
|
||||
if (g_pLocalPlayerPawn->m_iHealth() <= 0)
|
||||
return;
|
||||
|
||||
if (!pBaseCmd->pViewangles)
|
||||
return;
|
||||
|
||||
if (pBaseCmd->pViewangles->angValue.IsZero())
|
||||
return;
|
||||
|
||||
//if (aim::checkSpotted) {
|
||||
// GameTrace_t trace = GameTrace_t();
|
||||
// TraceFilter_t filter = TraceFilter_t(0x1C1003, g_pLocalPlayerPawn, nullptr, 4);
|
||||
// Ray_t ray = Ray_t();
|
||||
// interfaces::pTraceMgr->TraceShape2(&ray, enemyPlayer->m_pGameSceneNode()->GetSkeletonInstance()->m_bone_cache->GetOrigin(6), g_pLocalPlayerPawn->GetEyePosition(), &filter, &trace);
|
||||
// if (trace.m_pHitEntity != enemyPlayer || !trace.IsVisible())
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (aim::checkSpotted)
|
||||
{
|
||||
TraceFilter_t filter(0x1C3003, g_pLocalPlayerPawn, nullptr, 4);
|
||||
Ray_t ray = Ray_t();
|
||||
GameTrace_t trace = GameTrace_t();
|
||||
|
||||
interfaces::pTraceMgr->TraceShape2(&ray, g_pLocalPlayerPawn->GetEyePosition(), (Vector)enemyPlayer->m_pGameSceneNode()->getBoneArray(), &filter, &trace);
|
||||
|
||||
if ((trace.IsVisible() || (trace.m_pHitEntity && trace.m_pHitEntity->GetRefEHandle().GetEntryIndex() == enemyPlayer->GetRefEHandle().GetEntryIndex())))// && !(bSmokeCheck && !Utilities::LineGoesThroughSmoke(vecSource, vecPoint, flMaxDensity)))
|
||||
return;
|
||||
}
|
||||
|
||||
Vector aimPos;
|
||||
Vector newAngle;
|
||||
Vector angle;
|
||||
|
||||
if (playerLock)
|
||||
if (lockedPlayer != 0 && lockedPlayer != enemyPlayer) return;
|
||||
if (enemyPlayer == g_pLocalPlayerPawn) {
|
||||
lockedPlayer = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
aimPos = MemMan.ReadMem<Vector>(boneArray + boneMap[bones[boneSelect]] * 32);
|
||||
Vector angValue = Vector(pBaseCmd->pViewangles->angValue.x, pBaseCmd->pViewangles->angValue.y, pBaseCmd->pViewangles->angValue.z);
|
||||
auto eyePos = g_pLocalPlayerPawn->GetEyePosition();
|
||||
angle = CalculateAngle(eyePos, aimPos, angValue);
|
||||
newAngle = calculateBestAngle(angle, { 0, 0, fov });
|
||||
auto aimPunch = GetRecoil(pBaseCmd, g_pLocalPlayerPawn);
|
||||
|
||||
//if (rcs) {
|
||||
|
||||
// //Vector oldAngles = angValue;
|
||||
// static Vector oldAngles = { 0, 0, 0 };
|
||||
// Vector rcs = { 0, 0, 0 };
|
||||
|
||||
// if (g_pLocalPlayerPawn->GetShotsFired() > 1 && g_pLocalPlayerPawn->GetShotsFired() < 9999 /* Spectator check */) {
|
||||
// auto qAimPunc = g_pLocalPlayerPawn->GetAimPuchAngle();
|
||||
// Vector aimPunch = Vector(qAimPunc.x, qAimPunc.y, qAimPunc.z);
|
||||
// rcs.x = (aimPunch.x - oldAngles.x) * 2.f / (0.022f * sens);
|
||||
// rcs.y = (aimPunch.y - oldAngles.y) * 2.f / (0.022f * sens);
|
||||
|
||||
// oldAngles.x = aimPunch.y;
|
||||
// oldAngles.y = aimPunch.x;
|
||||
// }
|
||||
// newAngle = calculateBestAngle(angle, { rcs.x, rcs.y, fov });
|
||||
//};
|
||||
|
||||
//newAngle.x = (newAngle.x / (0.022f * sens)) / smoothing;
|
||||
//newAngle.y = (newAngle.y / (0.022f * sens)) / smoothing;
|
||||
if (rcs) {
|
||||
if (!newAngle.IsZero()) {
|
||||
newAngle.x += ((newAngle.x - aimPunch.x) / (0.022f * sens)) / smoothing;// minus AimPunch angle to counteract recoil
|
||||
newAngle.y += ((newAngle.y - aimPunch.y) / (0.022f * sens)) / smoothing;
|
||||
newAngle.Normalize();
|
||||
}
|
||||
}
|
||||
else {
|
||||
newAngle.x = (newAngle.x / (0.022f * sens)) / smoothing;
|
||||
newAngle.y = (newAngle.y / (0.022f * sens)) / smoothing;
|
||||
}
|
||||
|
||||
if (newAngle.IsZero()) {
|
||||
lockedPlayer = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
//newAngle.Clamp();
|
||||
|
||||
if (GetAsyncKeyState(VK_LBUTTON)) {
|
||||
aim::moveMouseToLocation(newAngle);
|
||||
}
|
||||
else if (alaimlock) {
|
||||
aim::moveMouseToLocation(newAngle);
|
||||
}
|
||||
|
||||
lockedPlayer = enemyPlayer;
|
||||
}
|
||||
|
||||
void aim::moveMouseToLocation(Vector pos) {
|
||||
if (pos.x == 0.f && pos.y == 0.f && pos.z == 0.f) return;
|
||||
|
||||
auto new_x = -pos.y;
|
||||
auto new_y = pos.x;
|
||||
|
||||
mouse_event(MOUSEEVENTF_MOVE, new_x, new_y, 0, 0);
|
||||
}
|
||||
|
||||
Vector aim::recoilControl(bool move, C_CSPlayerPawn* localPawn) {
|
||||
if (!localPawn)
|
||||
return {};
|
||||
|
||||
//if (localPawn->m_iHealth() <= 0)
|
||||
//return {};
|
||||
|
||||
localPawn->GetAimPuchAngleCache();
|
||||
localPawn->getViewAngles();
|
||||
|
||||
static Vector oldAngles = { 0, 0, 0 };
|
||||
Vector newAngles = { 0, 0, 0 };
|
||||
|
||||
if (localPawn->GetShotsFired() == 54587654) return newAngles; // Spectator check
|
||||
|
||||
if (localPawn->GetShotsFired() > 1) {
|
||||
auto qAimPunc = localPawn->GetAimPuchAngle();
|
||||
Vector aimPunch = Vector(qAimPunc.x, qAimPunc.y, qAimPunc.z);
|
||||
newAngles.x = (aimPunch.x - oldAngles.x) * 2.f / (0.022f * sens);
|
||||
newAngles.y = (aimPunch.y - oldAngles.y) * 2.f / (0.022f * sens);
|
||||
|
||||
if (move) aim::moveMouseToLocation(newAngles * -1);
|
||||
|
||||
oldAngles = aimPunch;
|
||||
return newAngles;
|
||||
}
|
||||
else {
|
||||
oldAngles = { 0, 0, 0 };
|
||||
return newAngles;
|
||||
}
|
||||
}
|
||||
|
||||
bool clicked = false;
|
||||
|
||||
const int trigger_cooldown()
|
||||
{
|
||||
// Generate a random float between 0.0 and 0.5, add 0.15F to it, then cast to int milliseconds
|
||||
return static_cast<int>((static_cast<float>(rand() % 50) / 100.0F + 0.15F) * 1000);
|
||||
}
|
||||
55
examples/raze-internal-cs2-main/src/game/external_aim/aim.h
Normal file
55
examples/raze-internal-cs2-main/src/game/external_aim/aim.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
#include "../../sdk/math/math.hpp"
|
||||
#include <windows.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
struct moduleData {
|
||||
HMODULE module;
|
||||
DWORD_PTR base;
|
||||
uintptr_t size;
|
||||
};
|
||||
|
||||
class C_CSPlayerPawn;
|
||||
class CUserCmd;
|
||||
class CBaseUserCmdPB;
|
||||
|
||||
namespace aim {
|
||||
Vector recoilControl(bool move, C_CSPlayerPawn* localPawn);
|
||||
void aimBot(C_CSPlayerPawn* enemyPlayer, uintptr_t boneArray, CUserCmd* pCmd, CBaseUserCmdPB* pBaseCmd);
|
||||
void moveMouseToLocation(Vector pos);
|
||||
//void triggerBot(DWORD_PTR base, C_CSPlayerPawn* localPawn);
|
||||
|
||||
inline C_CSPlayerPawn* lockedPlayer = 0;
|
||||
|
||||
inline bool isHotTrigger;
|
||||
inline int hotSelectTrigger = 0;
|
||||
inline int hotTrigger;
|
||||
inline bool playerLock;
|
||||
|
||||
inline bool state;
|
||||
inline bool rcs;
|
||||
inline bool trigger;
|
||||
|
||||
inline bool alaimlock = false;
|
||||
inline bool checkSpotted = true;
|
||||
inline float smoothing = 3.2f;
|
||||
|
||||
inline float fov = 2.5;
|
||||
inline bool fovCircle;
|
||||
|
||||
inline int bone;
|
||||
inline int boneSelect = 1;
|
||||
inline std::vector<std::string> bones = { "Head", "Neck","Chest", "Crotch" };
|
||||
inline std::map <std::string, int> boneMap = { {"Head",6},{"Neck",5},{"Chest",4},{"Crotch",0} };
|
||||
|
||||
inline int aimMode = 2;
|
||||
inline std::vector<std::string> aimModes = { "Closest to Player", "Closest to Crosshair", "Furthest from crosshair", "No preference" };
|
||||
inline std::map <std::string, int> aimModeMap = { {"Closest to Player",0},{"Closest to Crosshair",1},{"Furthest from crosshair",2},{"No preference",3} };
|
||||
|
||||
inline int hotSelectAim = 0;
|
||||
inline int hotAim;
|
||||
|
||||
inline float sens = 2.25f;
|
||||
}
|
||||
443
examples/raze-internal-cs2-main/src/game/game_hooks.cpp
Normal file
443
examples/raze-internal-cs2-main/src/game/game_hooks.cpp
Normal file
@@ -0,0 +1,443 @@
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include "../sdk/interfaces/interfaces.hpp"
|
||||
#include "../api/hook/hook.hpp"
|
||||
//#include "hook.hpp"
|
||||
#include "menu/menu.hpp"
|
||||
#include "movement/movement.hpp"
|
||||
#include "esp/esp.hpp"
|
||||
#include "chams/chams.hpp"
|
||||
#include <intrin.h>
|
||||
#include "world/world.hpp"
|
||||
#include "external_aim/aim.h"
|
||||
#include "skins/knife.h"
|
||||
|
||||
static void set_color(void* data, int r, int g, int b, int a)
|
||||
{
|
||||
*(byte*)((uintptr_t)data + 0x40) = r;
|
||||
*(byte*)((uintptr_t)data + 0x41) = g;
|
||||
*(byte*)((uintptr_t)data + 0x42) = b;
|
||||
*(byte*)((uintptr_t)data + 0x43) = a;
|
||||
}
|
||||
static CHook<bool __fastcall(void*)> g_mouseInputEnabled;
|
||||
static bool __fastcall hkMouseInputEnabled(void* rcx)
|
||||
{
|
||||
if (menu::IsOpen())
|
||||
return false;
|
||||
|
||||
return g_mouseInputEnabled(rcx);
|
||||
}
|
||||
|
||||
static CHook<void* __fastcall(void*, bool)> oIsRelativeMouseMode;
|
||||
static void* IsRelativeMouseMode(void* pThisptr, bool bActive)
|
||||
{
|
||||
//MENU::bMainActive = bActive;
|
||||
|
||||
if (menu::IsOpen())
|
||||
return oIsRelativeMouseMode(pThisptr, false);
|
||||
|
||||
return oIsRelativeMouseMode(pThisptr, bActive);
|
||||
}
|
||||
|
||||
static CHook<void* __fastcall(void*, CEntityInstance*, CHandle)> g_onAddEntity;
|
||||
static void* __fastcall hkOnAddEntity(void* rcx, CEntityInstance* pInstance,
|
||||
CHandle hHandle)
|
||||
{
|
||||
visuals::OnAddEntity(pInstance, hHandle);
|
||||
|
||||
return g_onAddEntity(rcx, pInstance, hHandle);
|
||||
}
|
||||
static CHook<void* __fastcall(void*, CEntityInstance*, CHandle)>
|
||||
g_onRemoveEntity;
|
||||
static void* __fastcall hkOnRemoveEntity(void* rcx, CEntityInstance* pInstance,
|
||||
CHandle hHandle)
|
||||
{
|
||||
visuals::OnRemoveEntity(pInstance, hHandle);
|
||||
return g_onRemoveEntity(rcx, pInstance, hHandle);
|
||||
}
|
||||
static CHook<void __fastcall(void*, void*, VMatrix*, VMatrix*, VMatrix*,
|
||||
VMatrix*)>
|
||||
g_getMatricesForView;
|
||||
static void __fastcall hkGetMatricesForView(void* rcx, void* view,
|
||||
VMatrix* pWorldToView,
|
||||
VMatrix* pViewToProjection,
|
||||
VMatrix* pWorldToProjection,
|
||||
VMatrix* pWorldToPixels)
|
||||
{
|
||||
g_getMatricesForView(rcx, view, pWorldToView, pViewToProjection,
|
||||
pWorldToProjection, pWorldToPixels);
|
||||
|
||||
math::UpdateViewMatrix(pWorldToProjection);
|
||||
visuals::CalculateBoundingBoxes();
|
||||
}
|
||||
|
||||
//bool spottedCheck(C_CSPlayerPawn pawn, C_CSPlayerPawn localPlayer) {
|
||||
//if (pawn.getEntitySpotted() & (1 << (localPlayer.GetOwnerHandleIndex())) || localPlayer.getEntitySpotted() & (1 << (pawn.GetOwnerHandleIndex()))) return 1;
|
||||
//return 0;
|
||||
//}
|
||||
|
||||
static CHook<bool __fastcall(CCSGOInput*, int, CUserCmd*)> g_CreateMove;
|
||||
static bool __fastcall hkCreateMove(CCSGOInput* pInput, int nSlot, CUserCmd* pCmd)
|
||||
{
|
||||
const bool result = g_CreateMove(pInput, nSlot, pCmd);
|
||||
if (!interfaces::pEngine->IsInGame() || !interfaces::pEngine->IsConnected())
|
||||
return result;
|
||||
|
||||
if (!pCmd)
|
||||
return result;
|
||||
|
||||
auto basecmd = pCmd->pBase.pBase;
|
||||
if (!basecmd)
|
||||
return result;
|
||||
|
||||
CCSPlayerController* LocalController = CGameEntitySystem::GetInstance()->GetLocalPlayerController();
|
||||
if (LocalController == nullptr)
|
||||
return result;
|
||||
|
||||
C_CSPlayerPawn* LocalPawn = LocalController->m_hPawn().Get<C_CSPlayerPawn>();
|
||||
if (LocalPawn == nullptr)
|
||||
return result;
|
||||
|
||||
CGameEntitySystem* pEntitySystem = CGameEntitySystem::GetInstance();
|
||||
if (!pEntitySystem)
|
||||
return result;
|
||||
|
||||
if (aim::rcs &&!menu::IsOpen())
|
||||
aim::recoilControl(true, LocalPawn);
|
||||
|
||||
for (int i = 1; i <= 64; ++i)
|
||||
{
|
||||
C_BaseEntity* pEntity = pEntitySystem->GetBaseEntity(i);
|
||||
if (!pEntity)
|
||||
continue;
|
||||
|
||||
SchemaClassInfoData_t* pClassInfo = pEntity->Schema_DynamicBinding();
|
||||
if (pClassInfo == nullptr)
|
||||
continue;
|
||||
|
||||
if (std::string_view{ pClassInfo->GetName() }.find("CCSPlayerController") == std::string::npos)
|
||||
continue;
|
||||
|
||||
CCSPlayerController* pPlayerController = reinterpret_cast<CCSPlayerController*>(pEntity);
|
||||
if (!pPlayerController->m_bPawnIsAlive())
|
||||
continue;
|
||||
|
||||
C_CSPlayerPawn* pPawn = pPlayerController->m_hPawn().Get<C_CSPlayerPawn>();
|
||||
if (!pPawn)
|
||||
continue;
|
||||
|
||||
const bool isLocalPlayer = pPlayerController->m_bIsLocalPlayerController();
|
||||
const bool isEnemy = pPawn->IsEnemyWithTeam(LocalController->m_iTeamNum());
|
||||
if (LocalController->m_iTeamNum() == pPawn->m_iTeamNum() || !isEnemy)
|
||||
continue;
|
||||
|
||||
if (aim::lockedPlayer == LocalPawn && (LocalPawn->m_iHealth() <= 0 || (aim::checkSpotted && !LocalPawn->getEntitySpotted()))) aim::lockedPlayer = 0;
|
||||
if ((LocalPawn->m_iHealth() <= 0 || LocalPawn->m_iHealth() > 100) || strcmp(LocalController->m_sSanitizedPlayerName(), "DemoRecorder") == 0) continue;
|
||||
|
||||
auto gameSceneNode = pPawn->m_pGameSceneNode();
|
||||
if (!gameSceneNode)
|
||||
continue;
|
||||
//if (isEnemy) continue;
|
||||
|
||||
if (aim::state && !menu::IsOpen()) {
|
||||
aim::aimBot(pPawn, gameSceneNode->getBoneArray(), pCmd, basecmd);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static CMaterial2* visible = nullptr;
|
||||
static CMaterial2* visible_black = nullptr;
|
||||
static CMaterial2* invisible_black = nullptr;
|
||||
static CMaterial2* invisible = nullptr;
|
||||
static CMaterial2* visible_bloom = nullptr;
|
||||
|
||||
void __fastcall hkDrawObject(void* pAnimatableSceneObjectDesc, void* pDx11,
|
||||
CMaterial2_Data_t* arrMeshDraw, int nDataCount,
|
||||
void* pSceneView, void* pSceneLayer, void* pUnk,
|
||||
void* pUnk2)
|
||||
{
|
||||
if (!interfaces::pEngine->IsConnected() || !interfaces::pEngine->IsInGame())
|
||||
return g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw,
|
||||
nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
if (!arrMeshDraw || !arrMeshDraw->m_material || !arrMeshDraw->m_pSceneAnimatableObject)
|
||||
return g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw,
|
||||
nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
CHandle hOwner = arrMeshDraw->m_pSceneAnimatableObject->hOwner;
|
||||
|
||||
C_BaseEntity* pEntity = hOwner.Get();
|
||||
if (!pEntity)
|
||||
return g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
SchemaClassInfoData_t* pClassInfo = pEntity->Schema_DynamicBinding();
|
||||
if (pClassInfo == nullptr)
|
||||
return g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
CCSPlayerController* LocalController = CGameEntitySystem::Get().GetLocalPlayerController();
|
||||
if (!LocalController)
|
||||
return g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
C_CSPlayerPawn* LocalPawn = LocalController->m_hPawn().Get<C_CSPlayerPawn>();
|
||||
if (!LocalPawn)
|
||||
return g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
if (pEntity->m_iTeamNum() == LocalPawn->m_iTeamNum())
|
||||
return g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
if (std::strcmp(arrMeshDraw->m_material->GetName(), "materials/dev/glowproperty.vmat") == 0)
|
||||
return g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
|
||||
if (!visible)
|
||||
visible = chams::create_visible("visible");
|
||||
if (!visible_black)
|
||||
visible_black = chams::create_visible_for_black("visible_for_black");
|
||||
if (!invisible_black)
|
||||
invisible_black = chams::create_invisible_for_black("invisible_for_black");
|
||||
if (!invisible)
|
||||
invisible = chams::create_invisible("invisible");
|
||||
if (!visible_bloom)
|
||||
visible_bloom = chams::create_bloom("bloom");
|
||||
|
||||
// weapon
|
||||
//if (std::string_view{ pClassInfo->GetName() }.find("C_CSGOViewModel") != std::string_view::npos && chams::weapon)
|
||||
//{
|
||||
// arrMeshDraw->m_material = visible;
|
||||
|
||||
// uint8_t new_color = chams::weapon_value;
|
||||
|
||||
// arrMeshDraw->m_color().c = new_color;
|
||||
// arrMeshDraw->m_color().m = new_color;
|
||||
// arrMeshDraw->m_color().y = new_color;
|
||||
// arrMeshDraw->m_color().k = 255;
|
||||
|
||||
|
||||
// g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
//}
|
||||
// player
|
||||
else if (std::string_view{ pClassInfo->GetName() }.find("C_CSPlayerPawn") != std::string_view::npos && chams::player)
|
||||
{
|
||||
if (chams::invisible)
|
||||
{
|
||||
if (chams::invisible_value > 30) {
|
||||
|
||||
arrMeshDraw->m_material = invisible;
|
||||
|
||||
uint8_t new_color = chams::invisible_value;
|
||||
|
||||
arrMeshDraw->m_color().c = new_color;
|
||||
arrMeshDraw->m_color().m = new_color;
|
||||
arrMeshDraw->m_color().y = new_color;
|
||||
arrMeshDraw->m_color().k = 255;
|
||||
}
|
||||
else {
|
||||
arrMeshDraw->m_material = invisible_black;
|
||||
|
||||
uint8_t new_color = chams::invisible_value;
|
||||
|
||||
arrMeshDraw->m_color().c = new_color;
|
||||
arrMeshDraw->m_color().m = new_color;
|
||||
arrMeshDraw->m_color().y = new_color;
|
||||
arrMeshDraw->m_color().k = 255;
|
||||
}
|
||||
|
||||
g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
}
|
||||
|
||||
// bloom
|
||||
if (chams::bloom)
|
||||
{
|
||||
arrMeshDraw->m_material = visible_bloom;
|
||||
|
||||
uint8_t new_color = chams::bloom_value;
|
||||
|
||||
arrMeshDraw->m_color().c = new_color;
|
||||
arrMeshDraw->m_color().m = new_color;
|
||||
arrMeshDraw->m_color().y = new_color;
|
||||
arrMeshDraw->m_color().k = 255;
|
||||
|
||||
//arrMeshDraw->m_color = color(1.f, 1.f, chams::bloom_value / 255.f, 0.100000);
|
||||
|
||||
g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
}
|
||||
else // visible
|
||||
{
|
||||
if (chams::visible_value > 30) {
|
||||
|
||||
arrMeshDraw->m_material = visible;
|
||||
|
||||
uint8_t new_color = chams::visible_value;
|
||||
|
||||
arrMeshDraw->m_object_info();
|
||||
|
||||
arrMeshDraw->m_color().c = new_color;
|
||||
arrMeshDraw->m_color().m = new_color;
|
||||
arrMeshDraw->m_color().y = new_color;
|
||||
arrMeshDraw->m_color().k = 255;
|
||||
}
|
||||
else {
|
||||
arrMeshDraw->m_material = visible_black;
|
||||
|
||||
uint8_t new_color = chams::visible_value;
|
||||
|
||||
arrMeshDraw->m_object_info();
|
||||
|
||||
arrMeshDraw->m_color().c = new_color;
|
||||
arrMeshDraw->m_color().m = new_color;
|
||||
arrMeshDraw->m_color().y = new_color;
|
||||
arrMeshDraw->m_color().k = 255;
|
||||
}
|
||||
|
||||
g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
}
|
||||
}
|
||||
// hands
|
||||
//else if (std::string_view{ pClassInfo->GetName() }.find("C_ViewmodelAttachmentModel") != std::string_view::npos && chams::hands)
|
||||
//{
|
||||
// arrMeshDraw->m_material = visible;
|
||||
|
||||
// uint8_t new_color = chams::hands_value;
|
||||
|
||||
// arrMeshDraw->m_color().c = new_color;
|
||||
// arrMeshDraw->m_color().m = new_color;
|
||||
// arrMeshDraw->m_color().y = new_color;
|
||||
// arrMeshDraw->m_color().k = 255;
|
||||
|
||||
|
||||
// g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
//}
|
||||
|
||||
return g_DrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
|
||||
}
|
||||
|
||||
static CHook<void* __fastcall(CGlowProperty*)> g_Glow;
|
||||
void* __fastcall hkGlow(CGlowProperty* GlowProperty)
|
||||
{
|
||||
if (!other::glow)
|
||||
return g_Glow(GlowProperty);
|
||||
|
||||
if (!GlowProperty)
|
||||
return g_Glow(GlowProperty);
|
||||
|
||||
if (!GlowProperty->m_hOwner)
|
||||
return g_Glow(GlowProperty);
|
||||
|
||||
CEntityInstance* owner = GlowProperty->m_hOwner;
|
||||
if (!owner)
|
||||
return g_Glow(GlowProperty);
|
||||
|
||||
auto PlayerPawn = interfaces::pGameResourceService->GetGameEntitySystem()->GetBaseEntity<C_CSPlayerPawn>(owner->GetRefEHandle().GetEntryIndex());
|
||||
|
||||
if (!PlayerPawn || PlayerPawn->m_iHealth() < 1)
|
||||
return g_Glow(GlowProperty);
|
||||
|
||||
CCSPlayerController* LocalController = CGameEntitySystem::Get().GetLocalPlayerController();
|
||||
if (!LocalController)
|
||||
return g_Glow(GlowProperty);
|
||||
|
||||
C_CSPlayerPawn* LocalPawn = LocalController->m_hPawn().Get<C_CSPlayerPawn>();
|
||||
if (!LocalPawn)
|
||||
return g_Glow(GlowProperty);
|
||||
|
||||
if ((LocalPawn == PlayerPawn) || (LocalPawn->m_iTeamNum() == PlayerPawn->m_iTeamNum()))
|
||||
return g_Glow(GlowProperty);
|
||||
|
||||
Color_t glowCol = Color_t(other::intesivity, other::intesivity, other::intesivity);
|
||||
|
||||
GlowProperty->Glowing() = true;
|
||||
GlowProperty->GlowColorOverride() = glowCol;
|
||||
|
||||
return g_Glow(GlowProperty);
|
||||
}
|
||||
|
||||
static CHook<void __fastcall(void*, int)> g_FrameStageNotify;
|
||||
void __fastcall hkFrameStageNotify(void* rcx, int stage)
|
||||
{
|
||||
switch (stage) {
|
||||
case 6:
|
||||
knife_changer::Run();
|
||||
break;
|
||||
}
|
||||
|
||||
//world::SkyBoxChanger();
|
||||
//switch (stage)
|
||||
//{
|
||||
// case 6:
|
||||
// break;
|
||||
//}
|
||||
|
||||
//if (stage == 6)
|
||||
//{
|
||||
// visuals::Render();
|
||||
//}
|
||||
|
||||
g_FrameStageNotify(rcx, stage);
|
||||
}
|
||||
|
||||
static CHook<void* __fastcall(void*)>g_3DBox;
|
||||
void* __fastcall UpdateSky3DParams(void* a1)
|
||||
{
|
||||
if (world::skybox)
|
||||
return nullptr;
|
||||
|
||||
return g_3DBox(a1);
|
||||
}
|
||||
|
||||
static CHook<Color_t __fastcall(PVOID, float*)> g_ApplyColorSO;
|
||||
Color_t ApplyColorToSceneObject(PVOID a1, float* a2)
|
||||
{
|
||||
if (world::nightmode)
|
||||
return Color_t(40, 40, 40, 255);
|
||||
|
||||
return g_ApplyColorSO(a1, a2);
|
||||
}
|
||||
|
||||
float g_lighting_color[3] = { 255.f / 255.f, 255.f / 255.f, 255.f / 255.f };
|
||||
float g_lighting_brightness = 6.f;
|
||||
static CHook<void __fastcall(__int64, __int64)> g_SetupLight;
|
||||
void __fastcall setup_lighting(__int64 a1, __int64 a2)
|
||||
{
|
||||
g_SetupLight(a1, a2);
|
||||
|
||||
if (world::nightmode)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
reinterpret_cast<float*>(a1 + 4)[i] = g_lighting_color[i] * g_lighting_brightness;
|
||||
}
|
||||
}
|
||||
|
||||
static CHook<PVOID __fastcall(C_EnvSky*)> g_UpdateSkybox;
|
||||
PVOID UpdateSkybox(C_EnvSky* thisptr)
|
||||
{
|
||||
static uint8_t nOldColor[3] =
|
||||
{
|
||||
thisptr->m_vTintColor()[0],
|
||||
thisptr->m_vTintColor()[1],
|
||||
thisptr->m_vTintColor()[2]
|
||||
};
|
||||
|
||||
thisptr->m_vTintColor() = world::nightmode ? Color_t(0, 0, 0) : Color_t(nOldColor[0], nOldColor[1], nOldColor[2]);
|
||||
thisptr->m_flBrightnessScale() = 0.f;
|
||||
thisptr->PostDataUpdate(1);
|
||||
|
||||
return g_UpdateSkybox(thisptr);
|
||||
}
|
||||
|
||||
void HookGameFunctions()
|
||||
{
|
||||
g_mouseInputEnabled.Hook(memory::fnMouseInputEnabled, HOOK_FUNCTION(hkMouseInputEnabled));
|
||||
oIsRelativeMouseMode.HookVirtual(interfaces::pInputSystem, 76, HOOK_FUNCTION(IsRelativeMouseMode));
|
||||
// g_onAddEntity.HookVirtual(CGameEntitySystem::GetInstance(), 15, HOOK_FUNCTION(hkOnAddEntity));
|
||||
// g_onRemoveEntity.HookVirtual(CGameEntitySystem::GetInstance(), 16, HOOK_FUNCTION(hkOnRemoveEntity));
|
||||
g_getMatricesForView.Hook(memory::fnGetMatricesForView, HOOK_FUNCTION(hkGetMatricesForView));
|
||||
g_CreateMove.Hook(memory::fnCreatMove, HOOK_FUNCTION(hkCreateMove));
|
||||
g_DrawObject.Hook(fnDrawObject, HOOK_FUNCTION(hkDrawObject));
|
||||
g_FrameStageNotify.Hook(memory::fnFrameStage, HOOK_FUNCTION(hkFrameStageNotify));
|
||||
//g_3DBox.Hook(memory::hkUpdateSky3DParams, HOOK_FUNCTION(UpdateSky3DParams));
|
||||
g_ApplyColorSO.Hook(memory::hkApplyColorToSceneObject, HOOK_FUNCTION(ApplyColorToSceneObject));
|
||||
g_SetupLight.Hook(memory::hksetup_lighting, HOOK_FUNCTION(setup_lighting));
|
||||
g_UpdateSkybox.Hook(memory::UpdateSkyboxColor, HOOK_FUNCTION(UpdateSkybox));
|
||||
g_Glow.Hook(memory::GlowFunction, HOOK_FUNCTION(hkGlow));
|
||||
|
||||
visuals::CacheCurrentEntities();
|
||||
}
|
||||
22
examples/raze-internal-cs2-main/src/game/menu/color_t.hpp
Normal file
22
examples/raze-internal-cs2-main/src/game/menu/color_t.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <imgui/imgui.h>
|
||||
#include <stdint.h>
|
||||
struct color_t {
|
||||
public:
|
||||
float r, g, b, a;
|
||||
constexpr color_t(const int r, const int g, const int b, const int a = 255)
|
||||
: r(static_cast<uint8_t>(r)),
|
||||
g(static_cast<uint8_t>(g)),
|
||||
b(static_cast<uint8_t>(b)),
|
||||
a(static_cast<uint8_t>(a)) {}
|
||||
inline ImColor to_im_color(float alpha = 1.f, bool use_gl_alpha = true) {
|
||||
return ImColor(
|
||||
r, g, b,
|
||||
(a * (use_gl_alpha ? ImGui::GetStyle().Alpha : 1.f)) * alpha);
|
||||
}
|
||||
|
||||
inline ImVec4 to_vec4(float alpha = 1.f, bool use_gl_alpha = true) {
|
||||
return ImVec4(
|
||||
r, g, b,
|
||||
(a * (use_gl_alpha ? ImGui::GetStyle().Alpha : 1.f)) * alpha);
|
||||
}
|
||||
};
|
||||
266
examples/raze-internal-cs2-main/src/game/menu/menu.cpp
Normal file
266
examples/raze-internal-cs2-main/src/game/menu/menu.cpp
Normal file
@@ -0,0 +1,266 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include "menu.hpp"
|
||||
|
||||
#include "../../sdk/interfaces/interfaces.hpp"
|
||||
#include "../../utils/utils.hpp"
|
||||
#include "../esp/esp.hpp"
|
||||
#include "../chams/chams.hpp"
|
||||
//#include "../nightmode/nightmode.hpp"
|
||||
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
#include "../world/world.hpp"
|
||||
#include "../external_aim/aim.h"
|
||||
#include "../skins/knife.h"
|
||||
#include "../../utils/external/config.hpp"
|
||||
|
||||
static bool g_bMenuIsOpen;
|
||||
|
||||
int tab = 0;
|
||||
|
||||
int prefer = 3;
|
||||
bool bombcheck;
|
||||
bool flashcheck;
|
||||
bool legscheck;
|
||||
|
||||
void CustomSliderInt(const char* label, int* v, float v_min, float v_max, bool checker_bool, const char* format)
|
||||
{
|
||||
auto posSlider = ImGui::GetCursorScreenPos();
|
||||
if (checker_bool)
|
||||
{
|
||||
ImGui::SliderInt(label, v, v_min, v_max, format);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::BeginDisabled(true);
|
||||
ImGui::SliderInt(label, v, v_min, v_max, format);
|
||||
ImGui::EndDisabled();
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(ImVec2(posSlider.x + 16, posSlider.y), ImVec2(posSlider.x + 180, posSlider.y + 37), ImColor(22, 22, 22, 155));
|
||||
}
|
||||
}
|
||||
|
||||
void CustomSliderFloat(const char* label, float* v, float v_min, float v_max, bool checker_bool)
|
||||
{
|
||||
auto posSlider = ImGui::GetCursorScreenPos();
|
||||
if (checker_bool)
|
||||
{
|
||||
ImGui::SliderFloat(label, v, v_min, v_max, "%.0f");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::BeginDisabled(true);
|
||||
ImGui::SliderFloat(label, v, v_min, v_max, "");
|
||||
ImGui::EndDisabled();
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(ImVec2(posSlider.x + 16, posSlider.y), ImVec2(posSlider.x + 180, posSlider.y + 37), ImColor(22, 22, 22, 155));
|
||||
}
|
||||
}
|
||||
|
||||
void custom_cursor(ImVec2 position, float rotation_angle_degrees, ImColor color) {
|
||||
float arrow_base_width = 8;
|
||||
float arrow_height = 9;
|
||||
float arrow_middle_width = 7;
|
||||
float outline_thickness = 2.0f;
|
||||
|
||||
|
||||
ImVec2 verts[4];
|
||||
verts[0] = position;
|
||||
verts[1] = ImVec2(position.x - arrow_base_width / 2, position.y + arrow_height);
|
||||
verts[2] = ImVec2(position.x, position.y + arrow_middle_width);
|
||||
verts[3] = ImVec2(position.x + arrow_base_width / 2, position.y + arrow_height);
|
||||
|
||||
|
||||
ImVec2 center = ImVec2(position.x, position.y + arrow_height / 2);
|
||||
|
||||
float angle_radians = rotation_angle_degrees * (3.14159f / 180.0f);
|
||||
|
||||
auto rotate_vertex = [&](ImVec2 point, ImVec2 center, float angle) -> ImVec2 {
|
||||
float translated_x = point.x - center.x;
|
||||
float translated_y = point.y - center.y;
|
||||
|
||||
float rotated_x = translated_x * cos(angle) - translated_y * sin(angle);
|
||||
float rotated_y = translated_x * sin(angle) + translated_y * cos(angle);
|
||||
|
||||
return ImVec2(rotated_x + center.x, rotated_y + center.y);
|
||||
};
|
||||
|
||||
verts[0] = rotate_vertex(verts[0], center, angle_radians);
|
||||
verts[1] = rotate_vertex(verts[1], center, angle_radians);
|
||||
verts[2] = rotate_vertex(verts[2], center, angle_radians);
|
||||
verts[3] = rotate_vertex(verts[3], center, angle_radians);
|
||||
|
||||
ImDrawList* draw_list = ImGui::GetForegroundDrawList();
|
||||
|
||||
draw_list->AddPolyline(verts, 4, color, true, outline_thickness);
|
||||
|
||||
draw_list->AddConvexPolyFilled(verts, 4, color);
|
||||
}
|
||||
|
||||
HCURSOR CreateNullCursor() {
|
||||
BYTE andMask[1] = { 0xFF }; // Все пиксели прозрачные (AND-маска)
|
||||
BYTE xorMask[1] = { 0x00 }; // Ничего не рисуем (XOR-маска)
|
||||
return CreateCursor(NULL, 0, 0, 1, 1, andMask, xorMask);
|
||||
}
|
||||
|
||||
void menu::Render()
|
||||
{
|
||||
ImGuiIO& IO = ImGui::GetIO();
|
||||
IO.ConfigFlags = ImGuiConfigFlags_NoMouseCursorChange;
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_Insert, false)) Toggle(!IsOpen());
|
||||
if (!IsOpen()) return;
|
||||
|
||||
//ImVec2 cursor_pos = ImGui::GetMousePos();
|
||||
//custom_cursor(cursor_pos, 250.0f, ImColor(255, 255, 255, 255));
|
||||
|
||||
IO.ConfigFlags = ImGuiConfigFlags_None;
|
||||
|
||||
ImGui::PushFont(visuals::menu_font);
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(477, 418));
|
||||
ImGui::Begin("RAZECLUB", nullptr, ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar);
|
||||
{
|
||||
auto draw = ImGui::GetWindowDrawList();
|
||||
auto pos = ImGui::GetWindowPos();
|
||||
|
||||
draw->AddImage(visuals::BG, ImVec2(pos.x + 4, pos.y + 2), ImVec2(pos.x + 472, pos.y + 417));
|
||||
|
||||
switch (tab)
|
||||
{
|
||||
case 0:
|
||||
draw->AddImage(visuals::legitBot, ImVec2(pos.x + 14 + 4, pos.y + 12 + 2), ImVec2(pos.x + 58 + 4, pos.y + 53.2 + 2));
|
||||
break;
|
||||
case 1:
|
||||
draw->AddImage(visuals::_visuals, ImVec2(pos.x + 8 + 4, pos.y + 52 + 2), ImVec2(pos.x + 58 + 4, pos.y + 99 + 2));
|
||||
break;
|
||||
case 2:
|
||||
draw->AddImage(visuals::_misc, ImVec2(pos.x + 11 + 4, pos.y + 98 + 2), ImVec2(pos.x + 55 + 4, pos.y + 140 + 2));
|
||||
break;
|
||||
case 3:
|
||||
draw->AddImage(visuals::_skins, ImVec2(pos.x + 11 + 4, pos.y + 139 + 2), ImVec2(pos.x + 55 + 4, pos.y + 183 + 2));
|
||||
break;
|
||||
case 4:
|
||||
draw->AddImage(visuals::_configs, ImVec2(pos.x + 12 + 4, pos.y + 184 + 2), ImVec2(pos.x + 54 + 4, pos.y + 226 + 2));
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::SetCursorPos(ImVec2(4, 4));
|
||||
ImGui::BeginChild("LeftIcons", ImVec2(57, 417));
|
||||
{
|
||||
if (ImGui::InvisibleButton("Legitbot", ImVec2(55, 45)))
|
||||
tab = 0;
|
||||
if (ImGui::InvisibleButton("Visuals", ImVec2(55, 35)))
|
||||
tab = 1;
|
||||
if (ImGui::InvisibleButton("Misc", ImVec2(55, 45)))
|
||||
tab = 2;
|
||||
if (ImGui::InvisibleButton("Skins", ImVec2(55, 35)))
|
||||
tab = 3;
|
||||
if (ImGui::InvisibleButton("Configs", ImVec2(55, 45)))
|
||||
tab = 4;
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::SetCursorPos(ImVec2(77, 25));
|
||||
ImGui::BeginChild("LeftPanel", ImVec2(185, 375));
|
||||
{
|
||||
switch (tab)
|
||||
{
|
||||
case 0:
|
||||
ImGui::Checkbox("Enable aimbot", &aimConf.state);
|
||||
|
||||
ImGui::Combo("Hitbox", &aimConf.boneSelect, "Head\0Neck\0Chest\0Crotch\0", 6);
|
||||
|
||||
ImGui::Checkbox("Aimlock", &aimConf.alaimlock);
|
||||
ImGui::Checkbox("Visible check", &aimConf.checkSpotted);
|
||||
ImGui::Checkbox("Player lock", &aimConf.playerLock);
|
||||
ImGui::Checkbox("Engine Prediction [Alpha]", &aimConf.predictionTest);
|
||||
|
||||
CustomSliderFloat("Aimbot FOV", &aimConf.fov, 0, 15, aimConf.state);
|
||||
|
||||
CustomSliderFloat("Aimbot smooth", &aimConf.smoothing, 1.0, 30, aimConf.state);
|
||||
|
||||
// CustomSliderInt("Aimbot preferience", &sosal, 0, 3, aimConf.state);
|
||||
|
||||
//ImGui::SliderFloat("Aimbot sensivity", &aimConf.sens, 0, 10);
|
||||
|
||||
ImGui::Checkbox("Trigger bot", &aimConf.trigger);
|
||||
ImGui::Checkbox("Trigger bot on key [ALT]", &aimConf.isHotTrigger);
|
||||
|
||||
CustomSliderInt("Trigger reaction", &aimConf.trigger_reaction, 0, 400, aimConf.trigger, "%d ms");
|
||||
|
||||
ImGui::Checkbox("Recoil sperm system", &aimConf.rcs);
|
||||
|
||||
config::save(0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ImGui::Checkbox("Enable", &visuals::esp_enable);
|
||||
ImGui::Checkbox("Esp box", &visuals::esp_box);
|
||||
ImGui::Checkbox("Esp name", &visuals::esp_name);
|
||||
ImGui::Checkbox("Esp health", &visuals::esp_health);
|
||||
ImGui::Checkbox("Esp glow", &visuals::esp_glow);
|
||||
ImGui::Checkbox("Esp bomb", &bombcheck);
|
||||
|
||||
ImGui::Spacing(); ImGui::Spacing(); ImGui::Spacing();
|
||||
|
||||
ImGui::Checkbox("Chams visible", &chams::player);
|
||||
CustomSliderInt("Visible chams intensity", &chams::visible_value, 0, 255, chams::player, "");
|
||||
|
||||
ImGui::Checkbox("Chams invisible", &chams::invisible);
|
||||
CustomSliderInt("Invisible chams intensity", &chams::invisible_value, 0, 255, chams::invisible, "");
|
||||
|
||||
ImGui::Checkbox("Model glow", &other::glow);
|
||||
CustomSliderInt("Model glow intensity", &other::intesivity, 0, 255, other::glow, "");
|
||||
|
||||
//ImGui::Spacing(); ImGui::Spacing(); ImGui::Spacing();
|
||||
|
||||
//ImGui::Checkbox("Nightmode", &world::nightmode);
|
||||
break;
|
||||
case 2:
|
||||
ImGui::ShadowText("SEX TEXT 1", ImColor(255, 255, 255), ImColor(255, 255, 255, 145), 25, ImVec2(pos.x + 89, pos.y + 31));
|
||||
break;
|
||||
case 3:
|
||||
ImGui::Checkbox("Knife model", &knife_changer::enable);
|
||||
ImGui::Combo("##combo", &knife_changer::selected, "-\0M9 Bayonet\0Classic\0Bayonet\0Flip\0Gut\0Karambit\0Tactical\0Falchion\0Bowie\0Butterfly\0Push\0Cord\0Canis\0Ursus\0Navaja\0Outdoor\0Stiletto\0Talon\0Skeleton\0Kukri", 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::SetCursorPos(ImVec2(273, 25));
|
||||
ImGui::BeginChild("RightPanel", ImVec2(185, 375));
|
||||
{
|
||||
switch (tab)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
ImGui::Checkbox("Nightmode", &world::nightmode);
|
||||
ImGui::Checkbox("Remove legs", &legscheck);
|
||||
ImGui::Checkbox("Remove flash", &flashcheck);
|
||||
break;
|
||||
case 2:
|
||||
ImGui::ShadowText("SEX TEXT 2", ImColor(255, 255, 255), ImColor(255, 255, 255, 145), 25, ImVec2(pos.x + 285, pos.y + 31));
|
||||
break;
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void menu::Toggle(bool bState)
|
||||
{
|
||||
static bool RelativeMouseMode = false;
|
||||
RelativeMouseMode = memory::fnSDL_GetRelativeMouseMode(memory::fnSDL_GetGrabbedWindow());
|
||||
g_bMenuIsOpen = bState;
|
||||
memory::fnSDL_SetRelativeMouseMode(memory::fnSDL_GetGrabbedWindow(), !g_bMenuIsOpen);
|
||||
}
|
||||
|
||||
bool menu::IsOpen()
|
||||
{
|
||||
return g_bMenuIsOpen;
|
||||
}
|
||||
7
examples/raze-internal-cs2-main/src/game/menu/menu.hpp
Normal file
7
examples/raze-internal-cs2-main/src/game/menu/menu.hpp
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
namespace menu {
|
||||
void Render();
|
||||
|
||||
void Toggle(bool bState);
|
||||
bool IsOpen();
|
||||
} // namespace menu
|
||||
@@ -0,0 +1,65 @@
|
||||
#include "movement.hpp"
|
||||
|
||||
template <class T, class U>
|
||||
static T fclamp(const T& in, const U& low, const U& high) {
|
||||
if (in <= low) return low;
|
||||
|
||||
if (in >= high) return high;
|
||||
|
||||
return in;
|
||||
}
|
||||
void movement::fix(CBaseUserCmdPB* base_cmd, QAngle_t angle) {
|
||||
QAngle_t wish_angle;
|
||||
wish_angle = base_cmd->pViewangles->angValue;
|
||||
int revers = wish_angle.x > 89.f ? -1 : 1;
|
||||
wish_angle.Clamp();
|
||||
|
||||
Vector view_fwd, view_right, view_up, cmd_fwd, cmd_right, cmd_up;
|
||||
auto viewangles = angle;
|
||||
|
||||
math::angle_vectors(wish_angle, &view_fwd, &view_right, &view_up);
|
||||
math::angle_vectors(viewangles, &cmd_fwd, &cmd_right, &cmd_up);
|
||||
|
||||
float v8 = sqrtf((view_fwd.x * view_fwd.x) + (view_fwd.y * view_fwd.y));
|
||||
float v10 =
|
||||
sqrtf((view_right.x * view_right.x) + (view_right.y * view_right.y));
|
||||
float v12 = sqrtf(view_up.z * view_up.z);
|
||||
|
||||
Vector norm_view_fwd((1.f / v8) * view_fwd.x, (1.f / v8) * view_fwd.y, 0.f);
|
||||
Vector norm_view_right((1.f / v10) * view_right.x,
|
||||
(1.f / v10) * view_right.y, 0.f);
|
||||
Vector norm_view_up(0.f, 0.f, (1.f / v12) * view_up.z);
|
||||
|
||||
float v14 = sqrtf((cmd_fwd.x * cmd_fwd.x) + (cmd_fwd.y * cmd_fwd.y));
|
||||
float v16 =
|
||||
sqrtf((cmd_right.x * cmd_right.x) + (cmd_right.y * cmd_right.y));
|
||||
float v18 = sqrtf(cmd_up.z * cmd_up.z);
|
||||
|
||||
Vector norm_cmd_fwd((1.f / v14) * cmd_fwd.x, (1.f / v14) * cmd_fwd.y, 0.f);
|
||||
Vector norm_cmd_right((1.f / v16) * cmd_right.x, (1.f / v16) * cmd_right.y,
|
||||
0.f);
|
||||
Vector norm_cmd_up(0.f, 0.f, (1.f / v18) * cmd_up.z);
|
||||
|
||||
float v22 = norm_view_fwd.x * base_cmd->flForwardMove;
|
||||
float v26 = norm_view_fwd.y * base_cmd->flForwardMove;
|
||||
float v28 = norm_view_fwd.z * base_cmd->flForwardMove;
|
||||
float v24 = norm_view_right.x * base_cmd->flSideMove;
|
||||
float v23 = norm_view_right.y * base_cmd->flSideMove;
|
||||
float v25 = norm_view_right.z * base_cmd->flSideMove;
|
||||
|
||||
base_cmd->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)));
|
||||
|
||||
base_cmd->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)));
|
||||
|
||||
base_cmd->flForwardMove = fclamp(base_cmd->flForwardMove, 9999, -9999);
|
||||
|
||||
base_cmd->flSideMove = fclamp(base_cmd->flSideMove, -9999, 9999);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "../../sdk/source2-sdk/classes/cusercmd.h"
|
||||
#include "../../sdk/math/math.hpp"
|
||||
|
||||
namespace movement {
|
||||
void fix(CBaseUserCmdPB* base_cmd, QAngle_t angle);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "../../sdk/interfaces/interfaces.hpp"
|
||||
#include "nightmode.hpp"
|
||||
|
||||
void nightmode::run() {
|
||||
|
||||
|
||||
if (!interfaces::pEngine->IsConnected() ||
|
||||
!interfaces::pEngine->IsInGame())
|
||||
return;
|
||||
|
||||
CCSPlayerController* Localcontroller =
|
||||
CGameEntitySystem::Get().GetLocalPlayerController();
|
||||
C_CSPlayerPawn* LocalPlayer =
|
||||
Localcontroller->m_hPawn().Get<C_CSPlayerPawn>();
|
||||
if (!LocalPlayer || LocalPlayer->m_iHealth() == 0 || LocalPlayer == nullptr) return;
|
||||
|
||||
auto camera_service = LocalPlayer->m_pCameraServices();
|
||||
if (!camera_service || camera_service == nullptr ||
|
||||
camera_service->m_hActivePostProcessingVolumes()
|
||||
.Get<C_PostProcessingVolume>() == NULL ||
|
||||
!camera_service->m_hActivePostProcessingVolumes()
|
||||
.Get<C_PostProcessingVolume>())
|
||||
return;
|
||||
|
||||
|
||||
|
||||
|
||||
if (bNightmode) {
|
||||
camera_service->m_hActivePostProcessingVolumes()
|
||||
.Get<C_PostProcessingVolume>()
|
||||
->m_bExposureControl() = 1;
|
||||
camera_service->m_hActivePostProcessingVolumes()
|
||||
.Get<C_PostProcessingVolume>()
|
||||
->m_flMinExposure() = max;
|
||||
camera_service->m_hActivePostProcessingVolumes()
|
||||
.Get<C_PostProcessingVolume>()
|
||||
->m_flMaxExposure() = max;
|
||||
}
|
||||
else {
|
||||
camera_service->m_hActivePostProcessingVolumes()
|
||||
.Get<C_PostProcessingVolume>()
|
||||
->m_bExposureControl() = 0;
|
||||
camera_service->m_hActivePostProcessingVolumes()
|
||||
.Get<C_PostProcessingVolume>()
|
||||
->m_flMinExposure() = 0.f;
|
||||
camera_service->m_hActivePostProcessingVolumes()
|
||||
.Get<C_PostProcessingVolume>()
|
||||
->m_flMaxExposure() = 0.f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
namespace nightmode{
|
||||
inline bool bNightmode;
|
||||
inline float min;
|
||||
inline float max;
|
||||
void run();
|
||||
}
|
||||
|
||||
1626
examples/raze-internal-cs2-main/src/game/render/font.h
Normal file
1626
examples/raze-internal-cs2-main/src/game/render/font.h
Normal file
File diff suppressed because it is too large
Load Diff
117
examples/raze-internal-cs2-main/src/game/render/render.cpp
Normal file
117
examples/raze-internal-cs2-main/src/game/render/render.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
#include <thread>
|
||||
|
||||
#include "../../utils/utils.hpp"
|
||||
|
||||
#include "../menu/menu.hpp"
|
||||
#include "../esp/esp.hpp"
|
||||
|
||||
#include "render.hpp"
|
||||
|
||||
#include <imgui/imgui.h>
|
||||
#include <imgui/imgui_freetype.h>
|
||||
|
||||
#include "font.h"
|
||||
#include "../esp/esp.hpp"
|
||||
|
||||
void render::Initialize( )
|
||||
{
|
||||
ImGuiIO& IO = ImGui::GetIO( );
|
||||
|
||||
ImVector<ImWchar> ranges;
|
||||
ImFontGlyphRangesBuilder builder;
|
||||
|
||||
//IO.Fonts->Clear();
|
||||
ImFontConfig font_config;
|
||||
//font_config.FontBuilderFlags |= ;
|
||||
//IO.Fonts->AddFontFromFileTTF("", 13,
|
||||
//nullptr,//&font_config,
|
||||
//IO.Fonts->GetGlyphRangesCyrillic());
|
||||
visuals::pixel_font = IO.Fonts->AddFontFromMemoryTTF((void*) esp, sizeof(esp), 8.f);
|
||||
//
|
||||
// ImFontConfig config;
|
||||
font_config.OversampleH = 3;
|
||||
font_config.OversampleV = 5;
|
||||
font_config.PixelSnapH = true;
|
||||
//font_config.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_Monochrome | ImGuiFreeTypeBuilderFlags_MonoHinting;
|
||||
|
||||
visuals::menu_font = IO.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\Verdana.ttf", 12, &font_config, IO.Fonts->GetGlyphRangesCyrillic( ));
|
||||
//IO.Fonts->Build();
|
||||
}
|
||||
void render::NewFrame( )
|
||||
{
|
||||
visuals::Render( );
|
||||
menu::Render( );
|
||||
}
|
||||
void render::text_outline(ImDrawList* draw_list, const ImVec2& pos, ImU32 col,
|
||||
const char* text)
|
||||
{
|
||||
ImGui::PushFont(visuals::menu_font);
|
||||
//draw_list->AddText(ImVec2(pos.x + 1, pos.y - 1), IM_COL32(56, 57, 72, 255),
|
||||
// text);
|
||||
//draw_list->AddText(ImVec2(pos.x - 1, pos.y + 1), IM_COL32(56, 57, 72, 255),
|
||||
// text);
|
||||
//draw_list->AddText(ImVec2(pos.x - 1, pos.y - 1), IM_COL32(56, 57, 72, 255),
|
||||
// text);
|
||||
//draw_list->AddText(ImVec2(pos.x + 1, pos.y + 1), IM_COL32(56, 57, 72, 255),
|
||||
// text);
|
||||
|
||||
//draw_list->AddText(ImVec2(pos.x, pos.y + 1), IM_COL32(85, 85, 143, 255),
|
||||
// text);
|
||||
//draw_list->AddText(ImVec2(pos.x, pos.y - 1), IM_COL32(56, 57, 72, 255),
|
||||
// text);
|
||||
//draw_list->AddText(ImVec2(pos.x + 1, pos.y), IM_COL32(56, 57, 72, 255),
|
||||
// text);
|
||||
//draw_list->AddText(ImVec2(pos.x - 1, pos.y), IM_COL32(56, 57, 72, 255),
|
||||
// text);
|
||||
draw_list->AddText(ImVec2(pos.x, pos.y), col, text);
|
||||
ImGui::PopFont( );
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void line(ImDrawList* draw, T x1, T y1, T x2, T y2, ImColor color,
|
||||
float thickness = 1.f)
|
||||
{
|
||||
draw->AddLine(ImVec2(x1, y1), ImVec2(x2, y2), color, thickness);
|
||||
}
|
||||
template <class T>
|
||||
inline void outline(ImDrawList* draw, T x1, T y1, T x2, T y2, ImColor color,
|
||||
float rounding = 0.f)
|
||||
{
|
||||
draw->AddRectFilled(ImVec2(x1 - 1, y1 - 1), ImVec2(x2 + 1, y2 + 1), color,
|
||||
rounding);
|
||||
}
|
||||
template <class T>
|
||||
inline void glow(ImDrawList* draw, T x1, T y1, T x2, T y2, ImColor color,
|
||||
float rounding = 0.f)
|
||||
{}
|
||||
|
||||
void render::corner_outline(ImDrawList* draw, float x1, float y1, float x2,
|
||||
float y2,
|
||||
ImColor color, ImColor color_outline, float th,
|
||||
float rounding)
|
||||
{
|
||||
int w = x2 - x1;
|
||||
int h = y2 - y1;
|
||||
|
||||
int iw = w / 4;
|
||||
int ih = h / 4;
|
||||
|
||||
|
||||
/* RENDER GLOW TOP CORNDER */
|
||||
/* RENDER GLOW BOTTOM CORNDER */
|
||||
|
||||
draw->AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), color, rounding);
|
||||
|
||||
|
||||
/* RENDER TOP CORNDER */
|
||||
outline(draw, x1, y1, x1 + iw, y1 + 1, color_outline, rounding);
|
||||
outline(draw, x1 + w - iw, y1, x1 + w, y1 + 1, color_outline, rounding);
|
||||
outline(draw, x1, y1, x1 + 1, y1 + ih, color_outline, rounding);
|
||||
outline(draw, x1 + w - 1, y1, x1 + w, y1 + ih, color_outline, rounding);
|
||||
/* RENDER BOTTOM CORNDER */
|
||||
outline(draw, x1, y1 + h, x1 + iw, y1 + h + 1, color_outline, rounding);
|
||||
outline(draw, x1 + w - iw, y1 + h, x1 + w, y1 + h + 1, color_outline, rounding);
|
||||
outline(draw, x1, y1 + h - ih, x1 + 1, y1 + h, color_outline, rounding);
|
||||
outline(draw, x1 + w - 1, y1 + h - ih, x1 + w, y1 + h, color_outline, rounding);
|
||||
|
||||
}
|
||||
12
examples/raze-internal-cs2-main/src/game/render/render.hpp
Normal file
12
examples/raze-internal-cs2-main/src/game/render/render.hpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include <imgui/imgui.h>
|
||||
#include <imgui/imgui_internal.h>
|
||||
namespace render {
|
||||
void Initialize();
|
||||
void NewFrame();
|
||||
void text_outline(ImDrawList* draw_list, const ImVec2& pos, ImU32 col,
|
||||
const char* text);
|
||||
void corner_outline(ImDrawList* draw, float x1, float y1, float x2,
|
||||
float y2, ImColor color, ImColor color_outline,
|
||||
float th = 1.f, float rounding = 0.f);
|
||||
} // namespace render
|
||||
201
examples/raze-internal-cs2-main/src/game/skins/knife.cpp
Normal file
201
examples/raze-internal-cs2-main/src/game/skins/knife.cpp
Normal file
@@ -0,0 +1,201 @@
|
||||
#include "knife.h"
|
||||
#include "../../sdk/interfaces/interfaces.hpp"
|
||||
#include "../../sdk/source2-sdk/types/chandle.hpp"
|
||||
|
||||
#pragma pack(push, 8)
|
||||
#define STRINGTOKEN_MURMURHASH_SEED 0x31415926
|
||||
|
||||
inline uint32_t MurmurHash2(const void* key, int len, uint32_t seed)
|
||||
{
|
||||
/* 'm' and 'r' are mixing constants generated offline.
|
||||
They're not really 'magic', they just happen to work well. */
|
||||
|
||||
const uint32_t m = 0x5bd1e995;
|
||||
const int r = 24;
|
||||
|
||||
/* Initialize the hash to a 'random' value */
|
||||
|
||||
uint32_t h = seed ^ len;
|
||||
|
||||
/* Mix 4 bytes at a time into the hash */
|
||||
|
||||
const unsigned char* data = (const unsigned char*)key;
|
||||
|
||||
while (len >= 4)
|
||||
{
|
||||
uint32_t k = *(uint32_t*)data;
|
||||
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
|
||||
h *= m;
|
||||
h ^= k;
|
||||
|
||||
data += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
/* Handle the last few bytes of the input array */
|
||||
|
||||
switch (len)
|
||||
{
|
||||
case 3:
|
||||
h ^= data[2] << 16;
|
||||
case 2:
|
||||
h ^= data[1] << 8;
|
||||
case 1:
|
||||
h ^= data[0];
|
||||
h *= m;
|
||||
};
|
||||
|
||||
/* Do a few final mixes of the hash to ensure the last few
|
||||
// bytes are well-incorporated. */
|
||||
|
||||
h ^= h >> 13;
|
||||
h *= m;
|
||||
h ^= h >> 15;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
#define TOLOWERU(c) ((uint32_t)(((c >= 'A') && (c <= 'Z')) ? c + 32 : c))
|
||||
|
||||
|
||||
inline uint32_t MurmurHash2LowerCaseA1(const char* pString, int len, uint32_t nSeed)
|
||||
{
|
||||
char* p = (char*)malloc(len + 1);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
p[i] = TOLOWERU(pString[i]);
|
||||
}
|
||||
return MurmurHash2(p, len, nSeed);
|
||||
}
|
||||
|
||||
class CUtlStringToken1
|
||||
{
|
||||
public:
|
||||
std::uint32_t m_nHashCode;
|
||||
#if DEBUG_STRINGTOKENS
|
||||
const char* m_pDebugName;
|
||||
#endif
|
||||
|
||||
CUtlStringToken1(const char* szString)
|
||||
{
|
||||
this->SetHashCode1(this->MakeStringToken1(szString));
|
||||
}
|
||||
|
||||
bool operator==(const CUtlStringToken1& other) const
|
||||
{
|
||||
return (other.m_nHashCode == m_nHashCode);
|
||||
}
|
||||
|
||||
bool operator!=(const CUtlStringToken1& other) const
|
||||
{
|
||||
return (other.m_nHashCode != m_nHashCode);
|
||||
}
|
||||
|
||||
bool operator<(const CUtlStringToken1& other) const
|
||||
{
|
||||
return (m_nHashCode < other.m_nHashCode);
|
||||
}
|
||||
|
||||
/// access to the hash code for people who need to store thse as 32-bits, regardless of the
|
||||
/// setting of DEBUG_STRINGTOKENS (for instance, for atomic operations).
|
||||
uint32_t GetHashCode1(void) const
|
||||
{
|
||||
return m_nHashCode;
|
||||
}
|
||||
|
||||
void SetHashCode1(uint32_t nCode)
|
||||
{
|
||||
m_nHashCode = nCode;
|
||||
}
|
||||
|
||||
__forceinline std::uint32_t MakeStringToken1(const char* szString, int nLen)
|
||||
{
|
||||
std::uint32_t nHashCode = MurmurHash2LowerCaseA1(szString, nLen, STRINGTOKEN_MURMURHASH_SEED);
|
||||
return nHashCode;
|
||||
}
|
||||
|
||||
__forceinline std::uint32_t MakeStringToken1(const char* szString)
|
||||
{
|
||||
return MakeStringToken1(szString, (int)strlen(szString));
|
||||
}
|
||||
|
||||
//__forceinline std::uint32_t MakeStringToken(CUtlString& str)
|
||||
//{
|
||||
// return MakeStringToken(str.Get(), str.Length());
|
||||
//}
|
||||
|
||||
CUtlStringToken1()
|
||||
{
|
||||
m_nHashCode = 0;
|
||||
}
|
||||
};
|
||||
|
||||
void knife_changer::Run() {
|
||||
if (!enable)
|
||||
return;
|
||||
|
||||
if (!interfaces::pEngine->IsInGame())
|
||||
return;
|
||||
|
||||
auto g_pLocalPlayerController = CGameEntitySystem::GetLocalPlayerController();
|
||||
if (!g_pLocalPlayerController)
|
||||
return;
|
||||
|
||||
auto g_pLocalPlayerPawn = g_pLocalPlayerController->m_hPawn().Get<C_CSPlayerPawn>();
|
||||
if (!g_pLocalPlayerPawn)
|
||||
return;
|
||||
|
||||
C_CSWeaponBase* pWeapon = g_pLocalPlayerPawn->GetWeaponActive();
|
||||
|
||||
if (!pWeapon)
|
||||
return;
|
||||
|
||||
if (pWeapon->GetWeaponVData() && pWeapon->GetWeaponVData()->GetWeaponType() != 0 /*WEAPON_TYPE_KNIFE*/)
|
||||
return;
|
||||
|
||||
CCSPlayer_ViewModelServices* pViewModelServices = g_pLocalPlayerPawn->m_pViewModelServices();
|
||||
if (!pViewModelServices)
|
||||
return;
|
||||
|
||||
C_CSGOViewModel2* pViewModel = interfaces::pGameResourceService->GetGameEntitySystem()->GetByIndex<C_CSGOViewModel2>(pViewModelServices->m_hViewModel2());
|
||||
if (!pViewModel)
|
||||
return;
|
||||
|
||||
C_AttributeContainer* pAttributeContainer = pWeapon->m_AttributeManager();
|
||||
if (!pAttributeContainer)
|
||||
return;
|
||||
|
||||
C_EconItemView* pWeaponItemView = pAttributeContainer->m_Item();
|
||||
if (!pWeaponItemView)
|
||||
return;
|
||||
|
||||
CEconItemDefinition* pWeaponDefinition = pWeaponItemView->GetStaticData();
|
||||
if (!pWeaponDefinition)
|
||||
return;
|
||||
|
||||
CGameSceneNode* pWeaponSceneNode = pWeapon->m_pGameSceneNode();
|
||||
if (!pWeaponSceneNode)
|
||||
return;
|
||||
|
||||
pWeaponItemView->m_bDisallowSOC() = false;
|
||||
pWeaponItemView->m_iItemDefinitionIndex() = knifes_data[selected - 1].def_index;
|
||||
|
||||
std::uint32_t hash_ = CUtlStringToken1(std::to_string(knifes_data[selected - 1].def_index).c_str()).GetHashCode1();
|
||||
pWeapon->m_nSubclassID() = hash_;
|
||||
pWeapon->UpdateSubClass();
|
||||
pWeapon->UpdateVData();
|
||||
|
||||
const char* knifeModel = knifes_data[selected - 1].model_path.c_str();
|
||||
pWeapon->SetModel(knifeModel);
|
||||
|
||||
CHandle hWeapon = pWeapon->GetRefEHandle();
|
||||
if (pViewModel && (pViewModel->m_hWeapon().GetEntryIndex() == hWeapon.GetEntryIndex()))
|
||||
{
|
||||
pViewModel->SetModel(knifeModel);
|
||||
pViewModel->pAnimationGraphInstance->pAnimGraphNetworkedVariables = nullptr;
|
||||
}
|
||||
}
|
||||
42
examples/raze-internal-cs2-main/src/game/skins/knife.h
Normal file
42
examples/raze-internal-cs2-main/src/game/skins/knife.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include "../../sdk/math/math.hpp"
|
||||
#include <windows.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
struct knifeData_t {
|
||||
std::string name;
|
||||
std::string model_path;
|
||||
int def_index;
|
||||
};
|
||||
|
||||
namespace knife_changer {
|
||||
void Run();
|
||||
|
||||
inline std::vector < knifeData_t > knifes_data = {
|
||||
{ "M9 Bayonet", "weapons/models/knife/knife_m9/weapon_knife_m9.vmdl", 508 },
|
||||
{ "Classic", "weapons/models/knife/knife_css/weapon_knife_css.vmdl", 503 },
|
||||
{ "Bayonet", "weapons/models/knife/knife_bayonet/weapon_knife_bayonet.vmdl", 500 },
|
||||
{ "Flip", "weapons/models/knife/knife_flip/weapon_knife_flip.vmdl", 505 },
|
||||
{ "Gut", "weapons/models/knife/knife_gut/weapon_knife_gut.vmdl", 506 },
|
||||
{ "Karambit", "weapons/models/knife/knife_karambit/weapon_knife_karambit.vmdl", 507 },
|
||||
{ "Tactical", "weapons/models/knife/knife_tactical/weapon_knife_tactical.vmdl", 509 },
|
||||
{ "Falchion", "weapons/models/knife/knife_falchion/weapon_knife_falchion.vmdl", 512 },
|
||||
{ "Bowie", "weapons/models/knife/knife_bowie/weapon_knife_bowie.vmdl", 514 },
|
||||
{ "Butterfly", "weapons/models/knife/knife_butterfly/weapon_knife_butterfly.vmdl", 515 },
|
||||
{ "Push", "weapons/models/knife/knife_push/weapon_knife_push.vmdl", 516 },
|
||||
{ "Cord", "weapons/models/knife/knife_cord/weapon_knife_cord.vmdl", 517 },
|
||||
{ "Canis", "weapons/models/knife/knife_canis/weapon_knife_canis.vmdl", 518 },
|
||||
{ "Ursus", "weapons/models/knife/knife_ursus/weapon_knife_ursus.vmdl", 519 },
|
||||
{ "Navaja", "weapons/models/knife/knife_navaja/weapon_knife_navaja.vmdl", 520 },
|
||||
{ "Outdoor", "weapons/models/knife/knife_outdoor/weapon_knife_outdoor.vmdl", 521 },
|
||||
{ "Stiletto", "weapons/models/knife/knife_stiletto/weapon_knife_stiletto.vmdl", 522 },
|
||||
{ "Talon", "weapons/models/knife/knife_talon/weapon_knife_talon.vmdl", 523 },
|
||||
{ "Skeleton", "weapons/models/knife/knife_skeleton/weapon_knife_skeleton.vmdl", 525 },
|
||||
{ "Kukri", "weapons/models/knife/knife_kukri/weapon_knife_kukri.vmdl", 526 },
|
||||
};
|
||||
|
||||
inline bool enable = false;
|
||||
inline int selected = 1;
|
||||
}
|
||||
40
examples/raze-internal-cs2-main/src/game/world/world.cpp
Normal file
40
examples/raze-internal-cs2-main/src/game/world/world.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "../../sdk/interfaces/interfaces.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
#include "../../utils/color.h"
|
||||
|
||||
void SkyBox(C_EnvSky* eSky)
|
||||
{
|
||||
eSky->m_vTintColorLightingOnly() = Color_t(0, 0, 0, 255);
|
||||
eSky->m_vTintColor() = Color_t(0, 0, 0, 255);
|
||||
}
|
||||
|
||||
void world::SkyBoxChanger()
|
||||
{
|
||||
for (int i = 64; i < interfaces::pGameResourceService->GetGameEntitySystem()->GetHighestEntityIndex(); i++) {
|
||||
|
||||
CEntityInstance* cEnt = (CEntityInstance*)interfaces::pGameResourceService->GetGameEntitySystem()->GetBaseEntity(i);
|
||||
|
||||
if (cEnt == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CEntityIdentity* pEntity = cEnt->m_pEntity();
|
||||
|
||||
if (!pEntity) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!pEntity->m_designerName()) {
|
||||
continue;
|
||||
}
|
||||
std::string classname;
|
||||
classname = pEntity->m_designerName();
|
||||
|
||||
if (classname == "env_sky") {
|
||||
C_EnvSky* SkyEntity = interfaces::pGameResourceService->GetGameEntitySystem()->GetBaseEntity<C_EnvSky>(i);
|
||||
if (world::skybox)
|
||||
SkyBox(SkyEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
examples/raze-internal-cs2-main/src/game/world/world.hpp
Normal file
11
examples/raze-internal-cs2-main/src/game/world/world.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace world {
|
||||
inline bool skybox;
|
||||
inline bool nightmode;
|
||||
void SkyBoxChanger();
|
||||
}
|
||||
|
||||
namespace other {
|
||||
inline bool glow;
|
||||
inline int intesivity = 255;
|
||||
}
|
||||
|
||||
25
examples/raze-internal-cs2-main/src/hooks/hooks.cpp
Normal file
25
examples/raze-internal-cs2-main/src/hooks/hooks.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <thread>
|
||||
|
||||
#include "hooks.hpp"
|
||||
|
||||
#include "../sdk/memory/memory.hpp"
|
||||
#include "../api/hook/hook.hpp"
|
||||
#include "../game/chams/chams.hpp"
|
||||
|
||||
void HookInputAPI( );
|
||||
void HookGraphicsAPI( );
|
||||
void HookGameFunctions( );
|
||||
|
||||
void hooks::Initialize( )
|
||||
{
|
||||
g_funchookCtx = funchook_create( );
|
||||
if (!g_funchookCtx) return;
|
||||
|
||||
HookInputAPI( );
|
||||
HookGameFunctions( );
|
||||
HookGraphicsAPI( );
|
||||
|
||||
if (funchook_install(g_funchookCtx, 0) != FUNCHOOK_ERROR_SUCCESS) return;
|
||||
LOG("hooks::Initialize() successful.\n");
|
||||
}
|
||||
|
||||
5
examples/raze-internal-cs2-main/src/hooks/hooks.hpp
Normal file
5
examples/raze-internal-cs2-main/src/hooks/hooks.hpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
namespace hooks {
|
||||
void Initialize();
|
||||
} // namespace hooks
|
||||
1018
examples/raze-internal-cs2-main/src/hooks/platform/graphics/bytes.h
Normal file
1018
examples/raze-internal-cs2-main/src/hooks/platform/graphics/bytes.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,300 @@
|
||||
#include "../../../utils/console/console.hpp"
|
||||
#include "../../../game/render/render.hpp"
|
||||
#include "../../../api/hook/hook.hpp"
|
||||
|
||||
#include "../../../src/game/esp/esp.hpp"
|
||||
|
||||
#pragma once
|
||||
#include <dxgi1_2.h>
|
||||
#include <imgui/imgui_impl_dx11.h>
|
||||
#include <imgui/imgui_impl_win32.h>
|
||||
#include <directX/Include/D3DX11tex.h>
|
||||
|
||||
#include "bytes.h"
|
||||
|
||||
#pragma comment (lib, "d3dx11.lib")
|
||||
|
||||
static ID3D11Device* g_pd3dDevice = NULL;
|
||||
static ID3D11DeviceContext* g_pd3dDeviceContext = NULL;
|
||||
static ID3D11RenderTargetView* g_pd3dRenderTarget = NULL;
|
||||
static IDXGISwapChain* g_pSwapChain = NULL;
|
||||
|
||||
// Defined in 'wndproc_hook.cpp'.
|
||||
HWND GetGameWindow();
|
||||
|
||||
static void CleanupDeviceD3D11();
|
||||
static void CleanupRenderTarget();
|
||||
static void RenderImGui_DX11(IDXGISwapChain* pSwapChain);
|
||||
|
||||
static bool CreateDeviceD3D11(HWND hWnd) {
|
||||
// Create the D3DDevice
|
||||
DXGI_SWAP_CHAIN_DESC swapChainDesc = {};
|
||||
swapChainDesc.Windowed = TRUE;
|
||||
swapChainDesc.BufferCount = 2;
|
||||
swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
swapChainDesc.OutputWindow = hWnd;
|
||||
swapChainDesc.SampleDesc.Count = 1;
|
||||
|
||||
const D3D_FEATURE_LEVEL featureLevels[] = {
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
};
|
||||
HRESULT hr = D3D11CreateDeviceAndSwapChain(
|
||||
NULL, D3D_DRIVER_TYPE_NULL, NULL, 0, featureLevels, 2,
|
||||
D3D11_SDK_VERSION, &swapChainDesc, &g_pSwapChain, &g_pd3dDevice,
|
||||
nullptr, nullptr);
|
||||
if (hr != S_OK) {
|
||||
LOG("[!] D3D11CreateDeviceAndSwapChain() failed. [rv: %lu]\n", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int GetCorrectDXGIFormat(int eCurrentFormat) {
|
||||
switch (eCurrentFormat) {
|
||||
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
|
||||
return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
}
|
||||
|
||||
return eCurrentFormat;
|
||||
}
|
||||
|
||||
static void CreateRenderTarget(IDXGISwapChain* pSwapChain) {
|
||||
ID3D11Texture2D* pBackBuffer = NULL;
|
||||
pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
|
||||
if (pBackBuffer) {
|
||||
DXGI_SWAP_CHAIN_DESC sd;
|
||||
pSwapChain->GetDesc(&sd);
|
||||
|
||||
D3D11_RENDER_TARGET_VIEW_DESC desc = {};
|
||||
desc.Format = static_cast<DXGI_FORMAT>(
|
||||
GetCorrectDXGIFormat(sd.BufferDesc.Format));
|
||||
|
||||
desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
|
||||
if (FAILED(g_pd3dDevice->CreateRenderTargetView(pBackBuffer, &desc,
|
||||
&g_pd3dRenderTarget))) {
|
||||
|
||||
|
||||
desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||
if (FAILED(g_pd3dDevice->CreateRenderTargetView(
|
||||
pBackBuffer, &desc, &g_pd3dRenderTarget))) {
|
||||
if (FAILED(g_pd3dDevice->CreateRenderTargetView(
|
||||
pBackBuffer, NULL, &g_pd3dRenderTarget))) {
|
||||
LOG("Severe error in CreateRenderTarget().\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pBackBuffer->Release();
|
||||
}
|
||||
}
|
||||
|
||||
static CHook<HRESULT WINAPI(IDXGISwapChain*, UINT, UINT)> g_present;
|
||||
static HRESULT WINAPI hkPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval,
|
||||
UINT Flags) {
|
||||
RenderImGui_DX11(pSwapChain);
|
||||
|
||||
return g_present(pSwapChain, SyncInterval, Flags);
|
||||
}
|
||||
|
||||
static CHook<HRESULT WINAPI(IDXGISwapChain*, UINT, UINT,
|
||||
const DXGI_PRESENT_PARAMETERS*)>
|
||||
g_present1;
|
||||
static HRESULT WINAPI
|
||||
hkPresent1(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT PresentFlags,
|
||||
const DXGI_PRESENT_PARAMETERS* pPresentParameters) {
|
||||
RenderImGui_DX11(pSwapChain);
|
||||
|
||||
return g_present1(pSwapChain, SyncInterval, PresentFlags,
|
||||
pPresentParameters);
|
||||
}
|
||||
|
||||
static CHook<HRESULT WINAPI(IDXGISwapChain*, UINT, UINT, UINT, DXGI_FORMAT,
|
||||
UINT)>
|
||||
g_resizeBuffers;
|
||||
static HRESULT WINAPI hkResizeBuffers(IDXGISwapChain* pSwapChain,
|
||||
UINT BufferCount, UINT Width, UINT Height,
|
||||
DXGI_FORMAT NewFormat,
|
||||
UINT SwapChainFlags) {
|
||||
CleanupRenderTarget();
|
||||
|
||||
return g_resizeBuffers(pSwapChain, BufferCount, Width, Height, NewFormat,
|
||||
SwapChainFlags);
|
||||
}
|
||||
|
||||
static CHook<HRESULT WINAPI(IDXGISwapChain*, UINT, UINT, UINT, DXGI_FORMAT,
|
||||
UINT, const UINT*, IUnknown* const*)>
|
||||
g_resizeBuffers1;
|
||||
static HRESULT WINAPI hkResizeBuffers1(IDXGISwapChain* pSwapChain,
|
||||
UINT BufferCount, UINT Width,
|
||||
UINT Height, DXGI_FORMAT NewFormat,
|
||||
UINT SwapChainFlags,
|
||||
const UINT* pCreationNodeMask,
|
||||
IUnknown* const* ppPresentQueue) {
|
||||
CleanupRenderTarget();
|
||||
|
||||
return g_resizeBuffers1(pSwapChain, BufferCount, Width, Height, NewFormat,
|
||||
SwapChainFlags, pCreationNodeMask, ppPresentQueue);
|
||||
}
|
||||
|
||||
static CHook<HRESULT WINAPI(IDXGIFactory*, IUnknown*, DXGI_SWAP_CHAIN_DESC*,
|
||||
IDXGISwapChain**)>
|
||||
g_createSwapChain;
|
||||
static HRESULT WINAPI hkCreateSwapChain(IDXGIFactory* pFactory,
|
||||
IUnknown* pDevice,
|
||||
DXGI_SWAP_CHAIN_DESC* pDesc,
|
||||
IDXGISwapChain** ppSwapChain) {
|
||||
CleanupRenderTarget();
|
||||
|
||||
return g_createSwapChain(pFactory, pDevice, pDesc, ppSwapChain);
|
||||
}
|
||||
|
||||
static CHook<HRESULT WINAPI(
|
||||
IDXGIFactory*, IUnknown*, HWND, const DXGI_SWAP_CHAIN_DESC1*,
|
||||
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC*, IDXGIOutput*, IDXGISwapChain1**)>
|
||||
g_createSwapChainForHwnd;
|
||||
static HRESULT WINAPI hkCreateSwapChainForHwnd(
|
||||
IDXGIFactory* pFactory, IUnknown* pDevice, HWND hWnd,
|
||||
const DXGI_SWAP_CHAIN_DESC1* pDesc,
|
||||
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
|
||||
IDXGIOutput* pRestrictToOutput, IDXGISwapChain1** ppSwapChain) {
|
||||
CleanupRenderTarget();
|
||||
|
||||
return g_createSwapChainForHwnd(pFactory, pDevice, hWnd, pDesc,
|
||||
pFullscreenDesc, pRestrictToOutput,
|
||||
ppSwapChain);
|
||||
}
|
||||
|
||||
static CHook<HRESULT WINAPI(IDXGIFactory*, IUnknown*, IUnknown*,
|
||||
const DXGI_SWAP_CHAIN_DESC1*, IDXGIOutput*,
|
||||
IDXGISwapChain1**)>
|
||||
g_createSwapChainForCoreWindow;
|
||||
static HRESULT WINAPI hkCreateSwapChainForCoreWindow(
|
||||
IDXGIFactory* pFactory, IUnknown* pDevice, IUnknown* pWindow,
|
||||
const DXGI_SWAP_CHAIN_DESC1* pDesc, IDXGIOutput* pRestrictToOutput,
|
||||
IDXGISwapChain1** ppSwapChain) {
|
||||
CleanupRenderTarget();
|
||||
|
||||
return g_createSwapChainForCoreWindow(pFactory, pDevice, pWindow, pDesc,
|
||||
pRestrictToOutput, ppSwapChain);
|
||||
}
|
||||
|
||||
static CHook<HRESULT WINAPI(IDXGIFactory*, IUnknown*,
|
||||
const DXGI_SWAP_CHAIN_DESC1*, IDXGIOutput*,
|
||||
IDXGISwapChain1**)>
|
||||
g_createSwapChainForComposition;
|
||||
static HRESULT WINAPI hkCreateSwapChainForComposition(
|
||||
IDXGIFactory* pFactory, IUnknown* pDevice,
|
||||
const DXGI_SWAP_CHAIN_DESC1* pDesc, IDXGIOutput* pRestrictToOutput,
|
||||
IDXGISwapChain1** ppSwapChain) {
|
||||
CleanupRenderTarget();
|
||||
|
||||
return g_createSwapChainForComposition(pFactory, pDevice, pDesc,
|
||||
pRestrictToOutput, ppSwapChain);
|
||||
}
|
||||
|
||||
void HookDX11GraphicsAPI() {
|
||||
if (!CreateDeviceD3D11(GetGameWindow())) {
|
||||
return;
|
||||
}
|
||||
|
||||
IDXGIDevice* pDXGIDevice = NULL;
|
||||
g_pd3dDevice->QueryInterface(IID_PPV_ARGS(&pDXGIDevice));
|
||||
|
||||
IDXGIAdapter* pDXGIAdapter = NULL;
|
||||
pDXGIDevice->GetAdapter(&pDXGIAdapter);
|
||||
|
||||
IDXGIFactory* pIDXGIFactory = NULL;
|
||||
pDXGIAdapter->GetParent(IID_PPV_ARGS(&pIDXGIFactory));
|
||||
|
||||
pIDXGIFactory->Release();
|
||||
pDXGIAdapter->Release();
|
||||
pDXGIDevice->Release();
|
||||
|
||||
g_createSwapChain.HookVirtual(pIDXGIFactory, 10,
|
||||
HOOK_FUNCTION(hkCreateSwapChain));
|
||||
g_createSwapChainForHwnd.HookVirtual(
|
||||
pIDXGIFactory, 15, HOOK_FUNCTION(hkCreateSwapChainForHwnd));
|
||||
g_createSwapChainForCoreWindow.HookVirtual(
|
||||
pIDXGIFactory, 16, HOOK_FUNCTION(hkCreateSwapChainForCoreWindow));
|
||||
g_createSwapChainForComposition.HookVirtual(
|
||||
pIDXGIFactory, 24, HOOK_FUNCTION(hkCreateSwapChainForComposition));
|
||||
|
||||
g_present.HookVirtual(g_pSwapChain, 8, HOOK_FUNCTION(hkPresent));
|
||||
g_present1.HookVirtual(g_pSwapChain, 22, HOOK_FUNCTION(hkPresent1));
|
||||
|
||||
g_resizeBuffers.HookVirtual(g_pSwapChain, 13,
|
||||
HOOK_FUNCTION(hkResizeBuffers));
|
||||
g_resizeBuffers1.HookVirtual(g_pSwapChain, 39,
|
||||
HOOK_FUNCTION(hkResizeBuffers1));
|
||||
|
||||
CleanupDeviceD3D11();
|
||||
}
|
||||
|
||||
|
||||
static void CleanupRenderTarget() {
|
||||
if (g_pd3dRenderTarget) {
|
||||
g_pd3dRenderTarget->Release();
|
||||
g_pd3dRenderTarget = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void CleanupDeviceD3D11() {
|
||||
CleanupRenderTarget();
|
||||
|
||||
if (g_pSwapChain) {
|
||||
g_pSwapChain->Release();
|
||||
g_pSwapChain = NULL;
|
||||
}
|
||||
if (g_pd3dDevice) {
|
||||
g_pd3dDevice->Release();
|
||||
g_pd3dDevice = NULL;
|
||||
}
|
||||
if (g_pd3dDeviceContext) {
|
||||
g_pd3dDeviceContext->Release();
|
||||
g_pd3dDeviceContext = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void RenderImGui_DX11(IDXGISwapChain* pSwapChain) {
|
||||
if (!ImGui::GetCurrentContext() || ::g_isShuttingDown) return;
|
||||
|
||||
if (!ImGui::GetIO().BackendRendererUserData) {
|
||||
if (SUCCEEDED(pSwapChain->GetDevice(IID_PPV_ARGS(&g_pd3dDevice)))) {
|
||||
g_pd3dDevice->GetImmediateContext(&g_pd3dDeviceContext);
|
||||
ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext);
|
||||
|
||||
D3DX11_IMAGE_LOAD_INFO iInfo;
|
||||
ID3DX11ThreadPump* threadPump{ nullptr };
|
||||
|
||||
D3DX11CreateShaderResourceViewFromMemory(g_pd3dDevice, background, sizeof(background), &iInfo, threadPump, &visuals::BG, 0);
|
||||
|
||||
D3DX11CreateShaderResourceViewFromMemory(g_pd3dDevice, legitbotIcon, sizeof(legitbotIcon), &iInfo, threadPump, &visuals::legitBot, 0);
|
||||
D3DX11CreateShaderResourceViewFromMemory(g_pd3dDevice, visualsIcon, sizeof(visualsIcon), &iInfo, threadPump, &visuals::_visuals, 0);
|
||||
D3DX11CreateShaderResourceViewFromMemory(g_pd3dDevice, miscIcon, sizeof(miscIcon), &iInfo, threadPump, &visuals::_misc, 0);
|
||||
D3DX11CreateShaderResourceViewFromMemory(g_pd3dDevice, skinsIcon, sizeof(skinsIcon), &iInfo, threadPump, &visuals::_skins, 0);
|
||||
D3DX11CreateShaderResourceViewFromMemory(g_pd3dDevice, configsIcon, sizeof(configsIcon), &iInfo, threadPump, &visuals::_configs, 0);
|
||||
|
||||
D3DX11CreateShaderResourceViewFromMemory(g_pd3dDevice, checkboxBG, sizeof(checkboxBG), &iInfo, threadPump, &visuals::check_box, 0);
|
||||
|
||||
render::Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_pd3dRenderTarget) {
|
||||
CreateRenderTarget(pSwapChain);
|
||||
} else {
|
||||
ImGui_ImplDX11_NewFrame();
|
||||
ImGui_ImplWin32_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
visuals::g_pBackgroundDrawList = ImGui::GetBackgroundDrawList();
|
||||
|
||||
render::NewFrame();
|
||||
ImGui::Render();
|
||||
g_pd3dDeviceContext->OMSetRenderTargets(1, &g_pd3dRenderTarget, NULL);
|
||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
#include <Windows.h>
|
||||
#include <thread>
|
||||
|
||||
#include "../../../game/menu/menu.hpp"
|
||||
|
||||
#include <imgui/imgui.h>
|
||||
#include <imgui/imgui_impl_win32.h>
|
||||
|
||||
static BOOL CALLBACK EnumWindowsCallback(HWND handle, LPARAM lParam);
|
||||
|
||||
static HWND g_hWindow;
|
||||
static WNDPROC g_oWndProc;
|
||||
static LRESULT hkWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (!ImGui::GetCurrentContext( ))
|
||||
{
|
||||
ImGui::CreateContext( );
|
||||
ImGui_ImplWin32_Init(hWnd);
|
||||
ImGuiIO& io = ImGui::GetIO( );
|
||||
io.IniFilename = io.LogFilename = nullptr;
|
||||
}
|
||||
|
||||
LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);
|
||||
if (menu::IsOpen( ))
|
||||
{
|
||||
// Messages handled by 'ImGui_ImplWin32_WndProcHandler'.
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_MOUSEMOVE:
|
||||
case WM_NCMOUSEMOVE:
|
||||
case WM_MOUSELEAVE:
|
||||
case WM_NCMOUSELEAVE:
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_MBUTTONDBLCLK:
|
||||
case WM_XBUTTONDOWN:
|
||||
case WM_XBUTTONDBLCLK:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_XBUTTONUP:
|
||||
case WM_MOUSEWHEEL:
|
||||
case WM_MOUSEHWHEEL:
|
||||
case WM_KEYDOWN:
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_SYSKEYUP:
|
||||
case WM_SETFOCUS:
|
||||
case WM_KILLFOCUS:
|
||||
case WM_CHAR:
|
||||
case WM_SETCURSOR:
|
||||
case WM_DEVICECHANGE:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return CallWindowProc(g_oWndProc, hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void HookInputAPI( )
|
||||
{
|
||||
while (!g_hWindow)
|
||||
{
|
||||
EnumWindows(::EnumWindowsCallback,
|
||||
reinterpret_cast<LPARAM>(&g_hWindow));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
|
||||
g_oWndProc = reinterpret_cast<WNDPROC>(SetWindowLongPtr(
|
||||
g_hWindow, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(hkWndProc)));
|
||||
}
|
||||
|
||||
void UnhookInputAPI( )
|
||||
{
|
||||
if (g_oWndProc)
|
||||
{
|
||||
SetWindowLongPtr(g_hWindow, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG_PTR>(g_oWndProc));
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL CALLBACK EnumWindowsCallback(HWND handle, LPARAM lParam)
|
||||
{
|
||||
const auto isMainWindow = [handle]( )
|
||||
{
|
||||
return GetWindow(handle, GW_OWNER) == nullptr &&
|
||||
IsWindowVisible(handle) && handle != GetConsoleWindow( );
|
||||
};
|
||||
|
||||
DWORD pID = 0;
|
||||
GetWindowThreadProcessId(handle, &pID);
|
||||
|
||||
if (GetCurrentProcessId( ) != pID || !isMainWindow( )) return TRUE;
|
||||
|
||||
*reinterpret_cast<HWND*>(lParam) = handle;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HWND GetGameWindow( )
|
||||
{
|
||||
return g_hWindow;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "../../utils/console/console.hpp"
|
||||
#include "../../utils/utils.hpp"
|
||||
|
||||
void HookDX11GraphicsAPI();
|
||||
|
||||
void HookGraphicsAPI() {
|
||||
|
||||
HookDX11GraphicsAPI();
|
||||
}
|
||||
|
||||
|
||||
45
examples/raze-internal-cs2-main/src/sdk/defines.hpp
Normal file
45
examples/raze-internal-cs2-main/src/sdk/defines.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#define MAX_PLAYERS 64
|
||||
|
||||
enum EEconItemQuality {
|
||||
IQ_UNDEFINED = -1,
|
||||
IQ_NORMAL,
|
||||
IQ_GENUINE,
|
||||
IQ_VINTAGE,
|
||||
IQ_UNUSUAL,
|
||||
IQ_UNIQUE,
|
||||
IQ_COMMUNITY,
|
||||
IQ_DEVELOPER,
|
||||
IQ_SELFMADE,
|
||||
IQ_CUSTOMIZED,
|
||||
IQ_STRANGE,
|
||||
IQ_COMPLETED,
|
||||
IQ_HAUNTED,
|
||||
IQ_TOURNAMENT,
|
||||
IQ_FAVORED
|
||||
};
|
||||
|
||||
enum EEconItemRarity {
|
||||
IR_DEFAULT,
|
||||
IR_COMMON,
|
||||
IR_UNCOMMON,
|
||||
IR_RARE,
|
||||
IR_MYTHICAL,
|
||||
IR_LEGENDARY,
|
||||
IR_ANCIENT,
|
||||
IR_IMMORTAL
|
||||
};
|
||||
|
||||
// https://gitlab.com/KittenPopo/csgo-2018-source/-/blob/main/game/shared/econ/econ_item_constants.h#L39
|
||||
enum EEconTypeID {
|
||||
k_EEconTypeItem = 1,
|
||||
k_EEconTypePersonaDataPublic = 2,
|
||||
k_EEconTypeGameAccountClient = 7,
|
||||
k_EEconTypeGameAccount = 8,
|
||||
k_EEconTypeEquipInstance = 31,
|
||||
k_EEconTypeDefaultEquippedDefinitionInstance = 42,
|
||||
k_EEconTypeDefaultEquippedDefinitionInstanceClient = 43,
|
||||
k_EEconTypeCoupon = 45,
|
||||
k_EEconTypeQuest = 46,
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "interfaces.hpp"
|
||||
|
||||
#include "../../api/module/module.hpp"
|
||||
|
||||
#define FIND_INTERFACE(dst, module, version) \
|
||||
module.FindInterface(version).Get(dst, "interfaces::" #dst);
|
||||
|
||||
void interfaces::Initialize() {
|
||||
CModule engine(ENGINE2_DLL);
|
||||
CModule client(CLIENT_DLL);
|
||||
CModule schemasystem(SCHEMASYSTEM_DLL);
|
||||
CModule inputsystem(INPUTSYSTEM_DLL);
|
||||
CModule tier0(TIER0_DLL);
|
||||
CModule localize(LOCALIZE_DLL);
|
||||
CModule materialsystem(MATERIALSYSTEM_DLL);
|
||||
|
||||
FIND_INTERFACE(pGameResourceService, engine, GAME_RESOURCE_SERVICE_CLIENT);
|
||||
FIND_INTERFACE(pClient, client, SOURCE2_CLIENT);
|
||||
FIND_INTERFACE(pSchemaSystem, schemasystem, SCHEMA_SYSTEM);
|
||||
FIND_INTERFACE(pInputSystem, inputsystem, INPUT_SYSTEM_VERSION);
|
||||
FIND_INTERFACE(pEngine, engine, SOURCE2_ENGINE_TO_CLIENT);
|
||||
FIND_INTERFACE(pCvar, tier0, ENGINE_CVAR);
|
||||
FIND_INTERFACE(pLocalize, localize, LOCALIZE);
|
||||
FIND_INTERFACE(pMaterialSystem, materialsystem, MATERIAL_SYSTEM);
|
||||
}
|
||||
|
||||
void interfaces::Shutdown() {}
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "../source2-sdk/interfaces/cgameresourceserviceclient.hpp"
|
||||
#include "../source2-sdk/interfaces/cgameentitysystem.hpp"
|
||||
#include "../source2-sdk/interfaces/csource2client.hpp"
|
||||
#include "../source2-sdk/interfaces/cschemasystem.hpp"
|
||||
#include "../source2-sdk/interfaces/cengineclient.hpp"
|
||||
#include "../source2-sdk/interfaces/cinputsystem.hpp"
|
||||
#include "../source2-sdk/interfaces/cgameevent.hpp"
|
||||
#include "../source2-sdk/interfaces/clocalize.hpp"
|
||||
#include "../source2-sdk/interfaces/ccvar.hpp"
|
||||
#include "../source2-sdk/interfaces/cgametracemanager.h"
|
||||
#include "../source2-sdk/interfaces/cmaterialsystem.hpp"
|
||||
#include "../source2-sdk/classes/ccsgoinput.hpp"
|
||||
|
||||
namespace interfaces
|
||||
{
|
||||
void Initialize( );
|
||||
void Shutdown( );
|
||||
|
||||
inline CGameResourceService* pGameResourceService;
|
||||
inline CSource2Client* pClient;
|
||||
inline CSchemaSystem* pSchemaSystem;
|
||||
inline CInputSystem* pInputSystem;
|
||||
inline CEngineClient* pEngine;
|
||||
inline CCvar* pCvar;
|
||||
inline CLocalize* pLocalize;
|
||||
inline IMaterialSystem2* pMaterialSystem;
|
||||
inline CGameTraceManager* pTraceMgr;
|
||||
//inline CCSGOInput* pInput = nullptr;
|
||||
} // namespace interfaces
|
||||
110
examples/raze-internal-cs2-main/src/sdk/math/math.cpp
Normal file
110
examples/raze-internal-cs2-main/src/sdk/math/math.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
#include "math.hpp"
|
||||
|
||||
#include "../memory/memory.hpp"
|
||||
#include <DirectXMath.h>
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <imgui/imgui.h>
|
||||
#include <imgui/imgui_internal.h>
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define RAD2DEG(radian) (float)radian * (180.f / (float)M_PI)
|
||||
#define DEG2RAD(degree) (float)degree*((float)M_PI / 180.f)
|
||||
static VMatrix g_viewMatrix;
|
||||
|
||||
bool math::WorldToScreen(const Vector& in, ImVec2& out) {
|
||||
if (!ImGui::GetCurrentContext()) return false;
|
||||
|
||||
const float z = g_viewMatrix[3][0] * in.x + g_viewMatrix[3][1] * in.y +
|
||||
g_viewMatrix[3][2] * in.z + g_viewMatrix[3][3];
|
||||
if (z < 0.001f) return false;
|
||||
|
||||
out = ImGui::GetIO().DisplaySize * 0.5f;
|
||||
out.x *= 1.0f + (g_viewMatrix[0][0] * in.x + g_viewMatrix[0][1] * in.y +
|
||||
g_viewMatrix[0][2] * in.z + g_viewMatrix[0][3]) /
|
||||
z;
|
||||
out.y *= 1.0f - (g_viewMatrix[1][0] * in.x + g_viewMatrix[1][1] * in.y +
|
||||
g_viewMatrix[1][2] * in.z + g_viewMatrix[1][3]) /
|
||||
z;
|
||||
|
||||
// So 'rounded' corners will not appear.
|
||||
out = ImFloor(out);
|
||||
return true;
|
||||
}
|
||||
|
||||
void math::UpdateViewMatrix(VMatrix* pViewMatrix) {
|
||||
if (!pViewMatrix) return;
|
||||
g_viewMatrix = *pViewMatrix;
|
||||
}
|
||||
|
||||
void math::angle_vectors(const QAngle_t& angles, Vector* forward, Vector* right,
|
||||
Vector* up) {
|
||||
float sr, sp, sy, cr, cp, cy;
|
||||
|
||||
DirectX::XMScalarSinCos(&sy, &cy, DEG2RAD(angles.y));
|
||||
DirectX::XMScalarSinCos(&sp, &cp, DEG2RAD(angles.x));
|
||||
DirectX::XMScalarSinCos(&sr, &cr, DEG2RAD(angles.z));
|
||||
|
||||
if (forward) {
|
||||
forward->x = (cp * cy);
|
||||
forward->y = (cp * sy);
|
||||
forward->z = (-sp);
|
||||
}
|
||||
|
||||
if (right) {
|
||||
right->x = (-1.f * sr * sp * cy + -1.f * cr * -sy);
|
||||
right->y = (-1.f * sr * sp * sy + -1.f * cr * cy);
|
||||
right->z = (-1.f * sr * cp);
|
||||
}
|
||||
|
||||
if (up) {
|
||||
up->x = (cr * sp * cy + -sr * -sy);
|
||||
up->y = (cr * sp * sy + -sr * cy);
|
||||
up->z = (cr * cp);
|
||||
}
|
||||
}
|
||||
void math::anglevectors(const QAngle_t& angles, Vector& forward) {
|
||||
float sx{}, sy{}, cx{}, cy{};
|
||||
|
||||
DirectX::XMScalarSinCos(&sy, &cy, DEG2RAD(angles.y));
|
||||
DirectX::XMScalarSinCos(&sx, &cx, DEG2RAD(angles.x));
|
||||
|
||||
forward.x = cx * cy;
|
||||
forward.y = cx * sy;
|
||||
forward.z = -sx;
|
||||
}
|
||||
void math::NormalizeAngle(QAngle_t angle) {
|
||||
angle.x = std::remainderf(angle.x, 180.f);
|
||||
angle.y = std::remainderf(angle.y, 360.f);
|
||||
}
|
||||
Vector cross_product(const Vector& a, const Vector& b) {
|
||||
return Vector(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z,
|
||||
a.x * b.y - a.y * b.x);
|
||||
}
|
||||
|
||||
void math::vector_angles(const Vector& forward, Vector& angles)
|
||||
{
|
||||
float yaw, pitch;
|
||||
|
||||
if (forward.y == 0.f && forward.x == 0.f) {
|
||||
yaw = 0.f;
|
||||
if (forward.z > 0)
|
||||
pitch = 270.f;
|
||||
else
|
||||
pitch = 90.f;
|
||||
} else {
|
||||
yaw = (float)(std::atan2f(forward.y, forward.x) * 180.f / (float)M_PI);
|
||||
if (yaw < 0.f) yaw += 360.f;
|
||||
|
||||
auto tmp = std::sqrtf(forward.x * forward.x + forward.y * forward.y);
|
||||
pitch = (float)(std::atan2f(-forward.x, tmp) * 180.f / (float)M_PI);
|
||||
if (pitch < 0.f) pitch += 360.f;
|
||||
}
|
||||
|
||||
angles.x = pitch;
|
||||
angles.y = yaw;
|
||||
angles.z = 0.f;
|
||||
}
|
||||
float math::normalize_yaw(float yaw) {
|
||||
while (yaw < -180.f) yaw += 360.f;
|
||||
while (yaw > 180.f) yaw -= 360.f;
|
||||
return yaw;
|
||||
}
|
||||
22
examples/raze-internal-cs2-main/src/sdk/math/math.hpp
Normal file
22
examples/raze-internal-cs2-main/src/sdk/math/math.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include "types/qangle.hpp"
|
||||
#include "types/vector.hpp"
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#define M_DEG2RAD(x) ((x) * (3.14159265358979323846 * 2.f) / 360.f)
|
||||
#define deg_to_rad(x) ((float)(x) * (float)(M_PI / 180.f))
|
||||
#define rad_to_deg(x) ((float)(x) * (float)(180.f / M_PI))
|
||||
struct ImVec2;
|
||||
|
||||
namespace math {
|
||||
bool WorldToScreen(const Vector& in, ImVec2& out);
|
||||
void UpdateViewMatrix(VMatrix* pViewMatrix);
|
||||
void angle_vectors(const QAngle_t& angles, Vector* forward, Vector* right,
|
||||
Vector* up);
|
||||
|
||||
void NormalizeAngle(QAngle_t angle);
|
||||
void vector_angles(const Vector& forward, Vector& angles);
|
||||
void anglevectors(const QAngle_t& angles, Vector& forward);
|
||||
float normalize_yaw(float yaw);
|
||||
} // namespace math
|
||||
236
examples/raze-internal-cs2-main/src/sdk/math/types/qangle.hpp
Normal file
236
examples/raze-internal-cs2-main/src/sdk/math/types/qangle.hpp
Normal file
@@ -0,0 +1,236 @@
|
||||
#include <cmath>
|
||||
#include "../math.hpp"
|
||||
#include "vector.hpp"
|
||||
#include <DirectXMath.h>
|
||||
#define M_DEG2RAD(DEGREES) ((DEGREES) * (3.14159265358979323846f / 180.f))
|
||||
#define M_RAD2DEG(RADIANS) ((RADIANS) * (180.f / 3.14159265358979323846f))
|
||||
#define M_LERP(X0, X1, FACTOR) ((X0) + ((X1) - (X0)) * (FACTOR))
|
||||
template <typename T>
|
||||
constexpr const T& clamp1(const T& value, const T& minimal,
|
||||
const T& maximal) noexcept {
|
||||
return (value < minimal) ? minimal : (value > maximal) ? maximal : value;
|
||||
}
|
||||
struct QAngle_t {
|
||||
constexpr QAngle_t(float x = 0.f, float y = 0.f, float z = 0.f)
|
||||
: x(x), y(y), z(z) {}
|
||||
|
||||
constexpr QAngle_t(const float* arrAngles)
|
||||
: x(arrAngles[0]), y(arrAngles[1]), z(arrAngles[2]) {}
|
||||
|
||||
#pragma region qangle_array_operators
|
||||
|
||||
[[nodiscard]] float& operator[](const int nIndex) {
|
||||
return reinterpret_cast<float*>(this)[nIndex];
|
||||
}
|
||||
|
||||
[[nodiscard]] const float& operator[](const int nIndex) const {
|
||||
return reinterpret_cast<const float*>(this)[nIndex];
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region qangle_relational_operators
|
||||
|
||||
bool operator==(const QAngle_t& angBase) const {
|
||||
return this->IsEqual(angBase);
|
||||
}
|
||||
|
||||
bool operator!=(const QAngle_t& angBase) const {
|
||||
return !this->IsEqual(angBase);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region qangle_assignment_operators
|
||||
|
||||
constexpr QAngle_t& operator=(const QAngle_t& angBase) {
|
||||
this->x = angBase.x;
|
||||
this->y = angBase.y;
|
||||
this->z = angBase.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region qangle_arithmetic_assignment_operators
|
||||
|
||||
constexpr QAngle_t& operator+=(const QAngle_t& angBase) {
|
||||
this->x += angBase.x;
|
||||
this->y += angBase.y;
|
||||
this->z += angBase.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr QAngle_t& operator-=(const QAngle_t& angBase) {
|
||||
this->x -= angBase.x;
|
||||
this->y -= angBase.y;
|
||||
this->z -= angBase.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr QAngle_t& operator*=(const QAngle_t& angBase) {
|
||||
this->x *= angBase.x;
|
||||
this->y *= angBase.y;
|
||||
this->z *= angBase.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr QAngle_t& operator/=(const QAngle_t& angBase) {
|
||||
this->x /= angBase.x;
|
||||
this->y /= angBase.y;
|
||||
this->z /= angBase.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr QAngle_t& operator+=(const float flAdd) {
|
||||
this->x += flAdd;
|
||||
this->y += flAdd;
|
||||
this->z += flAdd;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr QAngle_t& operator-=(const float flSubtract) {
|
||||
this->x -= flSubtract;
|
||||
this->y -= flSubtract;
|
||||
this->z -= flSubtract;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr QAngle_t& operator*=(const float flMultiply) {
|
||||
this->x *= flMultiply;
|
||||
this->y *= flMultiply;
|
||||
this->z *= flMultiply;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr QAngle_t& operator/=(const float flDivide) {
|
||||
this->x /= flDivide;
|
||||
this->y /= flDivide;
|
||||
this->z /= flDivide;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region qangle_arithmetic_unary_operators
|
||||
|
||||
constexpr QAngle_t& operator-() {
|
||||
this->x = -this->x;
|
||||
this->y = -this->y;
|
||||
this->z = -this->z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr QAngle_t operator-() const {
|
||||
return {-this->x, -this->y, -this->z};
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region qangle_arithmetic_ternary_operators
|
||||
|
||||
constexpr QAngle_t operator+(const QAngle_t& angAdd) const {
|
||||
return {this->x + angAdd.x, this->y + angAdd.y, this->z + angAdd.z};
|
||||
}
|
||||
|
||||
constexpr QAngle_t operator-(const QAngle_t& angSubtract) const {
|
||||
return {this->x - angSubtract.x, this->y - angSubtract.y,
|
||||
this->z - angSubtract.z};
|
||||
}
|
||||
|
||||
constexpr QAngle_t operator*(const QAngle_t& angMultiply) const {
|
||||
return {this->x * angMultiply.x, this->y * angMultiply.y,
|
||||
this->z * angMultiply.z};
|
||||
}
|
||||
|
||||
constexpr QAngle_t operator/(const QAngle_t& angDivide) const {
|
||||
return {this->x / angDivide.x, this->y / angDivide.y,
|
||||
this->z / angDivide.z};
|
||||
}
|
||||
|
||||
constexpr QAngle_t operator+(const float flAdd) const {
|
||||
return {this->x + flAdd, this->y + flAdd, this->z + flAdd};
|
||||
}
|
||||
|
||||
constexpr QAngle_t operator-(const float flSubtract) const {
|
||||
return {this->x - flSubtract, this->y - flSubtract,
|
||||
this->z - flSubtract};
|
||||
}
|
||||
|
||||
constexpr QAngle_t operator*(const float flMultiply) const {
|
||||
return {this->x * flMultiply, this->y * flMultiply,
|
||||
this->z * flMultiply};
|
||||
}
|
||||
|
||||
constexpr QAngle_t operator/(const float flDivide) const {
|
||||
return {this->x / flDivide, this->y / flDivide, this->z / flDivide};
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
[[nodiscard]] bool IsValid() const {
|
||||
return (std::isfinite(this->x) && std::isfinite(this->y) &&
|
||||
std::isfinite(this->z));
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsEqual(
|
||||
const QAngle_t& angEqual,
|
||||
const float flErrorMargin =
|
||||
std::numeric_limits<float>::epsilon()) const {
|
||||
return (std::fabsf(this->x - angEqual.x) < flErrorMargin &&
|
||||
std::fabsf(this->y - angEqual.y) < flErrorMargin &&
|
||||
std::fabsf(this->z - angEqual.z) < flErrorMargin);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsZero() const {
|
||||
return (this->x == 0.0f && this->y == 0.0f && this->z == 0.0f);
|
||||
}
|
||||
|
||||
[[nodiscard]] float Length2D() const { return std::sqrtf(x * x + y * y); }
|
||||
|
||||
constexpr QAngle_t& Clamp() {
|
||||
this->x = clamp1(this->x, -89.f, 89.f);
|
||||
this->y = clamp1(this->y, -180.f, 180.f);
|
||||
this->z = clamp1(this->z, -50.f, 50.f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QAngle_t& Normalize() {
|
||||
this->x = std::remainderf(this->x, 360.f);
|
||||
this->y = std::remainderf(this->y, 360.f);
|
||||
this->z = std::remainderf(this->z, 360.f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ToDirections(Vector* pvecForward, Vector* pvecRight, Vector* pvecUp) {
|
||||
float flPitchSin, flPitchCos, flYawSin, flYawCos, flRollSin, flRollCos;
|
||||
DirectX::XMScalarSinCos(&flPitchSin, &flPitchCos, M_DEG2RAD(this->x));
|
||||
DirectX::XMScalarSinCos(&flYawSin, &flYawCos, M_DEG2RAD(this->y));
|
||||
DirectX::XMScalarSinCos(&flRollSin, &flRollCos, M_DEG2RAD(this->z));
|
||||
|
||||
if (pvecForward != nullptr) {
|
||||
pvecForward->x = flPitchCos * flYawCos;
|
||||
pvecForward->y = flPitchCos * flYawSin;
|
||||
pvecForward->z = -flPitchSin;
|
||||
}
|
||||
|
||||
if (pvecRight != nullptr) {
|
||||
pvecRight->x =
|
||||
(-flRollSin * flPitchSin * flYawCos) + (-flRollCos * -flYawSin);
|
||||
pvecRight->y =
|
||||
(-flRollSin * flPitchSin * flYawSin) + (-flRollCos * flYawCos);
|
||||
pvecRight->z = (-flRollSin * flPitchCos);
|
||||
}
|
||||
|
||||
if (pvecUp != nullptr) {
|
||||
pvecUp->x =
|
||||
(flRollCos * flPitchSin * flYawCos) + (-flRollSin * -flYawSin);
|
||||
pvecUp->y =
|
||||
(flRollCos * flPitchSin * flYawSin) + (-flRollSin * flYawCos);
|
||||
pvecUp->z = (flRollCos * flPitchCos);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f;
|
||||
};
|
||||
110
examples/raze-internal-cs2-main/src/sdk/math/types/vector.hpp
Normal file
110
examples/raze-internal-cs2-main/src/sdk/math/types/vector.hpp
Normal file
@@ -0,0 +1,110 @@
|
||||
#pragma once
|
||||
#include <cmath>
|
||||
#include "vmatrix.hpp"
|
||||
#include <algorithm>
|
||||
#include <numbers>
|
||||
struct Vector4D
|
||||
{
|
||||
constexpr Vector4D(const float x = 0.0f, const float y = 0.0f,
|
||||
const float z = 0.0f, const float w = 0.0f)
|
||||
: x(x), y(y), z(z), w(w)
|
||||
{}
|
||||
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
|
||||
};
|
||||
class Vector
|
||||
{
|
||||
public:
|
||||
Vector operator+(const Vector& rhs) const noexcept
|
||||
{
|
||||
return Vector{ this->x + rhs.x, this->y + rhs.y, this->z + rhs.z };
|
||||
}
|
||||
|
||||
Vector operator-(const Vector& rhs) const noexcept
|
||||
{
|
||||
return Vector{ this->x - rhs.x, this->y - rhs.y, this->z - rhs.z };
|
||||
}
|
||||
|
||||
Vector operator*(const float rhs) const noexcept
|
||||
{
|
||||
return Vector{ this->x * rhs, this->y * rhs, this->z * rhs };
|
||||
}
|
||||
|
||||
Vector operator/(const float rhs) const noexcept
|
||||
{
|
||||
return Vector{ this->x / rhs, this->y / rhs, this->z / rhs };
|
||||
}
|
||||
|
||||
float DistToSquared(const Vector& rhs) const noexcept
|
||||
{
|
||||
const float _x = (this->x - rhs.x);
|
||||
const float _y = (this->y - rhs.y);
|
||||
const float _z = (this->z - rhs.z);
|
||||
|
||||
return _x * _x + _y * _y + _z * _z;
|
||||
}
|
||||
|
||||
float DistToSquaredInMeters(const Vector& rhs) const noexcept
|
||||
{
|
||||
// https://developer.valvesoftware.com/wiki/Dimensions_(Half-Life_2_and_Counter-Strike:_Source)/en
|
||||
// 1 foot = 12 units => 1 unit = 0.0254 meters.
|
||||
|
||||
return DistToSquared(rhs) * 0.00064516f;
|
||||
}
|
||||
|
||||
Vector ToAngle()
|
||||
{
|
||||
return Vector{
|
||||
std::atan2(-z, std::hypot(x, y)) * (180.0f / std::numbers::pi_v<float>),
|
||||
std::atan2(y, x) * (180.0f / std::numbers::pi_v<float>),
|
||||
0.0f
|
||||
};
|
||||
}
|
||||
|
||||
inline float Length_SQR_2D( ) const
|
||||
{
|
||||
return this->x * this->x + this->y * this->y;
|
||||
}
|
||||
inline float Length_2D( ) const
|
||||
{
|
||||
return std::sqrtf(Length_SQR_2D( ));
|
||||
}
|
||||
void Clamp( )
|
||||
{
|
||||
this->x = std::clamp(this->x, -89.0f, 89.0f);
|
||||
this->y = std::clamp(std::remainder(this->y, 360.0f), -180.0f, 180.0f);
|
||||
this->z = std::clamp(this->z, -50.0f, 50.0f);
|
||||
}
|
||||
void NormalizeInPlace( )
|
||||
{
|
||||
Vector& v = *this;
|
||||
|
||||
float iradius = 1.0f / (this->Length( ) + FLT_EPSILON);
|
||||
|
||||
v.x *= iradius;
|
||||
v.y *= iradius;
|
||||
v.z *= iradius;
|
||||
}
|
||||
|
||||
Vector& Normalize()
|
||||
{
|
||||
this->x = std::remainderf(this->x, 360.f);
|
||||
this->y = std::remainderf(this->y, 360.f);
|
||||
this->z = std::remainderf(this->z, 360.f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
float Dot(const Vector& vOther) const
|
||||
{
|
||||
return (x * vOther.x + y * vOther.y + z * vOther.z);
|
||||
}
|
||||
float Length( ) const
|
||||
{
|
||||
return sqrt(x * x + y * y + z * z);
|
||||
}
|
||||
constexpr const bool IsZero() const noexcept
|
||||
{
|
||||
return x == 0.f && y == 0.f && z == 0.f;
|
||||
}
|
||||
float x, y, z;
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
class VMatrix {
|
||||
public:
|
||||
auto operator[](int i) const noexcept { return m[i]; }
|
||||
|
||||
float m[4][4];
|
||||
};
|
||||
151
examples/raze-internal-cs2-main/src/sdk/memory/memory.cpp
Normal file
151
examples/raze-internal-cs2-main/src/sdk/memory/memory.cpp
Normal file
@@ -0,0 +1,151 @@
|
||||
#include "memory.hpp"
|
||||
#include <stb/stb.hh>
|
||||
#include "../interfaces/interfaces.hpp"
|
||||
#define MEMORY_VARIABLE(var) var, "memory::" #var
|
||||
|
||||
void memory::Initialize()
|
||||
{
|
||||
CModule client(CLIENT_DLL);
|
||||
CModule schemasystem(SCHEMASYSTEM_DLL);
|
||||
CModule sdl3(SDL3_DLL);
|
||||
CModule tier0(TIER0_DLL);
|
||||
CModule particles(PARTICLES_DLL);
|
||||
CModule scenesystem(SCENESYSTEM_DLL);
|
||||
CModule materialsystem(MATERIALSYSTEM_DLL);
|
||||
|
||||
client.FindPattern(GET_BASE_ENTITY)
|
||||
.Get(MEMORY_VARIABLE(fnGetBaseEntity));
|
||||
|
||||
client.FindPattern(GET_HIGHEST_ENTITY_INDEX)
|
||||
.ToAbsolute(3, 0)
|
||||
.Get(MEMORY_VARIABLE(fnGetHighestEntityIndex));
|
||||
|
||||
schemasystem.FindPattern(PRINT_SCHEMA_DETAILED_CLASS_LAYOUT)
|
||||
.Get(MEMORY_VARIABLE(schema_detailed_class_layout));
|
||||
|
||||
client.FindPattern(MOUSE_INPUT_ENABLED)
|
||||
.Get(MEMORY_VARIABLE(fnMouseInputEnabled));
|
||||
|
||||
|
||||
client.FindPattern(GET_GC_CLIENT_SYSTEM)
|
||||
.ToAbsolute(1, 0)
|
||||
.Get(MEMORY_VARIABLE(fnGetClientSystem));
|
||||
|
||||
|
||||
client.FindPattern(CREATE_BASE_TYPE_CACHE)
|
||||
.ToAbsolute(1, 0)
|
||||
.Get(MEMORY_VARIABLE(fnCreateBaseTypeCache));
|
||||
|
||||
client.FindPattern(FIND_SO_CACHE)
|
||||
.ToAbsolute(1, 0)
|
||||
.Get(MEMORY_VARIABLE(fnFindSOCache));
|
||||
|
||||
client.FindPattern(GET_LOCAL_PLAYER_CONTROLLER)
|
||||
.ToAbsolute(1, 0)
|
||||
.Get(MEMORY_VARIABLE(fnGetLocalPlayerController));
|
||||
|
||||
client.FindPattern(SET_DYNAMIC_ATTRIBUTE_VALUE_UINT)
|
||||
.ToAbsolute(1, 0)
|
||||
.Get(MEMORY_VARIABLE(fnSetDynamicAttributeValueUint));
|
||||
|
||||
|
||||
client.FindPattern(COMPUTE_HITBOX_SURROUNDING_BOX)
|
||||
.ToAbsolute(1, 0)
|
||||
.Get(MEMORY_VARIABLE(fnComputeHitboxSurroundingBox));
|
||||
|
||||
client.FindPattern(GET_MATRICES_FOR_VIEW)
|
||||
.Get(MEMORY_VARIABLE(fnGetMatricesForView));
|
||||
|
||||
//MEM::GetAbsoluteAddress(MEM::FindPattern(CLIENT_DLL, CS_XOR("E8 ? ? ? ? 48 85 C0 74 ? 44 38 60")), 0x1, 0x0)
|
||||
|
||||
client.FindPattern(SDK_SIG("48 89 5C 24 20 48 89 4C 24 08 55 56 41")).Get(MEMORY_VARIABLE(fnTraceShape));
|
||||
client.FindPattern(SDK_SIG("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 41 54 41 56 41 57 48 81 EC ? ? ? ? 48 8B 9C 24")).Get(MEMORY_VARIABLE(fnClipRayToEntity));
|
||||
|
||||
client.FindPattern(SDK_SIG("40 53 48 83 EC 30 48 8B 41 10 48 8B D9 8B 50 30")).Get(MEMORY_VARIABLE(fnGetPlayerPawn));
|
||||
|
||||
client.FindPattern(SDK_SIG("48 63 41 ? 48 8B 0D")).Get(MEMORY_VARIABLE(fnGetSurfaceData));
|
||||
|
||||
client.FindPattern(SDK_SIG("48 8B 05 ? ? ? ? F2 0F 11 45 ? 80 65 ? ? 89 7D")).ToAbsolute(0x3, 0).Dereference(1).Get(interfaces::pTraceMgr);
|
||||
|
||||
|
||||
client.FindPattern(CREATMOVE_SIG)
|
||||
.Get(MEMORY_VARIABLE(fnCreatMove));
|
||||
|
||||
client.FindPattern(FRAMESTAGE_NOTIFY)
|
||||
.Get(MEMORY_VARIABLE(fnFrameStage));
|
||||
|
||||
//client.FindPattern(UPDATE_3D_PARAMS)
|
||||
// .Get(MEMORY_VARIABLE(hkUpdateSky3DParams));
|
||||
|
||||
client.FindPattern(SDK_SIG("85 D2 75 3F 48 63 81 ? ? ? ? F2 41 0F 10 00 85 C0 74 1D 48 8B 89 ? ? ? ? 48 69 D0"))
|
||||
.Get(MEMORY_VARIABLE(m_CSGOInput_SetViewAngles));
|
||||
|
||||
client.FindPattern(SDK_SIG("E8 ? ? ? ? EB ? 48 8B 01 48 8D 54 24"))
|
||||
.ToAbsolute(1, 0)
|
||||
.Get(MEMORY_VARIABLE(m_CSGOInput_GetViewAngles));
|
||||
|
||||
client.FindPattern(SKYBOX_COLOR_UPDATE)
|
||||
.Get(MEMORY_VARIABLE(UpdateSkyboxColor));
|
||||
|
||||
client.FindPattern(SDK_SIG("40 53 48 83 EC 20 48 8B 54"))
|
||||
.Get(MEMORY_VARIABLE(GlowFunction));
|
||||
|
||||
client.FindPattern(SDK_SIG("40 53 48 83 EC 20 48 8B D9 4C 8B C2 48 8B 0D ? ? ? ? 48 8D 54 24"))
|
||||
.Get(MEMORY_VARIABLE(fnSetModel));
|
||||
|
||||
tier0.GetProcAddress("RandomInt").Get(MEMORY_VARIABLE(fnRandomInt));
|
||||
tier0.GetProcAddress("RandomSeed").Get(MEMORY_VARIABLE(fnRandomSeed));
|
||||
tier0
|
||||
.GetProcAddress(
|
||||
"?LoadKV3@@YA_NPEAVKeyValues3@@PEAVCUtlString@@PEAVCUtlBuffer@@AEBUKV3ID_t@@PEBD@Z")
|
||||
.Get(MEMORY_VARIABLE(fnLoadKV3));
|
||||
|
||||
client.FindPattern(SET_TYPE).ToAbsolute(1, 0).Get(
|
||||
MEMORY_VARIABLE(fnSetType));
|
||||
|
||||
client.FindPattern(FREE_ALLOC_KV3).ToAbsolute(1, 0).Get(
|
||||
MEMORY_VARIABLE(pFnFreeAlloc));
|
||||
|
||||
particles.FindPattern(SET_MATERIAL_SHADER)
|
||||
.ToAbsolute(32, 0)
|
||||
.Get(MEMORY_VARIABLE(fnSetMaterialShaderType));
|
||||
|
||||
//particles.FindPattern(SET_MATERIAL).Get(MEMORY_VARIABLE(fnSetMaterial));
|
||||
|
||||
particles.FindPattern(FIND_VAR).Get(MEMORY_VARIABLE(fnFindKeyVar));
|
||||
|
||||
scenesystem.FindPattern(DRAW_OBJECT).Get(MEMORY_VARIABLE(fnDrawObject));
|
||||
|
||||
scenesystem.FindPattern(UPDATE_COLOR_TO_SCENE)
|
||||
.ToAbsolute(1, 0)
|
||||
.Get(MEMORY_VARIABLE(hkApplyColorToSceneObject));
|
||||
|
||||
scenesystem.FindPattern(HK_SETUP_LIGHT)
|
||||
.ToAbsolute(1, 0)
|
||||
.Get(MEMORY_VARIABLE(hksetup_lighting));
|
||||
|
||||
//materialsystem.FindPattern(CREATE_MATERIAL)
|
||||
//.Get(MEMORY_VARIABLE(fnCreateMaterial));
|
||||
|
||||
tier0.GetProcAddress("??3KeyValues@@SAXPEAXHPEBDH@Z")
|
||||
.Get(MEMORY_VARIABLE(fnDelete));
|
||||
|
||||
tier0.GetProcAddress("MemAlloc_AllocFunc")
|
||||
.Get(MEMORY_VARIABLE(fnAllocMem));
|
||||
|
||||
tier0.GetProcAddress("MemAlloc_FreeFunc")
|
||||
.Get(MEMORY_VARIABLE(fnDeAllocMem));
|
||||
|
||||
sdl3.GetProcAddress("SDL_SetWindowRelativeMouseMode").Get(fnSDL_SetRelativeMouseMode);
|
||||
sdl3.GetProcAddress("SDL_GetWindowRelativeMouseMode").Get(fnSDL_GetRelativeMouseMode);
|
||||
sdl3.GetProcAddress("SDL_GetGrabbedWindow").Get(fnSDL_GetGrabbedWindow);
|
||||
sdl3.GetProcAddress("SDL_SetWindowMouseGrab").Get(fnSDL_SetWindowGrab);
|
||||
sdl3.GetProcAddress("SDL_WarpMouseInWindow").Get(fnSDL_WarpMouseInWindow);
|
||||
|
||||
UTILPtr ppHeapMemAlloc = tier0.GetProcAddress("g_pMemAlloc");
|
||||
if (ppHeapMemAlloc.IsValid())
|
||||
ppHeapMemAlloc.Dereference(1).Get(MEMORY_VARIABLE(g_pHeapMemAlloc));
|
||||
}
|
||||
|
||||
void memory::Shutdown()
|
||||
{}
|
||||
108
examples/raze-internal-cs2-main/src/sdk/memory/memory.hpp
Normal file
108
examples/raze-internal-cs2-main/src/sdk/memory/memory.hpp
Normal file
@@ -0,0 +1,108 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../api/module/module.hpp"
|
||||
|
||||
#include "../source2-sdk/cstrike15/ccsplayerinventory.hpp"
|
||||
class Vector;
|
||||
class CCSInventoryManager;
|
||||
class CCSPlayerController;
|
||||
|
||||
inline std::uint64_t(__fastcall* fnFindKeyVar)(const char*, unsigned int, int);
|
||||
struct MaterialKeyVar_t
|
||||
{
|
||||
std::uint64_t uKey;
|
||||
const char* szName;
|
||||
|
||||
MaterialKeyVar_t(std::uint64_t uKey, const char* szName)
|
||||
: uKey(uKey), szName(szName)
|
||||
{}
|
||||
|
||||
MaterialKeyVar_t(const char* szName, bool bShouldFindKey = false)
|
||||
: szName(szName)
|
||||
{
|
||||
uKey = bShouldFindKey ? FindKey(szName) : 0x0;
|
||||
}
|
||||
|
||||
std::uint64_t FindKey(const char* szName)
|
||||
{
|
||||
return fnFindKeyVar(szName, 0x12, 0x31415926);
|
||||
}
|
||||
};
|
||||
|
||||
namespace memory
|
||||
{
|
||||
void Initialize();
|
||||
void Shutdown();
|
||||
inline int(__cdecl* fnRandomSeed)(int iSeed) = nullptr;
|
||||
inline int(__cdecl* fnRandomInt)(int iMinValue, int iMaxValue) = nullptr;
|
||||
inline void* (__thiscall* fnGetBaseEntity)(void*, int);
|
||||
inline int(__thiscall* fnGetHighestEntityIndex)(void*, int*);
|
||||
inline void* (__thiscall* schema_detailed_class_layout)(void*, const char*);
|
||||
inline void* fnMouseInputEnabled;
|
||||
inline void(__thiscall* fnSetMeshGroupMask)(void*, uint64_t);
|
||||
inline CCSInventoryManager* (*fnGetInventoryManager)();
|
||||
inline void* fnInput;
|
||||
inline CGCClientSystem* (*fnGetClientSystem)();
|
||||
inline CEconItem* (*fnCreateSharedObjectSubclassEconItem)();
|
||||
inline CGCClientSharedObjectTypeCache* (__thiscall* fnCreateBaseTypeCache)(
|
||||
void*, int);
|
||||
inline CGCClientSharedObjectCache* (__thiscall* fnFindSOCache)(void*, SOID_t,
|
||||
bool);
|
||||
inline CCSPlayerController* (__fastcall* fnGetLocalPlayerController)(int);
|
||||
inline void* (__fastcall* fnSetDynamicAttributeValueUint)(void*, void*,
|
||||
void*);
|
||||
inline void* (__fastcall* fnSetModel)(void*, const char*);
|
||||
inline bool(__fastcall* fnComputeHitboxSurroundingBox)(void*, Vector&,
|
||||
Vector&);
|
||||
inline void* fnGetMatricesForView;
|
||||
inline void(__fastcall* hkUpdateSky3DParams)(void*);
|
||||
inline void* UpdateSkyboxColor;
|
||||
inline void* m_CSGOInput_SetViewAngles;
|
||||
inline void* m_CSGOInput_GetViewAngles;
|
||||
inline void* GlowFunction;
|
||||
|
||||
inline void(__fastcall* fnGetPlayerPawn)(void*);
|
||||
|
||||
// inline void(__fastcall* hksetup_lighting)(void*);
|
||||
//inline void(__fastcall* hkApplyColorToSceneObject)(void*);
|
||||
|
||||
inline void* hkApplyColorToSceneObject;
|
||||
inline void* hksetup_lighting;
|
||||
|
||||
inline void* fnFireEventClientSide;
|
||||
inline void* fnCreatMove;
|
||||
inline void* fnFrameStage;
|
||||
// inline void(__fastcall* fnAddStattrakEntity)(void*);
|
||||
// inline void(__fastcall* fnAddNametagEntity)(void*);
|
||||
// inline bool(__fastcall* fnIsPaintKitUsingLegacyModel)(const char*);
|
||||
|
||||
// SDL2 Functions
|
||||
inline void(__stdcall* fnSDL_SetRelativeMouseMode)(void*, bool);
|
||||
inline bool(__stdcall* fnSDL_GetRelativeMouseMode)(void*);
|
||||
inline void* (__stdcall* fnSDL_GetGrabbedWindow)();
|
||||
inline int(__stdcall* fnSDL_SetWindowGrab)(void*, int);
|
||||
inline int(__stdcall* fnSDL_WarpMouseInWindow)(void*, float, float);
|
||||
|
||||
// MATERIALSYSTEM Functions
|
||||
inline void(__fastcall* fnSetMaterial)(void*, MaterialKeyVar_t, int, int);
|
||||
//inline std::uint64_t(__fastcall* fnFindKeyVar)(const char*, unsigned int,
|
||||
// int);
|
||||
inline void(__fastcall* fnSetMaterialShaderType)(void*, MaterialKeyVar_t,
|
||||
const char*, int);
|
||||
inline std::int64_t(__fastcall* fnCreateMaterial)(void*, void*,
|
||||
const char*, void*,
|
||||
unsigned int,
|
||||
unsigned int);
|
||||
inline void(__fastcall* fnDelete)(void*, int, const char*, int);
|
||||
|
||||
inline void* (__fastcall* fnAllocMem)(int64_t);
|
||||
inline void(__fastcall* fnDeAllocMem)(void*);
|
||||
|
||||
inline bool(__fastcall* fnTraceShape)(void*, void*, Vector*, Vector*, void*, void*);
|
||||
inline bool(__fastcall* fnClipRayToEntity)(void*, void*, Vector*, Vector*, void*, void*, void*);
|
||||
|
||||
inline void* (__fastcall* fnGetSurfaceData)(void*);
|
||||
|
||||
//
|
||||
} // namespace memory
|
||||
|
||||
64
examples/raze-internal-cs2-main/src/sdk/schema/schema.cpp
Normal file
64
examples/raze-internal-cs2-main/src/sdk/schema/schema.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#include <unordered_map>
|
||||
|
||||
#include "schema.hpp"
|
||||
|
||||
#include "../interfaces/interfaces.hpp"
|
||||
|
||||
using SchemaKeyValueMap_t = std::unordered_map<uint32_t, int16_t>;
|
||||
using SchemaTableMap_t = std::unordered_map<uint32_t, SchemaKeyValueMap_t>;
|
||||
|
||||
static bool InitSchemaFieldsForClass(SchemaTableMap_t& tableMap,
|
||||
const char* className, uint32_t classKey) {
|
||||
CSchemaSystemTypeScope* pType =
|
||||
interfaces::pSchemaSystem->FindTypeScopeForModule(CLIENT_DLL);
|
||||
if (!pType) return false;
|
||||
|
||||
SchemaClassInfoData_t* pClassInfo = pType->FindDeclaredClass(className);
|
||||
if (!pClassInfo) {
|
||||
tableMap.emplace(classKey, SchemaKeyValueMap_t{});
|
||||
|
||||
LOG("InitSchemaFieldsForClass(): '%s' was not found!\n", className);
|
||||
return false;
|
||||
}
|
||||
|
||||
short fieldsSize = pClassInfo->GetFieldsSize();
|
||||
SchemaClassFieldData_t* pFields = pClassInfo->GetFields();
|
||||
|
||||
auto& keyValueMap = tableMap[classKey];
|
||||
keyValueMap.reserve(fieldsSize);
|
||||
|
||||
for (int i = 0; i < fieldsSize; ++i) {
|
||||
SchemaClassFieldData_t& field = pFields[i];
|
||||
|
||||
#ifdef SDK_ENABLE_SCHEMA_FIELD_OFFSET_LOGGING
|
||||
LOG("%s::%s found at -> 0x%X\n", className, field.m_name,
|
||||
field.m_offset);
|
||||
#endif
|
||||
|
||||
keyValueMap.emplace(hash_32_fnv1a_const(field.m_name), field.m_offset);
|
||||
}
|
||||
|
||||
LOG("schemaTableMap[%s] has %llu fields.\n", className, keyValueMap.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
int16_t schema::GetOffset(const char* className, uint32_t classKey,
|
||||
const char* memberName, uint32_t memberKey) {
|
||||
static SchemaTableMap_t schemaTableMap;
|
||||
const auto& tableMapIt = schemaTableMap.find(classKey);
|
||||
if (tableMapIt == schemaTableMap.cend()) {
|
||||
if (InitSchemaFieldsForClass(schemaTableMap, className, classKey))
|
||||
return GetOffset(className, classKey, memberName, memberKey);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const SchemaKeyValueMap_t& tableMap = tableMapIt->second;
|
||||
if (tableMap.find(memberKey) == tableMap.cend()) {
|
||||
LOG("schema::GetOffset(): '%s' was not found in '%s'!\n", memberName,
|
||||
className);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return tableMap.at(memberKey);
|
||||
}
|
||||
40
examples/raze-internal-cs2-main/src/sdk/schema/schema.hpp
Normal file
40
examples/raze-internal-cs2-main/src/sdk/schema/schema.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <fnv1a/hash_fnv1a_constexpr.h>
|
||||
|
||||
#define SCHEMA_FIELD_OFFSET(varName, datatable, propName, extra_offset, type) \
|
||||
std::add_lvalue_reference_t<type> varName() { \
|
||||
static constexpr auto datatable_hash = hash_32_fnv1a_const(datatable); \
|
||||
static constexpr auto prop_hash = hash_32_fnv1a_const(propName); \
|
||||
\
|
||||
static const auto m_offset = \
|
||||
schema::GetOffset(datatable, datatable_hash, propName, prop_hash); \
|
||||
\
|
||||
return *reinterpret_cast<std::add_pointer_t<type>>( \
|
||||
(uintptr_t)(this) + m_offset + extra_offset); \
|
||||
}
|
||||
|
||||
#define SCHEMA_FIELD(varName, datatable, propName, type) \
|
||||
SCHEMA_FIELD_OFFSET(varName, datatable, propName, 0, type)
|
||||
|
||||
#define PSCHEMA_FIELD_OFFSET(varName, datatable, propName, extra_offset, type) \
|
||||
auto varName() { \
|
||||
static constexpr auto datatable_hash = hash_32_fnv1a_const(datatable); \
|
||||
static constexpr auto prop_hash = hash_32_fnv1a_const(propName); \
|
||||
\
|
||||
static const auto m_offset = \
|
||||
schema::GetOffset(datatable, datatable_hash, propName, prop_hash); \
|
||||
\
|
||||
return reinterpret_cast<std::add_pointer_t<type>>( \
|
||||
(uintptr_t)(this) + m_offset + extra_offset); \
|
||||
}
|
||||
|
||||
#define PSCHEMA_FIELD(varName, datatable, propName, type) \
|
||||
PSCHEMA_FIELD_OFFSET(varName, datatable, propName, 0, type)
|
||||
|
||||
namespace schema {
|
||||
int16_t GetOffset(const char* className, uint32_t classKey,
|
||||
const char* memberName, uint32_t memberKey);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#include "cusercmd.h"
|
||||
#define MULTIPLAYER_BACKUP 150
|
||||
|
||||
#define _CS_INTERNAL_CONCATENATE(LEFT, RIGHT) LEFT##RIGHT
|
||||
#define CS_CONCATENATE(LEFT, RIGHT) _CS_INTERNAL_CONCATENATE(LEFT, RIGHT)
|
||||
|
||||
#define MEM_PAD(SIZE) \
|
||||
private: \
|
||||
char CS_CONCATENATE(pad_0, __COUNTER__)[SIZE]; \
|
||||
public:
|
||||
|
||||
class CTinyMoveStepData
|
||||
{
|
||||
public:
|
||||
float flWhen; //0x0000
|
||||
MEM_PAD(0x4); //0x0004
|
||||
std::uint64_t nButton; //0x0008
|
||||
bool bPressed; //0x0010
|
||||
MEM_PAD(0x7); //0x0011
|
||||
}; //Size: 0x0018
|
||||
|
||||
class CMoveStepButtons
|
||||
{
|
||||
public:
|
||||
std::uint64_t nKeyboardPressed; //0x0000
|
||||
std::uint64_t nMouseWheelheelPressed; //0x0008
|
||||
std::uint64_t nUnPressed; //0x0010
|
||||
std::uint64_t nKeyboardCopy; //0x0018
|
||||
}; //Size: 0x0020
|
||||
|
||||
// @credits: www.unknowncheats.me/forum/members/2943409.html
|
||||
class CExtendedMoveData : public CMoveStepButtons
|
||||
{
|
||||
public:
|
||||
float flForwardMove; //0x0020
|
||||
float flSideMove; //0x0024
|
||||
float flUpMove; //0x0028
|
||||
std::int32_t nMouseDeltaX; //0x002C
|
||||
std::int32_t nMouseDeltaY; //0x0030
|
||||
std::int32_t nAdditionalStepMovesCount; //0x0034
|
||||
CTinyMoveStepData tinyMoveStepData[12]; //0x0038
|
||||
Vector vecViewAngle; //0x0158
|
||||
std::int32_t nTargetHandle; //0x0164
|
||||
}; //Size:0x0168
|
||||
|
||||
class CCSGOInput
|
||||
{
|
||||
public:
|
||||
MEM_PAD(0x250);
|
||||
CUserCmd arrCommands[MULTIPLAYER_BACKUP];
|
||||
MEM_PAD(0x99)
|
||||
bool bInThirdPerson;
|
||||
MEM_PAD(0x6);
|
||||
QAngle_t angThirdPersonAngles;
|
||||
MEM_PAD(0xE);
|
||||
std::int32_t nSequenceNumber;
|
||||
double dbSomeTimer;
|
||||
CExtendedMoveData currentMoveData;
|
||||
std::int32_t nWeaponSwitchTick;
|
||||
MEM_PAD(0x1C4);
|
||||
CExtendedMoveData* pExtendedMoveData;
|
||||
MEM_PAD(0x48);
|
||||
int32_t nAttackStartHistoryIndex1;
|
||||
int32_t nAttackStartHistoryIndex2;
|
||||
int32_t nAttackStartHistoryIndex3;
|
||||
|
||||
CUserCmd* GetUserCmd() { return &arrCommands[nSequenceNumber % MULTIPLAYER_BACKUP]; }
|
||||
|
||||
QAngle_t* GetViewAngles() {
|
||||
return reinterpret_cast<QAngle_t*(__fastcall*)(CCSGOInput*, int32_t)>(memory::m_CSGOInput_GetViewAngles)(this, 0);
|
||||
}
|
||||
|
||||
bool SetViewAngles(QAngle_t& vecAngles) {
|
||||
return reinterpret_cast<bool(__fastcall*)(CCSGOInput*, int32_t, QAngle_t&)>(memory::m_CSGOInput_SetViewAngles)(this, 0, vecAngles);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,196 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include "../../math/math.hpp"
|
||||
#define COMBINE(x, y) x##y
|
||||
#define COMBINE2(x, y) COMBINE(x, y)
|
||||
|
||||
#define PAD_CLASS(sz) \
|
||||
private: \
|
||||
std::uint8_t COMBINE2(pad_, __COUNTER__)[sz]; \
|
||||
\
|
||||
public:
|
||||
enum { pipiska = 1 << 0 };
|
||||
enum ECommandButtons : __int32 {
|
||||
IN_ATTACK = (1 << 0),
|
||||
IN_JUMP = (1 << 1),
|
||||
IN_DUCK = (1 << 2),
|
||||
IN_FORWARD = (1 << 3),
|
||||
IN_BACK = (1 << 4),
|
||||
IN_USE = (1 << 5),
|
||||
IN_CANCEL = (1 << 6),
|
||||
IN_LEFT = (1 << 7),
|
||||
IN_RIGHT = (1 << 8),
|
||||
IN_MOVELEFT = (1 << 9),
|
||||
IN_MOVERIGHT = (1 << 10),
|
||||
IN_SECOND_ATTACK = (1 << 11),
|
||||
IN_RUN = (1 << 12),
|
||||
IN_RELOAD = (1 << 13),
|
||||
IN_LEFT_ALT = (1 << 14),
|
||||
IN_RIGHT_ALT = (1 << 15),
|
||||
IN_SCORE = (1 << 16),
|
||||
IN_SPEED = (1 << 17),
|
||||
IN_WALK = (1 << 18),
|
||||
IN_ZOOM = (1 << 19),
|
||||
IN_FIRST_WEAPON = (1 << 20),
|
||||
IN_SECOND_WEAPON = (1 << 21),
|
||||
IN_BULLRUSH = (1 << 22),
|
||||
IN_FIRST_GRENADE = (1 << 23),
|
||||
IN_SECOND_GRENADE = (1 << 24),
|
||||
IN_MIDDLE_ATTACK = (1 << 25),
|
||||
IN_USE_OR_RELOAD = (1 << 26)
|
||||
};
|
||||
class CBasePB {
|
||||
void* pVTable; // 0x0
|
||||
std::uint32_t nHasBits; // 0x8
|
||||
std::uint64_t nCachedBits; // 0xC
|
||||
};
|
||||
static_assert(sizeof(CBasePB) == 0x18);
|
||||
class CCmdQAngle : public CBasePB {
|
||||
public:
|
||||
QAngle_t angValue; // 0x18
|
||||
};
|
||||
|
||||
class CCmdVector : public CBasePB {
|
||||
public:
|
||||
Vector4D vecValue; // 0x18
|
||||
};
|
||||
|
||||
class CCSGOInterpolationInfo : public CBasePB {
|
||||
public:
|
||||
float flFraction; // 0x18
|
||||
int nSrcTick; // 0x1C
|
||||
int nDstTick; // 0x20
|
||||
};
|
||||
|
||||
class CCSGOInputHistoryEntryPB : public CBasePB {
|
||||
public:
|
||||
CCmdQAngle* pViewCmd; // 0x18
|
||||
CCmdVector* pShootOriginCmd; // 0x20
|
||||
CCmdVector* pTargetHeadOriginCmd; // 0x28
|
||||
CCmdVector* pTargetAbsOriginCmd; // 0x30
|
||||
CCmdQAngle* pTargetViewCmd; // 0x38
|
||||
CCSGOInterpolationInfo* cl_interp; // 0x40
|
||||
CCSGOInterpolationInfo* sv_interp0; // 0x48
|
||||
CCSGOInterpolationInfo* sv_interp1; // 0x50
|
||||
CCSGOInterpolationInfo* player_interp; // 0x58
|
||||
int nRenderTickCount; // 0x60
|
||||
float flRenderTickFraction; // 0x64
|
||||
int nPlayerTickCount; // 0x68
|
||||
float flPlayerTickFraction; // 0x6C
|
||||
int nFrameNumber; // 0x70
|
||||
int nTargetEntIndex; // 0x74
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct RepeatedPtrField_t
|
||||
{
|
||||
struct Rep_t
|
||||
{
|
||||
int nAllocatedSize;
|
||||
T* tElements[(std::numeric_limits<int>::max() - 2 * sizeof(int)) / sizeof(void*)];
|
||||
};
|
||||
|
||||
void* pArena;
|
||||
int nCurrentSize;
|
||||
int nTotalSize;
|
||||
Rep_t* pRep;
|
||||
};
|
||||
|
||||
struct CInButtonStatePB : CBasePB {
|
||||
std::uint64_t State1;
|
||||
std::uint64_t State2;
|
||||
std::uint64_t State3;
|
||||
};
|
||||
struct CSubtickMoveStep : CBasePB {
|
||||
uint64_t nButton;
|
||||
bool bPressed;
|
||||
float flWhen;
|
||||
float flAnalogForwardDelta;
|
||||
float flAnalogLeftDelta;
|
||||
};
|
||||
struct CInButtonState {
|
||||
void* pVTable;
|
||||
uint64_t nButtonState1;
|
||||
uint64_t nButtonState2;
|
||||
uint64_t nButtonState3;
|
||||
};
|
||||
class CBaseUserCmdPB : public CBasePB {
|
||||
public:
|
||||
RepeatedPtrField_t<CSubtickMoveStep> subtickMovesField;
|
||||
std::string* strMoveCrc;
|
||||
CInButtonState* pInButtonState; // 0x20
|
||||
CCmdQAngle* pViewangles; // 0x40
|
||||
std::int32_t nLegacyCommandNumber;
|
||||
std::int32_t nClientTick;
|
||||
float flForwardMove;
|
||||
float flSideMove;
|
||||
float flUpMove;
|
||||
std::int32_t nImpulse;
|
||||
std::int32_t nWeaponSelect;
|
||||
std::int32_t nRandomSeed;
|
||||
std::int32_t nMousedX;
|
||||
std::int32_t nMousedY;
|
||||
std::uint32_t nConsumedServerAngleChanges;
|
||||
std::int32_t nCmdFlags;
|
||||
std::uint32_t nPawnEntityHandle;
|
||||
};
|
||||
struct CSubTickCMD {
|
||||
CCSGOInputHistoryEntryPB* inputhistory;
|
||||
uint8_t _pad[0xe];
|
||||
CCmdQAngle* view;
|
||||
};
|
||||
class CSubTickContainer {
|
||||
public:
|
||||
int32_t nTickCount; // 0x0000
|
||||
char pad_0x0004[0x4]; // 0x0004
|
||||
uint8_t* pTickPointer; // 0x0008
|
||||
|
||||
CSubTickCMD* GetTick(std::int32_t index) {
|
||||
if (index < this->nTickCount) {
|
||||
CSubTickCMD** tick_list =
|
||||
reinterpret_cast<CSubTickCMD**>(this->pTickPointer + 0x8);
|
||||
return tick_list[index];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}; // Size=0x0010
|
||||
|
||||
class CCSGOUserCmdPB
|
||||
{
|
||||
public:
|
||||
std::uint32_t nHasBits;
|
||||
std::uint64_t nCachedSize;
|
||||
RepeatedPtrField_t<CCSGOInputHistoryEntryPB> inputHistoryField;
|
||||
CBaseUserCmdPB* pBase;
|
||||
bool bLeftHandDesired;
|
||||
std::int32_t nAttack3StartHistoryIndex;
|
||||
std::int32_t nAttack1StartHistoryIndex;
|
||||
std::int32_t nAttack2StartHistoryIndex;
|
||||
};
|
||||
struct StartHistoryIndexTick_t {
|
||||
int nAttack1;
|
||||
int nAttack2;
|
||||
int nAttack3;
|
||||
};
|
||||
|
||||
class CUserCmd
|
||||
{
|
||||
public:
|
||||
PAD_CLASS(0x18);
|
||||
CCSGOUserCmdPB pBase;
|
||||
CInButtonState buttonStates;
|
||||
PAD_CLASS(0x20)
|
||||
|
||||
CCSGOInputHistoryEntryPB* GetInputHistoryEntry(int nIndex)
|
||||
{
|
||||
if (nIndex >= pBase.inputHistoryField.pRep->nAllocatedSize || nIndex >= pBase.inputHistoryField.nCurrentSize)
|
||||
return nullptr;
|
||||
|
||||
return pBase.inputHistoryField.pRep->tElements[nIndex];
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "ccsinventorymanager.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
CCSInventoryManager* CCSInventoryManager::GetInstance() {
|
||||
if (!memory::fnGetInventoryManager) return nullptr;
|
||||
return memory::fnGetInventoryManager();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../virtual.hpp"
|
||||
|
||||
class CCSPlayerInventory;
|
||||
|
||||
class CCSInventoryManager {
|
||||
public:
|
||||
static CCSInventoryManager* GetInstance();
|
||||
|
||||
auto EquipItemInLoadout(int iTeam, int iSlot, uint64_t iItemID) {
|
||||
return CALL_VIRTUAL(bool, 60, this, iTeam, iSlot, iItemID);
|
||||
}
|
||||
|
||||
auto GetLocalInventory() {
|
||||
return CALL_VIRTUAL(CCSPlayerInventory*, 63, this);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,112 @@
|
||||
#include "ccsplayerinventory.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
#include "../gcsdk/cgcclientsharedobjecttypecache.hpp"
|
||||
|
||||
static CGCClientSharedObjectTypeCache* CreateBaseTypeCache(
|
||||
CCSPlayerInventory* pInventory) {
|
||||
CGCClientSystem* pGCClientSystem = CGCClientSystem::GetInstance();
|
||||
if (!pGCClientSystem) return nullptr;
|
||||
|
||||
CGCClient* pGCClient = pGCClientSystem->GetCGCClient();
|
||||
if (!pGCClient) return nullptr;
|
||||
|
||||
CGCClientSharedObjectCache* pSOCache =
|
||||
pGCClient->FindSOCache(pInventory->GetOwner());
|
||||
if (!pSOCache) return nullptr;
|
||||
|
||||
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.Exists(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;
|
||||
|
||||
CGCClientSharedObjectTypeCache* pSOTypeCache = ::CreateBaseTypeCache(this);
|
||||
if (pSOTypeCache) {
|
||||
const CUtlVector<CEconItem*>& vecItems =
|
||||
pSOTypeCache->GetVecObjects<CEconItem*>();
|
||||
|
||||
for (CEconItem* it : vecItems) {
|
||||
if (it && it->m_ulID == itemID) {
|
||||
pSOCData = it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pSOCData;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "../gcsdk/cgcclientsharedobjectcache.hpp"
|
||||
#include "../gcsdk/cgcclientsystem.hpp"
|
||||
#include "../entity/c_econitemview.hpp"
|
||||
#include "../types/utlvector.hpp"
|
||||
#include "../econ/ceconitem.hpp"
|
||||
|
||||
#include "ccsinventorymanager.hpp"
|
||||
|
||||
class CCSPlayerInventory {
|
||||
public:
|
||||
static CCSPlayerInventory* GetInstance();
|
||||
|
||||
auto SOCreated(SOID_t owner, CSharedObject* pObject, ESOCacheEvent eEvent) {
|
||||
return CALL_VIRTUAL(void, 0, this, owner, pObject, eEvent);
|
||||
}
|
||||
|
||||
auto SOUpdated(SOID_t owner, CSharedObject* pObject, ESOCacheEvent eEvent) {
|
||||
return CALL_VIRTUAL(void, 1, this, owner, pObject, eEvent);
|
||||
}
|
||||
|
||||
auto SODestroyed(SOID_t owner, CSharedObject* pObject,
|
||||
ESOCacheEvent eEvent) {
|
||||
return CALL_VIRTUAL(void, 2, this, owner, pObject, eEvent);
|
||||
}
|
||||
|
||||
auto GetItemInLoadout(int iClass, int iSlot) {
|
||||
return CALL_VIRTUAL(C_EconItemView*, 8, 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);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "ceconitem.hpp"
|
||||
|
||||
#include "../../interfaces/interfaces.hpp"
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
void CEconItem::SetDynamicAttributeValue(int index, void* value) {
|
||||
CEconItemSchema* pItemSchema =
|
||||
interfaces::pClient->GetEconItemSystem()->GetEconItemSchema();
|
||||
if (!pItemSchema) return;
|
||||
|
||||
void* pAttributeDefinitionInterface =
|
||||
pItemSchema->GetAttributeDefinitionInterface(index);
|
||||
if (!pAttributeDefinitionInterface) return;
|
||||
|
||||
if (!memory::fnSetDynamicAttributeValueUint) return;
|
||||
memory::fnSetDynamicAttributeValueUint(this, pAttributeDefinitionInterface,
|
||||
value);
|
||||
}
|
||||
|
||||
void CEconItem::SetDynamicAttributeValueString(int index, const char* value) {
|
||||
// CS2FIXME: Function got inlined and cannot be sigscanned.
|
||||
}
|
||||
|
||||
CEconItem* CEconItem::CreateInstance() {
|
||||
if (!memory::fnCreateSharedObjectSubclassEconItem) return nullptr;
|
||||
return memory::fnCreateSharedObjectSubclassEconItem();
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../virtual.hpp"
|
||||
|
||||
class CSharedObject;
|
||||
|
||||
class CEconItem {
|
||||
void SetDynamicAttributeValue(int index, void* value);
|
||||
void SetDynamicAttributeValueString(int index, const char* value);
|
||||
|
||||
public:
|
||||
static CEconItem* CreateInstance();
|
||||
|
||||
auto Destruct() { return CALL_VIRTUAL(void, 1, this, true); }
|
||||
|
||||
void SetPaintKit(float kit) { SetDynamicAttributeValue(6, &kit); }
|
||||
void SetPaintSeed(float seed) { SetDynamicAttributeValue(7, &seed); }
|
||||
void SetPaintWear(float wear) { SetDynamicAttributeValue(8, &wear); }
|
||||
void SetStatTrak(int count) { SetDynamicAttributeValue(80, &count); }
|
||||
void SetStatTrakType(int type) { SetDynamicAttributeValue(81, &type); }
|
||||
void SetCustomName(const char* pName) {
|
||||
SetDynamicAttributeValueString(111, pName);
|
||||
}
|
||||
|
||||
char pad0[0x10]; // 2 vtables
|
||||
uint64_t m_ulID;
|
||||
uint64_t m_ulOriginalID;
|
||||
void* m_pCustomDataOptimizedObject;
|
||||
uint32_t m_unAccountID;
|
||||
uint32_t m_unInventory;
|
||||
uint16_t m_unDefIndex;
|
||||
uint16_t m_unOrigin : 5;
|
||||
uint16_t m_nQuality : 4;
|
||||
uint16_t m_unLevel : 2;
|
||||
uint16_t m_nRarity : 4;
|
||||
uint16_t m_dirtybitInUse : 1;
|
||||
int16_t m_iItemSet;
|
||||
int m_bSOUpdateFrame;
|
||||
uint8_t m_unFlags;
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "ceconitemdefinition.hpp"
|
||||
|
||||
#include <fnv1a/hash_fnv1a_constexpr.h>
|
||||
|
||||
bool CEconItemDefinition::IsWeapon() {
|
||||
// Every gun supports at least 4 stickers.
|
||||
return GetStickersSupportedCount() >= 4;
|
||||
}
|
||||
|
||||
bool CEconItemDefinition::IsKnife(bool excludeDefault) {
|
||||
static constexpr auto CSGO_Type_Knife =
|
||||
hash_32_fnv1a_const("#CSGO_Type_Knife");
|
||||
|
||||
if (hash_32_fnv1a_const(m_pszItemTypeName) != CSGO_Type_Knife) return false;
|
||||
return excludeDefault ? m_nDefIndex >= 500 : true;
|
||||
}
|
||||
|
||||
bool CEconItemDefinition::IsGlove(bool excludeDefault) {
|
||||
static constexpr auto Type_Hands = hash_32_fnv1a_const("#Type_Hands");
|
||||
|
||||
if (hash_32_fnv1a_const(m_pszItemTypeName) != Type_Hands) return false;
|
||||
const bool defaultGlove = m_nDefIndex == 5028 || m_nDefIndex == 5029;
|
||||
|
||||
return excludeDefault ? !defaultGlove : true;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../virtual.hpp"
|
||||
|
||||
#include "../types/utlvector.hpp"
|
||||
|
||||
class CEconItemDefinition {
|
||||
public:
|
||||
bool IsWeapon();
|
||||
bool IsKnife(bool excludeDefault);
|
||||
bool IsGlove(bool excludeDefault);
|
||||
|
||||
auto GetModelName() {
|
||||
return *reinterpret_cast<const char**>((uintptr_t)(this) + 0xD8);
|
||||
}
|
||||
|
||||
auto GetStickersSupportedCount() {
|
||||
return *reinterpret_cast<int*>((uintptr_t)(this) + 0x100);
|
||||
}
|
||||
|
||||
auto GetSimpleWeaponName() {
|
||||
return *reinterpret_cast<const char**>((uintptr_t)(this) + 0x210);
|
||||
}
|
||||
|
||||
auto GetLoadoutSlot() {
|
||||
return *reinterpret_cast<int*>((uintptr_t)(this) + 0x2E8);
|
||||
}
|
||||
|
||||
char pad0[0x8]; // vtable
|
||||
void* m_pKVItem;
|
||||
uint16_t m_nDefIndex;
|
||||
CUtlVector<uint16_t> m_nAssociatedItemsDefIndexes;
|
||||
bool m_bEnabled;
|
||||
const char* m_szPrefab;
|
||||
uint8_t m_unMinItemLevel;
|
||||
uint8_t m_unMaxItemLevel;
|
||||
uint8_t m_nItemRarity;
|
||||
uint8_t m_nItemQuality;
|
||||
uint8_t m_nForcedItemQuality;
|
||||
uint8_t m_nDefaultDropItemQuality;
|
||||
uint8_t m_nDefaultDropQuantity;
|
||||
CUtlVector<void*> m_vecStaticAttributes;
|
||||
uint8_t m_nPopularitySeed;
|
||||
void* m_pPortraitsKV;
|
||||
const char* m_pszItemBaseName;
|
||||
bool m_bProperName;
|
||||
const char* m_pszItemTypeName;
|
||||
uint32_t m_unItemTypeID;
|
||||
const char* m_pszItemDesc;
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "ceconitemschema.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
//
|
||||
//bool CPaintKit::UsesLegacyModel() {
|
||||
// if (!this || !memory::fnIsPaintKitUsingLegacyModel) return false;
|
||||
// return memory::fnIsPaintKitUsingLegacyModel(this->sName);
|
||||
//}
|
||||
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../virtual.hpp"
|
||||
|
||||
#include "../types/utlmap.hpp"
|
||||
|
||||
class CEconItemDefinition;
|
||||
|
||||
inline constexpr uint64_t Helper_GetAlternateIconKeyForWeaponPaintWearItem(
|
||||
uint16_t nDefIdx, uint32_t nPaintId, uint32_t nWear) {
|
||||
return (nDefIdx << 16) + (nPaintId << 2) + nWear;
|
||||
}
|
||||
|
||||
struct AlternateIconData_t {
|
||||
const char* sSimpleName;
|
||||
const char* sLargeSimpleName;
|
||||
|
||||
private:
|
||||
char pad0[0x8]; // no idea
|
||||
char pad1[0x8]; // no idea
|
||||
char pad2[0x8]; // no idea
|
||||
char pad3[0x8]; // no idea
|
||||
};
|
||||
|
||||
class CPaintKit {
|
||||
public:
|
||||
//bool UsesLegacyModel();
|
||||
|
||||
int nID;
|
||||
const char* sName;
|
||||
const char* sDescriptionString;
|
||||
const char* sDescriptionTag;
|
||||
char pad0[0x8]; // no idea
|
||||
char pad1[0x8]; // no idea
|
||||
char pad2[0x8]; // no idea
|
||||
char pad3[0x8]; // no idea
|
||||
char pad4[0x4]; // no idea
|
||||
int nRarity;
|
||||
};
|
||||
|
||||
class CEconItemSchema {
|
||||
public:
|
||||
auto GetAttributeDefinitionInterface(int iAttribIndex) {
|
||||
return CALL_VIRTUAL(void*, 27, this, iAttribIndex);
|
||||
}
|
||||
|
||||
auto& GetSortedItemDefinitionMap() {
|
||||
return *reinterpret_cast<CUtlMap<int, CEconItemDefinition*>*>(
|
||||
(uintptr_t)(this) + 0x120);
|
||||
}
|
||||
|
||||
auto& GetAlternateIconsMap() {
|
||||
return *reinterpret_cast<CUtlMap<uint64_t, AlternateIconData_t>*>(
|
||||
(uintptr_t)(this) + 0x270);
|
||||
}
|
||||
|
||||
auto& GetPaintKits() {
|
||||
return *reinterpret_cast<CUtlMap<int, CPaintKit*>*>((uintptr_t)(this) +
|
||||
0x2E8);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "ceconitemschema.hpp"
|
||||
|
||||
class CEconItemSystem {
|
||||
public:
|
||||
auto GetEconItemSchema() {
|
||||
return *reinterpret_cast<CEconItemSchema**>((uintptr_t)(this) + 0x8);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "c_econitemview.hpp"
|
||||
|
||||
class C_AttributeContainer {
|
||||
public:
|
||||
PSCHEMA_FIELD(m_Item, "C_AttributeContainer", "m_Item", C_EconItemView);
|
||||
};
|
||||
@@ -0,0 +1,94 @@
|
||||
#include "c_baseentity.hpp"
|
||||
|
||||
#include "../../interfaces/interfaces.hpp"
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
#include <imgui/imgui_internal.h>
|
||||
|
||||
bool C_BaseEntity::IsBasePlayerController( )
|
||||
{
|
||||
return CALL_VIRTUAL(bool, 151, this);
|
||||
}
|
||||
|
||||
bool C_BaseEntity::IsBasePlayerWeapon( )
|
||||
{
|
||||
return CALL_VIRTUAL(bool, 158, this);
|
||||
}
|
||||
|
||||
bool C_BaseEntity::IsChicken( )
|
||||
{
|
||||
SchemaClassInfoData_t* pClassInfo = Schema_DynamicBinding( );
|
||||
if (!pClassInfo) return false;
|
||||
|
||||
const char* className = pClassInfo->GetName( );
|
||||
if (!className) return false;
|
||||
|
||||
static constexpr auto C_Chicken = hash_32_fnv1a_const("C_Chicken");
|
||||
return hash_32_fnv1a_const(className) == C_Chicken;
|
||||
}
|
||||
|
||||
bool C_BaseEntity::IsViewModel( )
|
||||
{
|
||||
return CALL_VIRTUAL(bool, 238, this);
|
||||
}
|
||||
|
||||
|
||||
const Vector& C_BaseEntity::GetOrigin( )
|
||||
{
|
||||
static const Vector null{};
|
||||
|
||||
CGameSceneNode* pGameSceneNode = m_pGameSceneNode( );
|
||||
if (!pGameSceneNode) return null;
|
||||
|
||||
return pGameSceneNode->m_vecAbsOrigin( );
|
||||
}
|
||||
|
||||
bool C_BaseEntity::GetBoundingBox(BBox_t& out, bool computeSurroundingBox)
|
||||
{
|
||||
CCollisionProperty* pCollision = m_pCollision( );
|
||||
if (!pCollision) return false;
|
||||
|
||||
Vector min{}, max{};
|
||||
if (computeSurroundingBox)
|
||||
{
|
||||
if (!ComputeHitboxSurroundingBox(min, max)) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
const Vector& absOrigin = GetOrigin( );
|
||||
min = pCollision->GetMins( ) + absOrigin;
|
||||
max = pCollision->GetMaxs( ) + absOrigin;
|
||||
}
|
||||
|
||||
out.x = out.y = std::numeric_limits<float>::max( );
|
||||
out.w = out.h = -std::numeric_limits<float>::max( );
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
const Vector point{ i & 1 ? max.x : min.x, i & 2 ? max.y : min.y,
|
||||
i & 4 ? max.z : min.z };
|
||||
ImVec2 screen;
|
||||
if (!math::WorldToScreen(point, screen)) return false;
|
||||
|
||||
out.x = std::min(out.x, screen.x);
|
||||
out.y = std::min(out.y, screen.y);
|
||||
out.w = std::max(out.w, screen.x);
|
||||
out.h = std::max(out.h, screen.y);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C_BaseEntity::ComputeHitboxSurroundingBox(Vector& mins, Vector& maxs)
|
||||
{
|
||||
if (!memory::fnComputeHitboxSurroundingBox) return false;
|
||||
return memory::fnComputeHitboxSurroundingBox(this, mins, maxs);
|
||||
}
|
||||
|
||||
float C_BaseEntity::DistanceToSquared(C_BaseEntity* pEntity)
|
||||
{
|
||||
const Vector& currentOrigin = GetOrigin( );
|
||||
const Vector& entityOrigin = pEntity->GetOrigin( );
|
||||
|
||||
return currentOrigin.DistToSquaredInMeters(entityOrigin);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
|
||||
#include "ccollisionproperty.hpp"
|
||||
#include "centityinstance.hpp"
|
||||
#include "cgamescenenode.hpp"
|
||||
#include "../types/bitflags.hpp"
|
||||
#include "../types/movetype.hpp"
|
||||
|
||||
#include "../../../utils/color.h"
|
||||
#include "../../../sdk/memory/memory.hpp"
|
||||
|
||||
struct BBox_t
|
||||
{
|
||||
float x, y, w, h;
|
||||
};
|
||||
|
||||
|
||||
class C_BaseEntity : public CEntityInstance
|
||||
{
|
||||
public:
|
||||
bool IsBasePlayerController( );
|
||||
bool IsBasePlayerWeapon( );
|
||||
bool IsChicken( );
|
||||
bool IsViewModel( );
|
||||
|
||||
const Vector& GetOrigin( );
|
||||
bool GetBoundingBox(BBox_t& out, bool computeSurroundingBox = false);
|
||||
bool ComputeHitboxSurroundingBox(Vector& mins, Vector& maxs);
|
||||
float DistanceToSquared(C_BaseEntity* pEntity);
|
||||
|
||||
void PostDataUpdate(int iUpdateType)
|
||||
{
|
||||
CALL_VIRTUAL(bool, 7, this, iUpdateType);
|
||||
}
|
||||
|
||||
SCHEMA_FIELD(m_pGameSceneNode, "C_BaseEntity", "m_pGameSceneNode",
|
||||
CGameSceneNode*);
|
||||
SCHEMA_FIELD(m_pCollision, "C_BaseEntity", "m_pCollision",
|
||||
CCollisionProperty*);
|
||||
SCHEMA_FIELD(m_iTeamNum, "C_BaseEntity", "m_iTeamNum", uint8_t);
|
||||
SCHEMA_FIELD(m_hOwnerEntity, "C_BaseEntity", "m_hOwnerEntity", CHandle);
|
||||
SCHEMA_FIELD(m_iHealth, "C_BaseEntity", "m_iHealth", int);
|
||||
SCHEMA_FIELD(m_vecVelocity, "C_BaseEntity", "m_vecVelocity", Vector);
|
||||
SCHEMA_FIELD(GetCollision, "C_BaseEntity", "m_pCollision", CCollisionProperty);
|
||||
SCHEMA_FIELD(m_fFlags, "C_BaseEntity", "m_fFlags", BitFlag);
|
||||
SCHEMA_FIELD(m_MoveType, "C_BaseEntity", "m_MoveType", MoveType);
|
||||
bool OnGround( ) noexcept
|
||||
{
|
||||
return (m_fFlags( ).has_flag(1)) != 0;
|
||||
}
|
||||
|
||||
SCHEMA_FIELD(m_nSubclassID, "C_BaseEntity", "m_nSubclassID", uint64_t);
|
||||
SCHEMA_FIELD_OFFSET(GetVData, "C_BaseEntity", "m_nSubclassID", 0x8, void*);
|
||||
|
||||
void UpdateSubClass()
|
||||
{
|
||||
memory::fnGetPlayerPawn(this);
|
||||
}
|
||||
|
||||
void UpdateVData()
|
||||
{
|
||||
CALL_VIRTUAL(void*, 182, this);
|
||||
}
|
||||
};
|
||||
|
||||
class C_EnvSky : public C_BaseEntity
|
||||
{
|
||||
public:
|
||||
SCHEMA_FIELD(m_bStartDisabled, "C_EnvSky", "m_bStartDisabled", bool);
|
||||
SCHEMA_FIELD(m_vTintColor, "C_EnvSky", "m_vTintColor", Color_t);
|
||||
SCHEMA_FIELD(m_vTintColorLightingOnly, "C_EnvSky", "m_vTintColorLightingOnly", Color_t);
|
||||
SCHEMA_FIELD(m_flBrightnessScale, "C_EnvSky", "m_flBrightnessScale", float);
|
||||
SCHEMA_FIELD(m_nFogType, "C_EnvSky", "m_nFogType", int);
|
||||
SCHEMA_FIELD(m_flFogMinStart, "C_EnvSky", "m_flFogMinStart", float);
|
||||
SCHEMA_FIELD(m_flFogMinEnd, "C_EnvSky", "m_flFogMinEnd", float);
|
||||
SCHEMA_FIELD(m_flFogMaxStart, "C_EnvSky", "m_flFogMaxStart", float);
|
||||
SCHEMA_FIELD(m_flFogMaxEnd, "C_EnvSky", "m_flFogMaxEnd", float);
|
||||
SCHEMA_FIELD(m_bEnabled, "C_EnvSky", "m_bEnabled", bool);
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "c_basemodelentity.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
void C_BaseModelEntity::SetModel(const char* name) {
|
||||
if (!memory::fnSetModel) return;
|
||||
memory::fnSetModel(this, name);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "c_baseentity.hpp"
|
||||
|
||||
class C_BaseModelEntity : public C_BaseEntity {
|
||||
public:
|
||||
void SetModel(const char* name);
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "cplayer_movementservices.hpp"
|
||||
#include "cplayer_weaponservices.hpp"
|
||||
#include "../interfaces/cplayer_cameraservices.hpp"
|
||||
#include "c_basemodelentity.hpp"
|
||||
|
||||
class C_BasePlayerPawn : public C_BaseModelEntity
|
||||
{
|
||||
public:
|
||||
SCHEMA_FIELD(m_hController, "C_BasePlayerPawn", "m_hController", CHandle);
|
||||
SCHEMA_FIELD(m_pWeaponServices, "C_BasePlayerPawn", "m_pWeaponServices",
|
||||
CPlayer_WeaponServices*);
|
||||
SCHEMA_FIELD(m_pMovementServices, "C_BasePlayerPawn", "m_pMovementServices",
|
||||
CPlayer_MovementServices*);
|
||||
SCHEMA_FIELD(m_pCameraServices, "C_BasePlayerPawn", "m_pCameraServices",
|
||||
CPlayer_CameraServices*);
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "c_econentity.hpp"
|
||||
|
||||
class C_BasePlayerWeapon : public C_EconEntity {
|
||||
public:
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "c_basemodelentity.hpp"
|
||||
|
||||
class C_BaseViewModel : public C_BaseModelEntity {
|
||||
public:
|
||||
SCHEMA_FIELD(m_hWeapon, "C_BaseViewModel", "m_hWeapon", CHandle);
|
||||
};
|
||||
|
||||
class CAnimGraphNetworkedVariables;
|
||||
class CAnimationGraphInstance2
|
||||
{
|
||||
public:
|
||||
char pad_0x0000[0x2E0]; //0x0000
|
||||
CAnimGraphNetworkedVariables* pAnimGraphNetworkedVariables; //0x02E0
|
||||
};
|
||||
|
||||
class C_CSGOViewModel2 : public C_BaseViewModel
|
||||
{
|
||||
public:
|
||||
char pad_0x0000[0xD60]; //0x0000
|
||||
CAnimationGraphInstance2* pAnimationGraphInstance; //0xD60
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../schema/schema.hpp"
|
||||
|
||||
#include "../types/chandle.hpp"
|
||||
|
||||
#include "c_basemodelentity.hpp"
|
||||
|
||||
class C_Chicken : public C_BaseModelEntity {
|
||||
public:
|
||||
SCHEMA_FIELD(m_leader, "C_Chicken", "m_leader", CHandle);
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "c_csplayerpawn.hpp"
|
||||
|
||||
#include "../../interfaces/interfaces.hpp"
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
bool C_CSPlayerPawn::IsEnemyWithTeam(int team) {
|
||||
static ConVar* mp_teammates_are_enemies =
|
||||
interfaces::pCvar->FindVarByName("mp_teammates_are_enemies");
|
||||
|
||||
CCSPlayerController* pPlayerController =
|
||||
m_hController().Get<CCSPlayerController>();
|
||||
|
||||
if (pPlayerController && pPlayerController->m_bIsLocalPlayerController())
|
||||
return false;
|
||||
|
||||
return mp_teammates_are_enemies->GetValue<bool>() ? true
|
||||
: m_iTeamNum() != team;
|
||||
}
|
||||
|
||||
bool C_CSPlayerPawn::IsVisible(C_CSPlayerPawn* pPawn, Vector vecPoint, bool bSmokeCheck, float flMaxDensity)
|
||||
{
|
||||
if (!this || !pPawn)
|
||||
return false;
|
||||
|
||||
TraceFilter_t filter(0x1C3003, this, nullptr, 4);
|
||||
Ray_t ray = Ray_t();
|
||||
GameTrace_t trace = GameTrace_t();
|
||||
|
||||
Vector vecSource = this->GetEyePosition();
|
||||
interfaces::pTraceMgr->TraceShape(&ray, vecSource, vecPoint, &filter, &trace);
|
||||
|
||||
if ((trace.IsVisible() || (trace.m_pHitEntity && trace.m_pHitEntity->GetRefEHandle().GetEntryIndex() == pPawn->GetRefEHandle().GetEntryIndex())))// && !(bSmokeCheck && !Utilities::LineGoesThroughSmoke(vecSource, vecPoint, flMaxDensity)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
C_CSWeaponBase* C_CSPlayerPawn::GetWeaponActive()
|
||||
{
|
||||
auto service = m_pWeaponServices();
|
||||
|
||||
if (!service)
|
||||
return nullptr;
|
||||
|
||||
auto handle = service->m_hActiveWeapon();
|
||||
auto weapon = reinterpret_cast<C_CSWeaponBase*>(interfaces::pGameResourceService->GetGameEntitySystem()->GetByIndex<C_CSWeaponBase>(handle));
|
||||
|
||||
if (!weapon)
|
||||
return nullptr;
|
||||
|
||||
return weapon;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
#include "c_csplayerpawnbase.hpp"
|
||||
#include "../../../sdk/interfaces/interfaces.hpp"
|
||||
#include "../../../sdk/source2-sdk/interfaces/cgameresourceserviceclient.hpp"
|
||||
|
||||
class EntitySpottedState_t
|
||||
{
|
||||
public:
|
||||
SCHEMA_FIELD(m_bSpotted, "EntitySpottedState_t", "m_bSpotted", bool);
|
||||
SCHEMA_FIELD(m_bSpottedByMask, "EntitySpottedState_t", "m_bSpottedByMask", int);
|
||||
};
|
||||
|
||||
class C_CSWeaponBase;
|
||||
|
||||
class C_CSPlayerPawn : public C_CSPlayerPawnBase
|
||||
{
|
||||
public:
|
||||
bool IsEnemyWithTeam(int team);
|
||||
bool IsVisible(C_CSPlayerPawn* pPawn, Vector vecPoint, bool bSmokeCheck, float flMaxDensity);
|
||||
|
||||
SCHEMA_FIELD(GetShotsFired, "C_CSPlayerPawn", "m_iShotsFired", int32_t);
|
||||
SCHEMA_FIELD(GetAimPuchAngle, "C_CSPlayerPawn", "m_aimPunchAngle", QAngle_t);
|
||||
SCHEMA_FIELD(GetAimPuchAngleCache, "C_CSPlayerPawn", "m_aimPunchCache", CUtlVector<QAngle_t>);
|
||||
SCHEMA_FIELD(getViewAngles, "C_CSPlayerPawn", "v_angle", CUtlVector<Vector>);
|
||||
SCHEMA_FIELD(m_entitySpottedState, "C_CSPlayerPawn", "m_entitySpottedState", EntitySpottedState_t*);
|
||||
|
||||
int getEntitySpotted() {
|
||||
auto datatable_hash = hash_32_fnv1a_const("C_CSPlayerPawn");
|
||||
auto prop_hash = hash_32_fnv1a_const("m_entitySpottedState");
|
||||
auto offset = schema::GetOffset("C_CSPlayerPawn", datatable_hash, "m_entitySpottedState", prop_hash);
|
||||
|
||||
auto datatable_hash2 = hash_32_fnv1a_const("EntitySpottedState_t");
|
||||
auto prop_hash2 = hash_32_fnv1a_const("m_bSpottedByMask");
|
||||
auto offset2 = schema::GetOffset("EntitySpottedState_t", datatable_hash2, "m_bSpottedByMask", prop_hash2);
|
||||
|
||||
//auto spotted = *reinterpret_cast<uintptr_t*>(this + offset + 0xC);
|
||||
//return spotted;
|
||||
auto spotted = m_entitySpottedState()->m_bSpottedByMask();
|
||||
return spotted;
|
||||
}
|
||||
|
||||
[[nodiscard]] Vector GetEyePosition()
|
||||
{
|
||||
Vector vecEyePosition = Vector(0.0f, 0.0f, 0.0f);
|
||||
CALL_VIRTUAL(void, 169, this, &vecEyePosition);
|
||||
return vecEyePosition;
|
||||
}
|
||||
|
||||
inline uint32_t GetOwnerHandleIndex()
|
||||
{
|
||||
uint32_t Result = -1;
|
||||
if (!(GetCollision().GetSolidFlags() & 4))
|
||||
Result = this->m_hOwnerEntity().GetEntryIndex();
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline uint16_t GetCollisionMask()
|
||||
{
|
||||
return GetCollision().CollisionMask(); // Collision + 0x38
|
||||
}
|
||||
|
||||
C_CSWeaponBase* GetWeaponActive();
|
||||
};
|
||||
|
||||
class CGlowProperty
|
||||
{
|
||||
private:
|
||||
char pad_0000[0x18];
|
||||
|
||||
public:
|
||||
CEntityInstance* m_hOwner;
|
||||
|
||||
SCHEMA_FIELD(GlowColorOverride, "CGlowProperty", "m_glowColorOverride", Color_t);
|
||||
SCHEMA_FIELD(Glowing, "CGlowProperty", "m_bGlowing", bool);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "ccsplayer_viewmodelservices.hpp"
|
||||
#include "c_baseplayerpawn.hpp"
|
||||
|
||||
class C_CSPlayerPawnBase : public C_BasePlayerPawn {
|
||||
public:
|
||||
SCHEMA_FIELD(m_pViewModelServices, "C_CSPlayerPawnBase",
|
||||
"m_pViewModelServices", CCSPlayer_ViewModelServices*);
|
||||
SCHEMA_FIELD(m_iIDEntIndex, "C_CSPlayerPawnBase",
|
||||
"m_iIDEntIndex", int);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "c_csweaponbase.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
//void C_CSWeaponBase::AddStattrakEntity() {
|
||||
// if (!memory::fnAddStattrakEntity) return;
|
||||
// return memory::fnAddStattrakEntity(m_hStattrakAttachment());
|
||||
//}
|
||||
//
|
||||
//void C_CSWeaponBase::AddNametagEntity() {
|
||||
// if (!memory::fnAddNametagEntity) return;
|
||||
// return memory::fnAddNametagEntity(m_hNametagAttachment());
|
||||
//}
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "c_baseplayerweapon.hpp"
|
||||
|
||||
class CCSWeaponBaseVData2
|
||||
{
|
||||
public:
|
||||
SCHEMA_FIELD(m_szName, "CCSWeaponBaseVData", "m_szName", const char*);
|
||||
SCHEMA_FIELD(GetWeaponType, "CCSWeaponBaseVData", "m_WeaponType", std::int32_t);
|
||||
};
|
||||
|
||||
|
||||
class C_CSWeaponBase : public C_BasePlayerWeapon {
|
||||
public:
|
||||
void AddStattrakEntity();
|
||||
void AddNametagEntity();
|
||||
|
||||
CCSWeaponBaseVData2* GetWeaponVData()
|
||||
{
|
||||
auto kek = GetVData();
|
||||
return static_cast<CCSWeaponBaseVData2*>(kek);
|
||||
}
|
||||
|
||||
SCHEMA_FIELD(m_bUIWeapon, "C_CSWeaponBase", "m_bUIWeapon", bool);
|
||||
SCHEMA_FIELD(m_iOriginalTeamNumber, "C_CSWeaponBase",
|
||||
"m_iOriginalTeamNumber", int);
|
||||
PSCHEMA_FIELD_OFFSET(m_hStattrakAttachment, "C_CSWeaponBase",
|
||||
"m_iNumEmptyAttacks", 4, void);
|
||||
PSCHEMA_FIELD_OFFSET(m_hNametagAttachment, "C_CSWeaponBase",
|
||||
"m_iNumEmptyAttacks", 20, void);
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "c_attributecontainer.hpp"
|
||||
#include "c_basemodelentity.hpp"
|
||||
|
||||
class C_EconEntity : public C_BaseModelEntity {
|
||||
public:
|
||||
PSCHEMA_FIELD(m_AttributeManager, "C_EconEntity", "m_AttributeManager",
|
||||
C_AttributeContainer);
|
||||
SCHEMA_FIELD(m_OriginalOwnerXuidLow, "C_EconEntity",
|
||||
"m_OriginalOwnerXuidLow", uint32_t);
|
||||
SCHEMA_FIELD(m_OriginalOwnerXuidHigh, "C_EconEntity",
|
||||
"m_OriginalOwnerXuidHigh", uint32_t);
|
||||
|
||||
uint64_t GetOriginalOwnerXuid() {
|
||||
return ((uint64_t)(m_OriginalOwnerXuidHigh()) << 32) |
|
||||
m_OriginalOwnerXuidLow();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "c_econitemview.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
CEconItem* C_EconItemView::GetSOCData() {
|
||||
CCSPlayerInventory* pInventory = CCSPlayerInventory::GetInstance();
|
||||
if (!pInventory) return nullptr;
|
||||
|
||||
return pInventory->GetSOCDataForItem(m_iItemID());
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../schema/schema.hpp"
|
||||
|
||||
#include "../econ/ceconitemdefinition.hpp"
|
||||
|
||||
class CEconItem;
|
||||
|
||||
class C_EconItemView {
|
||||
public:
|
||||
CEconItem* GetSOCData();
|
||||
|
||||
auto GetCustomPaintKitIndex() { return CALL_VIRTUAL(int, 2, this); }
|
||||
auto GetStaticData() {
|
||||
return CALL_VIRTUAL(CEconItemDefinition*, 13, this);
|
||||
}
|
||||
|
||||
SCHEMA_FIELD(m_iItemDefinitionIndex, "C_EconItemView",
|
||||
"m_iItemDefinitionIndex", uint16_t);
|
||||
SCHEMA_FIELD(m_iItemID, "C_EconItemView", "m_iItemID", uint64_t);
|
||||
SCHEMA_FIELD(m_iItemIDLow, "C_EconItemView", "m_iItemIDLow", uint32_t);
|
||||
SCHEMA_FIELD(m_iItemIDHigh, "C_EconItemView", "m_iItemIDHigh", uint32_t);
|
||||
SCHEMA_FIELD(m_iAccountID, "C_EconItemView", "m_iAccountID", uint32_t);
|
||||
SCHEMA_FIELD(m_bDisallowSOC, "C_EconItemView", "m_bDisallowSOC", bool);
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "c_basemodelentity.hpp"
|
||||
|
||||
class CBasePlayerController : public C_BaseModelEntity {
|
||||
public:
|
||||
SCHEMA_FIELD(m_steamID, "CBasePlayerController", "m_steamID", uint64_t);
|
||||
SCHEMA_FIELD(m_hPawn, "CBasePlayerController", "m_hPawn", CHandle);
|
||||
SCHEMA_FIELD(m_bIsLocalPlayerController, "CBasePlayerController",
|
||||
"m_bIsLocalPlayerController", bool);
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../schema/schema.hpp"
|
||||
#include "../../math/math.hpp"
|
||||
|
||||
class CCollisionProperty
|
||||
{
|
||||
public:
|
||||
std::uint16_t CollisionMask( )
|
||||
{
|
||||
return *reinterpret_cast<std::uint16_t*>(reinterpret_cast<std::uintptr_t>(this) + 0x38);
|
||||
}
|
||||
|
||||
SCHEMA_FIELD(GetMins, "CCollisionProperty", "m_vecMins", Vector);
|
||||
SCHEMA_FIELD(GetMaxs, "CCollisionProperty", "m_vecMaxs", Vector);
|
||||
SCHEMA_FIELD(GetSolidFlags, "CCollisionProperty", "m_usSolidFlags", uint8_t);
|
||||
SCHEMA_FIELD(GetCollisionGroup, "CCollisionProperty", "m_CollisionGroup", uint8_t);
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../schema/schema.hpp"
|
||||
|
||||
#include "../types/chandle.hpp"
|
||||
|
||||
|
||||
class CCSPlayer_ViewModelServices {
|
||||
public:
|
||||
PSCHEMA_FIELD(m_hViewModel, "CCSPlayer_ViewModelServices", "m_hViewModel",
|
||||
CHandle);
|
||||
SCHEMA_FIELD(m_hViewModel2, "CCSPlayer_ViewModelServices", "m_hViewModel",
|
||||
CHandle);
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "cbaseplayercontroller.hpp"
|
||||
#include "c_csplayerpawn.hpp"
|
||||
|
||||
class CCSPlayerController : public CBasePlayerController {
|
||||
public:
|
||||
SCHEMA_FIELD(m_sSanitizedPlayerName, "CCSPlayerController",
|
||||
"m_sSanitizedPlayerName", const char*);
|
||||
SCHEMA_FIELD(m_iPawnHealth, "CCSPlayerController", "m_iPawnHealth",
|
||||
uint32_t);
|
||||
SCHEMA_FIELD(m_bPawnIsAlive, "CCSPlayerController", "m_bPawnIsAlive", bool);
|
||||
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../schema/schema.hpp"
|
||||
#include "../../math/math.hpp"
|
||||
|
||||
#include "../types/chandle.hpp"
|
||||
|
||||
class CEntityIdentity {
|
||||
public:
|
||||
SCHEMA_FIELD(m_designerName, "CEntityIdentity", "m_designerName",
|
||||
const char*);
|
||||
SCHEMA_FIELD(m_flags, "CEntityIdentity", "m_flags", uint32_t);
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../interfaces/cschemasystem.hpp"
|
||||
|
||||
#include "centityidentity.hpp"
|
||||
|
||||
class CEntityInstance {
|
||||
public:
|
||||
auto Schema_DynamicBinding() {
|
||||
SchemaClassInfoData_t* rv = nullptr;
|
||||
CALL_VIRTUAL(void, 38, this, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
auto GetRefEHandle() {
|
||||
CEntityIdentity* pIdentity = m_pEntity();
|
||||
auto v3 = *(uint32_t*)(pIdentity + 16);
|
||||
auto v4 = ENT_ENTRY_MASK;
|
||||
auto v5 = ((v3 >> 15) - (*(uint32_t*)(pIdentity + 48) & 1)) << 15;
|
||||
if (v3 != -1) {
|
||||
v4 = *(uint32_t*)(pIdentity + 16) & ENT_ENTRY_MASK;
|
||||
}
|
||||
|
||||
return CHandle(v4 | v5);
|
||||
}
|
||||
|
||||
SCHEMA_FIELD(m_pEntity, "CEntityInstance", "m_pEntity", CEntityIdentity*);
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "cgamescenenode.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
void CGameSceneNode::SetMeshGroupMask(uint64_t meshGroupMask) {
|
||||
if (!memory::fnSetMeshGroupMask) return;
|
||||
return memory::fnSetMeshGroupMask(this, meshGroupMask);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../math/types/vector.hpp"
|
||||
#include "../../schema/schema.hpp"
|
||||
#include "../../virtual.hpp"
|
||||
|
||||
class CSkeletonInstance;
|
||||
class CGameSceneNode
|
||||
{
|
||||
public:
|
||||
void SetMeshGroupMask(uint64_t meshGroupMask);
|
||||
SCHEMA_FIELD(m_vecAbsOrigin, "CGameSceneNode", "m_vecAbsOrigin", Vector);
|
||||
|
||||
uintptr_t getBoneArray() {
|
||||
static constexpr auto datatable_hash = hash_32_fnv1a_const("CSkeletonInstance");
|
||||
static constexpr auto prop_hash = hash_32_fnv1a_const("m_modelState");
|
||||
static auto offset = schema::GetOffset("CSkeletonInstance", datatable_hash, "m_modelState", prop_hash);
|
||||
auto boneArray = *reinterpret_cast<uintptr_t*>(this + offset + 0x80);
|
||||
return boneArray;
|
||||
}
|
||||
|
||||
auto GetSkeletonInstance()
|
||||
{
|
||||
return CALL_VIRTUAL(CSkeletonInstance*, 8U, this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct Matrix2x4_t
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] const Vector GetOrigin(int nIndex)
|
||||
{
|
||||
return Vector(this[nIndex]._11, this[nIndex]._12, this[nIndex]._13);
|
||||
}
|
||||
|
||||
const void SetOrigin(int nIndex, Vector vecValue)
|
||||
{
|
||||
this[nIndex]._11 = vecValue.x;
|
||||
this[nIndex]._12 = vecValue.y;
|
||||
this[nIndex]._13 = vecValue.z;
|
||||
}
|
||||
|
||||
[[nodiscard]] const Vector4D GetRotation(int nIndex)
|
||||
{
|
||||
return Vector4D(this[nIndex]._21, this[nIndex]._22, this[nIndex]._23, this[nIndex]._24);
|
||||
}
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
float _11, _12, _13, _14;
|
||||
float _21, _22, _23, _24;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
struct CSkeletonInstance
|
||||
{
|
||||
//SCHEMA_FIELD(GetModelState, "CSkeletonInstance", "m_modelState", CModelState);
|
||||
SCHEMA_FIELD(m_nHitboxSet, "CSkeletonInstance", "m_nHitboxSet", uint8_t);
|
||||
SCHEMA_FIELD(m_modelState, "CSkeletonInstance", "m_modelState", uintptr_t);
|
||||
|
||||
char _pad1[0x1CC]; //0x0000
|
||||
int m_bone_count; //0x01CC
|
||||
char _pad2[0x18]; //0x01D0
|
||||
int m_mask; //0x01E8
|
||||
char _pad3[0x4]; //0x01EC
|
||||
Matrix2x4_t* m_bone_cache; //0x01F0
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "../../math/math.hpp"
|
||||
#include "../../schema/schema.hpp"
|
||||
|
||||
#include "../types/cnetworkutlvectorbase.hpp"
|
||||
#include "../types/chandle.hpp"
|
||||
|
||||
class CPlayer_MovementServices {
|
||||
public:
|
||||
SCHEMA_FIELD(m_vecOldViewAngles, "CPlayer_MovementServices", "m_vecOldViewAngles", QAngle_t);
|
||||
SCHEMA_FIELD(m_flMaxspeed, "CPlayer_MovementServices", "m_flMaxspeed",
|
||||
float);
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../schema/schema.hpp"
|
||||
|
||||
#include "../types/cnetworkutlvectorbase.hpp"
|
||||
#include "../types/chandle.hpp"
|
||||
|
||||
#include "c_csweaponbase.hpp"
|
||||
|
||||
class CPlayer_WeaponServices {
|
||||
public:
|
||||
SCHEMA_FIELD(m_hActiveWeapon, "CPlayer_WeaponServices", "m_hActiveWeapon",
|
||||
CHandle);
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "cgcclient.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
CGCClientSharedObjectCache* CGCClient::FindSOCache(SOID_t ID,
|
||||
bool bCreateIfMissing) {
|
||||
if (!memory::fnFindSOCache) return nullptr;
|
||||
return memory::fnFindSOCache(this, ID, bCreateIfMissing);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class CGCClientSharedObjectCache;
|
||||
|
||||
struct SOID_t {
|
||||
uint64_t m_id;
|
||||
uint32_t m_type;
|
||||
uint32_t m_padding;
|
||||
};
|
||||
|
||||
class CGCClient {
|
||||
public:
|
||||
CGCClientSharedObjectCache* FindSOCache(SOID_t ID,
|
||||
bool bCreateIfMissing = true);
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "cgcclientsharedobjectcache.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
CGCClientSharedObjectTypeCache* CGCClientSharedObjectCache::CreateBaseTypeCache(
|
||||
int nClassID) {
|
||||
if (!memory::fnCreateBaseTypeCache) return nullptr;
|
||||
return memory::fnCreateBaseTypeCache(this, nClassID);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
enum ESOCacheEvent {
|
||||
/// Dummy sentinel value
|
||||
eSOCacheEvent_None = 0,
|
||||
|
||||
/// We received a our first update from the GC and are subscribed
|
||||
eSOCacheEvent_Subscribed = 1,
|
||||
|
||||
/// We lost connection to GC or GC notified us that we are no longer
|
||||
/// subscribed. Objects stay in the cache, but we no longer receive updates
|
||||
eSOCacheEvent_Unsubscribed = 2,
|
||||
|
||||
/// We received a full update from the GC on a cache for which we were
|
||||
/// already subscribed. This can happen if connectivity is lost, and then
|
||||
/// restored before we realized it was lost.
|
||||
eSOCacheEvent_Resubscribed = 3,
|
||||
|
||||
/// We received an incremental update from the GC about specific object(s)
|
||||
/// being added, updated, or removed from the cache
|
||||
eSOCacheEvent_Incremental = 4,
|
||||
|
||||
/// A lister was added to the cache
|
||||
/// @see CGCClientSharedObjectCache::AddListener
|
||||
eSOCacheEvent_ListenerAdded = 5,
|
||||
|
||||
/// A lister was removed from the cache
|
||||
/// @see CGCClientSharedObjectCache::RemoveListener
|
||||
eSOCacheEvent_ListenerRemoved = 6,
|
||||
};
|
||||
|
||||
class CGCClientSharedObjectTypeCache;
|
||||
|
||||
class CGCClientSharedObjectCache {
|
||||
public:
|
||||
CGCClientSharedObjectTypeCache* CreateBaseTypeCache(int nClassID);
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../virtual.hpp"
|
||||
|
||||
#include "../types/utlvector.hpp"
|
||||
|
||||
class CSharedObject;
|
||||
|
||||
class CGCClientSharedObjectTypeCache {
|
||||
public:
|
||||
auto AddObject(CSharedObject* pObject) {
|
||||
return CALL_VIRTUAL(bool, 1, this, pObject);
|
||||
}
|
||||
|
||||
auto RemoveObject(CSharedObject* soIndex) {
|
||||
return CALL_VIRTUAL(CSharedObject*, 3, this, soIndex);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
auto& GetVecObjects() {
|
||||
return *reinterpret_cast<CUtlVector<T>*>((uintptr_t)(this) + 0x8);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "cgcclientsystem.hpp"
|
||||
|
||||
#include "../../memory/memory.hpp"
|
||||
|
||||
CGCClientSystem* CGCClientSystem::GetInstance() {
|
||||
if (!memory::fnGetClientSystem) return nullptr;
|
||||
return memory::fnGetClientSystem();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "cgcclient.hpp"
|
||||
|
||||
class CGCClientSystem {
|
||||
public:
|
||||
static CGCClientSystem* GetInstance();
|
||||
|
||||
CGCClient* GetCGCClient() {
|
||||
return reinterpret_cast<CGCClient*>((uintptr_t)(this) + 0xB8);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
typedef void *(*InstantiateInterfaceFn)();
|
||||
|
||||
// Used internally to register classes.
|
||||
struct InterfaceReg {
|
||||
InstantiateInterfaceFn m_CreateFn;
|
||||
const char *m_pName;
|
||||
InterfaceReg *m_pNext; // For the global list.
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../virtual.hpp"
|
||||
|
||||
class ConVar {
|
||||
public:
|
||||
const char* m_name;
|
||||
|
||||
template <typename T>
|
||||
T GetValue() {
|
||||
// Tip: Do not modify the value by making this a reference.
|
||||
// It'll get your account flagged.
|
||||
return *reinterpret_cast<T*>((uintptr_t)(this) + 0x40);
|
||||
}
|
||||
};
|
||||
|
||||
class CCvar {
|
||||
public:
|
||||
static CCvar& Get() {
|
||||
static CCvar inst;
|
||||
return inst;
|
||||
}
|
||||
auto GetFirstCvarIterator(uint64_t& idx) {
|
||||
return CALL_VIRTUAL(void*, 12, this, &idx);
|
||||
}
|
||||
|
||||
auto GetNextCvarIterator(uint64_t& idx) {
|
||||
return CALL_VIRTUAL(void*, 13, this, &idx, idx);
|
||||
}
|
||||
|
||||
auto FindVarByIndex(uint64_t index) {
|
||||
return CALL_VIRTUAL(ConVar*, 37, this, index);
|
||||
}
|
||||
|
||||
auto FindVarByName(const char* var_name) -> ConVar* {
|
||||
// Tip: There's logging in this function because this should run ONLY
|
||||
// once for every ConVar. If the console is spammed it means you haven't
|
||||
// made the variable static.
|
||||
|
||||
uint64_t i = 0;
|
||||
GetFirstCvarIterator(i);
|
||||
while (i != 0xFFFFFFFF) {
|
||||
ConVar* pCvar = FindVarByIndex(i);
|
||||
if (strcmp(pCvar->m_name, var_name) == 0) {
|
||||
LOG("CCvar::FindVarByName() found '%s' at -> %p\n", var_name,
|
||||
pCvar);
|
||||
return pCvar;
|
||||
}
|
||||
GetNextCvarIterator(i);
|
||||
}
|
||||
|
||||
LOG("CCvar::FindVarByName() couldn't find '%s'.\n", var_name);
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../virtual.hpp"
|
||||
|
||||
class CEngineClient {
|
||||
public:
|
||||
auto IsInGame() { return CALL_VIRTUAL(bool, 35U, this); }
|
||||
auto IsConnected() { return CALL_VIRTUAL(bool, 36U, this); }
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "cgameentitysystem.hpp"
|
||||
|
||||
#include "../../interfaces/interfaces.hpp"
|
||||
|
||||
CGameEntitySystem* CGameEntitySystem::GetInstance() {
|
||||
if (!interfaces::pGameResourceService) return nullptr;
|
||||
return interfaces::pGameResourceService->GetGameEntitySystem();
|
||||
}
|
||||
|
||||
CCSPlayerController* CGameEntitySystem::GetLocalPlayerController() {
|
||||
if (!memory::fnGetLocalPlayerController) return nullptr;
|
||||
return memory::fnGetLocalPlayerController(-1);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user