Skip to content

Commit

Permalink
General refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Viceroyy committed Jul 11, 2024
1 parent cb24e32 commit ae62b6c
Show file tree
Hide file tree
Showing 41 changed files with 284 additions and 453 deletions.
30 changes: 14 additions & 16 deletions Arsenal/Arsenal.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,16 @@
<ClCompile Include="Features\Players\Players.cpp" />
<ClCompile Include="Features\SpectatorList\SpectatorList.cpp" />
<ClCompile Include="Features\Visual\Visual.cpp" />
<ClCompile Include="Hooks\Definitions\CBasePlayer_CalcPlayerView.cpp" />
<ClCompile Include="Hooks\Definitions\ClientModeShared_CreateMove.cpp" />
<ClCompile Include="Hooks\Definitions\ClientModeShared_DoPostScreenSpaceEffects.cpp" />
<ClCompile Include="Hooks\Definitions\ClientModeShared_GetViewmodelFOV.cpp" />
<ClCompile Include="Hooks\Definitions\ClientModeShared_OverrideView.cpp" />
<ClCompile Include="Hooks\Definitions\CPrediction_RunCommand.cpp" />
<ClCompile Include="Hooks\Definitions\IBaseClientDLL_FrameStageNotify.cpp" />
<ClCompile Include="Hooks\Definitions\IBaseClientDLL_LevelInitPostEntity.cpp" />
<ClCompile Include="Hooks\Definitions\IBaseClientDLL_LevelShutdown.cpp" />
<ClCompile Include="Hooks\Definitions\IEngineVGui_Paint.cpp" />
<ClCompile Include="Hooks\Definitions\ModelRender_DrawModelExecute.cpp" />
<ClCompile Include="Hooks\Definitions\WINAPI_WndProc.cpp" />
<ClCompile Include="Hooks\Hooks.cpp" />
<ClCompile Include="Hooks\CBasePlayer_CalcPlayerView.cpp" />
<ClCompile Include="Hooks\ClientModeShared_CreateMove.cpp" />
<ClCompile Include="Hooks\ClientModeShared_GetViewmodelFOV.cpp" />
<ClCompile Include="Hooks\ClientModeShared_OverrideView.cpp" />
<ClCompile Include="Hooks\CPrediction_RunCommand.cpp" />
<ClCompile Include="Hooks\IBaseClientDLL_FrameStageNotify.cpp" />
<ClCompile Include="Hooks\IBaseClientDLL_LevelInitPostEntity.cpp" />
<ClCompile Include="Hooks\IBaseClientDLL_LevelShutdown.cpp" />
<ClCompile Include="Hooks\IEngineVGui_Paint.cpp" />
<ClCompile Include="Hooks\WINAPI_WndProc.cpp" />
<ClCompile Include="SDK\DrawManager\DrawManager.cpp" />
<ClCompile Include="SDK\Entities\NetVarManager\NetVarManager.cpp" />
<ClCompile Include="SDK\EntityCacher\EntityCacher.cpp" />
Expand All @@ -126,6 +123,7 @@
<ClCompile Include="SDK\Interfaces\IInputSystem.h" />
<ClCompile Include="SDK\Input\Input.cpp" />
<ClCompile Include="SDK\Interfaces\ICvar.cpp" />
<ClCompile Include="Util\Hook\HooksUtil.cpp" />
<ClCompile Include="Util\Hook\MinHook\buffer.c" />
<ClCompile Include="Util\Hook\MinHook\hde\hde32.c" />
<ClCompile Include="Util\Hook\MinHook\hde\hde64.c" />
Expand All @@ -151,8 +149,7 @@
<ClInclude Include="Features\Players\Players.h" />
<ClInclude Include="Features\SpectatorList\SpectatorList.h" />
<ClInclude Include="Features\Visual\Visual.h" />
<ClInclude Include="Hooks\Definitions\WINAPI_WndProc.h" />
<ClInclude Include="Hooks\Hooks.h" />
<ClInclude Include="Hooks\WINAPI_WndProc.h" />
<ClInclude Include="SDK\DrawManager\DrawManager.h" />
<ClInclude Include="SDK\Entities\C_BaseAnimating.h" />
<ClInclude Include="SDK\Entities\C_BaseCombatCharacter.h" />
Expand Down Expand Up @@ -219,11 +216,12 @@
<ClInclude Include="SDK\Interfaces\IVModelRender.h" />
<ClInclude Include="SDK\Interfaces\IVRenderView.h" />
<ClInclude Include="SDK\SDK.h" />
<ClInclude Include="Util\Assert\Assert.h" />
<ClInclude Include="Util\Color\Color.h" />
<ClInclude Include="Util\Config\Config.h" />
<ClInclude Include="Util\Config\json.hpp" />
<ClInclude Include="Util\Hash\Hash.h" />
<ClInclude Include="Util\Hook\Hook.h" />
<ClInclude Include="Util\Hook\HooksUtil.h" />
<ClInclude Include="Util\Hook\MinHook\buffer.h" />
<ClInclude Include="Util\Hook\MinHook\hde\hde32.h" />
<ClInclude Include="Util\Hook\MinHook\hde\hde64.h" />
Expand Down
46 changes: 20 additions & 26 deletions Arsenal/Arsenal.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,31 @@
<ClCompile Include="Util\Hook\MinHook\trampoline.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Hooks.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SDK\DrawManager\DrawManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SDK\Includes\checksum_crc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\IEngineVGui_Paint.cpp">
<ClCompile Include="Hooks\IEngineVGui_Paint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SDK\Entities\NetVarManager\NetVarManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\IBaseClientDLL_FrameStageNotify.cpp">
<ClCompile Include="Hooks\IBaseClientDLL_FrameStageNotify.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\IBaseClientDLL_LevelInitPostEntity.cpp">
<ClCompile Include="Hooks\IBaseClientDLL_LevelInitPostEntity.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\IBaseClientDLL_LevelShutdown.cpp">
<ClCompile Include="Hooks\IBaseClientDLL_LevelShutdown.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\CBasePlayer_CalcPlayerView.cpp">
<ClCompile Include="Hooks\CBasePlayer_CalcPlayerView.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\ClientModeShared_CreateMove.cpp">
<ClCompile Include="Hooks\ClientModeShared_CreateMove.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Features\Misc\Misc.cpp">
Expand All @@ -90,7 +87,7 @@
<ClCompile Include="Features\EnginePrediction\EnginePrediction.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\CPrediction_RunCommand.cpp">
<ClCompile Include="Hooks\CPrediction_RunCommand.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Features\ESP\ESP.cpp">
Expand All @@ -114,7 +111,7 @@
<ClCompile Include="SDK\Input\Input.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\WINAPI_WndProc.cpp">
<ClCompile Include="Hooks\WINAPI_WndProc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SDK\Interfaces\IInputSystem.h">
Expand All @@ -126,19 +123,13 @@
<ClCompile Include="Features\PlayerArrows\PlayerArrows.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\ClientModeShared_OverrideView.cpp">
<ClCompile Include="Hooks\ClientModeShared_OverrideView.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Features\Visual\Visual.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\ClientModeShared_GetViewmodelFOV.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\ClientModeShared_DoPostScreenSpaceEffects.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Hooks\Definitions\ModelRender_DrawModelExecute.cpp">
<ClCompile Include="Hooks\ClientModeShared_GetViewmodelFOV.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SDK\Interfaces\IHudChat.h">
Expand All @@ -150,6 +141,9 @@
<ClCompile Include="Features\Players\Players.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Util\Hook\HooksUtil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Entry\Entry.h">
Expand Down Expand Up @@ -182,9 +176,6 @@
<ClInclude Include="Util\VFunc\VFunc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Util\Hook\Hook.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Util\Hook\MinHook\hde\hde32.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -224,9 +215,6 @@
<ClInclude Include="SDK\Includes\color.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Hooks\Hooks.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SDK\Includes\isurface.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -425,7 +413,7 @@
<ClInclude Include="Util\Icons.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Hooks\Definitions\WINAPI_WndProc.h">
<ClInclude Include="Hooks\WINAPI_WndProc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Util\Color\Color.h">
Expand Down Expand Up @@ -461,5 +449,11 @@
<ClInclude Include="Features\Players\Players.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Util\Hook\HooksUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Util\Assert\Assert.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
11 changes: 3 additions & 8 deletions Arsenal/Entry/Entry.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Entry.h"
#include "../Hooks/Definitions/WINAPI_WndProc.h"
#include "../Hooks/WINAPI_WndProc.h"
#include "../Features/Notification/Notification.h"
#include "../Features/Players/Players.h"

