Skip to content

Commit

Permalink
ESP, bunny ,antiflash, snaplines
Browse files Browse the repository at this point in the history
  • Loading branch information
Spelchure committed Jun 6, 2020
1 parent b183497 commit 3c10c4f
Show file tree
Hide file tree
Showing 171 changed files with 5,882 additions and 3,005 deletions.
28 changes: 26 additions & 2 deletions CSGO Internal.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
Expand Down Expand Up @@ -79,6 +79,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)Dependencies\DirectX9SDK\Include;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)Dependencies\DirectX9SDK\Lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
Expand Down Expand Up @@ -117,12 +119,14 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>d3d9.lib;d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -142,6 +146,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="CSGOInternal\D3D9\Drawing.cc" />
<ClCompile Include="CSGOInternal\D3D9\DummyDevice.cc" />
<ClCompile Include="CSGOInternal\DllMain.cc" />
<ClCompile Include="CSGOInternal\Gateway.cc" />
Expand Down Expand Up @@ -191,6 +196,9 @@
<None Include="Docs\html\class_c_trace_filter-members.html" />
<None Include="Docs\html\class_c_trace_filter.html" />
<None Include="Docs\html\class_c_trace_filter.js" />
<None Include="Docs\html\class_d3_d9_drawing-members.html" />
<None Include="Docs\html\class_d3_d9_drawing.html" />
<None Include="Docs\html\class_d3_d9_drawing.js" />
<None Include="Docs\html\class_i_base_client_d_l_l-members.html" />
<None Include="Docs\html\class_i_base_client_d_l_l.html" />
<None Include="Docs\html\class_i_base_client_d_l_l.js" />
Expand Down Expand Up @@ -327,6 +335,8 @@
<None Include="Docs\html\search\classes_7.js" />
<None Include="Docs\html\search\classes_8.html" />
<None Include="Docs\html\search\classes_8.js" />
<None Include="Docs\html\search\classes_9.html" />
<None Include="Docs\html\search\classes_9.js" />
<None Include="Docs\html\search\files_0.html" />
<None Include="Docs\html\search\files_0.js" />
<None Include="Docs\html\search\files_1.html" />
Expand Down Expand Up @@ -377,6 +387,8 @@
<None Include="Docs\html\search\searchdata.js" />
<None Include="Docs\html\search\variables_0.html" />
<None Include="Docs\html\search\variables_0.js" />
<None Include="Docs\html\search\variables_1.html" />
<None Include="Docs\html\search\variables_1.js" />
<None Include="Docs\html\structcplane__t-members.html" />
<None Include="Docs\html\structcplane__t.html" />
<None Include="Docs\html\structcplane__t.js" />
Expand Down Expand Up @@ -675,6 +687,7 @@
<None Include="Docs\html\struct_my_document__coll__graph.dot" />
<None Include="Docs\html\struct_ray__t-members.html" />
<None Include="Docs\html\struct_ray__t.html" />
<None Include="Docs\html\struct_ray__t.js" />
<None Include="Docs\html\struct_stb_textedit_row-members.html" />
<None Include="Docs\html\struct_stb_textedit_row.html" />
<None Include="Docs\html\struct_stb_textedit_row.js" />
Expand All @@ -695,11 +708,18 @@
<None Include="Docs\html\struct___vector2-members.html" />
<None Include="Docs\html\struct___vector2.html" />
<None Include="Docs\html\struct___vector2.js" />
<None Include="Docs\html\struct___vector4-members.html" />
<None Include="Docs\html\struct___vector4.html" />
<None Include="Docs\html\struct___vector4.js" />
<None Include="Docs\html\tabs.css" />
<None Include="Docs\html\_dll_main_8cc.html" />
<None Include="Docs\html\_dll_main_8cc.js" />
<None Include="Docs\html\_dll_main_8cc_ae57465f54f783f35d7738032864a9926_cgraph.dot" />
<None Include="Docs\html\_dll_main_8cc__incl.dot" />
<None Include="Docs\html\_drawing_8cc.html" />
<None Include="Docs\html\_drawing_8cc.js" />
<None Include="Docs\html\_drawing_8hpp.html" />
<None Include="Docs\html\_drawing_8hpp_source.html" />
<None Include="Docs\html\_dummy_device_8cc.html" />
<None Include="Docs\html\_dummy_device_8cc.js" />
<None Include="Docs\html\_dummy_device_8cc__incl.dot" />
Expand Down Expand Up @@ -761,6 +781,9 @@
<None Include="Docs\html\_strings_8hpp.html" />
<None Include="Docs\html\_strings_8hpp.js" />
<None Include="Docs\html\_strings_8hpp_source.html" />
<None Include="Docs\html\_str_lang_8hpp.html" />
<None Include="Docs\html\_str_lang_8hpp.js" />
<None Include="Docs\html\_str_lang_8hpp_source.html" />
<None Include="Docs\html\_s_d_k_8hpp.html" />
<None Include="Docs\html\_s_d_k_8hpp_source.html" />
<None Include="Docs\html\_trace_ray_8hpp.html" />
Expand All @@ -775,12 +798,14 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Text Include="Changelog.txt" />
<Text Include="HACKING.txt" />
<Text Include="CSGOInternal\ImGui\LICENSE.txt" />
<Text Include="LICENSE" />
<Text Include="TODO.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="CSGOInternal\D3D9\Drawing.hpp" />
<ClInclude Include="CSGOInternal\D3D9\DummyDevice.hpp" />
<ClInclude Include="CSGOInternal\Hooks\Hooks.hpp" />
<ClInclude Include="CSGOInternal\Hooks\Memory.hpp" />
Expand All @@ -799,7 +824,6 @@
<ClInclude Include="CSGOInternal\Source SDK\Interfaces.hpp" />
<ClInclude Include="CSGOInternal\Source SDK\Netvars.hpp" />
<ClInclude Include="CSGOInternal\Source SDK\SDK.hpp" />
<ClInclude Include="CSGOInternal\Source SDK\Signatures.hpp" />
<ClInclude Include="CSGOInternal\Source SDK\Strings.hpp" />
<ClInclude Include="CSGOInternal\Source SDK\TraceRay.hpp" />
<ClInclude Include="CSGOInternal\Source SDK\Vectors.hpp" />
Expand Down
28 changes: 25 additions & 3 deletions CSGO Internal.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,31 @@
<None Include="Docs\html\search\functions_9.js" />
<None Include="Docs\html\search\functions_a.js" />
<None Include="Docs\html\search\variables_0.js" />
<None Include="Docs\html\search\classes_9.html" />
<None Include="Docs\html\search\variables_1.html" />
<None Include="Docs\html\_drawing_8cc.html" />
<None Include="Docs\html\_drawing_8hpp.html" />
<None Include="Docs\html\_drawing_8hpp_source.html" />
<None Include="Docs\html\_str_lang_8hpp.html" />
<None Include="Docs\html\_str_lang_8hpp_source.html" />
<None Include="Docs\html\class_d3_d9_drawing.html" />
<None Include="Docs\html\class_d3_d9_drawing-members.html" />
<None Include="Docs\html\struct___vector4.html" />
<None Include="Docs\html\struct___vector4-members.html" />
<None Include="Docs\html\_drawing_8cc.js" />
<None Include="Docs\html\_str_lang_8hpp.js" />
<None Include="Docs\html\class_d3_d9_drawing.js" />
<None Include="Docs\html\struct___vector4.js" />
<None Include="Docs\html\struct_ray__t.js" />
<None Include="Docs\html\search\classes_9.js" />
<None Include="Docs\html\search\variables_1.js" />
</ItemGroup>
<ItemGroup>
<Text Include="LICENSE" />
<Text Include="CSGOInternal\ImGui\LICENSE.txt" />
<Text Include="HACKING.txt" />
<Text Include="TODO.txt" />
<Text Include="Changelog.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CSGOInternal\DllMain.cc">
Expand Down Expand Up @@ -700,6 +719,9 @@
<ClCompile Include="CSGOInternal\MainMenu.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CSGOInternal\D3D9\Drawing.cc">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CSGOInternal\Hooks\Memory.hpp">
Expand Down Expand Up @@ -981,9 +1003,6 @@
<ClInclude Include="CSGOInternal\Source SDK\Vectors.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CSGOInternal\Source SDK\Signatures.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CSGOInternal\Source SDK\TraceRay.hpp">
<Filter>Header Files</Filter>
</ClInclude>
Expand All @@ -993,6 +1012,9 @@
<ClInclude Include="CSGOInternal\StrLang.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CSGOInternal\D3D9\Drawing.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="Docs\html\folderclosed.png">
Expand Down
93 changes: 93 additions & 0 deletions CSGOInternal/D3D9/Drawing.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*****************************************************************//**
* \file Drawing.cc
* \brief
*
* \author ALPEREN
* \date June 2020
*
* <br>
* This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*********************************************************************/
#include "Drawing.hpp"

