diff --git a/csgo2/csgo2.vcxproj b/csgo2/csgo2.vcxproj index 897f09f..98c197e 100644 --- a/csgo2/csgo2.vcxproj +++ b/csgo2/csgo2.vcxproj @@ -158,6 +158,7 @@ + @@ -172,17 +173,10 @@ - - - - - - + - - @@ -196,6 +190,7 @@ + @@ -212,10 +207,7 @@ - - - - + Create @@ -223,12 +215,11 @@ Create Create - - - + + diff --git a/csgo2/csgo2.vcxproj.filters b/csgo2/csgo2.vcxproj.filters index 8544c47..a677b18 100644 --- a/csgo2/csgo2.vcxproj.filters +++ b/csgo2/csgo2.vcxproj.filters @@ -49,27 +49,9 @@ {c28f9f29-7571-4821-9cbd-11f27692566a} - - {e26bdf5e-ad8d-4ed2-965c-1fdb958a6098} - {c5938a38-9035-4f7a-952c-156a8549bb54} - - {ec02337e-1abc-42a9-b29c-355278bf4bf2} - - - {6c9da4be-92c5-4504-8c46-ab0cc612bfe5} - - - {f1101bd0-b17e-4c9e-87f1-e34d97979e77} - - - {63beb427-0b96-4062-83e0-752efb2ed5f0} - - - {68556c7c-97c0-4e1e-82f0-e4b45b9ad40d} - {befb97b4-a3ba-48a8-84a8-c36a74d2d48c} @@ -168,33 +150,9 @@ 头文件\sdk\interfaces - - 头文件\native_sdk\interfaces - - - 头文件\native_sdk\interfaces - - - 头文件\native_sdk\interfaces - - - 头文件\native_sdk\entity - 头文件\memory - - 头文件\native_sdk\entity - - - 头文件\native_sdk\handle - - - 头文件\native_sdk\entity - - - 头文件\native_sdk\interfaces - 头文件\sdk\convar @@ -219,6 +177,15 @@ 头文件\players + + 头文件 + + + 头文件\native_sdk + + + 头文件\native_sdk + @@ -260,24 +227,9 @@ 源文件\events - - 源文件\native_sdk\interfaces - - + 源文件\memory - - 源文件\native_sdk\interfaces - - - 源文件\native_sdk\interfaces - - - 源文件\native_sdk\entity - - - 源文件\native_sdk\handle - 头文件\sdk\convar @@ -287,8 +239,11 @@ 源文件\players - - 源文件\native_sdk\entity + + 源文件\native_sdk + + + 源文件\native_sdk diff --git a/csgo2/dllmain.cpp b/csgo2/dllmain.cpp index 6751781..476bf36 100644 --- a/csgo2/dllmain.cpp +++ b/csgo2/dllmain.cpp @@ -1,5 +1,5 @@ // dllmain.cpp : 定义 DLL 应用程序的入口点。 -#include "pch.h" +#include "head.h" auto unload() -> void { hooks::unload(); diff --git a/csgo2/events.cpp b/csgo2/events.cpp index c1bef74..8b0a85e 100644 --- a/csgo2/events.cpp +++ b/csgo2/events.cpp @@ -1,7 +1,4 @@ #include "events.h" -#include "native_sdk/entity/cbaseplayercontroller.h" -#include "player.h" -#include "player_manager.h" namespace events { auto OnPlayerDeathEvent(IGameEvent* event) -> void { @@ -13,21 +10,18 @@ auto OnPlayerDeathEvent(IGameEvent* event) -> void { const auto attacker = reinterpret_cast( event->GetPlayerPawn(&attackerNameParams)); - CGameEntitySystem* pEntitySystem = CGameEntitySystem::GetInstance(); - if (!pEntitySystem) return; - - for (int i = 1; i <= 64; ++i) { - CBaseEntity* pEntity = pEntitySystem->GetBaseEntity(i); - if (!pEntity) continue; - if (pEntity->IsBasePlayerController()) { - const auto player = reinterpret_cast(pEntity); - if (player->m_hPawn().Get() == victim) { - printf("Found Pawn Player: %d %s \n", player->GetRefEHandle().GetEntryIndex(),&player->m_iszPlayerName()); - break; - } - } - } //printf("player[%p] %s kill[%p] %llu\n", attacker, &attacker->m_iszPlayerName(), victim, &victim->m_steamID()); } -auto OnPlayerChat(IGameEvent* event) -> void {} +auto OnPlayerChat(CCSPlayerController* player, std::string message) -> bool { + auto [procesChatSuccess, chatType, chatCtx] = SdkTools::ProcessChatString(message); + if (procesChatSuccess == false) { + return false; + } + + LOG("player %s say[%d]: %s steamid: %llu\n", &player->m_iszPlayerName(), chatType ,chatCtx.c_str(), player->m_steamID()); + if (chatCtx.at(0) == '/' || chatCtx.at(0) == '!') { + return true; + } + return false; +} } // namespace events diff --git a/csgo2/events.h b/csgo2/events.h index 50c2e13..56bcc37 100644 --- a/csgo2/events.h +++ b/csgo2/events.h @@ -1,8 +1,7 @@ #pragma once -#include "pch.h" -#include "sdk/gameevent/IGameEvent.h" - +#include "head.h" +class CCSPlayerController; namespace events { auto OnPlayerDeathEvent(IGameEvent* event) -> void; - auto OnPlayerChat(IGameEvent* event) -> void; + auto OnPlayerChat(CCSPlayerController* player, std::string message) -> bool; } diff --git a/csgo2/global.h b/csgo2/global.h index a5cfaed..b6797cd 100644 --- a/csgo2/global.h +++ b/csgo2/global.h @@ -1,5 +1,5 @@ #pragma once -#include "pch.h" +#include "head.h" namespace global { extern bool Exit; extern int MaxPlayers; diff --git a/csgo2/head.h b/csgo2/head.h new file mode 100644 index 0000000..4423a50 --- /dev/null +++ b/csgo2/head.h @@ -0,0 +1,62 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "framework.h" +#include "stb.hh" +// #define LOG DebugPrintA +static void DebugPrintA(const char* format, ...) { + std::string temp; + va_list marker = { 0 }; + va_start(marker, format); + size_t num_of_chars = _vscprintf(format, marker); + if (num_of_chars > temp.capacity()) { + temp.reserve(num_of_chars + 1); + } + vsprintf_s(const_cast(temp.c_str()), num_of_chars + 1, format, + marker); + OutputDebugStringA(temp.c_str()); +} +#define LOG(...) printf(__VA_ARGS__) +#define THE_GAME_SIG(sig) \ + stb::simple_conversion::build::value +// +#include "./MinHook/include/MinHook.h" +#include "hash_fnv1a_constexpr.h" +//߿ + +#include "vmt.h" +#include "memory.h" +#include "sdk/gameevent/IGameEvent.h" +#include "sdk/tier1/bufferstring.h" +#include "sdk/public/eiface.h" +#include "sdk/player/playerslot.h" + +//sdk +#include "sdk/sdk.h" +#include "sdk/tier1/UtlString.hpp" +#include "sdk/interfaces/interfaces.h" +#include "sdk/public/eiface.h" +#include "sdk/gameevent/IGameEvent.h" +#include "sdk/convar/convar.hpp" +#include "sdk/tier1/bufferstring.h" + +#include "offset.h" +#include "native_sdk.h" + +#include "interface.h" +#include "module.h" +#include "global.h" + +#include "events.h" +#include "hooks.h" +#include "vmthook.h" + +#include "player_manager.h" +#include "sdk_tools.h" \ No newline at end of file diff --git a/csgo2/hooks.cpp b/csgo2/hooks.cpp index 9bc805e..ca07641 100644 --- a/csgo2/hooks.cpp +++ b/csgo2/hooks.cpp @@ -1,8 +1,5 @@ #include "hooks.h" -#include "native_sdk/entity/cbaseentity.h" -#include "sdk/convar/convar.hpp" -#include "player_manager.h" -#include "native_sdk/entity/cbaseplayercontroller.h" + FireEventServerSide_t original_FireEventServerSide = NULL; OnClientConnect_t original_OnClientConnected = NULL; OnClientDisconnect_t original_OnClientDisconnect = NULL; @@ -41,13 +38,17 @@ void __fastcall hook_Host_Say(void* pEntity, void* args, bool teamonly, const auto theEntity = reinterpret_cast(pEntity); char* pos = nullptr; + bool blockMsg = false; do { if (theArgs == nullptr || theEntity == nullptr) { break; + } + const auto message = std::string(theArgs->GetCommandString()); + + if (events::OnPlayerChat(theEntity, message) == true) { + blockMsg = true; + break; } - auto message = std::string(theArgs->GetCommandString()); - printf("player[%d][%p] %s : %s \n", theEntity->GetRefEHandle().GetEntryIndex(),theEntity, &theEntity->m_iszPlayerName(), - message.c_str()); } while (false); /* if (*pMessage == '!' || *pMessage == '/') @@ -56,7 +57,10 @@ void __fastcall hook_Host_Say(void* pEntity, void* args, bool teamonly, if (*pMessage == '/') return; */ - return original_Host_Say(pEntity, args, teamonly, unk1, unk2); + if (blockMsg) { return; } + else { + return original_Host_Say(pEntity, args, teamonly, unk1, unk2); + } } bool __fastcall hook_FireEventServerSide(CGameEventManager* rcx, diff --git a/csgo2/hooks.h b/csgo2/hooks.h index cef3b38..f41ad1a 100644 --- a/csgo2/hooks.h +++ b/csgo2/hooks.h @@ -1,7 +1,5 @@ #pragma once -#include "pch.h" -#include "sdk/gameevent/IGameEvent.h" -#include "sdk/tier1/bufferstring.h" +#include "head.h" typedef bool(__fastcall* FireEventServerSide_t)(CGameEventManager*, IGameEvent*, bool); typedef void(__fastcall* Host_Say_t)(void*, void*, bool, int, const char*); diff --git a/csgo2/interface.cpp b/csgo2/interface.cpp index 077f315..5ba0ac6 100644 --- a/csgo2/interface.cpp +++ b/csgo2/interface.cpp @@ -1,4 +1,4 @@ -#include "pch.h" +#include "head.h" namespace interfaces { } // namespace interfaces diff --git a/csgo2/interface.h b/csgo2/interface.h index b1fe292..b19dba2 100644 --- a/csgo2/interface.h +++ b/csgo2/interface.h @@ -1,5 +1,5 @@ #pragma once -#include "pch.h" +#include "head.h" namespace interfaces { } // namespace interfaces diff --git a/csgo2/memory.h b/csgo2/memory.h index 4dbc559..27968b8 100644 --- a/csgo2/memory.h +++ b/csgo2/memory.h @@ -1,5 +1,5 @@ #pragma once -#include "pch.h" +#include "head.h" namespace Memory { template void write(uintptr_t address, T value) diff --git a/csgo2/module.h b/csgo2/module.h index e55f923..b8c0dbf 100644 --- a/csgo2/module.h +++ b/csgo2/module.h @@ -1,5 +1,5 @@ #pragma once -#include "pch.h" +#include "head.h" #define IS_WINDOWS 1 class InterfaceReg; // Pointer arithmetic utility class. diff --git a/csgo2/schema.cpp b/csgo2/native_sdk.cpp similarity index 61% rename from csgo2/schema.cpp rename to csgo2/native_sdk.cpp index 7dbffa7..d8b37a7 100644 --- a/csgo2/schema.cpp +++ b/csgo2/native_sdk.cpp @@ -1,6 +1,58 @@ -#include "schema.h" -#include "native_sdk/cgameentitysystem.h" -#include "native_sdk/cschemasystem.h" +#include "native_sdk.h" + +CBaseEntity* CHandle::GetBaseEntity() const +{ + CGameEntitySystem* pEntitySystem = CGameEntitySystem::GetInstance(); + if (!pEntitySystem) + return nullptr; + + return pEntitySystem->GetBaseEntity(GetEntryIndex()); +} +CGameEntitySystem* CGameEntitySystem::GetInstance() { + return Offset::InterFaces::GameResourceServiceServer->GetGameEntitySystem(); +} + +auto CSchemaSystemTypeScope::FindDeclaredClass(const char* pClass) -> SchemaClassInfoData_t* +{ + SchemaClassInfoData_t* rv = nullptr; + CALL_VIRTUAL(void, 2, this, &rv, pClass); + return rv; +} + +auto CSchemaSystem::FindTypeScopeForModule(const char* module) -> CSchemaSystemTypeScope* +{ + return CALL_VIRTUAL(CSchemaSystemTypeScope*, 13, this, module, nullptr); +} + +bool CBaseEntity::IsBasePlayerController() { + return CALL_VIRTUAL(bool, 144, this); +} + +auto CBasePlayer::ForceRespawn() -> void +{ + return CALL_VIRTUAL(void, 26, this); +} + +auto CCSPlayerPawn::GetPlayerController() -> CCSPlayerController* +{ + CGameEntitySystem* pEntitySystem = CGameEntitySystem::GetInstance(); + if (!pEntitySystem) { + return nullptr; + } + for (int i = 1; i <= global::MaxPlayers; ++i) { + CBaseEntity* pEntity = pEntitySystem->GetBaseEntity(i); + if (!pEntity) continue; + if (pEntity->IsBasePlayerController()) { + const auto player = reinterpret_cast(pEntity); + if (player->m_hPawn().Get() == this) { + //printf("Found Pawn Player: %d %s \n", player->GetRefEHandle().GetEntryIndex(), &player->m_iszPlayerName()); + return player; + } + } + } + return nullptr; +} + using SchemaKeyValueMap_t = std::unordered_map; using SchemaTableMap_t = std::unordered_map; diff --git a/csgo2/native_sdk.h b/csgo2/native_sdk.h new file mode 100644 index 0000000..c748177 --- /dev/null +++ b/csgo2/native_sdk.h @@ -0,0 +1,334 @@ +#pragma once +#include "head.h" +namespace Offset { + extern uint64_t NetworkStateChangedPtr; +} +#define DECLARE_CLASS(className) static constexpr auto ThisClass = #className; + +#define MAX_ENTITIES_IN_LIST 512 +#define MAX_ENTITY_LISTS 64 +#define MAX_TOTAL_ENTITIES MAX_ENTITIES_IN_LIST *MAX_ENTITY_LISTS +#define INVALID_EHANDLE_INDEX 0xFFFFFFFF +#define ENT_ENTRY_MASK 0x7FFF +#define SCHEMA_FIELD_OFFSET(type, varName, extra_offset) \ + std::add_lvalue_reference_t varName() \ + { \ + static constexpr auto datatable_hash = hash_32_fnv1a_const(ThisClass); \ + static constexpr auto prop_hash = hash_32_fnv1a_const(#varName); \ + \ + static const auto m_offset = \ + schema::GetOffset(ThisClass, datatable_hash, #varName, prop_hash); \ + \ + return *reinterpret_cast>( \ + (uintptr_t)(this) + m_offset + extra_offset); \ + } \ + void varName(type val) \ + { \ + static constexpr auto datatable_hash = hash_32_fnv1a_const(ThisClass); \ + static constexpr auto prop_hash = hash_32_fnv1a_const(#varName); \ + \ + static const auto m_offset = \ + schema::GetOffset(ThisClass, datatable_hash, #varName, prop_hash); \ + \ + static const auto m_chain = \ + schema::FindChainOffset(ThisClass); \ + \ + if (m_chain != 0) \ + { \ + reinterpret_cast(Offset::NetworkStateChangedPtr)((uintptr_t)(this) + m_chain, m_offset + extra_offset, 0xFFFFFFFF); \ + } \ + *reinterpret_cast>((uintptr_t)(this) + m_offset + extra_offset) = val; \ + } + +#define SCHEMA_FIELD(type, varName) \ + SCHEMA_FIELD_OFFSET(type, varName, 0) + +#define PSCHEMA_FIELD_OFFSET(type, varName, extra_offset) \ + auto varName() \ + { \ + static constexpr auto datatable_hash = hash_32_fnv1a_const(ThisClass); \ + static constexpr auto prop_hash = hash_32_fnv1a_const(#varName); \ + \ + static const auto m_offset = \ + schema::GetOffset(ThisClass, datatable_hash, #varName, prop_hash); \ + \ + return reinterpret_cast>( \ + (uintptr_t)(this) + m_offset + extra_offset); \ + } + +#define PSCHEMA_FIELD(type, varName) \ + PSCHEMA_FIELD_OFFSET(type, varName, 0) + +typedef void(__fastcall* FnNetworkStateChanged)(uintptr_t chainEntity, uintptr_t offset, uintptr_t a3); +namespace schema +{ + int16_t FindChainOffset(const char* className); + int16_t GetOffset(const char* className, uint32_t classKey, const char* memberName, uint32_t memberKey); +} + + +struct SchemaClassFieldData_t +{ + const char* m_name; + char pad0[0x8]; + short m_offset; + char pad1[0xE]; +}; + +class SchemaClassInfoData_t; + +struct SchemaBaseClassInfoData_t +{ + unsigned int m_offset; + SchemaClassInfoData_t* m_class; +}; + +class SchemaClassInfoData_t +{ +public: + auto GetName() + { + return m_name; + } + + auto GetFieldsSize() + { + return m_align; + } + + auto GetFields() + { + return m_fields; + } + + auto GetParent() + { + return m_schema_parent->m_class; + } + +private: + char pad_0x0000[0x8]; // 0x0000 + + const char* m_name; // 0x0008 + char* m_module; // 0x0010 + + int m_size; // 0x0018 + std::int16_t m_align; // 0x001C + + std::int16_t m_static_size; // 0x001E + std::int16_t m_metadata_size; // 0x0020 + std::int16_t m_i_unk1; // 0x0022 + std::int16_t m_i_unk2; // 0x0024 + std::int16_t m_i_unk3; // 0x0026 + + SchemaClassFieldData_t* m_fields; // 0x0028 + + char pad_0x0030[0x8]; // 0x0030 + SchemaBaseClassInfoData_t* m_schema_parent; // 0x0038 + + char pad_0x0038[0x10]; // 0x0038 +}; + +class CSchemaSystemTypeScope +{ +public: + auto FindDeclaredClass(const char* pClass)->SchemaClassInfoData_t*; +}; + +class CSchemaSystem +{ +public: + auto FindTypeScopeForModule(const char* module)->CSchemaSystemTypeScope*; +}; + +class CBaseEntity; +class CEntityIdentity +{ +public: + CBaseEntity* entity; //0 + void* dunno; //8 + int64_t unk0; //12 + int64_t unk1; //16 + const char* internalName; + const char* entityName; + void* unk2; + void* unk3; + void* unk4; + void* unk5; + CEntityIdentity* prevValid; + CEntityIdentity* nextValid; + void* unkptr; + void* unkptr2; + void* unkptr3; +}; + +class CEntityIdentities +{ +public: + CEntityIdentity m_pIdentities[MAX_ENTITIES_IN_LIST]; +}; + +class EntityIdentityList +{ +public: + CEntityIdentities* m_pIdentityList; +}; + +class CGameEntitySystem +{ +public: + virtual void n_0(); + void* unk; + CEntityIdentities* m_pEntityList[MAX_ENTITY_LISTS]; + + CBaseEntity* GetBaseEntity(int index) + { + if (index <= -1 || index >= MAX_TOTAL_ENTITIES) + return nullptr; + + int listToUse = (index / MAX_ENTITIES_IN_LIST); + if (!m_pEntityList[listToUse]) + return nullptr; + + if (m_pEntityList[listToUse]->m_pIdentities[index % MAX_ENTITIES_IN_LIST].entity) + return m_pEntityList[listToUse]->m_pIdentities[index % MAX_ENTITIES_IN_LIST].entity; + else + return nullptr; + } + + static CGameEntitySystem* GetInstance(); +}; +struct VPhysicsCollisionAttribute_t +{ + DECLARE_CLASS(VPhysicsCollisionAttribute_t) + + SCHEMA_FIELD(uint8_t, m_nCollisionGroup) +}; + +class CCollisionProperty +{ +public: + DECLARE_CLASS(CCollisionProperty) + + SCHEMA_FIELD(VPhysicsCollisionAttribute_t, m_collisionAttribute) + //SCHEMA_FIELD(SolidType_t, m_nSolidType) + SCHEMA_FIELD(uint8_t, m_usSolidFlags) + SCHEMA_FIELD(uint8_t, m_CollisionGroup) +}; + +class CHandle +{ + CBaseEntity* GetBaseEntity() const; + +public: + bool operator==(CHandle rhs) const { return m_Index == rhs.m_Index; } + + bool IsValid() const { return m_Index != INVALID_EHANDLE_INDEX; } + + int GetEntryIndex() const { return m_Index & ENT_ENTRY_MASK; } + + template + T* Get() const + { + return reinterpret_cast(GetBaseEntity()); + } + uint32_t m_Index; +}; +class CEntityInstance { +public: + DECLARE_CLASS(CEntityInstance); + + auto Schema_DynamicBinding() { + SchemaClassInfoData_t* rv = nullptr; + CALL_VIRTUAL(void, 34, this, &rv); + return rv; + } + + auto GetRefEHandle() { + char* pIdentity = (char*)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(CEntityIdentity*, m_pEntity); + SCHEMA_FIELD(const char*, m_designerName); +}; + +class CBaseEntity : public CEntityInstance { +public: + DECLARE_CLASS(CBaseEntity); + + SCHEMA_FIELD(int, m_iHealth) + // SCHEMA_FIELD(Vector, m_vecBaseVelocity) + SCHEMA_FIELD(CCollisionProperty*, m_pCollision) + bool IsBasePlayerController(); +}; + + +class CBasePlayerController : public CBaseEntity { +public: + DECLARE_CLASS(CBasePlayerController); + + SCHEMA_FIELD(uint64_t, m_steamID) + SCHEMA_FIELD(CHandle, m_hPawn) + SCHEMA_FIELD(char, m_iszPlayerName) + SCHEMA_FIELD(CUtlString, m_szNetworkIDString) +}; + +class CCSPlayerController : public CBasePlayerController { +public: + DECLARE_CLASS(CCSPlayerController) + + SCHEMA_FIELD(uint32_t, m_iPawnHealth) + SCHEMA_FIELD(bool, m_bPawnIsAlive) + SCHEMA_FIELD(const char*, m_szClanName) +}; + + +class CBasePlayer { +public: + auto ForceRespawn() -> void; +}; + +class CPlayer_MovementServices { +public: + DECLARE_CLASS(CPlayer_MovementServices); +}; + +class CCSPlayerController_InGameMoneyServices { +public: + DECLARE_CLASS(CCSPlayerController_InGameMoneyServices); + + SCHEMA_FIELD(int, m_iAccount) +}; +class CBasePlayerPawn : public CBaseEntity { +public: + DECLARE_CLASS(CBasePlayerPawn); + + SCHEMA_FIELD(CPlayer_MovementServices*, m_pMovementServices) + SCHEMA_FIELD(uint8_t*, m_pWeaponServices) + SCHEMA_FIELD(uint8_t**, m_pItemServices) +}; +class CCSPlayerPawn : public CBasePlayerPawn { +public: + DECLARE_CLASS(CCSPlayerPawn); + SCHEMA_FIELD(const char*, m_szLastPlaceName) + auto GetPlayerController() -> CCSPlayerController*; +}; + +class CGameEntitySystem; + +class CGameResourceService +{ +public: + CGameEntitySystem* GetGameEntitySystem() + { + return *reinterpret_cast((uintptr_t)(this) + 0x58); + } +}; \ No newline at end of file diff --git a/csgo2/native_sdk/cgameentitysystem.cpp b/csgo2/native_sdk/cgameentitysystem.cpp deleted file mode 100644 index 3d029c0..0000000 --- a/csgo2/native_sdk/cgameentitysystem.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "cgameentitysystem.h" -#include "../pch.h" - -CGameEntitySystem* CGameEntitySystem::GetInstance(){ - return Offset::InterFaces::GameResourceServiceServer->GetGameEntitySystem(); -} diff --git a/csgo2/native_sdk/cgameentitysystem.h b/csgo2/native_sdk/cgameentitysystem.h deleted file mode 100644 index 8edc4e0..0000000 --- a/csgo2/native_sdk/cgameentitysystem.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once -#include "entity/cbaseentity.h" - -#define MAX_ENTITIES_IN_LIST 512 -#define MAX_ENTITY_LISTS 64 -#define MAX_TOTAL_ENTITIES MAX_ENTITIES_IN_LIST *MAX_ENTITY_LISTS - -class CEntityIdentity -{ -public: - CBaseEntity *entity; //0 - void *dunno; //8 - int64_t unk0; //12 - int64_t unk1; //16 - const char *internalName; - const char *entityName; - void *unk2; - void *unk3; - void *unk4; - void *unk5; - CEntityIdentity *prevValid; - CEntityIdentity *nextValid; - void *unkptr; - void *unkptr2; - void *unkptr3; -}; - -class CEntityIdentities -{ -public: - CEntityIdentity m_pIdentities[MAX_ENTITIES_IN_LIST]; -}; - -class EntityIdentityList -{ -public: - CEntityIdentities *m_pIdentityList; -}; - -class CGameEntitySystem -{ -public: - virtual void n_0(); - void *unk; - CEntityIdentities *m_pEntityList[MAX_ENTITY_LISTS]; - - CBaseEntity *GetBaseEntity(int index) - { - if (index <= -1 || index >= MAX_TOTAL_ENTITIES) - return nullptr; - - int listToUse = (index / MAX_ENTITIES_IN_LIST); - if (!m_pEntityList[listToUse]) - return nullptr; - - if (m_pEntityList[listToUse]->m_pIdentities[index % MAX_ENTITIES_IN_LIST].entity) - return m_pEntityList[listToUse]->m_pIdentities[index % MAX_ENTITIES_IN_LIST].entity; - else - return nullptr; - } - - static CGameEntitySystem *GetInstance(); -}; \ No newline at end of file diff --git a/csgo2/native_sdk/cgameresourceserviceserver.h b/csgo2/native_sdk/cgameresourceserviceserver.h deleted file mode 100644 index 035ed80..0000000 --- a/csgo2/native_sdk/cgameresourceserviceserver.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once -#include "../pch.h" -class CGameEntitySystem; - -class CGameResourceService -{ -public: - CGameEntitySystem *GetGameEntitySystem() - { - return *reinterpret_cast((uintptr_t)(this) + 0x58); - } -}; \ No newline at end of file diff --git a/csgo2/native_sdk/cschemasystem.cpp b/csgo2/native_sdk/cschemasystem.cpp deleted file mode 100644 index 8faed05..0000000 --- a/csgo2/native_sdk/cschemasystem.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "cschemasystem.h" - -auto CSchemaSystemTypeScope::FindDeclaredClass(const char* pClass) -> SchemaClassInfoData_t* -{ - SchemaClassInfoData_t* rv = nullptr; - CALL_VIRTUAL(void, 2, this, &rv, pClass); - return rv; -} - -auto CSchemaSystem::FindTypeScopeForModule(const char* module) -> CSchemaSystemTypeScope* -{ - return CALL_VIRTUAL(CSchemaSystemTypeScope*, 13, this, module, nullptr); -} \ No newline at end of file diff --git a/csgo2/native_sdk/cschemasystem.h b/csgo2/native_sdk/cschemasystem.h deleted file mode 100644 index 2ae0fad..0000000 --- a/csgo2/native_sdk/cschemasystem.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once -#include "../pch.h" -#include "../vmt.h" - -struct SchemaClassFieldData_t -{ - const char *m_name; - char pad0[0x8]; - short m_offset; - char pad1[0xE]; -}; - -class SchemaClassInfoData_t; - -struct SchemaBaseClassInfoData_t -{ - unsigned int m_offset; - SchemaClassInfoData_t *m_class; -}; - -class SchemaClassInfoData_t -{ -public: - auto GetName() - { - return m_name; - } - - auto GetFieldsSize() - { - return m_align; - } - - auto GetFields() - { - return m_fields; - } - - auto GetParent() - { - return m_schema_parent->m_class; - } - -private: - char pad_0x0000[0x8]; // 0x0000 - - const char *m_name; // 0x0008 - char *m_module; // 0x0010 - - int m_size; // 0x0018 - std::int16_t m_align; // 0x001C - - std::int16_t m_static_size; // 0x001E - std::int16_t m_metadata_size; // 0x0020 - std::int16_t m_i_unk1; // 0x0022 - std::int16_t m_i_unk2; // 0x0024 - std::int16_t m_i_unk3; // 0x0026 - - SchemaClassFieldData_t *m_fields; // 0x0028 - - char pad_0x0030[0x8]; // 0x0030 - SchemaBaseClassInfoData_t *m_schema_parent; // 0x0038 - - char pad_0x0038[0x10]; // 0x0038 -}; - -class CSchemaSystemTypeScope -{ -public: - auto FindDeclaredClass(const char* pClass) -> SchemaClassInfoData_t*; -}; - -class CSchemaSystem -{ -public: - auto FindTypeScopeForModule(const char* module) ->CSchemaSystemTypeScope*; -}; \ No newline at end of file diff --git a/csgo2/native_sdk/entity/cbaseentity.cpp b/csgo2/native_sdk/entity/cbaseentity.cpp deleted file mode 100644 index 02f05ee..0000000 --- a/csgo2/native_sdk/entity/cbaseentity.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "cbaseentity.h" -bool CBaseEntity::IsBasePlayerController() { - return CALL_VIRTUAL(bool, 144, this); -} diff --git a/csgo2/native_sdk/entity/cbaseentity.h b/csgo2/native_sdk/entity/cbaseentity.h deleted file mode 100644 index af8c2c2..0000000 --- a/csgo2/native_sdk/entity/cbaseentity.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include "../../schema.h" -#include "ccollisionproperty.h" -#include "../handle/handle.h" -#include "../cgameentitysystem.h" -class CEntityIdentity; -class CEntityInstance { - public: - DECLARE_CLASS(CEntityInstance); - - auto Schema_DynamicBinding() { - SchemaClassInfoData_t* rv = nullptr; - CALL_VIRTUAL(void, 34, this, &rv); - return rv; - } - - auto GetRefEHandle() { - char* pIdentity = (char*)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(CEntityIdentity*, m_pEntity); - SCHEMA_FIELD(const char*, m_designerName); -}; - -class CBaseEntity : public CEntityInstance { - public: - DECLARE_CLASS(CBaseEntity); - - SCHEMA_FIELD(int, m_iHealth) - // SCHEMA_FIELD(Vector, m_vecBaseVelocity) - SCHEMA_FIELD(CCollisionProperty*, m_pCollision) - bool IsBasePlayerController(); -}; diff --git a/csgo2/native_sdk/entity/cbaseplayercontroller.h b/csgo2/native_sdk/entity/cbaseplayercontroller.h deleted file mode 100644 index e679377..0000000 --- a/csgo2/native_sdk/entity/cbaseplayercontroller.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once -#include "../../pch.h" -#include "../handle/handle.h" -#include "cbaseentity.h" -#include "sdk/tier1/UtlString.hpp" -class CBasePlayerController : public CBaseEntity { - public: - DECLARE_CLASS(CBasePlayerController); - - SCHEMA_FIELD(uint64_t, m_steamID) - SCHEMA_FIELD(CHandle, m_hPawn) - SCHEMA_FIELD(char, m_iszPlayerName) - SCHEMA_FIELD(CUtlString, m_szNetworkIDString) -}; - -class CCSPlayerController : public CBasePlayerController { - public: - DECLARE_CLASS(CCSPlayerController) - - SCHEMA_FIELD(uint32_t, m_iPawnHealth) - SCHEMA_FIELD(bool, m_bPawnIsAlive) - SCHEMA_FIELD(const char*, m_szClanName) -}; diff --git a/csgo2/native_sdk/entity/cbaseplayerpawn.h b/csgo2/native_sdk/entity/cbaseplayerpawn.h deleted file mode 100644 index 9cc9f23..0000000 --- a/csgo2/native_sdk/entity/cbaseplayerpawn.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "cbaseentity.h" -#include "services.h" - -class CBasePlayerPawn : public CBaseEntity -{ -public: - DECLARE_CLASS(CBasePlayerPawn); - - SCHEMA_FIELD(CPlayer_MovementServices*, m_pMovementServices) - SCHEMA_FIELD(uint8*, m_pWeaponServices) - SCHEMA_FIELD(uint8**, m_pItemServices) -}; \ No newline at end of file diff --git a/csgo2/native_sdk/entity/ccollisionproperty.h b/csgo2/native_sdk/entity/ccollisionproperty.h deleted file mode 100644 index fae053e..0000000 --- a/csgo2/native_sdk/entity/ccollisionproperty.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "../../pch.h" -#include "../../schema.h" - -struct VPhysicsCollisionAttribute_t -{ - DECLARE_CLASS(VPhysicsCollisionAttribute_t) - - SCHEMA_FIELD(uint8_t, m_nCollisionGroup) -}; - -class CCollisionProperty -{ -public: - DECLARE_CLASS(CCollisionProperty) - - SCHEMA_FIELD(VPhysicsCollisionAttribute_t, m_collisionAttribute) - //SCHEMA_FIELD(SolidType_t, m_nSolidType) - SCHEMA_FIELD(uint8_t, m_usSolidFlags) - SCHEMA_FIELD(uint8_t, m_CollisionGroup) -}; \ No newline at end of file diff --git a/csgo2/native_sdk/entity/ccsplayercontroller.h b/csgo2/native_sdk/entity/ccsplayercontroller.h deleted file mode 100644 index 8b08ccc..0000000 --- a/csgo2/native_sdk/entity/ccsplayercontroller.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "cbaseplayercontroller.h" -#include "services.h" - -class CCSPlayerController : public CBasePlayerController -{ -public: - DECLARE_CLASS(CCSPlayerController); - - SCHEMA_FIELD(CCSPlayerController_InGameMoneyServices*, m_pInGameMoneyServices) -}; \ No newline at end of file diff --git a/csgo2/native_sdk/entity/ccsplayerpawn.h b/csgo2/native_sdk/entity/ccsplayerpawn.h deleted file mode 100644 index 6c1f72e..0000000 --- a/csgo2/native_sdk/entity/ccsplayerpawn.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "cbaseplayerpawn.h" - -class CCSPlayerPawn : public CBasePlayerPawn -{ -public: - DECLARE_CLASS(CCSPlayerPawn); -}; \ No newline at end of file diff --git a/csgo2/native_sdk/entity/services.h b/csgo2/native_sdk/entity/services.h deleted file mode 100644 index eba7b37..0000000 --- a/csgo2/native_sdk/entity/services.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include - -#include "../schema.h" - -class CPlayer_MovementServices -{ -public: - DECLARE_CLASS(CPlayer_MovementServices); -}; - -class CCSPlayerController_InGameMoneyServices -{ -public: - DECLARE_CLASS(CCSPlayerController_InGameMoneyServices); - - SCHEMA_FIELD(int, m_iAccount) -}; \ No newline at end of file diff --git a/csgo2/native_sdk/handle/handle.cpp b/csgo2/native_sdk/handle/handle.cpp deleted file mode 100644 index 00da4bb..0000000 --- a/csgo2/native_sdk/handle/handle.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "handle.h" -#include "../cgameentitysystem.h" - -CBaseEntity* CHandle::GetBaseEntity() const -{ - CGameEntitySystem* pEntitySystem = CGameEntitySystem::GetInstance(); - if (!pEntitySystem) - return nullptr; - - return pEntitySystem->GetBaseEntity(GetEntryIndex()); -} \ No newline at end of file diff --git a/csgo2/native_sdk/handle/handle.h b/csgo2/native_sdk/handle/handle.h deleted file mode 100644 index 1e801aa..0000000 --- a/csgo2/native_sdk/handle/handle.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once -#include -#define INVALID_EHANDLE_INDEX 0xFFFFFFFF -#define ENT_ENTRY_MASK 0x7FFF -class CBaseEntity; - -class CHandle -{ - CBaseEntity* GetBaseEntity() const; - -public: - bool operator==(CHandle rhs) const { return m_Index == rhs.m_Index; } - - bool IsValid() const { return m_Index != INVALID_EHANDLE_INDEX; } - - int GetEntryIndex() const { return m_Index & ENT_ENTRY_MASK; } - - template - T* Get() const - { - return reinterpret_cast(GetBaseEntity()); - } - uint32_t m_Index; -}; \ No newline at end of file diff --git a/csgo2/offset.h b/csgo2/offset.h index 316b279..190b1a5 100644 --- a/csgo2/offset.h +++ b/csgo2/offset.h @@ -1,10 +1,8 @@ #pragma once -#include "pch.h" -#include "native_sdk/cschemasystem.h" -#include "native_sdk/cgameresourceserviceserver.h" -#include "sdk/public/eiface.h" -class CSchemaSystem; +#include "head.h" +class CSchemaSystem; +class CGameResourceService; namespace Offset { namespace InterFaces { extern CSchemaSystem* SchemaSystem; diff --git a/csgo2/pch.cpp b/csgo2/pch.cpp index 70af52d..f4be518 100644 --- a/csgo2/pch.cpp +++ b/csgo2/pch.cpp @@ -1,17 +1,3 @@ // pch.cpp: 与预编译标头对应的源文件 #include "pch.h" -void DebugPrintA(const char* format, ...) { - std::string temp; - va_list marker = { 0 }; - va_start(marker, format); - size_t num_of_chars = _vscprintf(format, marker); - if (num_of_chars > temp.capacity()) { - temp.reserve(num_of_chars + 1); - } - vsprintf_s(const_cast(temp.c_str()), num_of_chars + 1, format, - marker); - OutputDebugStringA(temp.c_str()); -} - -// 当使用预编译的头时,需要使用此源文件,编译才能成功。 diff --git a/csgo2/pch.h b/csgo2/pch.h index 9ebc366..69c6b02 100644 --- a/csgo2/pch.h +++ b/csgo2/pch.h @@ -3,35 +3,3 @@ // 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。 // 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。 // 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "framework.h" -#include "stb.hh" - -#include "memory.h" -extern void DebugPrintA(const char* format, ...); -// #define LOG DebugPrintA -#define LOG(...) printf(__VA_ARGS__) -#define THE_GAME_SIG(sig) \ - stb::simple_conversion::build::value -#include "vmt.h" - -#include "./MinHook/include/MinHook.h" -#include "sdk/sdk.h" -#include "interface.h" -#include "module.h" -#include "hash_fnv1a_constexpr.h" -#include "global.h" - -#include "offset.h" -#include "events.h" -#include "hooks.h" -#include "vmthook.h" diff --git a/csgo2/player.cpp b/csgo2/player.cpp deleted file mode 100644 index 23fb848..0000000 --- a/csgo2/player.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "player.h" - -auto CBasePlayer::ForceRespawn() -> void -{ - return CALL_VIRTUAL(void, 26, this); -} \ No newline at end of file diff --git a/csgo2/player.h b/csgo2/player.h deleted file mode 100644 index b4b345a..0000000 --- a/csgo2/player.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once -#include "pch.h" -#include "schema.h" -#include "native_sdk/entity/cbaseentity.h" -#include "sdk/player/playerslot.h" - -class CBasePlayer { - public: - auto ForceRespawn() -> void; -}; - -class CPlayer_MovementServices { - public: - DECLARE_CLASS(CPlayer_MovementServices); -}; - -class CCSPlayerController_InGameMoneyServices { - public: - DECLARE_CLASS(CCSPlayerController_InGameMoneyServices); - - SCHEMA_FIELD(int, m_iAccount) -}; -class CBasePlayerPawn : public CBaseEntity { - public: - DECLARE_CLASS(CBasePlayerPawn); - - SCHEMA_FIELD(CPlayer_MovementServices*, m_pMovementServices) - SCHEMA_FIELD(uint8_t*, m_pWeaponServices) - SCHEMA_FIELD(uint8_t**, m_pItemServices) -}; -class CCSPlayerPawn : public CBasePlayerPawn { - public: - DECLARE_CLASS(CCSPlayerPawn); - SCHEMA_FIELD(const char*, m_szLastPlaceName) -}; diff --git a/csgo2/player_manager.cpp b/csgo2/player_manager.cpp index d76d5b2..90ff9fa 100644 --- a/csgo2/player_manager.cpp +++ b/csgo2/player_manager.cpp @@ -1,5 +1,4 @@ #include "player_manager.h" -#include "native_sdk/cgameentitysystem.h" namespace ExtendPlayerManager { std::shared_mutex mutex_Table_PlayerSteamIdPlayerSlot; diff --git a/csgo2/player_manager.h b/csgo2/player_manager.h index 2dc739c..9e7b19d 100644 --- a/csgo2/player_manager.h +++ b/csgo2/player_manager.h @@ -1,6 +1,5 @@ #pragma once -#include "pch.h" -#include "sdk/player/playerslot.h" +#include "head.h" namespace ExtendPlayerManager { auto AddSteamIdToPlayerSteamIdWithNameTable(uint64_t SteamId, uint64_t PlayerSlot) -> void; diff --git a/csgo2/schema.h b/csgo2/schema.h deleted file mode 100644 index 8b0bd3e..0000000 --- a/csgo2/schema.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -#include "pch.h" -typedef void(__fastcall* FnNetworkStateChanged)(uintptr_t chainEntity, uintptr_t offset, uintptr_t a3); - -#define SCHEMA_FIELD_OFFSET(type, varName, extra_offset) \ - std::add_lvalue_reference_t varName() \ - { \ - static constexpr auto datatable_hash = hash_32_fnv1a_const(ThisClass); \ - static constexpr auto prop_hash = hash_32_fnv1a_const(#varName); \ - \ - static const auto m_offset = \ - schema::GetOffset(ThisClass, datatable_hash, #varName, prop_hash); \ - \ - return *reinterpret_cast>( \ - (uintptr_t)(this) + m_offset + extra_offset); \ - } \ - void varName(type val) \ - { \ - static constexpr auto datatable_hash = hash_32_fnv1a_const(ThisClass); \ - static constexpr auto prop_hash = hash_32_fnv1a_const(#varName); \ - \ - static const auto m_offset = \ - schema::GetOffset(ThisClass, datatable_hash, #varName, prop_hash); \ - \ - static const auto m_chain = \ - schema::FindChainOffset(ThisClass); \ - \ - if (m_chain != 0) \ - { \ - reinterpret_cast(Offset::NetworkStateChangedPtr)((uintptr_t)(this) + m_chain, m_offset + extra_offset, 0xFFFFFFFF); \ - } \ - *reinterpret_cast>((uintptr_t)(this) + m_offset + extra_offset) = val; \ - } - -#define SCHEMA_FIELD(type, varName) \ - SCHEMA_FIELD_OFFSET(type, varName, 0) - -#define PSCHEMA_FIELD_OFFSET(type, varName, extra_offset) \ - auto varName() \ - { \ - static constexpr auto datatable_hash = hash_32_fnv1a_const(ThisClass); \ - static constexpr auto prop_hash = hash_32_fnv1a_const(#varName); \ - \ - static const auto m_offset = \ - schema::GetOffset(ThisClass, datatable_hash, #varName, prop_hash); \ - \ - return reinterpret_cast>( \ - (uintptr_t)(this) + m_offset + extra_offset); \ - } - -#define PSCHEMA_FIELD(type, varName) \ - PSCHEMA_FIELD_OFFSET(type, varName, 0) - -namespace schema -{ - int16_t FindChainOffset(const char* className); - int16_t GetOffset(const char* className, uint32_t classKey, const char* memberName, uint32_t memberKey); -} - -#define DECLARE_CLASS(className) static constexpr auto ThisClass = #className; diff --git a/csgo2/sdk/interfaces/interfaces.h b/csgo2/sdk/interfaces/interfaces.h index e3f3437..735d120 100644 --- a/csgo2/sdk/interfaces/interfaces.h +++ b/csgo2/sdk/interfaces/interfaces.h @@ -1,3 +1,4 @@ +#pragma once #include "../sdk.h" class IBaseInterface { diff --git a/csgo2/sdk/sdk.h b/csgo2/sdk/sdk.h index 98651b2..156d39a 100644 --- a/csgo2/sdk/sdk.h +++ b/csgo2/sdk/sdk.h @@ -29,4 +29,4 @@ enum EUniverse // k_EUniverseRC = 5, // no such universe anymore k_EUniverseMax }; -#include "../pch.h" \ No newline at end of file +#include "../head.h" \ No newline at end of file diff --git a/csgo2/sdk_tools.cpp b/csgo2/sdk_tools.cpp new file mode 100644 index 0000000..7312bd5 --- /dev/null +++ b/csgo2/sdk_tools.cpp @@ -0,0 +1,34 @@ +#include "sdk_tools.h" + +namespace SdkTools { + auto ProcessChatString(const std::string& input) -> std::tuple + { + _ChatType chatType; + std::string content; + bool success = true; + // Ƿ "say_team" "say" ͷ + if (input.size() >= 9 && input.substr(0, 9) == "say_team ") { + chatType = _ChatType::kTeam; + content = input.substr(9); + } + else if (input.size() >= 5 && input.substr(0, 4) == "say ") { + chatType = _ChatType::kAll; + content = input.substr(4); + } + else { + success = false; + } + if (success == true) { + // ǷŰΧ + if (content.front() != '"' || content.back() != '"') { + success = false; + } + else { + // Ƴ + content = content.substr(1, content.size() - 2); + } + } + + return std::make_tuple(success, chatType, content); + } +}; \ No newline at end of file diff --git a/csgo2/sdk_tools.h b/csgo2/sdk_tools.h new file mode 100644 index 0000000..8f8c06e --- /dev/null +++ b/csgo2/sdk_tools.h @@ -0,0 +1,10 @@ +#pragma once +#include "head.h" +enum _ChatType +{ + kTeam, + kAll +}; +namespace SdkTools { + auto ProcessChatString(const std::string& input) -> std::tuple; +}; \ No newline at end of file diff --git a/csgo2/vmt.cpp b/csgo2/vmt.cpp new file mode 100644 index 0000000..3761dc6 --- /dev/null +++ b/csgo2/vmt.cpp @@ -0,0 +1,14 @@ +#include "vmt.h" +namespace vmt { + template + inline T GetVMethod(uint32_t uIndex, void* pClass) { + void** pVTable = *static_cast(pClass); + return reinterpret_cast(pVTable[uIndex]); + } + + template + inline T CallVirtual(uint32_t uIndex, void* pClass, Args... args) { + auto pFunc = GetVMethod(uIndex, pClass); + return pFunc(pClass, args...); + } +} // namespace vmt diff --git a/csgo2/vmt.h b/csgo2/vmt.h index de1ebd7..dbaa370 100644 --- a/csgo2/vmt.h +++ b/csgo2/vmt.h @@ -1,5 +1,5 @@ #pragma once -#include "pch.h" +#include "head.h" #define CALL_VIRTUAL(retType, idx, ...) \ vmt::CallVirtual(idx, __VA_ARGS__) diff --git a/csgo2/VTHook.cpp b/csgo2/vmthook.cpp similarity index 92% rename from csgo2/VTHook.cpp rename to csgo2/vmthook.cpp index 647df35..f233ccb 100644 --- a/csgo2/VTHook.cpp +++ b/csgo2/vmthook.cpp @@ -3,14 +3,12 @@ VMTHook::VMTHook(void* vmt_addy) { vmt = (void**)vmt_addy; - LOG("vmt: %p \n", vmt); } void* VMTHook::Hook(int index, void* hk) { // Store the index and original function address hooked_funcs.insert(std::make_pair(index, vmt[index])); - LOG("%s vmt[index]: %p \n", __FUNCTION__ ,vmt[index]); // Change the memory's access rights, patch the address to our hook, restore original rights DWORD old; diff --git a/csgo2/vmthook.h b/csgo2/vmthook.h index 7d90a65..9f26d9e 100644 --- a/csgo2/vmthook.h +++ b/csgo2/vmthook.h @@ -1,8 +1,7 @@ #pragma once //form https://www.unknowncheats.me/forum/c-and-c-/188449-vmt-hooking-class.html - -#include "pch.h" - +#include +#include class VMTHook { public: @@ -10,7 +9,6 @@ public: void** vmt = nullptr; // Pointer to the VMT, we're using it more as an array of void* VMTHook(void* vmt); // Hook original VMT by it's address - VMTHook(DWORD64* vmt_ptr); // Create Shadow VMT from VMT pointer ( Not implemented here ) ~VMTHook(); // Destructor, removes all hooks void* Hook(int index, void* hk);