Expand Down Expand Up @@ -109,11 +109,7 @@ void CGlobal_Entry::Load()
//DumpTables();
H::Draw.Initialize();

if (I::EngineClient->IsInGame())
g_Globals.m_nLocalIndex = I::EngineClient->GetLocalPlayer();

G::Hooks.Initialize();
WINAPI_HOOK::WINAPI_WndProc::Init();
U::Hooks.Initialize();

PlayerManager::Parse();

Expand All @@ -129,8 +125,7 @@ void CGlobal_Entry::Unload()
CFG::Visual_FOV = 90;
CFG::Visual_ViewmodelFOV = 70;

G::Hooks.Uninitialize();
SetWindowLongPtr(WINAPI_HOOK::WINAPI_WndProc::hwWindow, GWL_WNDPROC, (LONG_PTR)WINAPI_HOOK::WINAPI_WndProc::Original);
U::Hooks.Unload();

Sleep(100);

Expand Down
2 changes: 1 addition & 1 deletion Arsenal/Entry/Entry.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "../Hooks/Hooks.h"
#include "../SDK/SDK.h"

class CGlobal_Entry
{
Expand Down
42 changes: 17 additions & 25 deletions Arsenal/Features/ESP/ESP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@ void CFeatures_ESP::DrawPlayers(C_CSPlayer* pLocal)
if (CFG::ESP_Players_Box)
{
H::Draw.OutlinedRect(x, y, w, h, clrTeam);

//Outline
H::Draw.OutlinedRect(x - 1, y - 1, w + 2, h + 2, COLOR_BLACK);

//Inline
H::Draw.OutlinedRect(x + 1, y + 1, w - 2, h - 2, COLOR_BLACK);
H::Draw.OutlinedRect(x - 1, y - 1, w + 2, h + 2, COLOR_BLACK); // Outline
H::Draw.OutlinedRect(x + 1, y + 1, w - 2, h - 2, COLOR_BLACK); // Inline
}

if (CFG::ESP_Players_HealthBar)
Expand Down Expand Up @@ -123,7 +119,7 @@ void CFeatures_ESP::DrawPlayers(C_CSPlayer* pLocal)
if (CFG::ESP_Players_Name && I::EngineClient->GetPlayerInfo(nIndex, &pi))
{
tOffset += H::Draw.GetFontHeight(fFont) + 2;
H::Draw.String(fFont, x + (w / 2), y - tOffset, COLOR_GREY, ALIGN_TOP, Util::ConvertUtf8ToWide(pi.name).data());
H::Draw.String(fFont, x + (w / 2), y - tOffset, COLOR_WHITE, ALIGN_TOP, Util::ConvertUtf8ToWide(pi.name).data());
}
}