#pragma warning(disable : 4244)

#define ABS(x) ((x < 0) ? (-x) : (x)) // Absolute value of x

void
D3D9Drawing::DrawFilledRect(int x, int y, int w, int h, D3DCOLOR color) {
D3DRECT rect = { x,y,x + w,y + h };
pDev->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0);
}

void
D3D9Drawing::DrawLine(int x1, int y1, int x2, int y2, int thickness, D3DCOLOR color) {
if (nullptr == lineInst)
D3DXCreateLine(pDev, &lineInst);


D3DXVECTOR2 Line[2];
Line[0] = D3DXVECTOR2(x1, y1);
Line[1] = D3DXVECTOR2(x2, y2);
lineInst->SetWidth(thickness);
lineInst->Draw(Line, 2, color);
}

void
D3D9Drawing::DrawLine(Vector2 src, Vector2 dst, int thickness, D3DCOLOR color) {
this->DrawLine(src.x, src.y, dst.x, dst.y, thickness, color);
}

void
D3D9Drawing::DrawEspBox(Vector2 top, Vector2 bot, int thickness, D3DCOLOR color) {
int height = ABS(top.y - bot.y);

Vector2 tl, tr;
tl.x = top.x - height / 4;
tr.x = top.x + height / 4;
tl.y = tr.y = top.y;

Vector2 bl, br;
bl.x = bot.x - height / 4;
br.x = bot.x + height / 4;
bl.y = br.y = bot.y;

DrawLine(tl, tr, thickness, color);
DrawLine(bl, br, thickness, color);
DrawLine(tl, bl, thickness, color);
DrawLine(tr, br, thickness, color);
}

