增加loader
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
@@ -79,10 +80,14 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(MSBuildProjectDirectory)\sdk\protobuf-2.6.1\src;$(MSBuildProjectDirectory)\LuaBridge;$(IncludePath)</IncludePath>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(MSBuildProjectDirectory)\sdk\protobuf-2.6.1\src;$(MSBuildProjectDirectory)\LuaBridge;$(IncludePath)</IncludePath>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@@ -214,8 +219,10 @@
|
||||
<ClInclude Include="sdk\player\player.h" />
|
||||
<ClInclude Include="sdk\player\playerslot.h" />
|
||||
<ClInclude Include="sdk\public\bitvec.h" />
|
||||
<ClInclude Include="sdk\public\color.h" />
|
||||
<ClInclude Include="sdk\public\eiface.h" />
|
||||
<ClInclude Include="sdk\public\IAppSystem.h" />
|
||||
<ClInclude Include="sdk\public\icvar.h" />
|
||||
<ClInclude Include="sdk\public\irecipientfilter.h" />
|
||||
<ClInclude Include="sdk\public\iserver.h" />
|
||||
<ClInclude Include="sdk\public\mathlib.h" />
|
||||
@@ -223,6 +230,7 @@
|
||||
<ClInclude Include="sdk\public\string_t.h" />
|
||||
<ClInclude Include="sdk\public\utlmap.h" />
|
||||
<ClInclude Include="sdk\public\utlrbtree.h" />
|
||||
<ClInclude Include="sdk\public\Vector_Sdk.h" />
|
||||
<ClInclude Include="sdk\sdk.h" />
|
||||
<ClInclude Include="sdk\tier1\bufferstring.h" />
|
||||
<ClInclude Include="sdk\tier1\cbyteswap.h" />
|
||||
@@ -305,14 +313,19 @@
|
||||
<ClCompile Include="sdk_tools.cpp" />
|
||||
<ClCompile Include="timer.cpp" />
|
||||
<ClCompile Include="tools.cpp" />
|
||||
<ClCompile Include="version_hijack.cpp" />
|
||||
<ClCompile Include="vmthook.cpp" />
|
||||
<ClCompile Include="weapon.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
<None Include="lua\Makefile" />
|
||||
<MASM Include="version_jump.asm">
|
||||
<FileType>Document</FileType>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -82,6 +82,9 @@
|
||||
<Filter Include="头文件\game_time_system">
|
||||
<UniqueIdentifier>{f26913ae-881a-43da-a215-8c0c7a9173cd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\hijack">
|
||||
<UniqueIdentifier>{23cedcbc-aa1d-444b-baf2-0f55c87c525e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
@@ -342,6 +345,15 @@
|
||||
<ClInclude Include="sdk\tier1\cbyteswap.h">
|
||||
<Filter>头文件\sdk\tier1</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\public\icvar.h">
|
||||
<Filter>头文件\sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\public\color.h">
|
||||
<Filter>头文件\sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\public\Vector_Sdk.h">
|
||||
<Filter>头文件\sdk\public</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
@@ -521,6 +533,9 @@
|
||||
<ClCompile Include="weapon.cpp">
|
||||
<Filter>源文件\native_sdk</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="version_hijack.cpp">
|
||||
<Filter>源文件\hijack</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
@@ -528,4 +543,9 @@
|
||||
<Filter>头文件\lua</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="version_jump.asm">
|
||||
<Filter>源文件\hijack</Filter>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -54,12 +54,14 @@ auto init(void* ctx) -> bool {
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
extern BOOL APIENTRY VersionHijack_DllMain(HMODULE hModule, DWORD dwReason, PVOID pvReserved);
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved) {
|
||||
bool result = true;
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
// 有vac
|
||||
//VersionHijack_DllMain(hModule, ul_reason_for_call, lpReserved);
|
||||
CreateThread(NULL, 0,
|
||||
reinterpret_cast<LPTHREAD_START_ROUTINE>(init),
|
||||
NULL, 0, NULL);
|
||||
|
||||
@@ -1,6 +1,48 @@
|
||||
#include "events.h"
|
||||
|
||||
namespace events {
|
||||
auto OnRoundEndEvent(IGameEvent* event) -> void {
|
||||
/*
|
||||
"winner" "byte" // winner team/user i
|
||||
"reason" "byte" // reson why team won
|
||||
"message" "string" // end round message
|
||||
*/
|
||||
|
||||
UnkGameEventStruct_t winnerNameParams{0};
|
||||
UnkGameEventStruct_t reasonNameParams{0};
|
||||
UnkGameEventStruct_t messageNameParams{0};
|
||||
|
||||
static const auto winnerStr = "winner";
|
||||
static const auto reasonStr = "reason";
|
||||
static const auto messageStr = "message";
|
||||
|
||||
winnerNameParams.m_Unk = Offset::FnServerHashFunction(
|
||||
winnerStr, sizeof winnerStr, SERVER_HASH_FUCNTION_KEY);
|
||||
winnerNameParams.m_Key = winnerStr;
|
||||
|
||||
reasonNameParams.m_Unk = Offset::FnServerHashFunction(
|
||||
reasonStr, sizeof reasonStr, SERVER_HASH_FUCNTION_KEY);
|
||||
reasonNameParams.m_Key = reasonStr;
|
||||
|
||||
messageNameParams.m_Unk = Offset::FnServerHashFunction(
|
||||
messageStr, sizeof messageStr, SERVER_HASH_FUCNTION_KEY);
|
||||
messageNameParams.m_Key = messageStr;
|
||||
|
||||
const auto message = event->GetString(&messageNameParams);
|
||||
const auto winner = event->GetInt(&winnerNameParams);
|
||||
const auto reason = event->GetInt(&reasonNameParams);
|
||||
|
||||
ScriptCallBacks::luaCall_onRoundEnd(winner, reason, message);
|
||||
}
|
||||
auto OnRoundStartEvent(IGameEvent* event) -> void {
|
||||
UnkGameEventStruct_t timelimitNameParams{0};
|
||||
static const auto timelimitStr = "timelimit";
|
||||
timelimitNameParams.m_Unk = Offset::FnServerHashFunction(
|
||||
timelimitStr, sizeof timelimitStr, SERVER_HASH_FUCNTION_KEY);
|
||||
timelimitNameParams.m_Key = timelimitStr;
|
||||
const auto timelimit = event->GetInt(&timelimitNameParams);
|
||||
ScriptCallBacks::luaCall_onRoundStart(timelimit);
|
||||
}
|
||||
auto OnPlayerSpawnEvent(IGameEvent* event) -> void {
|
||||
UnkGameEventStruct_t userIdNameParams{"userid"};
|
||||
const auto playerPawn = reinterpret_cast<CCSPlayerPawn*>(
|
||||
|
||||
@@ -11,4 +11,6 @@ auto OnPlayerDisconnect(int slot, const char* pszName, uint64_t xuid,
|
||||
const char* pszNetworkID, const char* pszAddress,
|
||||
bool bFakePlayer) -> void;
|
||||
auto OnPlayerSpawnEvent(IGameEvent* event) -> void;
|
||||
auto OnRoundStartEvent(IGameEvent* event) -> void;
|
||||
auto OnRoundEndEvent(IGameEvent* event) -> void;
|
||||
} // namespace events
|
||||
|
||||
@@ -130,6 +130,8 @@ bool __fastcall hook_FireEventServerSide(CGameEventManager* rcx,
|
||||
static constexpr auto player_chat = hash_32_fnv1a_const("player_chat");
|
||||
static constexpr auto player_spawn =
|
||||
hash_32_fnv1a_const("player_spawn");
|
||||
static constexpr auto round_start = hash_32_fnv1a_const("round_start");
|
||||
static constexpr auto round_end = hash_32_fnv1a_const("round_end");
|
||||
|
||||
switch (hash_32_fnv1a_const(eventName)) {
|
||||
case player_death:
|
||||
@@ -138,6 +140,12 @@ bool __fastcall hook_FireEventServerSide(CGameEventManager* rcx,
|
||||
case player_spawn:
|
||||
events::OnPlayerSpawnEvent(event);
|
||||
break;
|
||||
case round_start:
|
||||
events::OnRoundStartEvent(event);
|
||||
break;
|
||||
case round_end:
|
||||
events::OnRoundEndEvent(event);
|
||||
break;
|
||||
// V<><56>bug,<2C>ⲻ<EFBFBD><E2B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/*
|
||||
case player_chat:
|
||||
|
||||
@@ -23,8 +23,15 @@ auto CSchemaSystem::FindTypeScopeForModule(const char* module)
|
||||
}
|
||||
|
||||
auto CBaseEntity::IsBasePlayerController() -> bool {
|
||||
return true;
|
||||
//return CALL_VIRTUAL(bool, 146, this);
|
||||
SchemaClassInfoData_t* pClassInfo = Schema_DynamicBinding();
|
||||
if (!pClassInfo) return false;
|
||||
|
||||
const char* className = pClassInfo->GetName();
|
||||
if (!className) return false;
|
||||
static constexpr auto C_CCSPlayerController = hash_32_fnv1a_const("CCSPlayerController");
|
||||
static constexpr auto C_CCSPlayerPawn = hash_32_fnv1a_const("CCSPlayerPawn");
|
||||
|
||||
return hash_32_fnv1a_const(className) == C_CCSPlayerController || hash_32_fnv1a_const(className) == C_CCSPlayerPawn;
|
||||
}
|
||||
auto CBaseEntity::SpawnClientEntity() -> void { CALL_VIRTUAL(void, 19, this); }
|
||||
auto CBasePlayer::ForceRespawn() -> void {
|
||||
|
||||
@@ -152,7 +152,6 @@ class SchemaClassInfoData_t {
|
||||
|
||||
return m_schema_parent->m_class;
|
||||
}
|
||||
|
||||
private:
|
||||
char pad_0x0000[0x8]; // 0x0000
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ ISource2Server* ISource2ServerInterFace;
|
||||
CLocalize* ILocalize;
|
||||
INetworkServerService* INetworkServerServiceInteFace;
|
||||
CCSGameRules* CCSGameRulesInterFace;
|
||||
ICvar* IVEngineCvar;
|
||||
}; // namespace InterFaces
|
||||
auto SafeDelayInit(void* ctx) -> void {
|
||||
// <20><>Ҫ<EFBFBD><D2AA>Ϸ<EFBFBD><CFB7><EFBFBD>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
@@ -84,6 +85,9 @@ auto Init() -> bool {
|
||||
// engine.FindInterface("GameEventSystemServerV001").Get());
|
||||
InterFaces::ILocalize = reinterpret_cast<CLocalize*>(
|
||||
localize.FindInterface("Localize_001").Get());
|
||||
InterFaces::IVEngineCvar = reinterpret_cast<ICvar*>(
|
||||
engine.FindInterface("VEngineCvar007").Get());
|
||||
|
||||
InterFaces::GameResourceServiceServer =
|
||||
reinterpret_cast<CGameResourceService*>(
|
||||
engine.FindInterface("GameResourceServiceServerV001").Get());
|
||||
@@ -96,6 +100,7 @@ auto Init() -> bool {
|
||||
server.FindInterface("Source2GameClients001").Get());
|
||||
InterFaces::ISource2ServerInterFace = reinterpret_cast<ISource2Server*>(
|
||||
server.FindInterface("Source2Server001").Get());
|
||||
|
||||
if (InterFaces::ISource2ServerInterFace) {
|
||||
InterFaces::GameEventManager =
|
||||
(IGameEventManager2*)(CALL_VIRTUAL(
|
||||
@@ -135,6 +140,8 @@ auto Init() -> bool {
|
||||
InterFaces::IVEngineServer);
|
||||
LOG("[huoji]InterFaces::ISource2ServerInterFace : %llx \n",
|
||||
InterFaces::ISource2ServerInterFace);
|
||||
LOG("[huoji]InterFaces::IVEngineCvar : %llx \n",
|
||||
InterFaces::IVEngineCvar);
|
||||
LOG("[huoji] CGameEntitySystem::GetInstance : %llx \n",
|
||||
CGameEntitySystem::GetInstance());
|
||||
LOG("init offset success !\n");
|
||||
|
||||
@@ -41,6 +41,7 @@ extern CLocalize* ILocalize;
|
||||
extern INetworkServerService* INetworkServerServiceInteFace;
|
||||
extern ISource2Server* ISource2ServerInterFace;
|
||||
extern CCSGameRules* CCSGameRulesInterFace;
|
||||
extern ICvar* IVEngineCvar;
|
||||
}; // namespace InterFaces
|
||||
static const auto pattern_CGameEventManager = THE_GAME_SIG(
|
||||
"48 ?? ?? ?? ?? ?? ?? 48 89 ?? ?? ?? 48 89 01 48 8B D9 48 ?? ?? ?? ?? ?? "
|
||||
|
||||
@@ -24,8 +24,8 @@ auto RunTickCallBack(_GameTickRunTime* timer) -> void {
|
||||
luaL_unref(timer->m_luaVm, LUA_REGISTRYINDEX, timer->m_iParamIndex);
|
||||
}
|
||||
auto TimerCallBack(_GameTimer* timer) -> void {
|
||||
LOG("excute timer: %d %d m_bRepeat: %d\n", timer->m_iLuaCallBackFn,
|
||||
timer->m_iParamIndex, timer->m_bRepeat);
|
||||
// LOG("excute timer: %d %d m_bRepeat: %d\n", timer->m_iLuaCallBackFn,
|
||||
// timer->m_iParamIndex, timer->m_bRepeat);
|
||||
lua_rawgeti(timer->m_luaVm, LUA_REGISTRYINDEX, timer->m_iLuaCallBackFn);
|
||||
lua_rawgeti(timer->m_luaVm, LUA_REGISTRYINDEX, timer->m_iParamIndex);
|
||||
lua_pcall(timer->m_luaVm, 1, 0, 0);
|
||||
@@ -231,7 +231,9 @@ auto luaApi_GetPlayerWeaponInfo(lua_State* luaVm) -> _luaApi_WeaponInfo {
|
||||
? _luaApi_WeaponType::kGun
|
||||
: _luaApi_WeaponType::kOther));
|
||||
info.weaponIndex = weaponIndex;
|
||||
//LOG("luaApi_GetPlayerWeaponInfo: %s %s %s %d \n", info.weaponName.c_str(), info.weaponBaseName.c_str(), checkWeaponName, weaponIndex);
|
||||
// LOG("luaApi_GetPlayerWeaponInfo: %s %s %s %d \n",
|
||||
// info.weaponName.c_str(), info.weaponBaseName.c_str(),
|
||||
// checkWeaponName, weaponIndex);
|
||||
} while (false);
|
||||
});
|
||||
return info;
|
||||
@@ -399,6 +401,9 @@ auto luaApi_GivePlayerWeapon(lua_State* luaVm) -> int {
|
||||
const auto weaponName = lua_tostring(luaVm, 2);
|
||||
auto isSuccess = false;
|
||||
ExcutePlayerAction(playerIndex, [&](CCSPlayerController* playerController) {
|
||||
if (playerController->m_bPawnIsAlive() == false) {
|
||||
return;
|
||||
}
|
||||
isSuccess =
|
||||
GameWeapons::ParseWeaponCommand(playerController, weaponName);
|
||||
});
|
||||
@@ -430,7 +435,8 @@ auto luApi_GetPlayerAllWeaponIndex(lua_State* luaVm) -> int {
|
||||
continue;
|
||||
}
|
||||
const auto activeWeapon = handle->Get<CBasePlayerWeapon>();
|
||||
const auto attributeManager = activeWeapon->m_AttributeManager();
|
||||
const auto attributeManager =
|
||||
activeWeapon->m_AttributeManager();
|
||||
if (activeWeapon == nullptr) {
|
||||
break;
|
||||
}
|
||||
@@ -448,7 +454,8 @@ auto luApi_GetPlayerAllWeaponIndex(lua_State* luaVm) -> int {
|
||||
if (checkWeaponName == nullptr || strlen(checkWeaponName) < 1) {
|
||||
break;
|
||||
}
|
||||
//printf("weapon name: %s \n", itemStaticData->GetSimpleWeaponName());
|
||||
// printf("weapon name: %s \n",
|
||||
// itemStaticData->GetSimpleWeaponName());
|
||||
const auto weaponIndex =
|
||||
weapon->GetRefEHandle().GetEntryIndex();
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ std::unordered_map<uint32_t, _CallbackNames> callbackNameWithEnumMap{
|
||||
{hash_32_fnv1a_const("player_death"), _CallbackNames::kOnPlayerDeath},
|
||||
{hash_32_fnv1a_const("player_chat"), _CallbackNames::kOnPlayerSpeak},
|
||||
{hash_32_fnv1a_const("player_spawn"), _CallbackNames::kOnPlayerSpawn},
|
||||
{hash_32_fnv1a_const("round_start"), _CallbackNames::kOnRoundStart},
|
||||
{hash_32_fnv1a_const("round_end"), _CallbackNames::kOnRoundEnd},
|
||||
|
||||
};
|
||||
auto CallBackNameToEnum(const char* name) -> _CallbackNames {
|
||||
@@ -146,4 +148,37 @@ auto luaCall_onPlayerSpawn(int player) -> void {
|
||||
}
|
||||
});
|
||||
}
|
||||
auto luaCall_onRoundStart(int timeLimit) -> void {
|
||||
ExcuteCallbackInAllLuaVm(_CallbackNames::kOnRoundStart,
|
||||
[&](lua_State* luaVm, int refIndex) -> void {
|
||||
lua_rawgeti(luaVm, LUA_REGISTRYINDEX,
|
||||
refIndex);
|
||||
if (lua_isfunction(luaVm, -1)) {
|
||||
lua_pushinteger(luaVm, timeLimit);
|
||||
if (lua_pcall(luaVm, 1, 0, 0) != LUA_OK) {
|
||||
LOG("Error calling Lua callback: %s\n",
|
||||
lua_tostring(luaVm, -1));
|
||||
lua_pop(luaVm, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
auto luaCall_onRoundEnd(int winnerTeam, int reason, const char* message)
|
||||
-> void {
|
||||
ExcuteCallbackInAllLuaVm(_CallbackNames::kOnRoundEnd,
|
||||
[&](lua_State* luaVm, int refIndex) -> void {
|
||||
lua_rawgeti(luaVm, LUA_REGISTRYINDEX,
|
||||
refIndex);
|
||||
if (lua_isfunction(luaVm, -1)) {
|
||||
lua_pushinteger(luaVm, winnerTeam);
|
||||
lua_pushinteger(luaVm, reason);
|
||||
lua_pushstring(luaVm, message);
|
||||
if (lua_pcall(luaVm, 3, 0, 0) != LUA_OK) {
|
||||
LOG("Error calling Lua callback: %s\n",
|
||||
lua_tostring(luaVm, -1));
|
||||
lua_pop(luaVm, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} // namespace ScriptCallBacks
|
||||
|
||||
@@ -8,7 +8,9 @@ enum class _CallbackNames {
|
||||
kOnPlayerDisconnect,
|
||||
kOnPlayerDeath,
|
||||
kOnPlayerSpeak,
|
||||
kOnPlayerSpawn
|
||||
kOnPlayerSpawn,
|
||||
kOnRoundStart,
|
||||
kOnRoundEnd
|
||||
};
|
||||
extern std::unordered_map<lua_State*, std::unordered_map<_CallbackNames, int>>
|
||||
callbackList;
|
||||
@@ -24,4 +26,7 @@ auto luaCall_onPlayerDeath(int victim, int killer, bool isHeadShot) -> void;
|
||||
auto luaCall_onPlayerSpeak(int speaker, int chatType, std::string message)
|
||||
-> bool;
|
||||
auto luaCall_onPlayerSpawn(int player) -> void;
|
||||
auto luaCall_onRoundStart(int timeLimit) -> void;
|
||||
auto luaCall_onRoundEnd(int winnerTeam, int reason, const char* message)
|
||||
-> void;
|
||||
} // namespace ScriptCallBacks
|
||||
|
||||
@@ -47,11 +47,14 @@ auto initLuaScripts() -> void {
|
||||
ScriptApis::initFunciton(L);
|
||||
|
||||
pluginEnvs[dirName] = L;
|
||||
|
||||
if (dirPath.starts_with("disable_")) {
|
||||
continue;
|
||||
}
|
||||
std::string file = dirPath + "\\main.lua";
|
||||
if (std::filesystem::exists(file) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG("execute: %s\n", file.c_str());
|
||||
|
||||
std::string scriptDir = dirPath;
|
||||
@@ -87,8 +90,8 @@ auto reloadLuaScripts() -> void {
|
||||
initLuaScripts();
|
||||
}
|
||||
auto Init() -> void {
|
||||
// luaPath = Tools::GetExePath() + "\\huoji_scripts\\";
|
||||
luaPath = "F:\\source2\\huoji_scripts\\";
|
||||
luaPath = Tools::GetExePath() + "\\huoji_scripts\\";
|
||||
// luaPath = "F:\\source2\\huoji_scripts\\";
|
||||
initLuaScripts();
|
||||
}
|
||||
} // namespace ScriptEngine
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "convar.hpp"
|
||||
|
||||
#include "../../head.h"
|
||||
inline const char** CCommand::ArgV() const {
|
||||
return ArgC() ? (const char**)m_Args.Base() : NULL;
|
||||
}
|
||||
@@ -114,3 +114,64 @@ int DefaultCompletionFunc(const char* partial,
|
||||
CUtlVector<CUtlString>& commands) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Statically constructed list of ConCommandBases,
|
||||
// used for registering them with the ICVar interface
|
||||
//-----------------------------------------------------------------------------
|
||||
static int64 s_nCVarFlag = 0;
|
||||
static bool s_bRegistered = false;
|
||||
|
||||
class ConCommandRegList;
|
||||
class ConCommandRegList
|
||||
{
|
||||
public:
|
||||
static void RegisterCommand(ConCommand* pCmd)
|
||||
{
|
||||
if (s_bConCommandsRegistered)
|
||||
{
|
||||
ConCommandHandle hndl = Offset::InterFaces::IVEngineCvar->RegisterConCommand(pCmd, s_nCVarFlag);
|
||||
if (!hndl.IsValid())
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
|
||||
pCmd->SetHandle(hndl);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetCommandRegList()->AddToTail(pCmd);
|
||||
}
|
||||
}
|
||||
|
||||
static void RegisterAll()
|
||||
{
|
||||
if (!s_bConCommandsRegistered && Offset::InterFaces::IVEngineCvar)
|
||||
{
|
||||
s_bConCommandsRegistered = true;
|
||||
|
||||
for (int i = 0; i < GetCommandRegList()->Count(); i++)
|
||||
{
|
||||
ConCommand* pCmd = GetCommandRegList()->Element(i);
|
||||
ConCommandHandle hndl = Offset::InterFaces::IVEngineCvar->RegisterConCommand(pCmd, s_nCVarFlag);
|
||||
pCmd->SetHandle(hndl);
|
||||
|
||||
if (!hndl.IsValid())
|
||||
{
|
||||
__debugbreak();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
|
||||
// GAMMACASE: Required to prevent static initialization order problem https://isocpp.org/wiki/faq/ctors#static-init-order
|
||||
static CUtlVector<ConCommand*>* GetCommandRegList()
|
||||
{
|
||||
static CUtlVector<ConCommand*> s_ConCommandRegList;
|
||||
return &s_ConCommandRegList;
|
||||
}
|
||||
|
||||
static bool s_bConCommandsRegistered;
|
||||
};
|
||||
|
||||
@@ -1,25 +1,49 @@
|
||||
#pragma once
|
||||
#include "../sdk.h"
|
||||
struct characterset_t {
|
||||
char set[256];
|
||||
class CCommandContext;
|
||||
class ConCommandHandle;
|
||||
class CCommand;
|
||||
class ConCommandRefAbstract;
|
||||
class ICommandCallback
|
||||
{
|
||||
public:
|
||||
virtual void CommandCallback(const CCommandContext& context, const CCommand& command) = 0;
|
||||
};
|
||||
class ConCommandBase {
|
||||
|
||||
class ICommandCompletionCallback
|
||||
{
|
||||
public:
|
||||
virtual int CommandCompletionCallback(const char* pPartial, CUtlVector< CUtlString >& commands) = 0;
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Called when a ConCommand needs to execute
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef void (*FnCommandCallback_t)(const CCommandContext& context, const CCommand& command);
|
||||
typedef void (*FnCommandCallbackNoContext_t)(const CCommand& command);
|
||||
typedef void (*FnCommandCallbackVoid_t)();
|
||||
typedef int(*FnCommandCompletionCallback)(const char* partial, CUtlVector< CUtlString >& commands);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: The base console invoked command/cvar interface
|
||||
//-----------------------------------------------------------------------------
|
||||
class ConCommandBase
|
||||
{
|
||||
friend class CCvar;
|
||||
friend class ConCommand;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ConCommandBase(void);
|
||||
public:
|
||||
|
||||
public:
|
||||
~ConCommandBase(void);
|
||||
// Check flag
|
||||
bool IsFlagSet(int64_t flag) const;
|
||||
bool IsFlagSet(int64 flag) const;
|
||||
// Set flag
|
||||
void AddFlags(int64_t flags);
|
||||
void AddFlags(int64 flags);
|
||||
// Clear flag
|
||||
void RemoveFlags(int64_t flags);
|
||||
void RemoveFlags(int64 flags);
|
||||
|
||||
int64_t GetFlags() const;
|
||||
int64 GetFlags() const;
|
||||
|
||||
// Return name of cvar
|
||||
const char* GetName(void) const;
|
||||
@@ -27,14 +51,127 @@ class ConCommandBase {
|
||||
// Return help text for cvar
|
||||
const char* GetHelpText(void) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
// Static data
|
||||
const char* m_pszName;
|
||||
const char* m_pszHelpString;
|
||||
|
||||
// ConVar flags
|
||||
int64_t m_nFlags;
|
||||
int64 m_nFlags;
|
||||
};
|
||||
class ConCommandHandle
|
||||
{
|
||||
public:
|
||||
bool IsValid() { return value != kInvalidConCommandHandle; }
|
||||
uint16 Get() { return value; }
|
||||
void Set(uint16 _value) { value = _value; }
|
||||
void Reset() { value = kInvalidConCommandHandle; }
|
||||
|
||||
bool HasCallback() const;
|
||||
void Dispatch(const CCommandContext& context, const CCommand& command);
|
||||
|
||||
void Unregister();
|
||||
|
||||
private:
|
||||
uint16_t value = kInvalidConCommandHandle;
|
||||
|
||||
private:
|
||||
static const uint16 kInvalidConCommandHandle = 0xFFFF;
|
||||
};
|
||||
|
||||
class ConCommandRefAbstract
|
||||
{
|
||||
public:
|
||||
ConCommandHandle handle;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: The console invoked command
|
||||
//-----------------------------------------------------------------------------
|
||||
class ConCommand : public ConCommandBase
|
||||
{
|
||||
friend class CCvar;
|
||||
friend class ConCommandHandle;
|
||||
|
||||
public:
|
||||
typedef ConCommandBase BaseClass;
|
||||
|
||||
ConCommand(ConCommandRefAbstract* pReferenceOut, const char* pName, FnCommandCallback_t callback,
|
||||
const char* pHelpString = 0, int64 flags = 0, FnCommandCompletionCallback completionFunc = 0);
|
||||
ConCommand(ConCommandRefAbstract* pReferenceOut, const char* pName, FnCommandCallbackVoid_t callback,
|
||||
const char* pHelpString = 0, int64 flags = 0, FnCommandCompletionCallback completionFunc = 0);
|
||||
ConCommand(ConCommandRefAbstract* pReferenceOut, const char* pName, FnCommandCallbackNoContext_t callback,
|
||||
const char* pHelpString = 0, int64 flags = 0, FnCommandCompletionCallback completionFunc = 0);
|
||||
ConCommand(ConCommandRefAbstract* pReferenceOut, const char* pName, ICommandCallback* pCallback,
|
||||
const char* pHelpString = 0, int64 flags = 0, ICommandCompletionCallback* pCommandCompletionCallback = 0);
|
||||
|
||||
~ConCommand(void);
|
||||
|
||||
// Used internally by OneTimeInit to initialize/shutdown
|
||||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
void Create(const char* pName, const char* pHelpString = 0,
|
||||
int64 flags = 0);
|
||||
|
||||
int AutoCompleteSuggest(const char* partial, CUtlVector< CUtlString >& commands);
|
||||
|
||||
bool CanAutoComplete(void);
|
||||
|
||||
inline ConCommandRefAbstract* GetRef(void) const
|
||||
{
|
||||
return m_pReference;
|
||||
}
|
||||
|
||||
inline void SetHandle(ConCommandHandle hndl)
|
||||
{
|
||||
m_pReference->handle = hndl;
|
||||
}
|
||||
|
||||
private:
|
||||
// Call this function when executing the command
|
||||
class CallbackInfo_t
|
||||
{
|
||||
public:
|
||||
union {
|
||||
FnCommandCallback_t m_fnCommandCallback;
|
||||
FnCommandCallbackVoid_t m_fnVoidCommandCallback;
|
||||
FnCommandCallbackNoContext_t m_fnContextlessCommandCallback;
|
||||
ICommandCallback* m_pCommandCallback;
|
||||
};
|
||||
|
||||
bool m_bUsingCommandCallbackInterface : 1;
|
||||
bool m_bHasVoidCommandCallback : 1;
|
||||
bool m_bHasContextlessCommandCallback : 1;
|
||||
};
|
||||
|
||||
CallbackInfo_t m_Callback;
|
||||
|
||||
// NOTE: To maintain backward compat, we have to be very careful:
|
||||
// All public virtual methods must appear in the same order always
|
||||
// since engine code will be calling into this code, which *does not match*
|
||||
// in the mod code; it's using slightly different, but compatible versions
|
||||
// of this class. Also: Be very careful about adding new fields to this class.
|
||||
// Those fields will not exist in the version of this class that is instanced
|
||||
// in mod code.
|
||||
|
||||
union
|
||||
{
|
||||
FnCommandCompletionCallback m_fnCompletionCallback;
|
||||
ICommandCompletionCallback* m_pCommandCompletionCallback;
|
||||
};
|
||||
|
||||
bool m_bHasCompletionCallback : 1;
|
||||
bool m_bUsingCommandCompletionInterface : 1;
|
||||
|
||||
ConCommandRefAbstract* m_pReference;
|
||||
};
|
||||
|
||||
struct characterset_t {
|
||||
char set[256];
|
||||
};
|
||||
|
||||
|
||||
class CCommand {
|
||||
public:
|
||||
@@ -81,3 +218,116 @@ class CCommand {
|
||||
CUtlVectorFixedGrowable<char, COMMAND_MAX_LENGTH> m_ArgvBuffer;
|
||||
CUtlVectorFixedGrowable<char*, COMMAND_MAX_ARGC> m_Args;
|
||||
};
|
||||
struct CSplitScreenSlot
|
||||
{
|
||||
CSplitScreenSlot(int index)
|
||||
{
|
||||
m_Data = index;
|
||||
}
|
||||
|
||||
int Get() const
|
||||
{
|
||||
return m_Data;
|
||||
}
|
||||
|
||||
int m_Data;
|
||||
};
|
||||
|
||||
class ConVarHandle
|
||||
{
|
||||
public:
|
||||
bool IsValid() { return value != kInvalidConVarHandle; }
|
||||
uint32 Get() { return value; }
|
||||
void Set(uint32 _value) { value = _value; }
|
||||
|
||||
private:
|
||||
uint32 value = kInvalidConVarHandle;
|
||||
|
||||
private:
|
||||
static const uint32 kInvalidConVarHandle = 0xFFFFFFFF;
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum EConVarType : short
|
||||
{
|
||||
EConVarType_Invalid = -1,
|
||||
EConVarType_Bool,
|
||||
EConVarType_Int16,
|
||||
EConVarType_UInt16,
|
||||
EConVarType_Int32,
|
||||
EConVarType_UInt32,
|
||||
EConVarType_Int64,
|
||||
EConVarType_UInt64,
|
||||
EConVarType_Float32,
|
||||
EConVarType_Float64,
|
||||
EConVarType_String,
|
||||
EConVarType_Color,
|
||||
EConVarType_Vector2,
|
||||
EConVarType_Vector3,
|
||||
EConVarType_Vector4,
|
||||
EConVarType_Qangle
|
||||
};
|
||||
class Vector;
|
||||
union CVValue_t
|
||||
{
|
||||
bool m_bValue;
|
||||
short m_i16Value;
|
||||
uint16 m_u16Value;
|
||||
int m_i32Value;
|
||||
uint m_u32Value;
|
||||
int64 m_i64Value;
|
||||
uint64 m_u64Value;
|
||||
float m_flValue;
|
||||
double m_dbValue;
|
||||
const char* m_szValue;
|
||||
Color m_clrValue;
|
||||
Vector2D m_vec2Value;
|
||||
Vector_SimPleSdk m_vec3Value;
|
||||
Vector4D m_vec4Value;
|
||||
Vector_SimPleSdk m_angValue;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: A console variable
|
||||
//-----------------------------------------------------------------------------
|
||||
class ConVar
|
||||
{
|
||||
friend class CCvar;
|
||||
friend class ConVarRef;
|
||||
friend class SplitScreenConVarRef;
|
||||
|
||||
public:
|
||||
const char* m_pszName;
|
||||
CVValue_t* m_cvvDefaultValue;
|
||||
CVValue_t* m_cvvMinValue;
|
||||
CVValue_t* m_cvvMaxValue;
|
||||
const char* m_pszHelpString;
|
||||
EConVarType m_eVarType;
|
||||
|
||||
// This gets copied from the ConVarDesc_t on creation
|
||||
short unk1;
|
||||
|
||||
unsigned int timesChanged;
|
||||
int64 flags;
|
||||
unsigned int callback_index;
|
||||
|
||||
// Used when setting default, max, min values from the ConVarDesc_t
|
||||
// although that's not the only place of usage
|
||||
// flags seems to be:
|
||||
// (1 << 0) Skip setting value to split screen slots and also something keyvalues related
|
||||
// (1 << 1) Skip setting default value
|
||||
// (1 << 2) Skip setting min/max values
|
||||
int allocation_flag_of_some_sort;
|
||||
|
||||
CVValue_t** values;
|
||||
};
|
||||
|
||||
class ConVarRefAbstract
|
||||
{
|
||||
public:
|
||||
// High-speed method to read convar data
|
||||
ConVarHandle m_Handle;
|
||||
ConVar* m_pConVarState;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,146 +6,169 @@
|
||||
#include "../interfaces/interfaces.h"
|
||||
class CMsgSource1LegacyGameEvent;
|
||||
class CUtlString;
|
||||
class IToolGameEventAPI
|
||||
{
|
||||
virtual void unk001(void*) = 0;
|
||||
class IToolGameEventAPI {
|
||||
virtual void unk001(void*) = 0;
|
||||
};
|
||||
struct UnkGameEventStruct_t {
|
||||
UnkGameEventStruct_t(const char* keyName) {
|
||||
m_Unk = 0;
|
||||
m_Key = keyName;
|
||||
}
|
||||
UnkGameEventStruct_t(const char* keyName) {
|
||||
m_Unk = 0;
|
||||
m_Key = keyName;
|
||||
}
|
||||
|
||||
uint64_t m_Unk;
|
||||
const char* m_Key;
|
||||
uint64_t m_Unk;
|
||||
const char* m_Key;
|
||||
};
|
||||
|
||||
class IGameEvent
|
||||
{
|
||||
public:
|
||||
// 0
|
||||
virtual ~IGameEvent() {};
|
||||
virtual const char* GetName() const = 0; // get event name
|
||||
virtual int GetID() const = 0;
|
||||
class IGameEvent {
|
||||
public:
|
||||
// 0
|
||||
virtual ~IGameEvent(){};
|
||||
virtual const char* GetName() const = 0; // get event name
|
||||
virtual int GetID() const = 0;
|
||||
|
||||
virtual bool IsReliable() const = 0; // if event handled reliable
|
||||
virtual bool IsLocal() const = 0; // if event is never networked
|
||||
virtual bool IsEmpty(const char* keyName = NULL) = 0; // check if data field exists
|
||||
virtual bool IsReliable() const = 0; // if event handled reliable
|
||||
virtual bool IsLocal() const = 0; // if event is never networked
|
||||
virtual bool IsEmpty(
|
||||
const char* keyName = NULL) = 0; // check if data field exists
|
||||
|
||||
// Data access index 6
|
||||
virtual bool GetBool(UnkGameEventStruct_t* keyName = NULL, bool defaultValue = false) = 0;
|
||||
virtual int GetInt(const char* keyName = NULL, int defaultValue = 0) = 0;
|
||||
virtual uint64_t GetUint64(const char* keyName = NULL, uint64_t defaultValue = 0) = 0;
|
||||
virtual float GetFloat(const char* keyName = NULL, float defaultValue = 0.0f) = 0;
|
||||
virtual const char* GetString(const char* keyName = NULL, const char* defaultValue = "") = 0;
|
||||
virtual void* GetPtr(const char* keyName = NULL, void* defaultValue = NULL) = 0;
|
||||
// Data access index 6
|
||||
virtual bool GetBool(UnkGameEventStruct_t* keyName = NULL,
|
||||
bool defaultValue = false) = 0;
|
||||
virtual int GetInt(UnkGameEventStruct_t* keyName = NULL,
|
||||
int defaultValue = 0) = 0;
|
||||
virtual uint64_t GetUint64(const char* keyName = NULL,
|
||||
uint64_t defaultValue = 0) = 0;
|
||||
virtual float GetFloat(const char* keyName = NULL,
|
||||
float defaultValue = 0.0f) = 0;
|
||||
virtual const char* GetString(UnkGameEventStruct_t* keyName = NULL,
|
||||
const char* defaultValue = "") = 0;
|
||||
virtual void* GetPtr(const char* keyName = NULL,
|
||||
void* defaultValue = NULL) = 0;
|
||||
|
||||
/* These function prototypes and names are very speculative and might be incorrect */
|
||||
virtual CEntityHandle GetEHandle(UnkGameEventStruct_t* keyName, CEntityHandle defaultValue) = 0;
|
||||
virtual CEntityHandle GetStrictEHandle(UnkGameEventStruct_t* keyName, CEntityHandle defaultValue) = 0;
|
||||
virtual CEntityHandle GetEHandle2(UnkGameEventStruct_t* keyName, CEntityHandle defaultValue) = 0;
|
||||
/* These function prototypes and names are very speculative and might be
|
||||
* incorrect */
|
||||
virtual CEntityHandle GetEHandle(UnkGameEventStruct_t* keyName,
|
||||
CEntityHandle defaultValue) = 0;
|
||||
virtual CEntityHandle GetStrictEHandle(UnkGameEventStruct_t* keyName,
|
||||
CEntityHandle defaultValue) = 0;
|
||||
virtual CEntityHandle GetEHandle2(UnkGameEventStruct_t* keyName,
|
||||
CEntityHandle defaultValue) = 0;
|
||||
|
||||
virtual CPlayerSlot* GetPlayerSlot(UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
virtual CBasePlayer* GetPlayer(UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
virtual CPlayerSlot* GetPlayerSlot(
|
||||
UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
virtual CBasePlayer* GetPlayer(UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
|
||||
virtual void* GetPlayerPawn(UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
virtual CEntityHandle GetPlayerControllerEHandle(UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
virtual CEntityHandle GetPlayerControllerEHandle2(UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
/* ============================================================ */
|
||||
virtual void* GetPlayerPawn(UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
virtual CEntityHandle GetPlayerControllerEHandle(
|
||||
UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
virtual CEntityHandle GetPlayerControllerEHandle2(
|
||||
UnkGameEventStruct_t* keyName = NULL) = 0;
|
||||
/* ============================================================ */
|
||||
|
||||
virtual void SetBool(const char* keyName, bool value) = 0;
|
||||
virtual void SetInt(const char* keyName, int value) = 0;
|
||||
virtual void SetUint64(const char* keyName, uint64_t value) = 0;
|
||||
virtual void SetFloat(const char* keyName, float value) = 0;
|
||||
virtual void SetString(const char* keyName, const char* value) = 0;
|
||||
virtual void SetPtr(const char* keyName, void* value) = 0;
|
||||
virtual void SetBool(const char* keyName, bool value) = 0;
|
||||
virtual void SetInt(const char* keyName, int value) = 0;
|
||||
virtual void SetUint64(const char* keyName, uint64_t value) = 0;
|
||||
virtual void SetFloat(const char* keyName, float value) = 0;
|
||||
virtual void SetString(const char* keyName, const char* value) = 0;
|
||||
virtual void SetPtr(const char* keyName, void* value) = 0;
|
||||
|
||||
/* These function prototypes and names are very speculative and might be incorrect */
|
||||
virtual void SetEHandleStrict(const char* keyName, CEntityHandle handle) = 0;
|
||||
virtual void SetEHandle(const char* keyName, CEntityHandle handle) = 0;
|
||||
/* These function prototypes and names are very speculative and might be
|
||||
* incorrect */
|
||||
virtual void SetEHandleStrict(const char* keyName,
|
||||
CEntityHandle handle) = 0;
|
||||
virtual void SetEHandle(const char* keyName, CEntityHandle handle) = 0;
|
||||
|
||||
// Also sets the _pawn key
|
||||
virtual void SetPlayerSlot(const char* keyName, CPlayerSlot value) = 0;
|
||||
virtual void SetPlayer(const char* keyName, CBasePlayer* value) = 0;
|
||||
/* ============================================================ */
|
||||
// Also sets the _pawn key
|
||||
virtual void SetPlayerSlot(const char* keyName, CPlayerSlot value) = 0;
|
||||
virtual void SetPlayer(const char* keyName, CBasePlayer* value) = 0;
|
||||
/* ============================================================ */
|
||||
|
||||
virtual bool HasKey(const char* keyName) = 0;
|
||||
virtual bool HasKey(const char* keyName) = 0;
|
||||
|
||||
// Something script vm related
|
||||
virtual void unk001() = 0;
|
||||
// Something script vm related
|
||||
virtual void unk001() = 0;
|
||||
|
||||
//virtual KeyValues* GetDataKeys() const = 0;
|
||||
// virtual KeyValues* GetDataKeys() const = 0;
|
||||
};
|
||||
class IGameEventListener2
|
||||
{
|
||||
public:
|
||||
virtual ~IGameEventListener2(void) {};
|
||||
class IGameEventListener2 {
|
||||
public:
|
||||
virtual ~IGameEventListener2(void){};
|
||||
|
||||
// FireEvent is called by EventManager if event just occured
|
||||
// KeyValue memory will be freed by manager if not needed anymore
|
||||
virtual void FireGameEvent(IGameEvent* event) = 0;
|
||||
// FireEvent is called by EventManager if event just occured
|
||||
// KeyValue memory will be freed by manager if not needed anymore
|
||||
virtual void FireGameEvent(IGameEvent* event) = 0;
|
||||
};
|
||||
class IGameEventManager2 : public IBaseInterface, public IToolGameEventAPI
|
||||
{
|
||||
public:
|
||||
virtual ~IGameEventManager2(void) {};
|
||||
class IGameEventManager2 : public IBaseInterface, public IToolGameEventAPI {
|
||||
public:
|
||||
virtual ~IGameEventManager2(void){};
|
||||
|
||||
// load game event descriptions from a file eg "resource\gameevents.res"
|
||||
virtual int LoadEventsFromFile(const char* filename, bool bSearchAll) = 0;
|
||||
// load game event descriptions from a file eg "resource\gameevents.res"
|
||||
virtual int LoadEventsFromFile(const char* filename, bool bSearchAll) = 0;
|
||||
|
||||
// removes all and anything
|
||||
virtual void Reset() = 0;
|
||||
// removes all and anything
|
||||
virtual void Reset() = 0;
|
||||
|
||||
// adds a listener for a particular event
|
||||
virtual bool AddListener(IGameEventListener2* listener, const char* name, bool bServerSide) = 0;
|
||||
// adds a listener for a particular event
|
||||
virtual bool AddListener(IGameEventListener2* listener, const char* name,
|
||||
bool bServerSide) = 0;
|
||||
|
||||
// returns true if this listener is listens to given event
|
||||
virtual bool FindListener(IGameEventListener2* listener, const char* name) = 0;
|
||||
// returns true if this listener is listens to given event
|
||||
virtual bool FindListener(IGameEventListener2* listener,
|
||||
const char* name) = 0;
|
||||
|
||||
// removes a listener
|
||||
virtual void RemoveListener(IGameEventListener2* listener) = 0;
|
||||
// removes a listener
|
||||
virtual void RemoveListener(IGameEventListener2* listener) = 0;
|
||||
|
||||
// create an event by name, but doesn't fire it. returns NULL is event is not
|
||||
// known or no listener is registered for it. bForce forces the creation even if no listener is active
|
||||
virtual IGameEvent* CreateEvent(const char* name, bool bForce = false, int* pCookie = NULL) = 0;
|
||||
// create an event by name, but doesn't fire it. returns NULL is event is
|
||||
// not known or no listener is registered for it. bForce forces the creation
|
||||
// even if no listener is active
|
||||
virtual IGameEvent* CreateEvent(const char* name, bool bForce = false,
|
||||
int* pCookie = NULL) = 0;
|
||||
|
||||
// fires a server event created earlier, if bDontBroadcast is set, event is not send to clients
|
||||
virtual bool FireEvent(IGameEvent* event, bool bDontBroadcast = false) = 0;
|
||||
// fires a server event created earlier, if bDontBroadcast is set, event is
|
||||
// not send to clients
|
||||
virtual bool FireEvent(IGameEvent* event, bool bDontBroadcast = false) = 0;
|
||||
|
||||
// fires an event for the local client only, should be used only by client code
|
||||
virtual bool FireEventClientSide(IGameEvent* event) = 0;
|
||||
// fires an event for the local client only, should be used only by client
|
||||
// code
|
||||
virtual bool FireEventClientSide(IGameEvent* event) = 0;
|
||||
|
||||
// create a new copy of this event, must be free later
|
||||
virtual IGameEvent* DuplicateEvent(IGameEvent* event) = 0;
|
||||
// create a new copy of this event, must be free later
|
||||
virtual IGameEvent* DuplicateEvent(IGameEvent* event) = 0;
|
||||
|
||||
// if an event was created but not fired for some reason, it has to bee freed, same UnserializeEvent
|
||||
virtual void FreeEvent(IGameEvent* event) = 0;
|
||||
// if an event was created but not fired for some reason, it has to bee
|
||||
// freed, same UnserializeEvent
|
||||
virtual void FreeEvent(IGameEvent* event) = 0;
|
||||
|
||||
// write/read event to/from bitbuffer
|
||||
virtual bool SerializeEvent(IGameEvent* event, CMsgSource1LegacyGameEvent* ev) = 0;
|
||||
virtual IGameEvent* UnserializeEvent(const CMsgSource1LegacyGameEvent& ev) = 0; // create new KeyValues, must be deleted
|
||||
// write/read event to/from bitbuffer
|
||||
virtual bool SerializeEvent(IGameEvent* event,
|
||||
CMsgSource1LegacyGameEvent* ev) = 0;
|
||||
virtual IGameEvent* UnserializeEvent(
|
||||
const CMsgSource1LegacyGameEvent&
|
||||
ev) = 0; // create new KeyValues, must be deleted
|
||||
|
||||
virtual int LookupEventId(const char* name) = 0;
|
||||
virtual int LookupEventId(const char* name) = 0;
|
||||
|
||||
virtual void PrintEventToString(IGameEvent* event, CUtlString& out) = 0;
|
||||
virtual void PrintEventToString(IGameEvent* event, CUtlString& out) = 0;
|
||||
|
||||
virtual bool HasEventDescriptor(const char* name) = 0;
|
||||
virtual bool HasEventDescriptor(const char* name) = 0;
|
||||
};
|
||||
|
||||
class CGameEventManager : public IGameEventManager2
|
||||
{
|
||||
public: // IGameEventManager functions
|
||||
virtual ~CGameEventManager() = 0;
|
||||
class CGameEventManager : public IGameEventManager2 {
|
||||
public: // IGameEventManager functions
|
||||
virtual ~CGameEventManager() = 0;
|
||||
|
||||
virtual int LoadEventsFromFile(const char* filename) = 0;
|
||||
virtual void Reset() = 0;
|
||||
virtual int LoadEventsFromFile(const char* filename) = 0;
|
||||
virtual void Reset() = 0;
|
||||
|
||||
virtual bool AddListener(IGameEventListener2* listener, const char* name, bool bServerSide) = 0;
|
||||
virtual bool FindListener(IGameEventListener2* listener, const char* name) = 0;
|
||||
virtual void RemoveListener(IGameEventListener2* listener) = 0;
|
||||
virtual bool AddListener(IGameEventListener2* listener, const char* name,
|
||||
bool bServerSide) = 0;
|
||||
virtual bool FindListener(IGameEventListener2* listener,
|
||||
const char* name) = 0;
|
||||
virtual void RemoveListener(IGameEventListener2* listener) = 0;
|
||||
|
||||
virtual IGameEvent* CreateEvent(const char* name, bool bForce = false) = 0;
|
||||
virtual IGameEvent* DuplicateEvent(IGameEvent* event) = 0;
|
||||
virtual bool FireEvent(IGameEvent* event, bool bDontBroadcast = false) = 0;
|
||||
virtual bool FireEventClientSide(IGameEvent* event) = 0;
|
||||
virtual IGameEvent* CreateEvent(const char* name, bool bForce = false) = 0;
|
||||
virtual IGameEvent* DuplicateEvent(IGameEvent* event) = 0;
|
||||
virtual bool FireEvent(IGameEvent* event, bool bDontBroadcast = false) = 0;
|
||||
virtual bool FireEventClientSide(IGameEvent* event) = 0;
|
||||
};
|
||||
|
||||
49
csgo2/sdk/public/Vector_Sdk.h
Normal file
49
csgo2/sdk/public/Vector_Sdk.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
#include "../sdk.h"
|
||||
|
||||
//cancer fix me
|
||||
struct Vector_SimPleSdk
|
||||
{
|
||||
public:
|
||||
float x, y, z;
|
||||
|
||||
Vector_SimPleSdk()
|
||||
{}
|
||||
|
||||
Vector_SimPleSdk(float x_, float y_, float z_)
|
||||
{
|
||||
x = x_;
|
||||
y = y_;
|
||||
z = z_;
|
||||
}
|
||||
};
|
||||
struct Vector2D
|
||||
{
|
||||
public:
|
||||
float x, y;
|
||||
|
||||
Vector2D()
|
||||
{}
|
||||
|
||||
Vector2D(float x_, float y_)
|
||||
{
|
||||
x = x_;
|
||||
y = y_;
|
||||
}
|
||||
};
|
||||
struct Vector4D
|
||||
{
|
||||
public:
|
||||
float x, y, z, c;
|
||||
|
||||
Vector4D()
|
||||
{}
|
||||
|
||||
Vector4D(float x_, float y_, float z_, float c_)
|
||||
{
|
||||
x = x_;
|
||||
y = y_;
|
||||
z = z_;
|
||||
c = c_;
|
||||
}
|
||||
};
|
||||
367
csgo2/sdk/public/color.h
Normal file
367
csgo2/sdk/public/color.h
Normal file
@@ -0,0 +1,367 @@
|
||||
#pragma once
|
||||
#include "../sdk.h"
|
||||
|
||||
class Color
|
||||
{
|
||||
public:
|
||||
Color()
|
||||
{
|
||||
*((int*)this) = 0;
|
||||
}
|
||||
|
||||
Color(int color32)
|
||||
{
|
||||
*((int*)this) = color32;
|
||||
}
|
||||
|
||||
Color(int _r, int _g, int _b)
|
||||
{
|
||||
SetColor(_r, _g, _b, 255);
|
||||
}
|
||||
|
||||
Color(int _r, int _g, int _b, int _a)
|
||||
{
|
||||
SetColor(_r, _g, _b, _a);
|
||||
}
|
||||
|
||||
void SetColor(int _r, int _g, int _b, int _a = 255)
|
||||
{
|
||||
_color[0] = (unsigned char)_r;
|
||||
_color[1] = (unsigned char)_g;
|
||||
_color[2] = (unsigned char)_b;
|
||||
_color[3] = (unsigned char)_a;
|
||||
}
|
||||
|
||||
void GetColor(int& _r, int& _g, int& _b, int& _a) const
|
||||
{
|
||||
_r = _color[0];
|
||||
_g = _color[1];
|
||||
_b = _color[2];
|
||||
_a = _color[3];
|
||||
}
|
||||
|
||||
void SetRawColor(int color32)
|
||||
{
|
||||
*((int*)this) = color32;
|
||||
}
|
||||
|
||||
int GetRawColor() const
|
||||
{
|
||||
return *((int*)this);
|
||||
}
|
||||
|
||||
int GetD3DColor() const
|
||||
{
|
||||
return ((int)((((_color[3]) & 0xff) << 24) | (((_color[0]) & 0xff) << 16) | (((_color[1]) & 0xff) << 8) | ((_color[2]) & 0xff)));
|
||||
}
|
||||
|
||||
inline int r() const
|
||||
{
|
||||
return _color[0];
|
||||
}
|
||||
|
||||
inline int g() const
|
||||
{
|
||||
return _color[1];
|
||||
}
|
||||
|
||||
inline int b() const
|
||||
{
|
||||
return _color[2];
|
||||
}
|
||||
|
||||
inline int a() const
|
||||
{
|
||||
return _color[3];
|
||||
}
|
||||
|
||||
inline float rBase() const
|
||||
{
|
||||
return _color[0] / 255.0f;
|
||||
}
|
||||
|
||||
inline float gBase() const
|
||||
{
|
||||
return _color[1] / 255.0f;
|
||||
}
|
||||
|
||||
inline float bBase() const
|
||||
{
|
||||
return _color[2] / 255.0f;
|
||||
}
|
||||
|
||||
inline float aBase() const
|
||||
{
|
||||
return _color[3] / 255.0f;
|
||||
}
|
||||
|
||||
unsigned char& operator[](int index)
|
||||
{
|
||||
return _color[index];
|
||||
}
|
||||
|
||||
const unsigned char& operator[](int index) const
|
||||
{
|
||||
return _color[index];
|
||||
}
|
||||
|
||||
bool operator ==(const Color& rhs) const
|
||||
{
|
||||
return (*((int*)this) == *((int*)&rhs));
|
||||
}
|
||||
|
||||
bool operator !=(const Color& rhs) const
|
||||
{
|
||||
return !(operator==(rhs));
|
||||
}
|
||||
|
||||
Color& operator=(const Color& rhs)
|
||||
{
|
||||
SetRawColor(rhs.GetRawColor());
|
||||
return *this;
|
||||
}
|
||||
|
||||
float* Base()
|
||||
{
|
||||
float clr[3];
|
||||
|
||||
clr[0] = _color[0] / 255.0f;
|
||||
clr[1] = _color[1] / 255.0f;
|
||||
clr[2] = _color[2] / 255.0f;
|
||||
|
||||
return &clr[0];
|
||||
}
|
||||
|
||||
float* BaseAlpha()
|
||||
{
|
||||
float clr[4];
|
||||
|
||||
clr[0] = _color[0] / 255.0f;
|
||||
clr[1] = _color[1] / 255.0f;
|
||||
clr[2] = _color[2] / 255.0f;
|
||||
clr[3] = _color[3] / 255.0f;
|
||||
|
||||
return &clr[0];
|
||||
}
|
||||
|
||||
float Hue() const
|
||||
{
|
||||
if (_color[0] == _color[1] && _color[1] == _color[2])
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float r = _color[0] / 255.0f;
|
||||
float g = _color[1] / 255.0f;
|
||||
float b = _color[2] / 255.0f;
|
||||
|
||||
float max = r > g ? r : g > b ? g : b,
|
||||
min = r < g ? r : g < b ? g : b;
|
||||
float delta = max - min;
|
||||
float hue = 0.0f;
|
||||
|
||||
if (r == max)
|
||||
{
|
||||
hue = (g - b) / delta;
|
||||
}
|
||||
else if (g == max)
|
||||
{
|
||||
hue = 2 + (b - r) / delta;
|
||||
}
|
||||
else if (b == max)
|
||||
{
|
||||
hue = 4 + (r - g) / delta;
|
||||
}
|
||||
hue *= 60;
|
||||
|
||||
if (hue < 0.0f)
|
||||
{
|
||||
hue += 360.0f;
|
||||
}
|
||||
return hue;
|
||||
}
|
||||
|
||||
float Saturation() const
|
||||
{
|
||||
float r = _color[0] / 255.0f;
|
||||
float g = _color[1] / 255.0f;
|
||||
float b = _color[2] / 255.0f;
|
||||
|
||||
float max = r > g ? r : g > b ? g : b,
|
||||
min = r < g ? r : g < b ? g : b;
|
||||
float l, s = 0;
|
||||
|
||||
if (max != min)
|
||||
{
|
||||
l = (max + min) / 2;
|
||||
if (l <= 0.5f)
|
||||
s = (max - min) / (max + min);
|
||||
else
|
||||
s = (max - min) / (2 - max - min);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
float Brightness() const
|
||||
{
|
||||
float r = _color[0] / 255.0f;
|
||||
float g = _color[1] / 255.0f;
|
||||
float b = _color[2] / 255.0f;
|
||||
|
||||
float max = r > g ? r : g > b ? g : b,
|
||||
min = r < g ? r : g < b ? g : b;
|
||||
return (max + min) / 2;
|
||||
}
|
||||
|
||||
static Color FromHSB(float hue, float saturation, float brightness)
|
||||
{
|
||||
float h = hue == 1.0f ? 0 : hue * 6.0f;
|
||||
float f = h - (int)h;
|
||||
float p = brightness * (1.0f - saturation);
|
||||
float q = brightness * (1.0f - saturation * f);
|
||||
float t = brightness * (1.0f - (saturation * (1.0f - f)));
|
||||
|
||||
if (h < 1)
|
||||
{
|
||||
return Color(
|
||||
(unsigned char)(brightness * 255),
|
||||
(unsigned char)(t * 255),
|
||||
(unsigned char)(p * 255)
|
||||
);
|
||||
}
|
||||
else if (h < 2)
|
||||
{
|
||||
return Color(
|
||||
(unsigned char)(q * 255),
|
||||
(unsigned char)(brightness * 255),
|
||||
(unsigned char)(p * 255)
|
||||
);
|
||||
}
|
||||
else if (h < 3)
|
||||
{
|
||||
return Color(
|
||||
(unsigned char)(p * 255),
|
||||
(unsigned char)(brightness * 255),
|
||||
(unsigned char)(t * 255)
|
||||
);
|
||||
}
|
||||
else if (h < 4)
|
||||
{
|
||||
return Color(
|
||||
(unsigned char)(p * 255),
|
||||
(unsigned char)(q * 255),
|
||||
(unsigned char)(brightness * 255)
|
||||
);
|
||||
}
|
||||
else if (h < 5)
|
||||
{
|
||||
return Color(
|
||||
(unsigned char)(t * 255),
|
||||
(unsigned char)(p * 255),
|
||||
(unsigned char)(brightness * 255)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color(
|
||||
(unsigned char)(brightness * 255),
|
||||
(unsigned char)(p * 255),
|
||||
(unsigned char)(q * 255)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static Color Red()
|
||||
{
|
||||
return Color(255, 0, 0);
|
||||
}
|
||||
|
||||
static Color Green()
|
||||
{
|
||||
return Color(0, 255, 0);
|
||||
}
|
||||
|
||||
static Color Blue()
|
||||
{
|
||||
return Color(0, 0, 255);
|
||||
}
|
||||
|
||||
static Color LightBlue()
|
||||
{
|
||||
return Color(100, 100, 255);
|
||||
}
|
||||
|
||||
static Color Grey()
|
||||
{
|
||||
return Color(128, 128, 128);
|
||||
}
|
||||
|
||||
static Color DarkGrey()
|
||||
{
|
||||
return Color(45, 45, 45);
|
||||
}
|
||||
|
||||
static Color Black()
|
||||
{
|
||||
return Color(0, 0, 0);
|
||||
}
|
||||
|
||||
static Color White()
|
||||
{
|
||||
return Color(255, 255, 255);
|
||||
}
|
||||
|
||||
static Color Purple()
|
||||
{
|
||||
return Color(220, 0, 220);
|
||||
}
|
||||
|
||||
//Menu
|
||||
static Color Background()
|
||||
{
|
||||
return Color(55, 55, 55);
|
||||
}
|
||||
|
||||
static Color FrameBorder()
|
||||
{
|
||||
return Color(80, 80, 80);
|
||||
}
|
||||
|
||||
static Color MainText()
|
||||
{
|
||||
return Color(230, 230, 230);
|
||||
}
|
||||
|
||||
static Color HeaderText()
|
||||
{
|
||||
return Color(49, 124, 230);
|
||||
}
|
||||
|
||||
static Color CurrentTab()
|
||||
{
|
||||
return Color(55, 55, 55);
|
||||
}
|
||||
|
||||
static Color Tabs()
|
||||
{
|
||||
return Color(23, 23, 23);
|
||||
}
|
||||
|
||||
static Color Highlight()
|
||||
{
|
||||
return Color(49, 124, 230);
|
||||
}
|
||||
|
||||
static Color ElementBorder()
|
||||
{
|
||||
return Color(0, 0, 0);
|
||||
}
|
||||
|
||||
static Color SliderScroll()
|
||||
{
|
||||
return Color(78, 143, 230);
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned char _color[4];
|
||||
};
|
||||
@@ -127,7 +127,36 @@ inline CGlobalVars::CGlobalVars() :
|
||||
}
|
||||
class CSharedEdictChangeInfo;
|
||||
class IAchievementMgr;
|
||||
class CCommandContext;
|
||||
enum CommandTarget_t
|
||||
{
|
||||
CT_NO_TARGET = -1,
|
||||
CT_FIRST_SPLITSCREEN_CLIENT = 0,
|
||||
CT_LAST_SPLITSCREEN_CLIENT = 3,
|
||||
};
|
||||
|
||||
class CCommandContext
|
||||
{
|
||||
public:
|
||||
CCommandContext(CommandTarget_t nTarget, CPlayerSlot nSlot) :
|
||||
m_nTarget(nTarget), m_nPlayerSlot(nSlot)
|
||||
{
|
||||
}
|
||||
|
||||
CommandTarget_t GetTarget() const
|
||||
{
|
||||
return m_nTarget;
|
||||
}
|
||||
|
||||
CPlayerSlot GetPlayerSlot() const
|
||||
{
|
||||
return m_nPlayerSlot;
|
||||
}
|
||||
|
||||
private:
|
||||
CommandTarget_t m_nTarget;
|
||||
CPlayerSlot m_nPlayerSlot;
|
||||
};
|
||||
|
||||
class EconControlPointInfo_t;
|
||||
struct EconItemInfo_t {
|
||||
|
||||
|
||||
84
csgo2/sdk/public/icvar.h
Normal file
84
csgo2/sdk/public/icvar.h
Normal file
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
#include "../sdk.h"
|
||||
|
||||
class ConCommandBase;
|
||||
|
||||
class ConVar;
|
||||
class Color;
|
||||
class IConVarListener;
|
||||
class CConVarDetail;
|
||||
struct ConVarSnapshot_t;
|
||||
union CVValue_t;
|
||||
class KeyValues;
|
||||
class ConVarRefAbstract;
|
||||
class ConVarHandle;
|
||||
struct CSplitScreenSlot;
|
||||
class ConCommandHandle;
|
||||
class ConCommand;
|
||||
typedef void(*FnChangeCallbackGlobal_t)(ConVarRefAbstract* cvar, CSplitScreenSlot nSlot, const char* pNewValue, const char* pOldValue);
|
||||
typedef void(*FnChangeCallback_t)(ConVarRefAbstract* cvar, CSplitScreenSlot nSlot, CVValue_t* pNewValue, CVValue_t* pOldValue);
|
||||
class ConCommandRefAbstract;
|
||||
class ConVarRefAbstract;
|
||||
class ICVarListenerCallbacks
|
||||
{
|
||||
public:
|
||||
virtual void OnConVarCreated(ConVarRefAbstract* pNewCvar) = 0;
|
||||
virtual void OnConCommandCreated(ConCommandRefAbstract* pNewCommand) = 0;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: DLL interface to ConVars/ConCommands
|
||||
//-----------------------------------------------------------------------------
|
||||
class ICvar : public IAppSystem
|
||||
{
|
||||
public:
|
||||
// bAllowDeveloper - Allows finding convars with FCVAR_DEVELOPMENTONLY flag
|
||||
virtual ConVarHandle FindConVar(const char* name, bool bAllowDeveloper = false) = 0;
|
||||
virtual ConVarHandle FindFirstConVar() = 0;
|
||||
virtual ConVarHandle FindNextConVar(ConVarHandle prev) = 0;
|
||||
virtual void SetConVarValue(ConVarHandle cvarid, CSplitScreenSlot nSlot, CVValue_t* pNewValue, CVValue_t* pOldValue) = 0;
|
||||
|
||||
virtual ConCommandHandle FindCommand(const char* name) = 0;
|
||||
virtual ConCommandHandle FindFirstCommand() = 0;
|
||||
virtual ConCommandHandle FindNextCommand(ConCommandHandle prev) = 0;
|
||||
virtual void DispatchConCommand(ConCommandHandle cmd, const CCommandContext& ctx, const CCommand& args) = 0;
|
||||
|
||||
// Install a global change callback (to be called when any convar changes)
|
||||
virtual void InstallGlobalChangeCallback(FnChangeCallbackGlobal_t callback) = 0;
|
||||
virtual void RemoveGlobalChangeCallback(FnChangeCallbackGlobal_t callback) = 0;
|
||||
virtual void CallGlobalChangeCallbacks(ConVarRefAbstract* var, CSplitScreenSlot nSlot, const char* pOldString, float flOldValue) = 0;
|
||||
|
||||
// Reverts cvars which contain a specific flag
|
||||
virtual void RevertFlaggedConVars(int nFlag) = 0;
|
||||
|
||||
virtual void SetMaxSplitScreenSlots(int nSlots) = 0;
|
||||
virtual int GetMaxSplitScreenSlots() const = 0;
|
||||
|
||||
virtual void RegisterCreationListeners(ICVarListenerCallbacks* callbacks) = 0;
|
||||
virtual void RemoveCreationListeners(ICVarListenerCallbacks* callbacks) = 0;
|
||||
|
||||
virtual void unk1() = 0;
|
||||
|
||||
virtual void ResetConVarsToDefaultValues(const char* pszPrefix) = 0;
|
||||
|
||||
virtual ConVarSnapshot_t* TakeConVarSnapshot(void) = 0;
|
||||
virtual void ResetConVarsToSnapshot(ConVarSnapshot_t* pSnapshot) = 0;
|
||||
virtual void DestroyConVarSnapshot(ConVarSnapshot_t* pSnaoshot) = 0;
|
||||
|
||||
virtual characterset_t GetCharacterSet(void) = 0;
|
||||
virtual void SetConVarsFromGameInfo(KeyValues* pKV) = 0;
|
||||
|
||||
virtual void unk2() = 0;
|
||||
|
||||
// Register, unregister vars
|
||||
virtual void RegisterConVar(ConVar* pConVar, int64 nAdditionalFlags, ConVarHandle& pCvarRef, ConVar& pCvar) = 0;
|
||||
virtual void UnregisterConVar(ConVarHandle handle) = 0;
|
||||
virtual ConVar* GetConVar(ConVarHandle handle) = 0;
|
||||
|
||||
// Register, unregister commands
|
||||
virtual ConCommandHandle RegisterConCommand(ConCommand* pCmd, int64 nAdditionalFlags = 0) = 0;
|
||||
virtual void UnregisterConCommand(ConCommandHandle handle) = 0;
|
||||
virtual ConCommand* GetCommand(ConCommandHandle handle) = 0;
|
||||
|
||||
virtual void QueueThreadSetValue(ConVarRefAbstract* ref, CSplitScreenSlot nSlot, CVValue_t* value) = 0;
|
||||
};
|
||||
@@ -16,6 +16,7 @@
|
||||
#define INCORRECT_PATH_SEPARATOR '/'
|
||||
#define INCORRECT_PATH_SEPARATOR_S "/"
|
||||
#define FMTFUNCTION(a, b)
|
||||
|
||||
enum EStringConvertErrorPolicy {
|
||||
_STRINGCONVERTFLAG_SKIP = 1,
|
||||
_STRINGCONVERTFLAG_FAIL = 2,
|
||||
@@ -79,6 +80,10 @@ inline T AlignValue(T val, uintptr_t alignment) {
|
||||
return (T)(((uintptr_t)val + alignment - 1) & ~(alignment - 1));
|
||||
}
|
||||
|
||||
|
||||
#include "public/Vector_Sdk.h"
|
||||
#include "public/color.h"
|
||||
|
||||
#include "player/playerslot.h"
|
||||
|
||||
#include "public/mathlib.h"
|
||||
@@ -103,7 +108,7 @@ inline T AlignValue(T val, uintptr_t alignment) {
|
||||
#include "interfaces/interfaces.h"
|
||||
#include "gameevent/IGameEvent.h"
|
||||
#include "convar/convar.hpp"
|
||||
|
||||
#include "public/icvar.h"
|
||||
#include "gameevent/IGameEvent.h"
|
||||
#include "tier1/bufferstring.h"
|
||||
#include "public/eiface.h"
|
||||
|
||||
187
csgo2/version_hijack.cpp
Normal file
187
csgo2/version_hijack.cpp
Normal file
@@ -0,0 +1,187 @@
|
||||
|
||||
//
|
||||
// created by AheadLib
|
||||
// github:https://github.com/strivexjun/AheadLib-x86-x64
|
||||
//
|
||||
|
||||
#include <windows.h>
|
||||
#include <Shlwapi.h>
|
||||
|
||||
#pragma comment( lib, "Shlwapi.lib")
|
||||
|
||||
#pragma comment(linker, "/EXPORT:GetFileVersionInfoA=AheadLib_GetFileVersionInfoA,@1")
|
||||
#pragma comment(linker, "/EXPORT:GetFileVersionInfoByHandle=AheadLib_GetFileVersionInfoByHandle,@2")
|
||||
#pragma comment(linker, "/EXPORT:GetFileVersionInfoExA=AheadLib_GetFileVersionInfoExA,@3")
|
||||
#pragma comment(linker, "/EXPORT:GetFileVersionInfoExW=AheadLib_GetFileVersionInfoExW,@4")
|
||||
#pragma comment(linker, "/EXPORT:GetFileVersionInfoSizeA=AheadLib_GetFileVersionInfoSizeA,@5")
|
||||
#pragma comment(linker, "/EXPORT:GetFileVersionInfoSizeExA=AheadLib_GetFileVersionInfoSizeExA,@6")
|
||||
#pragma comment(linker, "/EXPORT:GetFileVersionInfoSizeExW=AheadLib_GetFileVersionInfoSizeExW,@7")
|
||||
#pragma comment(linker, "/EXPORT:GetFileVersionInfoSizeW=AheadLib_GetFileVersionInfoSizeW,@8")
|
||||
#pragma comment(linker, "/EXPORT:GetFileVersionInfoW=AheadLib_GetFileVersionInfoW,@9")
|
||||
#pragma comment(linker, "/EXPORT:VerFindFileA=AheadLib_VerFindFileA,@10")
|
||||
#pragma comment(linker, "/EXPORT:VerFindFileW=AheadLib_VerFindFileW,@11")
|
||||
#pragma comment(linker, "/EXPORT:VerInstallFileA=AheadLib_VerInstallFileA,@12")
|
||||
#pragma comment(linker, "/EXPORT:VerInstallFileW=AheadLib_VerInstallFileW,@13")
|
||||
#pragma comment(linker, "/EXPORT:VerLanguageNameA=KERNEL32.VerLanguageNameA,@14")
|
||||
#pragma comment(linker, "/EXPORT:VerLanguageNameW=KERNEL32.VerLanguageNameW,@15")
|
||||
#pragma comment(linker, "/EXPORT:VerQueryValueA=AheadLib_VerQueryValueA,@16")
|
||||
#pragma comment(linker, "/EXPORT:VerQueryValueW=AheadLib_VerQueryValueW,@17")
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
PVOID pfnAheadLib_GetFileVersionInfoA;
|
||||
PVOID pfnAheadLib_GetFileVersionInfoByHandle;
|
||||
PVOID pfnAheadLib_GetFileVersionInfoExA;
|
||||
PVOID pfnAheadLib_GetFileVersionInfoExW;
|
||||
PVOID pfnAheadLib_GetFileVersionInfoSizeA;
|
||||
PVOID pfnAheadLib_GetFileVersionInfoSizeExA;
|
||||
PVOID pfnAheadLib_GetFileVersionInfoSizeExW;
|
||||
PVOID pfnAheadLib_GetFileVersionInfoSizeW;
|
||||
PVOID pfnAheadLib_GetFileVersionInfoW;
|
||||
PVOID pfnAheadLib_VerFindFileA;
|
||||
PVOID pfnAheadLib_VerFindFileW;
|
||||
PVOID pfnAheadLib_VerInstallFileA;
|
||||
PVOID pfnAheadLib_VerInstallFileW;
|
||||
PVOID pfnAheadLib_VerQueryValueA;
|
||||
PVOID pfnAheadLib_VerQueryValueW;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
HMODULE g_OldModule = NULL;
|
||||
|
||||
VOID WINAPI Free()
|
||||
{
|
||||
if (g_OldModule)
|
||||
{
|
||||
FreeLibrary(g_OldModule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL WINAPI Load()
|
||||
{
|
||||
TCHAR tzPath[MAX_PATH];
|
||||
TCHAR tzTemp[MAX_PATH * 2];
|
||||
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ϵͳĿ¼<C4BF><C2BC><EFBFBD><EFBFBD>ǰĿ¼<C4BF><C2BC><EFBFBD><EFBFBD>ԭʼDLL
|
||||
//
|
||||
//GetModuleFileName(NULL,tzPath,MAX_PATH); //<2F><>ȡ<EFBFBD><C8A1>Ŀ¼<C4BF>µ<EFBFBD>
|
||||
//PathRemoveFileSpec(tzPath);
|
||||
|
||||
GetSystemDirectory(tzPath, MAX_PATH); //Ĭ<>ϻ<EFBFBD>ȡϵͳĿ¼<C4BF><C2BC>
|
||||
|
||||
lstrcat(tzPath, TEXT("\\version.dll"));
|
||||
|
||||
g_OldModule = LoadLibrary(tzPath);
|
||||
if (g_OldModule == NULL)
|
||||
{
|
||||
wsprintf(tzTemp, TEXT("<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>ģ<EFBFBD><EFBFBD> %s,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), tzPath);
|
||||
MessageBox(NULL, tzTemp, TEXT("AheadLib"), MB_ICONSTOP);
|
||||
}
|
||||
|
||||
return (g_OldModule != NULL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
FARPROC WINAPI GetAddress(PCSTR pszProcName)
|
||||
{
|
||||
FARPROC fpAddress;
|
||||
CHAR szProcName[64];
|
||||
TCHAR tzTemp[MAX_PATH];
|
||||
|
||||
fpAddress = GetProcAddress(g_OldModule, pszProcName);
|
||||
if (fpAddress == NULL)
|
||||
{
|
||||
if (HIWORD(pszProcName) == 0)
|
||||
{
|
||||
wsprintfA(szProcName, "#%d", pszProcName);
|
||||
pszProcName = szProcName;
|
||||
}
|
||||
|
||||
wsprintf(tzTemp, TEXT("<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %hs,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), pszProcName);
|
||||
MessageBox(NULL, tzTemp, TEXT("AheadLib"), MB_ICONSTOP);
|
||||
ExitProcess(-2);
|
||||
}
|
||||
return fpAddress;
|
||||
}
|
||||
|
||||
BOOL WINAPI Init()
|
||||
{
|
||||
pfnAheadLib_GetFileVersionInfoA = GetAddress("GetFileVersionInfoA");
|
||||
pfnAheadLib_GetFileVersionInfoByHandle = GetAddress("GetFileVersionInfoByHandle");
|
||||
pfnAheadLib_GetFileVersionInfoExA = GetAddress("GetFileVersionInfoExA");
|
||||
pfnAheadLib_GetFileVersionInfoExW = GetAddress("GetFileVersionInfoExW");
|
||||
pfnAheadLib_GetFileVersionInfoSizeA = GetAddress("GetFileVersionInfoSizeA");
|
||||
pfnAheadLib_GetFileVersionInfoSizeExA = GetAddress("GetFileVersionInfoSizeExA");
|
||||
pfnAheadLib_GetFileVersionInfoSizeExW = GetAddress("GetFileVersionInfoSizeExW");
|
||||
pfnAheadLib_GetFileVersionInfoSizeW = GetAddress("GetFileVersionInfoSizeW");
|
||||
pfnAheadLib_GetFileVersionInfoW = GetAddress("GetFileVersionInfoW");
|
||||
pfnAheadLib_VerFindFileA = GetAddress("VerFindFileA");
|
||||
pfnAheadLib_VerFindFileW = GetAddress("VerFindFileW");
|
||||
pfnAheadLib_VerInstallFileA = GetAddress("VerInstallFileA");
|
||||
pfnAheadLib_VerInstallFileW = GetAddress("VerInstallFileW");
|
||||
pfnAheadLib_VerQueryValueA = GetAddress("VerQueryValueA");
|
||||
pfnAheadLib_VerQueryValueW = GetAddress("VerQueryValueW");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD WINAPI ThreadProc(LPVOID lpThreadParameter)
|
||||
{
|
||||
HANDLE hProcess;
|
||||
|
||||
PVOID addr1 = reinterpret_cast<PVOID>(0x00401000);
|
||||
BYTE data1[] = { 0x90, 0x90, 0x90, 0x90 };
|
||||
|
||||
//
|
||||
// <20>ƹ<EFBFBD>VMP3.x <20><><EFBFBD>ڴ汣<DAB4><E6B1A3>
|
||||
//
|
||||
hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, GetCurrentProcessId());
|
||||
if (hProcess)
|
||||
{
|
||||
WriteProcessMemory(hProcess, addr1, data1, sizeof(data1), NULL);
|
||||
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL APIENTRY VersionHijack_DllMain(HMODULE hModule, DWORD dwReason, PVOID pvReserved)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
DisableThreadLibraryCalls(hModule);
|
||||
|
||||
if (Load() && Init())
|
||||
{
|
||||
TCHAR szAppName[MAX_PATH] = TEXT("cs2.exe");//<2F><><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
TCHAR szCurName[MAX_PATH];
|
||||
|
||||
GetModuleFileName(NULL, szCurName, MAX_PATH);
|
||||
PathStripPath(szCurName);
|
||||
|
||||
//<2F>Ƿ<EFBFBD><C7B7>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (StrCmpI(szCurName, szAppName) == 0)
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻߳<DFB3><CCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
HANDLE hThread = CreateThread(NULL, NULL, ThreadProc, NULL, NULL, NULL);
|
||||
if (hThread)
|
||||
{
|
||||
CloseHandle(hThread);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dwReason == DLL_PROCESS_DETACH)
|
||||
{
|
||||
Free();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
97
csgo2/version_jump.asm
Normal file
97
csgo2/version_jump.asm
Normal file
@@ -0,0 +1,97 @@
|
||||
|
||||
;
|
||||
; created by AheadLib
|
||||
; github:https://github.com/strivexjun/AheadLib-x86-x64
|
||||
;
|
||||
; <20><> .asm <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||
; <20>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>-<2D><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD>-
|
||||
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>
|
||||
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD>:<3A><>
|
||||
|
||||
; Ȼ<><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ml64 /Fo $(IntDir)%(fileName).obj /c /Cp %(fileName).asm
|
||||
; <20><><EFBFBD><EFBFBD>: $(IntDir)%(fileName).obj;%(Outputs)
|
||||
; <20><><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD>: <20><>
|
||||
;
|
||||
|
||||
|
||||
.DATA
|
||||
EXTERN pfnAheadLib_GetFileVersionInfoA:dq;
|
||||
EXTERN pfnAheadLib_GetFileVersionInfoByHandle:dq;
|
||||
EXTERN pfnAheadLib_GetFileVersionInfoExA:dq;
|
||||
EXTERN pfnAheadLib_GetFileVersionInfoExW:dq;
|
||||
EXTERN pfnAheadLib_GetFileVersionInfoSizeA:dq;
|
||||
EXTERN pfnAheadLib_GetFileVersionInfoSizeExA:dq;
|
||||
EXTERN pfnAheadLib_GetFileVersionInfoSizeExW:dq;
|
||||
EXTERN pfnAheadLib_GetFileVersionInfoSizeW:dq;
|
||||
EXTERN pfnAheadLib_GetFileVersionInfoW:dq;
|
||||
EXTERN pfnAheadLib_VerFindFileA:dq;
|
||||
EXTERN pfnAheadLib_VerFindFileW:dq;
|
||||
EXTERN pfnAheadLib_VerInstallFileA:dq;
|
||||
EXTERN pfnAheadLib_VerInstallFileW:dq;
|
||||
EXTERN pfnAheadLib_VerQueryValueA:dq;
|
||||
EXTERN pfnAheadLib_VerQueryValueW:dq;
|
||||
|
||||
.CODE
|
||||
AheadLib_GetFileVersionInfoA PROC
|
||||
jmp pfnAheadLib_GetFileVersionInfoA
|
||||
AheadLib_GetFileVersionInfoA ENDP
|
||||
|
||||
AheadLib_GetFileVersionInfoByHandle PROC
|
||||
jmp pfnAheadLib_GetFileVersionInfoByHandle
|
||||
AheadLib_GetFileVersionInfoByHandle ENDP
|
||||
|
||||
AheadLib_GetFileVersionInfoExA PROC
|
||||
jmp pfnAheadLib_GetFileVersionInfoExA
|
||||
AheadLib_GetFileVersionInfoExA ENDP
|
||||
|
||||
AheadLib_GetFileVersionInfoExW PROC
|
||||
jmp pfnAheadLib_GetFileVersionInfoExW
|
||||
AheadLib_GetFileVersionInfoExW ENDP
|
||||
|
||||
AheadLib_GetFileVersionInfoSizeA PROC
|
||||
jmp pfnAheadLib_GetFileVersionInfoSizeA
|
||||
AheadLib_GetFileVersionInfoSizeA ENDP
|
||||
|
||||
AheadLib_GetFileVersionInfoSizeExA PROC
|
||||
jmp pfnAheadLib_GetFileVersionInfoSizeExA
|
||||
AheadLib_GetFileVersionInfoSizeExA ENDP
|
||||
|
||||
AheadLib_GetFileVersionInfoSizeExW PROC
|
||||
jmp pfnAheadLib_GetFileVersionInfoSizeExW
|
||||
AheadLib_GetFileVersionInfoSizeExW ENDP
|
||||
|
||||
AheadLib_GetFileVersionInfoSizeW PROC
|
||||
jmp pfnAheadLib_GetFileVersionInfoSizeW
|
||||
AheadLib_GetFileVersionInfoSizeW ENDP
|
||||
|
||||
AheadLib_GetFileVersionInfoW PROC
|
||||
jmp pfnAheadLib_GetFileVersionInfoW
|
||||
AheadLib_GetFileVersionInfoW ENDP
|
||||
|
||||
AheadLib_VerFindFileA PROC
|
||||
jmp pfnAheadLib_VerFindFileA
|
||||
AheadLib_VerFindFileA ENDP
|
||||
|
||||
AheadLib_VerFindFileW PROC
|
||||
jmp pfnAheadLib_VerFindFileW
|
||||
AheadLib_VerFindFileW ENDP
|
||||
|
||||
AheadLib_VerInstallFileA PROC
|
||||
jmp pfnAheadLib_VerInstallFileA
|
||||
AheadLib_VerInstallFileA ENDP
|
||||
|
||||
AheadLib_VerInstallFileW PROC
|
||||
jmp pfnAheadLib_VerInstallFileW
|
||||
AheadLib_VerInstallFileW ENDP
|
||||
|
||||
AheadLib_VerQueryValueA PROC
|
||||
jmp pfnAheadLib_VerQueryValueA
|
||||
AheadLib_VerQueryValueA ENDP
|
||||
|
||||
AheadLib_VerQueryValueW PROC
|
||||
jmp pfnAheadLib_VerQueryValueW
|
||||
AheadLib_VerQueryValueW ENDP
|
||||
|
||||
|
||||
END
|
||||
31
loader/loader.sln
Normal file
31
loader/loader.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33130.400
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loader", "loader\loader.vcxproj", "{5B7C31B7-436F-403A-B1FE-D5C44227C6A8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5B7C31B7-436F-403A-B1FE-D5C44227C6A8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5B7C31B7-436F-403A-B1FE-D5C44227C6A8}.Debug|x64.Build.0 = Debug|x64
|
||||
{5B7C31B7-436F-403A-B1FE-D5C44227C6A8}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{5B7C31B7-436F-403A-B1FE-D5C44227C6A8}.Debug|x86.Build.0 = Debug|Win32
|
||||
{5B7C31B7-436F-403A-B1FE-D5C44227C6A8}.Release|x64.ActiveCfg = Release|x64
|
||||
{5B7C31B7-436F-403A-B1FE-D5C44227C6A8}.Release|x64.Build.0 = Release|x64
|
||||
{5B7C31B7-436F-403A-B1FE-D5C44227C6A8}.Release|x86.ActiveCfg = Release|Win32
|
||||
{5B7C31B7-436F-403A-B1FE-D5C44227C6A8}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0EE46AF2-88B0-404B-A6B5-777E97DF934D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
56
loader/loader/loader.cpp
Normal file
56
loader/loader/loader.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
// loader.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
||||
|
||||
#include <windows.h>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <filesystem>
|
||||
|
||||
// 读取INI文件
|
||||
std::pair<std::string, std::string> readConfig() {
|
||||
char path[255], command[255];
|
||||
|
||||
GetPrivateProfileStringA("server", "path", "", path, 255, ".\\config.ini");
|
||||
GetPrivateProfileStringA("server", "command", "", command, 255, ".\\config.ini");
|
||||
|
||||
return { std::string(path), std::string(command) };
|
||||
}
|
||||
|
||||
// 创建进程
|
||||
PROCESS_INFORMATION createProcess(const std::string& path, const std::string& command) {
|
||||
STARTUPINFOA si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
ZeroMemory(&pi, sizeof(pi));
|
||||
|
||||
// 注意:CreateProcessW需要宽字符,如果你的项目是使用多字节字符集,需要转换
|
||||
if (!CreateProcessA(path.c_str(), const_cast<char*>(command.c_str()), NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi)) {
|
||||
std::cerr << "CreateProcess failed (" << GetLastError() << ").\n";
|
||||
}
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
||||
// 加载DLL
|
||||
void loadDll(PROCESS_INFORMATION pi) {
|
||||
LPVOID addr = (LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA");
|
||||
LPVOID arg = (LPVOID)VirtualAllocEx(pi.hProcess, NULL, strlen("csgo2.dll") + 1, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
|
||||
WriteProcessMemory(pi.hProcess, arg, "csgo2.dll", strlen("csgo2.dll") + 1, NULL);
|
||||
HANDLE hThread = CreateRemoteThread(pi.hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)addr, arg, 0, NULL);
|
||||
|
||||
if (hThread == NULL) {
|
||||
std::cerr << "CreateRemoteThread failed (" << GetLastError() << ").\n";
|
||||
}
|
||||
|
||||
ResumeThread(pi.hThread);
|
||||
}
|
||||
|
||||
int main() {
|
||||
auto [path, command] = readConfig();
|
||||
PROCESS_INFORMATION pi = createProcess(path, command);
|
||||
loadDll(pi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
149
loader/loader/loader.vcxproj
Normal file
149
loader/loader/loader.vcxproj
Normal file
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{5b7c31b7-436f-403a-b1fe-d5c44227c6a8}</ProjectGuid>
|
||||
<RootNamespace>loader</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="loader.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
loader/loader/loader.vcxproj.filters
Normal file
22
loader/loader/loader.vcxproj.filters
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="loader.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user