统一native_sdk
This commit is contained in:
@@ -158,6 +158,7 @@
|
||||
<ClInclude Include="events.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="global.h" />
|
||||
<ClInclude Include="head.h" />
|
||||
<ClInclude Include="hooks.h" />
|
||||
<ClInclude Include="interface.h" />
|
||||
<ClInclude Include="math\types\vector.hpp" />
|
||||
@@ -172,17 +173,10 @@
|
||||
<ClInclude Include="MinHook\src\HDE\table64.h" />
|
||||
<ClInclude Include="MinHook\src\trampoline.h" />
|
||||
<ClInclude Include="module.h" />
|
||||
<ClInclude Include="native_sdk\cgameentitysystem.h" />
|
||||
<ClInclude Include="native_sdk\cgameresourceserviceserver.h" />
|
||||
<ClInclude Include="native_sdk\cschemasystem.h" />
|
||||
<ClInclude Include="native_sdk\entity\cbaseentity.h" />
|
||||
<ClInclude Include="native_sdk\entity\cbaseplayercontroller.h" />
|
||||
<ClInclude Include="native_sdk\handle\handle.h" />
|
||||
<ClInclude Include="native_sdk.h" />
|
||||
<ClInclude Include="offset.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="player.h" />
|
||||
<ClInclude Include="player_manager.h" />
|
||||
<ClInclude Include="schema.h" />
|
||||
<ClInclude Include="sdk\convar\convar.hpp" />
|
||||
<ClInclude Include="sdk\gameevent\IGameEvent.h" />
|
||||
<ClInclude Include="sdk\handle\basehandle.h" />
|
||||
@@ -196,6 +190,7 @@
|
||||
<ClInclude Include="sdk\tier1\UtlMemory.hpp" />
|
||||
<ClInclude Include="sdk\tier1\UtlString.hpp" />
|
||||
<ClInclude Include="sdk\tier1\UtlVector.hpp" />
|
||||
<ClInclude Include="sdk_tools.h" />
|
||||
<ClInclude Include="stb.hh" />
|
||||
<ClInclude Include="vmt.h" />
|
||||
<ClInclude Include="vmthook.h" />
|
||||
@@ -212,10 +207,7 @@
|
||||
<ClCompile Include="MinHook\src\HDE\hde64.c" />
|
||||
<ClCompile Include="MinHook\src\hook.c" />
|
||||
<ClCompile Include="MinHook\src\trampoline.c" />
|
||||
<ClCompile Include="native_sdk\cgameentitysystem.cpp" />
|
||||
<ClCompile Include="native_sdk\cschemasystem.cpp" />
|
||||
<ClCompile Include="native_sdk\entity\cbaseentity.cpp" />
|
||||
<ClCompile Include="native_sdk\handle\handle.cpp" />
|
||||
<ClCompile Include="native_sdk.cpp" />
|
||||
<ClCompile Include="offset.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
@@ -223,12 +215,11 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="player.cpp" />
|
||||
<ClCompile Include="player_manager.cpp" />
|
||||
<ClCompile Include="schema.cpp" />
|
||||
<ClCompile Include="sdk\convar\convar.cpp" />
|
||||
<ClCompile Include="sdk\tier1\UtlString.cpp" />
|
||||
<ClCompile Include="VTHook.cpp" />
|
||||
<ClCompile Include="sdk_tools.cpp" />
|
||||
<ClCompile Include="vmthook.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
|
||||
@@ -49,27 +49,9 @@
|
||||
<Filter Include="源文件\native_sdk">
|
||||
<UniqueIdentifier>{c28f9f29-7571-4821-9cbd-11f27692566a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\native_sdk\interfaces">
|
||||
<UniqueIdentifier>{e26bdf5e-ad8d-4ed2-965c-1fdb958a6098}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="头文件\native_sdk">
|
||||
<UniqueIdentifier>{c5938a38-9035-4f7a-952c-156a8549bb54}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="头文件\native_sdk\interfaces">
|
||||
<UniqueIdentifier>{ec02337e-1abc-42a9-b29c-355278bf4bf2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\native_sdk\entity">
|
||||
<UniqueIdentifier>{6c9da4be-92c5-4504-8c46-ab0cc612bfe5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="头文件\native_sdk\entity">
|
||||
<UniqueIdentifier>{f1101bd0-b17e-4c9e-87f1-e34d97979e77}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="头文件\native_sdk\handle">
|
||||
<UniqueIdentifier>{63beb427-0b96-4062-83e0-752efb2ed5f0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\native_sdk\handle">
|
||||
<UniqueIdentifier>{68556c7c-97c0-4e1e-82f0-e4b45b9ad40d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="头文件\sdk\convar">
|
||||
<UniqueIdentifier>{befb97b4-a3ba-48a8-84a8-c36a74d2d48c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -168,33 +150,9 @@
|
||||
<ClInclude Include="sdk\interfaces\interfaces.h">
|
||||
<Filter>头文件\sdk\interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="schema.h">
|
||||
<Filter>头文件\native_sdk\interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="native_sdk\cschemasystem.h">
|
||||
<Filter>头文件\native_sdk\interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="native_sdk\cgameentitysystem.h">
|
||||
<Filter>头文件\native_sdk\interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="native_sdk\entity\cbaseentity.h">
|
||||
<Filter>头文件\native_sdk\entity</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vmthook.h">
|
||||
<Filter>头文件\memory</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="native_sdk\entity\cbaseplayercontroller.h">
|
||||
<Filter>头文件\native_sdk\entity</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="native_sdk\handle\handle.h">
|
||||
<Filter>头文件\native_sdk\handle</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="player.h">
|
||||
<Filter>头文件\native_sdk\entity</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="native_sdk\cgameresourceserviceserver.h">
|
||||
<Filter>头文件\native_sdk\interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\convar\convar.hpp">
|
||||
<Filter>头文件\sdk\convar</Filter>
|
||||
</ClInclude>
|
||||
@@ -219,6 +177,15 @@
|
||||
<ClInclude Include="player_manager.h">
|
||||
<Filter>头文件\players</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="head.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="native_sdk.h">
|
||||
<Filter>头文件\native_sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk_tools.h">
|
||||
<Filter>头文件\native_sdk</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
@@ -260,24 +227,9 @@
|
||||
<ClCompile Include="events.cpp">
|
||||
<Filter>源文件\events</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="schema.cpp">
|
||||
<Filter>源文件\native_sdk\interfaces</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VTHook.cpp">
|
||||
<ClCompile Include="vmthook.cpp">
|
||||
<Filter>源文件\memory</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="native_sdk\cschemasystem.cpp">
|
||||
<Filter>源文件\native_sdk\interfaces</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="native_sdk\cgameentitysystem.cpp">
|
||||
<Filter>源文件\native_sdk\interfaces</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="player.cpp">
|
||||
<Filter>源文件\native_sdk\entity</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="native_sdk\handle\handle.cpp">
|
||||
<Filter>源文件\native_sdk\handle</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sdk\convar\convar.cpp">
|
||||
<Filter>头文件\sdk\convar</Filter>
|
||||
</ClCompile>
|
||||
@@ -287,8 +239,11 @@
|
||||
<ClCompile Include="player_manager.cpp">
|
||||
<Filter>源文件\players</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="native_sdk\entity\cbaseentity.cpp">
|
||||
<Filter>源文件\native_sdk\entity</Filter>
|
||||
<ClCompile Include="native_sdk.cpp">
|
||||
<Filter>源文件\native_sdk</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sdk_tools.cpp">
|
||||
<Filter>源文件\native_sdk</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// dllmain.cpp : 定义 DLL 应用程序的入口点。
|
||||
#include "pch.h"
|
||||
#include "head.h"
|
||||
|
||||
auto unload() -> void {
|
||||
hooks::unload();
|
||||
|
||||
@@ -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<CCSPlayerPawn*>(
|
||||
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<CCSPlayerController*>(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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "head.h"
|
||||
namespace global {
|
||||
extern bool Exit;
|
||||
extern int MaxPlayers;
|
||||
|
||||
62
csgo2/head.h
Normal file
62
csgo2/head.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <array>
|
||||
#include <Windows.h>
|
||||
#include <Psapi.h>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <shared_mutex>
|
||||
#include <sstream>
|
||||
#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<char*>(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<stb::fixed_string{sig}>::value
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#include "./MinHook/include/MinHook.h"
|
||||
#include "hash_fnv1a_constexpr.h"
|
||||
//<2F><><EFBFBD>߿<EFBFBD>
|
||||
|
||||
#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"
|
||||
@@ -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<CCSPlayerController*>(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,
|
||||
|
||||
@@ -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*);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "head.h"
|
||||
namespace interfaces {
|
||||
|
||||
} // namespace interfaces
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "head.h"
|
||||
namespace interfaces {
|
||||
|
||||
} // namespace interfaces
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "head.h"
|
||||
namespace Memory {
|
||||
template<class T>
|
||||
void write(uintptr_t address, T value)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "head.h"
|
||||
#define IS_WINDOWS 1
|
||||
class InterfaceReg;
|
||||
// Pointer arithmetic utility class.
|
||||
|
||||
@@ -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<CCSPlayerController*>(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<uint32_t, int16_t>;
|
||||
using SchemaTableMap_t = std::unordered_map<uint32_t, SchemaKeyValueMap_t>;
|
||||
|
||||
334
csgo2/native_sdk.h
Normal file
334
csgo2/native_sdk.h
Normal file
@@ -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<type> 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<std::add_pointer_t<type>>( \
|
||||
(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<FnNetworkStateChanged>(Offset::NetworkStateChangedPtr)((uintptr_t)(this) + m_chain, m_offset + extra_offset, 0xFFFFFFFF); \
|
||||
} \
|
||||
*reinterpret_cast<std::add_pointer_t<type>>((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<std::add_pointer_t<type>>( \
|
||||
(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 <typename T = CBaseEntity>
|
||||
T* Get() const
|
||||
{
|
||||
return reinterpret_cast<T*>(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<CGameEntitySystem**>((uintptr_t)(this) + 0x58);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
#include "cgameentitysystem.h"
|
||||
#include "../pch.h"
|
||||
|
||||
CGameEntitySystem* CGameEntitySystem::GetInstance(){
|
||||
return Offset::InterFaces::GameResourceServiceServer->GetGameEntitySystem();
|
||||
}
|
||||
@@ -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();
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
#include "../pch.h"
|
||||
class CGameEntitySystem;
|
||||
|
||||
class CGameResourceService
|
||||
{
|
||||
public:
|
||||
CGameEntitySystem *GetGameEntitySystem()
|
||||
{
|
||||
return *reinterpret_cast<CGameEntitySystem **>((uintptr_t)(this) + 0x58);
|
||||
}
|
||||
};
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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*;
|
||||
};
|
||||
@@ -1,4 +0,0 @@
|
||||
#include "cbaseentity.h"
|
||||
bool CBaseEntity::IsBasePlayerController() {
|
||||
return CALL_VIRTUAL(bool, 144, this);
|
||||
}
|
||||
@@ -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();
|
||||
};
|
||||
@@ -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)
|
||||
};
|
||||
@@ -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)
|
||||
};
|
||||
@@ -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)
|
||||
};
|
||||
@@ -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)
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "cbaseplayerpawn.h"
|
||||
|
||||
class CCSPlayerPawn : public CBasePlayerPawn
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(CCSPlayerPawn);
|
||||
};
|
||||
@@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
#include <platform.h>
|
||||
|
||||
#include "../schema.h"
|
||||
|
||||
class CPlayer_MovementServices
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(CPlayer_MovementServices);
|
||||
};
|
||||
|
||||
class CCSPlayerController_InGameMoneyServices
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(CCSPlayerController_InGameMoneyServices);
|
||||
|
||||
SCHEMA_FIELD(int, m_iAccount)
|
||||
};
|
||||
@@ -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());
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#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 <typename T = CBaseEntity>
|
||||
T* Get() const
|
||||
{
|
||||
return reinterpret_cast<T*>(GetBaseEntity());
|
||||
}
|
||||
uint32_t m_Index;
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
@@ -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<char*>(temp.c_str()), num_of_chars + 1, format,
|
||||
marker);
|
||||
OutputDebugStringA(temp.c_str());
|
||||
}
|
||||
|
||||
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
|
||||
|
||||
32
csgo2/pch.h
32
csgo2/pch.h
@@ -3,35 +3,3 @@
|
||||
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
|
||||
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
|
||||
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
|
||||
#include <string>
|
||||
#include <array>
|
||||
#include <Windows.h>
|
||||
#include <Psapi.h>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <shared_mutex>
|
||||
#include <sstream>
|
||||
|
||||
#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<stb::fixed_string{sig}>::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"
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#include "player.h"
|
||||
|
||||
auto CBasePlayer::ForceRespawn() -> void
|
||||
{
|
||||
return CALL_VIRTUAL(void, 26, this);
|
||||
}
|
||||
@@ -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)
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "player_manager.h"
|
||||
#include "native_sdk/cgameentitysystem.h"
|
||||
namespace ExtendPlayerManager {
|
||||
std::shared_mutex mutex_Table_PlayerSteamIdPlayerSlot;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<type> 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<std::add_pointer_t<type>>( \
|
||||
(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<FnNetworkStateChanged>(Offset::NetworkStateChangedPtr)((uintptr_t)(this) + m_chain, m_offset + extra_offset, 0xFFFFFFFF); \
|
||||
} \
|
||||
*reinterpret_cast<std::add_pointer_t<type>>((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<std::add_pointer_t<type>>( \
|
||||
(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;
|
||||
@@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#include "../sdk.h"
|
||||
class IBaseInterface
|
||||
{
|
||||
|
||||
@@ -29,4 +29,4 @@ enum EUniverse
|
||||
// k_EUniverseRC = 5, // no such universe anymore
|
||||
k_EUniverseMax
|
||||
};
|
||||
#include "../pch.h"
|
||||
#include "../head.h"
|
||||
34
csgo2/sdk_tools.cpp
Normal file
34
csgo2/sdk_tools.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "sdk_tools.h"
|
||||
|
||||
namespace SdkTools {
|
||||
auto ProcessChatString(const std::string& input) -> std::tuple<bool, _ChatType, std::string>
|
||||
{
|
||||
_ChatType chatType;
|
||||
std::string content;
|
||||
bool success = true;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD> "say_team" <20><> "say" <20><>ͷ
|
||||
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) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ű<EFBFBD>Χ
|
||||
if (content.front() != '"' || content.back() != '"') {
|
||||
success = false;
|
||||
}
|
||||
else {
|
||||
// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>
|
||||
content = content.substr(1, content.size() - 2);
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_tuple(success, chatType, content);
|
||||
}
|
||||
};
|
||||
10
csgo2/sdk_tools.h
Normal file
10
csgo2/sdk_tools.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "head.h"
|
||||
enum _ChatType
|
||||
{
|
||||
kTeam,
|
||||
kAll
|
||||
};
|
||||
namespace SdkTools {
|
||||
auto ProcessChatString(const std::string& input) -> std::tuple<bool, _ChatType, std::string>;
|
||||
};
|
||||
14
csgo2/vmt.cpp
Normal file
14
csgo2/vmt.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "vmt.h"
|
||||
namespace vmt {
|
||||
template <typename T = void*>
|
||||
inline T GetVMethod(uint32_t uIndex, void* pClass) {
|
||||
void** pVTable = *static_cast<void***>(pClass);
|
||||
return reinterpret_cast<T>(pVTable[uIndex]);
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
inline T CallVirtual(uint32_t uIndex, void* pClass, Args... args) {
|
||||
auto pFunc = GetVMethod<T(__thiscall*)(void*, Args...)>(uIndex, pClass);
|
||||
return pFunc(pClass, args...);
|
||||
}
|
||||
} // namespace vmt
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "head.h"
|
||||
|
||||
#define CALL_VIRTUAL(retType, idx, ...) \
|
||||
vmt::CallVirtual<retType>(idx, __VA_ARGS__)
|
||||
|
||||
@@ -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;
|
||||
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
//form https://www.unknowncheats.me/forum/c-and-c-/188449-vmt-hooking-class.html
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include <map>
|
||||
#include <Windows.h>
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user