bool
D3D9Drawing::World2Screen(float* viewMatrix, Vector3 pos, Vector2& screen)
{
Vector4 clipCoords;
clipCoords.x = pos.x * viewMatrix[0] + pos.y * viewMatrix[1] + pos.z * viewMatrix[2] + viewMatrix[3];
clipCoords.y = pos.x * viewMatrix[4] + pos.y * viewMatrix[5] + pos.z * viewMatrix[6] + viewMatrix[7];
clipCoords.z = pos.x * viewMatrix[8] + pos.y * viewMatrix[9] + pos.z * viewMatrix[10] + viewMatrix[11];
clipCoords.w = pos.x * viewMatrix[12] + pos.y * viewMatrix[13] + pos.z * viewMatrix[14] + viewMatrix[15];

if (clipCoords.w < 0.1f)
return false;

Vector NDC;
NDC.x = clipCoords.x / clipCoords.w;
NDC.y = clipCoords.y / clipCoords.w;
NDC.z = clipCoords.z / clipCoords.w;

screen.x = (screen_w / 2 * NDC.x) + (NDC.x + screen_w / 2);
screen.y = -(screen_h / 2 * NDC.y) + (NDC.y + screen_h / 2);
return true;

}
68 changes: 68 additions & 0 deletions CSGOInternal/D3D9/Drawing.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*****************************************************************//**
* \file Drawing.hpp
* \brief
*
* \author ALPEREN
* \date June 2020
*
* <br>
* This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*********************************************************************/
#pragma once

#include <d3d9.h>
#include <d3dx9.h>
#include "../Source SDK/Vectors.hpp"


class D3D9Drawing {
LPDIRECT3DDEVICE9 pDev;
ID3DXLine* lineInst;
//ID3DXFont* FontF;
public:
int screen_h, screen_w;

D3D9Drawing(LPDIRECT3DDEVICE9 pDevice) : pDev(pDevice),
screen_h(0), screen_w(0), lineInst(nullptr) {}

~D3D9Drawing() {
if (nullptr != lineInst)
lineInst->Release();
}

void SetDevice(LPDIRECT3DDEVICE9 pDevice) {
pDev = pDevice;
}
void GetReady() {

/* Get viewport (screen size ) */
D3DVIEWPORT9 viewPort;
pDev->GetViewport(&viewPort);
screen_w = viewPort.Width; // +viewPort.X;
screen_h = viewPort.Height; // + viewPort.Y;

D3DXCreateLine(pDev, &lineInst);


}

void DrawFilledRect(int x, int y, int w, int h, D3DCOLOR color);
void DrawLine(int x1, int y1, int x2, int y2, int thickness, D3DCOLOR color);
void DrawLine(Vector2 src, Vector2 dst, int thickness, D3DCOLOR color);
void DrawEspBox(Vector2 top, Vector2 bot, int thickness, D3DCOLOR color);
bool World2Screen(float* viewMatrix, Vector3 pos, Vector2& screen);
};



Loading

0 comments on commit 3c10c4f

Please sign in to comment.