Expand Down Expand Up @@ -151,12 +147,8 @@ void CFeatures_ESP::DrawWorld()
if (CFG::ESP_World_Box)
{
H::Draw.OutlinedRect(x, y, w, h, CFG::Colors_PlantedC4);

//Outline
H::Draw.OutlinedRect(x - 1, y - 1, w + 2, h + 2, COLOR_BLACK);

//Inline
H::Draw.OutlinedRect(x + 1, y + 1, w - 2, h - 2, COLOR_BLACK);
H::Draw.OutlinedRect(x - 1, y - 1, w + 2, h + 2, COLOR_BLACK); // Outline
H::Draw.OutlinedRect(x + 1, y + 1, w - 2, h - 2, COLOR_BLACK); // Inline
}

if (CFG::ESP_World_Name)
Expand All @@ -178,13 +170,9 @@ void CFeatures_ESP::DrawWorld()

if (CFG::ESP_World_Box)
{
H::Draw.OutlinedRect(x, y, w, h, CFG::Colors_PlantedC4);

//Outline
H::Draw.OutlinedRect(x - 1, y - 1, w + 2, h + 2, COLOR_BLACK);

//Inline
H::Draw.OutlinedRect(x + 1, y + 1, w - 2, h - 2, COLOR_BLACK);
H::Draw.OutlinedRect(x, y, w, h, CFG::Colors_DroppedWeapons);
H::Draw.OutlinedRect(x - 1, y - 1, w + 2, h + 2, COLOR_BLACK); // Outline
H::Draw.OutlinedRect(x + 1, y + 1, w - 2, h - 2, COLOR_BLACK); // Inline
}

