Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

major update #100

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cstrike/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* - used to verify game version
*/

#define CS_PRODUCTSTRINGVERSION CS_XOR("1.40.2.0")
#define CS_PRODUCTSTRINGVERSION CS_XOR("1.40.2.1")

/*
* game's modules
Expand Down
19 changes: 11 additions & 8 deletions cstrike/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ static bool Setup(HMODULE hModule)
}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("features initialization completed");

if (!SCHEMA::Setup(CS_XOR(L"schema_client.txt"), CS_XOR("client.dll")))
// iterate all valid modules for schema
std::vector<std::string> vecNeededModules = { CS_XOR("client.dll"), CS_XOR("engine2.dll"), CS_XOR("schemasystem.dll") };
for (auto& szModule : vecNeededModules)
{
CS_ASSERT(false); // failed to setup schema system
return false;
if (!SCHEMA::Setup(CS_XOR(L"schema.txt"), szModule.c_str()))
{
CS_ASSERT(false); // failed to setup schema system
return false;
}
}
//if (!SCHEMA::Setup(CS_XOR(L"schema_server.txt"), CS_XOR("server.dll")))
//{
// CS_ASSERT(false); // failed to setup schema system
// return false;
//}
L_PRINT(LOG_NONE) << L::SetColor(LOG_COLOR_FORE_GREEN | LOG_COLOR_FORE_INTENSITY) << CS_XOR("schema system initialization completed");

if (!CONVAR::Dump(CS_XOR(L"convars.txt")))
Expand Down Expand Up @@ -214,6 +214,9 @@ extern "C" BOOL WINAPI _CRT_INIT(HMODULE hModule, DWORD dwReason, LPVOID lpReser

BOOL APIENTRY CoreEntryPoint(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
// Disables the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the specified dynamic-link library (DLL). This can reduce the size of the working set for some applications
DisableThreadLibraryCalls(hModule);

// process destroy of the cheat before crt calls atexit table
if (dwReason == DLL_PROCESS_DETACH)
Destroy();
Expand Down
6 changes: 5 additions & 1 deletion cstrike/core/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "../sdk/interfaces/inetworkclientservice.h"
#include "../sdk/interfaces/iglobalvars.h"
#include "../sdk/interfaces/imaterialsystem.h"
#include "../sdk/interfaces/ipvs.h"

// used: viewsetup
#include "../sdk/datatypes/viewsetup.h"
Expand Down Expand Up @@ -123,7 +124,7 @@ bool H::Setup()
return false;
L_PRINT(LOG_INFO) << CS_XOR("\"DrawObject\" hook has been created");

if (!hkIsRelativeMouseMode.Create(MEM::GetVFunc(I::InputSystem, VTABLE::SDL::ISRELATIVEMOUSEMODE), reinterpret_cast<void*>(&IsRelativeMouseMode)))
if (!hkIsRelativeMouseMode.Create(MEM::GetVFunc(I::InputSystem, VTABLE::INPUTSYSTEM::ISRELATIVEMOUSEMODE), reinterpret_cast<void*>(&IsRelativeMouseMode)))
return false;
L_PRINT(LOG_INFO) << CS_XOR("\"IsRelativeMouseMode\" hook has been created");

Expand Down Expand Up @@ -252,6 +253,9 @@ __int64* CS_FASTCALL H::LevelInit(void* pClientModeShared, const char* szNewMap)
if (I::GlobalVars == nullptr)
I::GlobalVars = *reinterpret_cast<IGlobalVars**>(MEM::ResolveRelativeAddress(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 0D ? ? ? ? 48 89 41")), 0x3, 0x7));

// disable model occlusion
I::PVS->Set(false);

return oLevelInit(pClientModeShared, szNewMap);
}

Expand Down
6 changes: 2 additions & 4 deletions cstrike/core/hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ namespace VTABLE
};
}

namespace SDL
namespace INPUTSYSTEM
{
enum
{
ISRELATIVEMOUSEMODE = 78u,
ISRELATIVEMOUSEMODE = 78U,
};
}
}
Expand Down Expand Up @@ -76,8 +76,6 @@ namespace H
__int64 CS_FASTCALL LevelShutdown(void* pClientModeShared);
void CS_FASTCALL OverrideView(void* pClientModeCSNormal, CViewSetup* pSetup);
void CS_FASTCALL DrawObject(void* pAnimatableSceneObjectDesc, void* pDx11, CMeshData* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2);

// sdl functions
void* IsRelativeMouseMode(void* pThisptr, bool bActive);

/* @section: managers */
Expand Down
3 changes: 3 additions & 0 deletions cstrike/core/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ bool I::Setup()
GlobalVars = *reinterpret_cast<IGlobalVars**>(MEM::ResolveRelativeAddress(MEM::FindPattern(CLIENT_DLL, CS_XOR("48 89 0D ? ? ? ? 48 89 41")), 0x3, 0x7));
bSuccess &= (GlobalVars != nullptr);