if (CFG::ESP_World_Name)
Expand All @@ -205,18 +193,22 @@ bool CFeatures_ESP::GetDynamicBounds(C_BaseEntity* pEntity, int& x, int& y, int&
if (!pEntity)
return false;

Vector vMins, vMaxs;
pEntity->GetRenderBounds(vMins, vMaxs);
Vector vMins = pEntity->m_vecMins(), vMaxs = pEntity->m_vecMaxs();

auto& transform = const_cast<matrix3x4_t&>(pEntity->RenderableToWorldTransform());
U::Math.AngleMatrix(pEntity->GetRenderAngles(), transform);
U::Math.MatrixSetColumn(pEntity->GetRenderOrigin(), 3, transform);
if (pEntity && pEntity->entindex() == I::EngineClient->GetLocalPlayer())
{
Vector vAngles = I::EngineClient->GetViewAngles();
vAngles.x = vAngles.z = 0.f;
U::Math.AngleMatrix(vAngles, transform);
U::Math.MatrixSetColumn(pEntity->GetAbsOrigin(), 3, transform);
}

float flLeft, flRight, flTop, flBottom;
if (!Util::IsOnScreen(pEntity, transform, &flLeft, &flRight, &flTop, &flBottom))
return false;

x = flLeft;
x = flLeft + (flRight - flLeft) / 8.f;
y = flBottom;
w = flRight - flLeft;
h = flTop - flBottom;
Expand Down
18 changes: 4 additions & 14 deletions Arsenal/Features/EnginePrediction/EnginePrediction.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#include "EnginePrediction.h"

void CFeatures_EnginePrediction::Start(CUserCmd* cmd)
void CFeatures_EnginePrediction::Start(C_CSPlayer* pLocal, CUserCmd* cmd)
{
if (!I::MoveHelper)
return;

C_CSPlayer* pLocal = Util::CSPlayerByIndex(g_Globals.m_nLocalIndex);

if (!pLocal)
if (!pLocal || pLocal->deadflag() || !I::MoveHelper)
return;

cmd->random_seed = (MD5_PseudoRandom(cmd->command_number) & INT_MAX);
Expand Down Expand Up @@ -65,14 +60,9 @@ void CFeatures_EnginePrediction::Start(CUserCmd* cmd)
I::ClientPrediction->m_bFirstTimePredicted = bOldIsFirstPrediction;
}

void CFeatures_EnginePrediction::Finish()
void CFeatures_EnginePrediction::Finish(C_CSPlayer* pLocal, CUserCmd* cmd)
{
if (!I::MoveHelper)
return;

C_CSPlayer* pLocal = Util::CSPlayerByIndex(g_Globals.m_nLocalIndex);

if (!pLocal)
if (!pLocal || pLocal->deadflag())
return;

I::GameMovement->FinishTrackPredictionErrors(pLocal);
Expand Down
4 changes: 2 additions & 2 deletions Arsenal/Features/EnginePrediction/EnginePrediction.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
class CFeatures_EnginePrediction
{
public:
void Start(CUserCmd* cmd);
void Finish();
void Start(C_CSPlayer* pLocal, CUserCmd* cmd);
void Finish(C_CSPlayer* pLocal, CUserCmd* cmd);

private:
int GetTickbase(C_CSPlayer* pLocal, CUserCmd* cmd);
Expand Down
5 changes: 1 addition & 4 deletions Arsenal/Features/Misc/Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

void CFeatures_Misc::Run(C_CSPlayer* pLocal, CUserCmd* cmd)
{
if (!pLocal || pLocal->deadflag()) //|| pLocal->IsSwimming())
return;

if (pLocal->m_MoveType() == MOVETYPE_NOCLIP || pLocal->m_MoveType() == MOVETYPE_LADDER || pLocal->m_MoveType() == MOVETYPE_OBSERVER)
if (!pLocal || pLocal->deadflag() || pLocal->m_MoveType() != MOVETYPE_WALK) //|| pLocal->IsSwimming()) TODO: fix swimming
return;

Bunnyhop(pLocal, cmd);
Expand Down
19 changes: 19 additions & 0 deletions Arsenal/Hooks/CBasePlayer_CalcPlayerView.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "../SDK/SDK.h"

#include "../../Features/CFG.h"

MAKE_HOOK(CBasePlayer_CalcPlayerView, U::Offsets.C_BasePlayer_CalcPlayerView, void, __fastcall, C_BasePlayer* pThis, void* edx, Vector& eyeOrigin, Vector& eyeAngles, float& fov)
{
if (CFG::Visual_NoRecoil && pThis)
{
const Vector vOldPunch = pThis->m_vecPunchAngle();

pThis->m_vecPunchAngle().Init();
CALL_ORIGINAL(pThis, edx, eyeOrigin, eyeAngles, fov);
pThis->m_vecPunchAngle() = vOldPunch;
}
else
{
CALL_ORIGINAL(pThis, edx, eyeOrigin, eyeAngles, fov);
}
}
Loading

0 comments on commit ae62b6c

Please sign in to comment.