PVS = reinterpret_cast<CPVS*>(MEM::ResolveRelativeAddress(MEM::FindPattern(ENGINE2_DLL, CS_XOR("48 8D 0D ? ? ? ? 33 D2 FF 50")), 0x3, 0x7));
bSuccess &= (PVS != nullptr);

return bSuccess;
}

Expand Down
2 changes: 2 additions & 0 deletions cstrike/core/interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class INetworkClientService;
class IMaterialSystem2;
class IResourceSystem;
class CResourceHandleUtils;
class CPVS;

// [d3d] struct
struct ID3D11Device;
Expand Down Expand Up @@ -72,4 +73,5 @@ namespace I
inline IMaterialSystem2* MaterialSystem2 = nullptr;
inline IResourceSystem* ResourceSystem = nullptr;
inline CResourceHandleUtils* ResourceHandleUtils = nullptr;
inline CPVS* PVS = nullptr;
}
1 change: 1 addition & 0 deletions cstrike/cstrike.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
<ClInclude Include="features\visuals.h" />
<ClInclude Include="features\visuals\chams.h" />
<ClInclude Include="features\visuals\overlay.h" />
<ClInclude Include="sdk\interfaces\ipvs.h" />
<ClInclude Include="sdk\const.h" />
<ClInclude Include="sdk\datatypes\color.h" />
<ClInclude Include="sdk\datatypes\keyvalue3.h" />
Expand Down
3 changes: 3 additions & 0 deletions cstrike/cstrike.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@
</ClInclude>
<ClInclude Include="sdk\datatypes\utlbuffer.h" />
<ClInclude Include="features\CRC.h" />
<ClInclude Include="sdk\interfaces\ipvs.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\dependencies\imgui\imgui.cpp">
Expand Down
8 changes: 4 additions & 4 deletions cstrike/features/visuals/chams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ bool F::VISUALS::CHAMS::OnDrawObject(void* pAnimatableSceneObjectDesc, void* pDx
if (CRT::StringCompare(pClassInfo->szName, CS_XOR("C_CSPlayerPawn")) != 0)
return false;

auto pPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(hOwner);
if (pPawn == nullptr)
auto pPlayerPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(hOwner);
if (pPlayerPawn == nullptr)
return false;

if (!pPawn->IsOtherEnemy(SDK::LocalPawn))
if (!pPlayerPawn->IsOtherEnemy(SDK::LocalPawn))
return false;

// alive state
if (pPawn->GetHealth() == 0)
if (pPlayerPawn->GetHealth() <= 0)
return false;

return OverrideMaterial(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
Expand Down
12 changes: 6 additions & 6 deletions cstrike/sdk/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ CCSPlayerController* CCSPlayerController::GetLocalPlayerController()

const Vector_t& CCSPlayerController::GetPawnOrigin()
{
CBaseHandle hPawn = this->GetPawnHandle();
if (!hPawn.IsValid())
CBaseHandle hPawnHandle = this->GetPawnHandle();
if (!hPawnHandle.IsValid())
return vecEmpty;

C_CSPlayerPawn* pPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(hPawn);
if (pPawn == nullptr)
C_CSPlayerPawn* pPlayerPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(hPawnHandle);
if (pPlayerPawn == nullptr)
return vecEmpty;

return pPawn->GetSceneOrigin();
return pPlayerPawn->GetSceneOrigin();
}

C_BaseEntity* C_BaseEntity::GetLocalPlayer()
Expand Down Expand Up @@ -101,7 +101,7 @@ bool C_CSWeaponBaseGun::CanPrimaryAttack(const int nWeaponType, const float flSe
if (nWeaponType == WEAPONTYPE_KNIFE)
return true;

// check do weapon have ammo
// check do weapon have ammo
if (this->GetClip1() <= 0)
return false;

Expand Down
13 changes: 13 additions & 0 deletions cstrike/sdk/interfaces/ipvs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

// used: MEM::CallVFunc
#include "../../utilities/memory.h"

class CPVS
{
public:
void Set(bool bState)
{
MEM::CallVFunc<void*, 7U>(this, bState);
}
};
7 changes: 2 additions & 5 deletions cstrike/utilities/fnv1a.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ namespace FNV1A
const std::size_t nLength = CRT::StringLength(szString);

for (std::size_t i = 0U; i < nLength; ++i)
{
uKey ^= szString[i];
uKey *= ullPrime;
}
uKey = (uKey ^ szString[i]) * ullPrime;

return uKey;
}
}
}
Loading