├── .gitattributes
├── .gitignore
├── LICENSE
├── RCi.Tutorials.Csgo.Cheat.External.sln
├── README.md
├── Tutorial 001 - Process Hook
├── App.config
├── Data
│ └── GameProcess.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── Point.cs
│ │ └── Rect.cs
│ └── User32.cs
├── Tutorial 001 - Process Hook.csproj
└── Utils
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 002 - Read Memory
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ └── Player.cs
├── Math
│ └── Vector3.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── Point.cs
│ │ └── Rect.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 002 - Read Memory.csproj
└── Utils
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 003 - Overlay Window
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ └── Player.cs
├── Gfx
│ └── WindowOverlay.cs
├── Math
│ └── Vector3.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── Margins.cs
│ │ ├── Point.cs
│ │ └── Rect.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 003 - Overlay Window.csproj
└── Utils
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 004 - Graphics
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ └── Player.cs
├── Gfx
│ ├── DeviceExtensions.cs
│ ├── Graphics.cs
│ └── WindowOverlay.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── Margins.cs
│ │ ├── Point.cs
│ │ └── Rect.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 004 - Graphics.csproj
└── Utils
│ ├── FpsCounter.cs
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 005 - ESP Aim Crosshair
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ └── Player.cs
├── Features
│ └── EspAimCrosshair.cs
├── Gfx
│ ├── DeviceExtensions.cs
│ ├── GfxMath.cs
│ ├── Graphics.cs
│ └── WindowOverlay.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── Margins.cs
│ │ ├── Point.cs
│ │ └── Rect.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 005 - ESP Aim Crosshair.csproj
└── Utils
│ ├── FpsCounter.cs
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 006 - ESP Skeleton
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ ├── Internal
│ │ ├── Entity.cs
│ │ ├── EntityBase.cs
│ │ └── Player.cs
│ └── Raw
│ │ ├── Team.cs
│ │ ├── matrix3x4_t.cs
│ │ ├── mstudiobbox_t.cs
│ │ ├── mstudiobone_t.cs
│ │ ├── mstudiohitboxset_t.cs
│ │ └── studiohdr_t.cs
├── Features
│ ├── EspAimCrosshair.cs
│ └── EspSkeleton.cs
├── Gfx
│ ├── DeviceExtensions.cs
│ ├── GfxMath.cs
│ ├── Graphics.cs
│ └── WindowOverlay.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── Margins.cs
│ │ ├── Point.cs
│ │ └── Rect.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 006 - ESP Skeleton.csproj
└── Utils
│ ├── FpsCounter.cs
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 007 - ESP HitBoxes
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ ├── Internal
│ │ ├── Entity.cs
│ │ ├── EntityBase.cs
│ │ └── Player.cs
│ └── Raw
│ │ ├── Team.cs
│ │ ├── matrix3x4_t.cs
│ │ ├── mstudiobbox_t.cs
│ │ ├── mstudiobone_t.cs
│ │ ├── mstudiohitboxset_t.cs
│ │ └── studiohdr_t.cs
├── Features
│ ├── EspAimCrosshair.cs
│ ├── EspHitBoxes.cs
│ └── EspSkeleton.cs
├── Gfx
│ ├── DeviceExtensions.cs
│ ├── GfxMath.cs
│ ├── Graphics.cs
│ └── WindowOverlay.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── Margins.cs
│ │ ├── Point.cs
│ │ └── Rect.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 007 - ESP HitBoxes.csproj
└── Utils
│ ├── FpsCounter.cs
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 008 - Trigger Bot
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ ├── Internal
│ │ ├── Entity.cs
│ │ ├── EntityBase.cs
│ │ └── Player.cs
│ └── Raw
│ │ ├── Team.cs
│ │ ├── matrix3x4_t.cs
│ │ ├── mstudiobbox_t.cs
│ │ ├── mstudiobone_t.cs
│ │ ├── mstudiohitboxset_t.cs
│ │ └── studiohdr_t.cs
├── Features
│ ├── EspAimCrosshair.cs
│ ├── EspHitBoxes.cs
│ ├── EspSkeleton.cs
│ └── TriggerBot.cs
├── Gfx
│ ├── DeviceExtensions.cs
│ ├── Graphics.cs
│ ├── Math
│ │ ├── GfxMath.cs
│ │ └── Line3D.cs
│ └── WindowOverlay.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── HardwareInput.cs
│ │ ├── Input.cs
│ │ ├── KeybdInput.cs
│ │ ├── Margins.cs
│ │ ├── MouseEventFlags.cs
│ │ ├── MouseInput.cs
│ │ ├── Point.cs
│ │ ├── Rect.cs
│ │ ├── SendInputEventType.cs
│ │ └── WindowsVirtualKey.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 008 - Trigger Bot.csproj
└── Utils
│ ├── FpsCounter.cs
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 009 - Aim Bot (Mouse Calibration)
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ ├── Internal
│ │ ├── Entity.cs
│ │ ├── EntityBase.cs
│ │ └── Player.cs
│ └── Raw
│ │ ├── Team.cs
│ │ ├── matrix3x4_t.cs
│ │ ├── mstudiobbox_t.cs
│ │ ├── mstudiobone_t.cs
│ │ ├── mstudiohitboxset_t.cs
│ │ └── studiohdr_t.cs
├── Features
│ ├── AimBot.cs
│ ├── EspAimCrosshair.cs
│ ├── EspHitBoxes.cs
│ ├── EspSkeleton.cs
│ └── TriggerBot.cs
├── Gfx
│ ├── DeviceExtensions.cs
│ ├── Graphics.cs
│ ├── Math
│ │ ├── GfxMath.cs
│ │ └── Line3D.cs
│ └── WindowOverlay.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── HardwareInput.cs
│ │ ├── Input.cs
│ │ ├── KeybdInput.cs
│ │ ├── Margins.cs
│ │ ├── MouseEventFlags.cs
│ │ ├── MouseInput.cs
│ │ ├── Point.cs
│ │ ├── Rect.cs
│ │ ├── SendInputEventType.cs
│ │ └── WindowsVirtualKey.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 009 - Aim Bot (Mouse Calibration).csproj
└── Utils
│ ├── FpsCounter.cs
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 010 - Aim Bot (Async)
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ ├── Internal
│ │ ├── Entity.cs
│ │ ├── EntityBase.cs
│ │ └── Player.cs
│ └── Raw
│ │ ├── Team.cs
│ │ ├── matrix3x4_t.cs
│ │ ├── mstudiobbox_t.cs
│ │ ├── mstudiobone_t.cs
│ │ ├── mstudiohitboxset_t.cs
│ │ └── studiohdr_t.cs
├── Features
│ ├── AimBot.cs
│ ├── EspAimCrosshair.cs
│ ├── EspHitBoxes.cs
│ ├── EspSkeleton.cs
│ └── TriggerBot.cs
├── Gfx
│ ├── DeviceExtensions.cs
│ ├── Graphics.cs
│ ├── Math
│ │ ├── GfxMath.cs
│ │ ├── Line3D.cs
│ │ └── Plane3D.cs
│ └── WindowOverlay.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── HardwareInput.cs
│ │ ├── Input.cs
│ │ ├── KeybdInput.cs
│ │ ├── Margins.cs
│ │ ├── MouseEventFlags.cs
│ │ ├── MouseInput.cs
│ │ ├── Point.cs
│ │ ├── Rect.cs
│ │ ├── SendInputEventType.cs
│ │ └── WindowsVirtualKey.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 010 - Aim Bot (Async).csproj
└── Utils
│ ├── FpsCounter.cs
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 011 - Global Hook
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ ├── Internal
│ │ ├── Entity.cs
│ │ ├── EntityBase.cs
│ │ └── Player.cs
│ └── Raw
│ │ ├── Team.cs
│ │ ├── matrix3x4_t.cs
│ │ ├── mstudiobbox_t.cs
│ │ ├── mstudiobone_t.cs
│ │ ├── mstudiohitboxset_t.cs
│ │ └── studiohdr_t.cs
├── Features
│ ├── AimBot.cs
│ ├── EspAimCrosshair.cs
│ ├── EspHitBoxes.cs
│ ├── EspSkeleton.cs
│ └── TriggerBot.cs
├── Gfx
│ ├── DeviceExtensions.cs
│ ├── Graphics.cs
│ ├── Math
│ │ ├── GfxMath.cs
│ │ ├── Line3D.cs
│ │ └── Plane3D.cs
│ └── WindowOverlay.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── HardwareInput.cs
│ │ ├── HookProc.cs
│ │ ├── HookType.cs
│ │ ├── Input.cs
│ │ ├── KeybdInput.cs
│ │ ├── Margins.cs
│ │ ├── MouseEventFlags.cs
│ │ ├── MouseInput.cs
│ │ ├── MouseMessage.cs
│ │ ├── Point.cs
│ │ ├── Rect.cs
│ │ ├── SendInputEventType.cs
│ │ └── WindowsVirtualKey.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 011 - Global Hook.csproj
└── Utils
│ ├── FpsCounter.cs
│ ├── GlobalHook.cs
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── Tutorial 012 - Aim Bot (Sync)
├── App.config
├── Data
│ ├── GameData.cs
│ ├── GameProcess.cs
│ ├── Internal
│ │ ├── Entity.cs
│ │ ├── EntityBase.cs
│ │ └── Player.cs
│ └── Raw
│ │ ├── Team.cs
│ │ ├── matrix3x4_t.cs
│ │ ├── mstudiobbox_t.cs
│ │ ├── mstudiobone_t.cs
│ │ ├── mstudiohitboxset_t.cs
│ │ └── studiohdr_t.cs
├── Features
│ ├── AimBot.cs
│ ├── EspAimCrosshair.cs
│ ├── EspHitBoxes.cs
│ ├── EspSkeleton.cs
│ └── TriggerBot.cs
├── Gfx
│ ├── DeviceExtensions.cs
│ ├── Graphics.cs
│ ├── Math
│ │ ├── GfxMath.cs
│ │ ├── Line3D.cs
│ │ └── Plane3D.cs
│ └── WindowOverlay.cs
├── Offsets.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Sys
│ ├── Data
│ │ ├── HardwareInput.cs
│ │ ├── HookProc.cs
│ │ ├── HookType.cs
│ │ ├── Input.cs
│ │ ├── KeybdInput.cs
│ │ ├── Margins.cs
│ │ ├── MouseEventFlags.cs
│ │ ├── MouseInput.cs
│ │ ├── MouseMessage.cs
│ │ ├── Point.cs
│ │ ├── Rect.cs
│ │ ├── SendInputEventType.cs
│ │ └── WindowsVirtualKey.cs
│ ├── Dwmapi.cs
│ ├── Kernel32.cs
│ └── User32.cs
├── Tutorial 012 - Aim Bot (Sync).csproj
└── Utils
│ ├── FpsCounter.cs
│ ├── GlobalHook.cs
│ ├── Module.cs
│ ├── ThreadedComponent.cs
│ └── U.cs
├── lib
├── Microsoft.DirectX.Direct3D.dll
├── Microsoft.DirectX.Direct3DX.dll
└── Microsoft.DirectX.dll
├── offsets.txt
└── preview.png
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 RCi Works
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RCi.Tutorials.Csgo.Cheat.External
2 | "Counter-Strike: Global Offensive" External Cheat
3 |
4 | __Features__
5 | * Aim Crosshair
6 | * Wallhack (Skeleton, HitBoxes)
7 | * Trigger Bot
8 | * Aim Bot
9 |
10 | 
11 |
12 | __Fair use disclaimer__
13 |
14 | This project is for educational purposes. Do not use this in any way which could disturb or affect:
15 | * Integrity of the game
16 | * Any player's experience playing the game
17 |
--------------------------------------------------------------------------------
/Tutorial 001 - Process Hook/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 001 - Process Hook/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External
5 | {
6 | ///
7 | /// Main program.
8 | ///
9 | public class Program :
10 | System.Windows.Application,
11 | IDisposable
12 | {
13 | #region // entry point
14 |
15 | ///
16 | public static void Main() => new Program().Run();
17 |
18 | #endregion
19 |
20 | #region // storage
21 |
22 | ///
23 | private GameProcess GameProcess { get; set; }
24 |
25 | #endregion
26 |
27 | #region // ctor
28 |
29 | ///
30 | public Program()
31 | {
32 | Startup += (sender, args) => Ctor();
33 | Exit += (sender, args) => Dispose();
34 | }
35 |
36 | ///
37 | public void Ctor()
38 | {
39 | GameProcess = new GameProcess();
40 | GameProcess.Start();
41 | }
42 |
43 | ///
44 | public void Dispose()
45 | {
46 | GameProcess.Dispose();
47 | GameProcess = default;
48 | }
49 |
50 | #endregion
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Tutorial 001 - Process Hook/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 001 - Process Hook/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 001 - Process Hook/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 001 - Process Hook/Sys/User32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class User32
8 | {
9 | [DllImport("user32.dll", SetLastError = true)]
10 | public static extern bool ClientToScreen(IntPtr hWnd, out Point lpPoint);
11 |
12 | [DllImport("user32.dll", SetLastError = true)]
13 | public static extern bool GetClientRect(IntPtr hWnd, out Rect lpRect);
14 |
15 | [DllImport("user32.dll", SetLastError = true)]
16 | public static extern IntPtr GetForegroundWindow();
17 |
18 | [DllImport("user32.dll", SetLastError = true)]
19 | public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tutorial 001 - Process Hook/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | private Process Process { get; set; }
16 |
17 | ///
18 | private ProcessModule ProcessModule { get; set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
4 | {
5 | ///
6 | /// Game data retrieved from process.
7 | ///
8 | public class GameData :
9 | ThreadedComponent
10 | {
11 | #region // storage
12 |
13 | ///
14 | protected override string ThreadName => nameof(GameData);
15 |
16 | ///
17 | private GameProcess GameProcess { get; set; }
18 |
19 | ///
20 | public Player Player { get; set; }
21 |
22 | #endregion
23 |
24 | #region // ctor
25 |
26 | ///
27 | public GameData(GameProcess gameProcess)
28 | {
29 | GameProcess = gameProcess;
30 | Player = new Player();
31 | }
32 |
33 | ///
34 | public override void Dispose()
35 | {
36 | base.Dispose();
37 |
38 | Player = default;
39 | GameProcess = default;
40 | }
41 |
42 | #endregion
43 |
44 | ///
45 | protected override void FrameAction()
46 | {
47 | if (!GameProcess.IsValid)
48 | {
49 | return;
50 | }
51 |
52 | Player.Update(GameProcess);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Data/Player.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using RCi.Tutorials.Csgo.Cheat.External.Math;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Player class.
9 | ///
10 | public class Player
11 | {
12 | ///
13 | /// Update data from process.
14 | ///
15 | public void Update(GameProcess gameProcess)
16 | {
17 | var addressBase = gameProcess.ModuleClient.Read(Offsets.dwLocalPlayer);
18 | if (addressBase == IntPtr.Zero)
19 | {
20 | return;
21 | }
22 |
23 | var origin = gameProcess.Process.Read(addressBase + Offsets.m_vecOrigin);
24 | var viewOffset = gameProcess.Process.Read(addressBase + Offsets.m_vecViewOffset);
25 | var eyePosition = origin + viewOffset;
26 |
27 | Console.WriteLine($"{eyePosition.X:0.00} {eyePosition.Y:0.00} {eyePosition.Z:0.00}");
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Math/Vector3.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Math
4 | {
5 | [StructLayout(LayoutKind.Sequential)]
6 | public struct Vector3
7 | {
8 | public float X, Y, Z;
9 |
10 | public Vector3(float x, float y, float z)
11 | {
12 | X = x;
13 | Y = y;
14 | Z = z;
15 | }
16 |
17 | public static Vector3 operator +(Vector3 left, Vector3 right)
18 | {
19 | return new Vector3(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External
5 | {
6 | ///
7 | /// Main program.
8 | ///
9 | public class Program :
10 | System.Windows.Application,
11 | IDisposable
12 | {
13 | #region // entry point
14 |
15 | ///
16 | public static void Main() => new Program().Run();
17 |
18 | #endregion
19 |
20 | #region // storage
21 |
22 | ///
23 | private GameProcess GameProcess { get; set; }
24 | private GameData GameData { get; set; }
25 |
26 | #endregion
27 |
28 | #region // ctor
29 |
30 | ///
31 | public Program()
32 | {
33 | Startup += (sender, args) => Ctor();
34 | Exit += (sender, args) => Dispose();
35 | }
36 |
37 | ///
38 | public void Ctor()
39 | {
40 | GameProcess = new GameProcess();
41 | GameData = new GameData(GameProcess);
42 |
43 | GameProcess.Start();
44 | GameData.Start();
45 | }
46 |
47 | ///
48 | public void Dispose()
49 | {
50 | GameData.Dispose();
51 | GameData = default;
52 |
53 | GameProcess.Dispose();
54 | GameProcess = default;
55 | }
56 |
57 | #endregion
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | [DllImport("kernel32.dll", SetLastError = true)]
9 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Sys/User32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class User32
8 | {
9 | [DllImport("user32.dll", SetLastError = true)]
10 | public static extern bool ClientToScreen(IntPtr hWnd, out Point lpPoint);
11 |
12 | [DllImport("user32.dll", SetLastError = true)]
13 | public static extern bool GetClientRect(IntPtr hWnd, out Rect lpRect);
14 |
15 | [DllImport("user32.dll", SetLastError = true)]
16 | public static extern IntPtr GetForegroundWindow();
17 |
18 | [DllImport("user32.dll", SetLastError = true)]
19 | public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tutorial 002 - Read Memory/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
4 | {
5 | ///
6 | /// Game data retrieved from process.
7 | ///
8 | public class GameData :
9 | ThreadedComponent
10 | {
11 | #region // storage
12 |
13 | ///
14 | protected override string ThreadName => nameof(GameData);
15 |
16 | ///
17 | private GameProcess GameProcess { get; set; }
18 |
19 | ///
20 | public Player Player { get; set; }
21 |
22 | #endregion
23 |
24 | #region // ctor
25 |
26 | ///
27 | public GameData(GameProcess gameProcess)
28 | {
29 | GameProcess = gameProcess;
30 | Player = new Player();
31 | }
32 |
33 | ///
34 | public override void Dispose()
35 | {
36 | base.Dispose();
37 |
38 | Player = default;
39 | GameProcess = default;
40 | }
41 |
42 | #endregion
43 |
44 | ///
45 | protected override void FrameAction()
46 | {
47 | if (!GameProcess.IsValid)
48 | {
49 | return;
50 | }
51 |
52 | Player.Update(GameProcess);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Data/Player.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using RCi.Tutorials.Csgo.Cheat.External.Math;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Player class.
9 | ///
10 | public class Player
11 | {
12 | ///
13 | /// Update data from process.
14 | ///
15 | public void Update(GameProcess gameProcess)
16 | {
17 | var addressBase = gameProcess.ModuleClient.Read(Offsets.dwLocalPlayer);
18 | if (addressBase == IntPtr.Zero)
19 | {
20 | return;
21 | }
22 |
23 | var origin = gameProcess.Process.Read(addressBase + Offsets.m_vecOrigin);
24 | var viewOffset = gameProcess.Process.Read(addressBase + Offsets.m_vecViewOffset);
25 | var eyePosition = origin + viewOffset;
26 |
27 | Console.WriteLine($"{eyePosition.X:0.00} {eyePosition.Y:0.00} {eyePosition.Z:0.00}");
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Math/Vector3.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Math
4 | {
5 | [StructLayout(LayoutKind.Sequential)]
6 | public struct Vector3
7 | {
8 | public float X, Y, Z;
9 |
10 | public Vector3(float x, float y, float z)
11 | {
12 | X = x;
13 | Y = y;
14 | Z = z;
15 | }
16 |
17 | public static Vector3 operator +(Vector3 left, Vector3 right)
18 | {
19 | return new Vector3(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data;
3 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External
6 | {
7 | ///
8 | /// Main program.
9 | ///
10 | public class Program :
11 | System.Windows.Application,
12 | IDisposable
13 | {
14 | #region // entry point
15 |
16 | ///
17 | [STAThread]
18 | public static void Main() => new Program().Run();
19 |
20 | #endregion
21 |
22 | #region // storage
23 |
24 | ///
25 | private GameProcess GameProcess { get; set; }
26 |
27 | ///
28 | private GameData GameData { get; set; }
29 |
30 | ///
31 | private WindowOverlay WindowOverlay { get; set; }
32 |
33 | #endregion
34 |
35 | #region // ctor
36 |
37 | ///
38 | public Program()
39 | {
40 | Startup += (sender, args) => Ctor();
41 | Exit += (sender, args) => Dispose();
42 | }
43 |
44 | ///
45 | public void Ctor()
46 | {
47 | GameProcess = new GameProcess();
48 | GameData = new GameData(GameProcess);
49 | WindowOverlay = new WindowOverlay(GameProcess);
50 |
51 | GameProcess.Start();
52 | GameData.Start();
53 | WindowOverlay.Start();
54 | }
55 |
56 | ///
57 | public void Dispose()
58 | {
59 | WindowOverlay.Dispose();
60 | WindowOverlay = default;
61 |
62 | GameData.Dispose();
63 | GameData = default;
64 |
65 | GameProcess.Dispose();
66 | GameProcess = default;
67 | }
68 |
69 | #endregion
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 003 - Overlay Window/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
4 | {
5 | ///
6 | /// Game data retrieved from process.
7 | ///
8 | public class GameData :
9 | ThreadedComponent
10 | {
11 | #region // storage
12 |
13 | ///
14 | protected override string ThreadName => nameof(GameData);
15 |
16 | ///
17 | private GameProcess GameProcess { get; set; }
18 |
19 | ///
20 | public Player Player { get; set; }
21 |
22 | #endregion
23 |
24 | #region // ctor
25 |
26 | ///
27 | public GameData(GameProcess gameProcess)
28 | {
29 | GameProcess = gameProcess;
30 | Player = new Player();
31 | }
32 |
33 | ///
34 | public override void Dispose()
35 | {
36 | base.Dispose();
37 |
38 | Player = default;
39 | GameProcess = default;
40 | }
41 |
42 | #endregion
43 |
44 | ///
45 | protected override void FrameAction()
46 | {
47 | if (!GameProcess.IsValid)
48 | {
49 | return;
50 | }
51 |
52 | Player.Update(GameProcess);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Data/Player.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.DirectX;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Player class.
9 | ///
10 | public class Player
11 | {
12 | ///
13 | /// Update data from process.
14 | ///
15 | public void Update(GameProcess gameProcess)
16 | {
17 | var addressBase = gameProcess.ModuleClient.Read(Offsets.dwLocalPlayer);
18 | if (addressBase == IntPtr.Zero)
19 | {
20 | return;
21 | }
22 |
23 | var origin = gameProcess.Process.Read(addressBase + Offsets.m_vecOrigin);
24 | var viewOffset = gameProcess.Process.Read(addressBase + Offsets.m_vecViewOffset);
25 | var eyePosition = origin + viewOffset;
26 |
27 | Console.WriteLine($"{eyePosition.X:0.00} {eyePosition.Y:0.00} {eyePosition.Z:0.00}");
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Gfx/DeviceExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Linq;
3 | using Microsoft.DirectX;
4 | using Microsoft.DirectX.Direct3D;
5 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Gfx
8 | {
9 | ///
10 | /// Graphics device drawing extensions.
11 | ///
12 | public static class DeviceExtensions
13 | {
14 | ///
15 | /// Draw 2D polyline in screen space.
16 | ///
17 | public static void DrawPolyline(this Device device, Vector3[] vertices, Color color)
18 | {
19 | if (vertices.Length < 2 || vertices.Any(v => !v.IsValidScreen()))
20 | {
21 | return;
22 | }
23 |
24 | var vertexStreamZeroData = vertices.Select(v => new CustomVertex.TransformedColored(v.X, v.Y, v.Z, 0, color.ToArgb())).ToArray();
25 | device.VertexFormat = VertexFormats.Diffuse | VertexFormats.Transformed;
26 | device.DrawUserPrimitives(PrimitiveType.LineStrip, vertexStreamZeroData.Length - 1, vertexStreamZeroData);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data;
3 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External
6 | {
7 | ///
8 | /// Main program.
9 | ///
10 | public class Program :
11 | System.Windows.Application,
12 | IDisposable
13 | {
14 | #region // entry point
15 |
16 | ///
17 | [STAThread]
18 | public static void Main() => new Program().Run();
19 |
20 | #endregion
21 |
22 | #region // storage
23 |
24 | ///
25 | private GameProcess GameProcess { get; set; }
26 |
27 | ///
28 | private GameData GameData { get; set; }
29 |
30 | ///
31 | private WindowOverlay WindowOverlay { get; set; }
32 |
33 | ///
34 | private Graphics Graphics { get; set; }
35 |
36 | #endregion
37 |
38 | #region // ctor
39 |
40 | ///
41 | public Program()
42 | {
43 | Startup += (sender, args) => Ctor();
44 | Exit += (sender, args) => Dispose();
45 | }
46 |
47 | ///
48 | public void Ctor()
49 | {
50 | GameProcess = new GameProcess();
51 | GameData = new GameData(GameProcess);
52 | WindowOverlay = new WindowOverlay(GameProcess);
53 | Graphics = new Graphics(WindowOverlay, GameProcess, GameData);
54 |
55 | GameProcess.Start();
56 | GameData.Start();
57 | WindowOverlay.Start();
58 | Graphics.Start();
59 | }
60 |
61 | ///
62 | public void Dispose()
63 | {
64 | Graphics.Dispose();
65 | Graphics = default;
66 |
67 | WindowOverlay.Dispose();
68 | WindowOverlay = default;
69 |
70 | GameData.Dispose();
71 | GameData = default;
72 |
73 | GameProcess.Dispose();
74 | GameProcess = default;
75 | }
76 |
77 | #endregion
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Utils/FpsCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Class for measuring fps.
8 | ///
9 | public class FpsCounter
10 | {
11 | #region // storage
12 |
13 | ///
14 | /// One second timespan.
15 | ///
16 | private static readonly TimeSpan TimeSpanFpsUpdate = new TimeSpan(0, 0, 0, 1);
17 |
18 | ///
19 | /// Stopwatch for measuring time.
20 | ///
21 | private Stopwatch FpsTimer { get; } = Stopwatch.StartNew();
22 |
23 | ///
24 | /// Frame count since last timer restart.
25 | ///
26 | private int FpsFrameCount { get; set; }
27 |
28 | ///
29 | /// Average fps (frames per second).
30 | ///
31 | public double Fps { get; private set; }
32 |
33 | #endregion
34 |
35 | #region // routines
36 |
37 | ///
38 | /// Trigger frame update.
39 | ///
40 | public void Update()
41 | {
42 | var fpsTimerElapsed = FpsTimer.Elapsed;
43 | if (fpsTimerElapsed > TimeSpanFpsUpdate)
44 | {
45 | Fps = FpsFrameCount / fpsTimerElapsed.TotalSeconds;
46 | FpsTimer.Restart();
47 | FpsFrameCount = 0;
48 | }
49 | FpsFrameCount++;
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tutorial 004 - Graphics/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
4 | {
5 | ///
6 | /// Game data retrieved from process.
7 | ///
8 | public class GameData :
9 | ThreadedComponent
10 | {
11 | #region // storage
12 |
13 | ///
14 | protected override string ThreadName => nameof(GameData);
15 |
16 | ///
17 | private GameProcess GameProcess { get; set; }
18 |
19 | ///
20 | public Player Player { get; set; }
21 |
22 | #endregion
23 |
24 | #region // ctor
25 |
26 | ///
27 | public GameData(GameProcess gameProcess)
28 | {
29 | GameProcess = gameProcess;
30 | Player = new Player();
31 | }
32 |
33 | ///
34 | public override void Dispose()
35 | {
36 | base.Dispose();
37 |
38 | Player = default;
39 | GameProcess = default;
40 | }
41 |
42 | #endregion
43 |
44 | ///
45 | protected override void FrameAction()
46 | {
47 | if (!GameProcess.IsValid)
48 | {
49 | return;
50 | }
51 |
52 | Player.Update(GameProcess);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Features/EspAimCrosshair.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DirectX;
2 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
6 | {
7 | ///
8 | /// ESP Aim Crosshair.
9 | ///
10 | public static class EspAimCrosshair
11 | {
12 | ///
13 | /// Get aim crosshair in screen space.
14 | ///
15 | public static Vector3 GetPositionScreen(Graphics graphics)
16 | {
17 | var screenSize = graphics.GameProcess.WindowRectangleClient.Size;
18 | var aspectRatio = (double)screenSize.Width / screenSize.Height;
19 | var player = graphics.GameData.Player;
20 | var fovY = ((double)player.Fov).DegreeToRadian();
21 | var fovX = fovY * aspectRatio;
22 | var punchX = ((double)player.AimPunchAngle.X * Offsets.weapon_recoil_scale).DegreeToRadian();
23 | var punchY = ((double)player.AimPunchAngle.Y * Offsets.weapon_recoil_scale).DegreeToRadian();
24 | var pointClip = new Vector3
25 | (
26 | (float)(-punchY / fovX),
27 | (float)(-punchX / fovY),
28 | 0
29 | );
30 | return player.MatrixViewport.Transform(pointClip);
31 | }
32 |
33 | ///
34 | /// Draw aim crosshair.
35 | ///
36 | public static void Draw(Graphics graphics)
37 | {
38 | Draw(graphics, GetPositionScreen(graphics));
39 | }
40 |
41 | ///
42 | /// Draw aim crosshair in screen space.
43 | ///
44 | private static void Draw(Graphics graphics, Vector3 pointScreen)
45 | {
46 | const int radius = 3;
47 | var color = System.Drawing.Color.Red;
48 | graphics.Device.DrawPolyline(new[] { pointScreen - new Vector3(radius, 0, 0), pointScreen + new Vector3(radius + 1, 0, 0), }, color);
49 | graphics.Device.DrawPolyline(new[] { pointScreen - new Vector3(0, radius, 0), pointScreen + new Vector3(0, radius + 1, 0), }, color);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Gfx/DeviceExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Linq;
3 | using Microsoft.DirectX;
4 | using Microsoft.DirectX.Direct3D;
5 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Gfx
8 | {
9 | ///
10 | /// Graphics device drawing extensions.
11 | ///
12 | public static class DeviceExtensions
13 | {
14 | ///
15 | /// Draw 2D polyline in screen space.
16 | ///
17 | public static void DrawPolyline(this Device device, Vector3[] vertices, Color color)
18 | {
19 | if (vertices.Length < 2 || vertices.Any(v => !v.IsValidScreen()))
20 | {
21 | return;
22 | }
23 |
24 | var vertexStreamZeroData = vertices.Select(v => new CustomVertex.TransformedColored(v.X, v.Y, v.Z, 0, color.ToArgb())).ToArray();
25 | device.VertexFormat = VertexFormats.Diffuse | VertexFormats.Transformed;
26 | device.DrawUserPrimitives(PrimitiveType.LineStrip, vertexStreamZeroData.Length - 1, vertexStreamZeroData);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Utils/FpsCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Class for measuring fps.
8 | ///
9 | public class FpsCounter
10 | {
11 | #region // storage
12 |
13 | ///
14 | /// One second timespan.
15 | ///
16 | private static readonly TimeSpan TimeSpanFpsUpdate = new TimeSpan(0, 0, 0, 1);
17 |
18 | ///
19 | /// Stopwatch for measuring time.
20 | ///
21 | private Stopwatch FpsTimer { get; } = Stopwatch.StartNew();
22 |
23 | ///
24 | /// Frame count since last timer restart.
25 | ///
26 | private int FpsFrameCount { get; set; }
27 |
28 | ///
29 | /// Average fps (frames per second).
30 | ///
31 | public double Fps { get; private set; }
32 |
33 | #endregion
34 |
35 | #region // routines
36 |
37 | ///
38 | /// Trigger frame update.
39 | ///
40 | public void Update()
41 | {
42 | var fpsTimerElapsed = FpsTimer.Elapsed;
43 | if (fpsTimerElapsed > TimeSpanFpsUpdate)
44 | {
45 | Fps = FpsFrameCount / fpsTimerElapsed.TotalSeconds;
46 | FpsTimer.Restart();
47 | FpsFrameCount = 0;
48 | }
49 | FpsFrameCount++;
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tutorial 005 - ESP Aim Crosshair/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Game data retrieved from process.
9 | ///
10 | public class GameData :
11 | ThreadedComponent
12 | {
13 | #region // storage
14 |
15 | ///
16 | protected override string ThreadName => nameof(GameData);
17 |
18 | ///
19 | private GameProcess GameProcess { get; set; }
20 |
21 | ///
22 | public Player Player { get; set; }
23 |
24 | ///
25 | public Entity[] Entities { get; private set; }
26 |
27 | #endregion
28 |
29 | #region // ctor
30 |
31 | ///
32 | public GameData(GameProcess gameProcess)
33 | {
34 | GameProcess = gameProcess;
35 | Player = new Player();
36 | Entities = Enumerable.Range(0, 64).Select(index => new Entity(index)).ToArray();
37 | }
38 |
39 | ///
40 | public override void Dispose()
41 | {
42 | base.Dispose();
43 |
44 | Entities = default;
45 | Player = default;
46 | GameProcess = default;
47 | }
48 |
49 | #endregion
50 |
51 | ///
52 | protected override void FrameAction()
53 | {
54 | if (!GameProcess.IsValid)
55 | {
56 | return;
57 | }
58 |
59 | Player.Update(GameProcess);
60 | foreach (var entity in Entities)
61 | {
62 | entity.Update(GameProcess);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Data/Raw/Team.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
2 | {
3 | ///
4 | /// Enumeration of teams.
5 | ///
6 | public enum Team
7 | {
8 | Unknown = 0,
9 | Spectator = 1,
10 | Terrorists = 2,
11 | CounterTerrorists = 3,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Data/Raw/matrix3x4_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/mathlib/mathlib.h#L237
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct matrix3x4_t
10 | {
11 | public float m00; // xAxis.x
12 | public float m10; // yAxis.x
13 | public float m20; // zAxis.x
14 | public float m30; // vecOrigin.x
15 |
16 | public float m01; // xAxis.y
17 | public float m11; // yAxis.y
18 | public float m21; // zAxis.y
19 | public float m31; // vecOrigin.y
20 |
21 | public float m02; // xAxis.z
22 | public float m12; // yAxis.z
23 | public float m22; // zAxis.z
24 | public float m32; // vecOrigin.z
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Data/Raw/mstudiobbox_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L420
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobbox_t
11 | {
12 | public int bone;
13 | public int group; // intersection group
14 | public Vector3 bbmin; // bounding box
15 | public Vector3 bbmax;
16 | public int szhitboxnameindex; // offset to the name of the hitbox.
17 | public fixed int unused[3];
18 | public float radius; // when radius is -1 it's box, otherwise it's capsule (cylinder with spheres on the end)
19 | public fixed int pad[4];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Data/Raw/mstudiobone_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L238
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobone_t
11 | {
12 | public int sznameindex;
13 | public int parent; // parent bone
14 | public fixed int bonecontroller[6]; // bone controller index, -1 == none
15 | public Vector3 pos;
16 | public Quaternion quat;
17 | public Vector3 rot;
18 | public Vector3 posscale;
19 | public Vector3 rotscale;
20 | public matrix3x4_t poseToBone;
21 | public Quaternion qAlignment;
22 | public int flags;
23 | public int proctype;
24 | public int procindex; // procedural rule
25 | public int physicsbone; // index into physically simulated bone
26 | public int surfacepropidx; // index into string tablefor property name
27 | public int contents; // See BSPFlags.h for the contents flags
28 | public fixed int unused[8]; // remove as appropriat
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Data/Raw/mstudiohitboxset_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L1612
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct mstudiohitboxset_t
10 | {
11 | public int sznameindex;
12 | public int numhitboxes;
13 | public int hitboxindex;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Data/Raw/studiohdr_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L2050
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct studiohdr_t
11 | {
12 | public int id;
13 | public int version;
14 | public int checksum;
15 | public fixed byte name[64];
16 | public int length;
17 | public Vector3 eyeposition;
18 | public Vector3 illumposition;
19 | public Vector3 hull_min;
20 | public Vector3 hull_max;
21 | public Vector3 view_bbmin;
22 | public Vector3 view_bbmax;
23 | public int flags;
24 | public int numbones; // bones
25 | public int boneindex;
26 | public int numbonecontrollers; // bone controllers
27 | public int bonecontrollerindex;
28 | public int numhitboxsets;
29 | public int hitboxsetindex;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Features/EspAimCrosshair.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DirectX;
2 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
6 | {
7 | ///
8 | /// ESP Aim Crosshair.
9 | ///
10 | public static class EspAimCrosshair
11 | {
12 | ///
13 | /// Get aim crosshair in screen space.
14 | ///
15 | public static Vector3 GetPositionScreen(Graphics graphics)
16 | {
17 | var screenSize = graphics.GameProcess.WindowRectangleClient.Size;
18 | var aspectRatio = (double)screenSize.Width / screenSize.Height;
19 | var player = graphics.GameData.Player;
20 | var fovY = ((double)player.Fov).DegreeToRadian();
21 | var fovX = fovY * aspectRatio;
22 | var punchX = ((double)player.AimPunchAngle.X * Offsets.weapon_recoil_scale).DegreeToRadian();
23 | var punchY = ((double)player.AimPunchAngle.Y * Offsets.weapon_recoil_scale).DegreeToRadian();
24 | var pointClip = new Vector3
25 | (
26 | (float)(-punchY / fovX),
27 | (float)(-punchX / fovY),
28 | 0
29 | );
30 | return player.MatrixViewport.Transform(pointClip);
31 | }
32 |
33 | ///
34 | /// Draw aim crosshair.
35 | ///
36 | public static void Draw(Graphics graphics)
37 | {
38 | Draw(graphics, GetPositionScreen(graphics));
39 | }
40 |
41 | ///
42 | /// Draw aim crosshair in screen space.
43 | ///
44 | private static void Draw(Graphics graphics, Vector3 pointScreen)
45 | {
46 | const int radius = 3;
47 | var color = System.Drawing.Color.Red;
48 | graphics.DrawPolylineScreen(new[] { pointScreen - new Vector3(radius, 0, 0), pointScreen + new Vector3(radius + 1, 0, 0), }, color);
49 | graphics.DrawPolylineScreen(new[] { pointScreen - new Vector3(0, radius, 0), pointScreen + new Vector3(0, radius + 1, 0), }, color);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Features/EspSkeleton.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Data.Raw;
4 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
5 | using Graphics = RCi.Tutorials.Csgo.Cheat.External.Gfx.Graphics;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
8 | {
9 | ///
10 | /// ESP Skeleton.
11 | ///
12 | public static class EspSkeleton
13 | {
14 | ///
15 | /// Draw skeleton.
16 | ///
17 | public static void Draw(Graphics graphics)
18 | {
19 | foreach (var entity in graphics.GameData.Entities)
20 | {
21 | // validate
22 | if (!entity.IsAlive() || entity.AddressBase == graphics.GameData.Player.AddressBase)
23 | {
24 | continue;
25 | }
26 |
27 | // draw
28 | var color = entity.Team == Team.Terrorists ? Color.Gold : Color.DodgerBlue;
29 | Draw(graphics, entity, color);
30 | }
31 | }
32 |
33 | ///
34 | /// Draw skeleton of given entity.
35 | ///
36 | public static void Draw(Graphics graphics, Entity entity, Color color)
37 | {
38 | for (var i = 0; i < entity.SkeletonCount; i++)
39 | {
40 | var (from, to) = entity.Skeleton[i];
41 |
42 | // validate
43 | if (from == to || from < 0 || to < 0 || from >= Offsets.MAXSTUDIOBONES || to >= Offsets.MAXSTUDIOBONES)
44 | {
45 | continue;
46 | }
47 |
48 | // draw
49 | graphics.DrawPolylineWorld(color, entity.BonesPos[from], entity.BonesPos[to]);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Gfx/DeviceExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Linq;
3 | using Microsoft.DirectX;
4 | using Microsoft.DirectX.Direct3D;
5 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Gfx
8 | {
9 | ///
10 | /// Graphics device drawing extensions.
11 | ///
12 | public static class DeviceExtensions
13 | {
14 | ///
15 | /// Draw polyline in world space.
16 | ///
17 | public static void DrawPolylineWorld(this Graphics graphics, Color color, params Vector3[] verticesWorld)
18 | {
19 | var verticesScreen = verticesWorld.Select(v => graphics.GameData.Player.MatrixViewProjectionViewport.Transform(v)).ToArray();
20 | graphics.DrawPolylineScreen(verticesScreen, color);
21 | }
22 |
23 | ///
24 | /// Draw 2D polyline in screen space.
25 | ///
26 | public static void DrawPolylineScreen(this Graphics graphics, Vector3[] vertices, Color color)
27 | {
28 | if (vertices.Length < 2 || vertices.Any(v => !v.IsValidScreen()))
29 | {
30 | return;
31 | }
32 |
33 | var vertexStreamZeroData = vertices.Select(v => new CustomVertex.TransformedColored(v.X, v.Y, v.Z, 0, color.ToArgb())).ToArray();
34 | graphics.Device.VertexFormat = VertexFormats.Diffuse | VertexFormats.Transformed;
35 | graphics.Device.DrawUserPrimitives(PrimitiveType.LineStrip, vertexStreamZeroData.Length - 1, vertexStreamZeroData);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Utils/FpsCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Class for measuring fps.
8 | ///
9 | public class FpsCounter
10 | {
11 | #region // storage
12 |
13 | ///
14 | /// One second timespan.
15 | ///
16 | private static readonly TimeSpan TimeSpanFpsUpdate = new TimeSpan(0, 0, 0, 1);
17 |
18 | ///
19 | /// Stopwatch for measuring time.
20 | ///
21 | private Stopwatch FpsTimer { get; } = Stopwatch.StartNew();
22 |
23 | ///
24 | /// Frame count since last timer restart.
25 | ///
26 | private int FpsFrameCount { get; set; }
27 |
28 | ///
29 | /// Average fps (frames per second).
30 | ///
31 | public double Fps { get; private set; }
32 |
33 | #endregion
34 |
35 | #region // routines
36 |
37 | ///
38 | /// Trigger frame update.
39 | ///
40 | public void Update()
41 | {
42 | var fpsTimerElapsed = FpsTimer.Elapsed;
43 | if (fpsTimerElapsed > TimeSpanFpsUpdate)
44 | {
45 | Fps = FpsFrameCount / fpsTimerElapsed.TotalSeconds;
46 | FpsTimer.Restart();
47 | FpsFrameCount = 0;
48 | }
49 | FpsFrameCount++;
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tutorial 006 - ESP Skeleton/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Game data retrieved from process.
9 | ///
10 | public class GameData :
11 | ThreadedComponent
12 | {
13 | #region // storage
14 |
15 | ///
16 | protected override string ThreadName => nameof(GameData);
17 |
18 | ///
19 | private GameProcess GameProcess { get; set; }
20 |
21 | ///
22 | public Player Player { get; set; }
23 |
24 | ///
25 | public Entity[] Entities { get; private set; }
26 |
27 | #endregion
28 |
29 | #region // ctor
30 |
31 | ///
32 | public GameData(GameProcess gameProcess)
33 | {
34 | GameProcess = gameProcess;
35 | Player = new Player();
36 | Entities = Enumerable.Range(0, 64).Select(index => new Entity(index)).ToArray();
37 | }
38 |
39 | ///
40 | public override void Dispose()
41 | {
42 | base.Dispose();
43 |
44 | Entities = default;
45 | Player = default;
46 | GameProcess = default;
47 | }
48 |
49 | #endregion
50 |
51 | ///
52 | protected override void FrameAction()
53 | {
54 | if (!GameProcess.IsValid)
55 | {
56 | return;
57 | }
58 |
59 | Player.Update(GameProcess);
60 | foreach (var entity in Entities)
61 | {
62 | entity.Update(GameProcess);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Data/Raw/Team.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
2 | {
3 | ///
4 | /// Enumeration of teams.
5 | ///
6 | public enum Team
7 | {
8 | Unknown = 0,
9 | Spectator = 1,
10 | Terrorists = 2,
11 | CounterTerrorists = 3,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Data/Raw/matrix3x4_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/mathlib/mathlib.h#L237
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct matrix3x4_t
10 | {
11 | public float m00; // xAxis.x
12 | public float m10; // yAxis.x
13 | public float m20; // zAxis.x
14 | public float m30; // vecOrigin.x
15 |
16 | public float m01; // xAxis.y
17 | public float m11; // yAxis.y
18 | public float m21; // zAxis.y
19 | public float m31; // vecOrigin.y
20 |
21 | public float m02; // xAxis.z
22 | public float m12; // yAxis.z
23 | public float m22; // zAxis.z
24 | public float m32; // vecOrigin.z
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Data/Raw/mstudiobbox_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L420
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobbox_t
11 | {
12 | public int bone;
13 | public int group; // intersection group
14 | public Vector3 bbmin; // bounding box
15 | public Vector3 bbmax;
16 | public int szhitboxnameindex; // offset to the name of the hitbox.
17 | public fixed int unused[3];
18 | public float radius; // when radius is -1 it's box, otherwise it's capsule (cylinder with spheres on the end)
19 | public fixed int pad[4];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Data/Raw/mstudiobone_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L238
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobone_t
11 | {
12 | public int sznameindex;
13 | public int parent; // parent bone
14 | public fixed int bonecontroller[6]; // bone controller index, -1 == none
15 | public Vector3 pos;
16 | public Quaternion quat;
17 | public Vector3 rot;
18 | public Vector3 posscale;
19 | public Vector3 rotscale;
20 | public matrix3x4_t poseToBone;
21 | public Quaternion qAlignment;
22 | public int flags;
23 | public int proctype;
24 | public int procindex; // procedural rule
25 | public int physicsbone; // index into physically simulated bone
26 | public int surfacepropidx; // index into string tablefor property name
27 | public int contents; // See BSPFlags.h for the contents flags
28 | public fixed int unused[8]; // remove as appropriat
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Data/Raw/mstudiohitboxset_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L1612
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct mstudiohitboxset_t
10 | {
11 | public int sznameindex;
12 | public int numhitboxes;
13 | public int hitboxindex;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Data/Raw/studiohdr_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L2050
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct studiohdr_t
11 | {
12 | public int id;
13 | public int version;
14 | public int checksum;
15 | public fixed byte name[64];
16 | public int length;
17 | public Vector3 eyeposition;
18 | public Vector3 illumposition;
19 | public Vector3 hull_min;
20 | public Vector3 hull_max;
21 | public Vector3 view_bbmin;
22 | public Vector3 view_bbmax;
23 | public int flags;
24 | public int numbones; // bones
25 | public int boneindex;
26 | public int numbonecontrollers; // bone controllers
27 | public int bonecontrollerindex;
28 | public int numhitboxsets;
29 | public int hitboxsetindex;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Features/EspAimCrosshair.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DirectX;
2 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
6 | {
7 | ///
8 | /// ESP Aim Crosshair.
9 | ///
10 | public static class EspAimCrosshair
11 | {
12 | ///
13 | /// Get aim crosshair in screen space.
14 | ///
15 | public static Vector3 GetPositionScreen(Graphics graphics)
16 | {
17 | var screenSize = graphics.GameProcess.WindowRectangleClient.Size;
18 | var aspectRatio = (double)screenSize.Width / screenSize.Height;
19 | var player = graphics.GameData.Player;
20 | var fovY = ((double)player.Fov).DegreeToRadian();
21 | var fovX = fovY * aspectRatio;
22 | var punchX = ((double)player.AimPunchAngle.X * Offsets.weapon_recoil_scale).DegreeToRadian();
23 | var punchY = ((double)player.AimPunchAngle.Y * Offsets.weapon_recoil_scale).DegreeToRadian();
24 | var pointClip = new Vector3
25 | (
26 | (float)(-punchY / fovX),
27 | (float)(-punchX / fovY),
28 | 0
29 | );
30 | return player.MatrixViewport.Transform(pointClip);
31 | }
32 |
33 | ///
34 | /// Draw aim crosshair.
35 | ///
36 | public static void Draw(Graphics graphics)
37 | {
38 | Draw(graphics, GetPositionScreen(graphics));
39 | }
40 |
41 | ///
42 | /// Draw aim crosshair in screen space.
43 | ///
44 | private static void Draw(Graphics graphics, Vector3 pointScreen)
45 | {
46 | const int radius = 3;
47 | var color = System.Drawing.Color.Red;
48 | graphics.DrawPolylineScreen(color, pointScreen - new Vector3(radius, 0, 0), pointScreen + new Vector3(radius + 1, 0, 0));
49 | graphics.DrawPolylineScreen(color, pointScreen - new Vector3(0, radius, 0), pointScreen + new Vector3(0, radius + 1, 0));
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Features/EspSkeleton.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Data.Raw;
4 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
5 | using Graphics = RCi.Tutorials.Csgo.Cheat.External.Gfx.Graphics;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
8 | {
9 | ///
10 | /// ESP Skeleton.
11 | ///
12 | public static class EspSkeleton
13 | {
14 | ///
15 | /// Draw skeleton.
16 | ///
17 | public static void Draw(Graphics graphics)
18 | {
19 | foreach (var entity in graphics.GameData.Entities)
20 | {
21 | // validate
22 | if (!entity.IsAlive() || entity.AddressBase == graphics.GameData.Player.AddressBase)
23 | {
24 | continue;
25 | }
26 |
27 | // draw
28 | var color = entity.Team == Team.Terrorists ? Color.Gold : Color.DodgerBlue;
29 | Draw(graphics, entity, color);
30 | }
31 | }
32 |
33 | ///
34 | /// Draw skeleton of given entity.
35 | ///
36 | public static void Draw(Graphics graphics, Entity entity, Color color)
37 | {
38 | for (var i = 0; i < entity.SkeletonCount; i++)
39 | {
40 | var (from, to) = entity.Skeleton[i];
41 |
42 | // validate
43 | if (from == to || from < 0 || to < 0 || from >= Offsets.MAXSTUDIOBONES || to >= Offsets.MAXSTUDIOBONES)
44 | {
45 | continue;
46 | }
47 |
48 | // draw
49 | graphics.DrawPolylineWorld(color, entity.BonesPos[from], entity.BonesPos[to]);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Utils/FpsCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Class for measuring fps.
8 | ///
9 | public class FpsCounter
10 | {
11 | #region // storage
12 |
13 | ///
14 | /// One second timespan.
15 | ///
16 | private static readonly TimeSpan TimeSpanFpsUpdate = new TimeSpan(0, 0, 0, 1);
17 |
18 | ///
19 | /// Stopwatch for measuring time.
20 | ///
21 | private Stopwatch FpsTimer { get; } = Stopwatch.StartNew();
22 |
23 | ///
24 | /// Frame count since last timer restart.
25 | ///
26 | private int FpsFrameCount { get; set; }
27 |
28 | ///
29 | /// Average fps (frames per second).
30 | ///
31 | public double Fps { get; private set; }
32 |
33 | #endregion
34 |
35 | #region // routines
36 |
37 | ///
38 | /// Trigger frame update.
39 | ///
40 | public void Update()
41 | {
42 | var fpsTimerElapsed = FpsTimer.Elapsed;
43 | if (fpsTimerElapsed > TimeSpanFpsUpdate)
44 | {
45 | Fps = FpsFrameCount / fpsTimerElapsed.TotalSeconds;
46 | FpsTimer.Restart();
47 | FpsFrameCount = 0;
48 | }
49 | FpsFrameCount++;
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tutorial 007 - ESP HitBoxes/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Game data retrieved from process.
9 | ///
10 | public class GameData :
11 | ThreadedComponent
12 | {
13 | #region // storage
14 |
15 | ///
16 | protected override string ThreadName => nameof(GameData);
17 |
18 | ///
19 | private GameProcess GameProcess { get; set; }
20 |
21 | ///
22 | public Player Player { get; set; }
23 |
24 | ///
25 | public Entity[] Entities { get; private set; }
26 |
27 | #endregion
28 |
29 | #region // ctor
30 |
31 | ///
32 | public GameData(GameProcess gameProcess)
33 | {
34 | GameProcess = gameProcess;
35 | Player = new Player();
36 | Entities = Enumerable.Range(0, 64).Select(index => new Entity(index)).ToArray();
37 | }
38 |
39 | ///
40 | public override void Dispose()
41 | {
42 | base.Dispose();
43 |
44 | Entities = default;
45 | Player = default;
46 | GameProcess = default;
47 | }
48 |
49 | #endregion
50 |
51 | ///
52 | protected override void FrameAction()
53 | {
54 | if (!GameProcess.IsValid)
55 | {
56 | return;
57 | }
58 |
59 | Player.Update(GameProcess);
60 | foreach (var entity in Entities)
61 | {
62 | entity.Update(GameProcess);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Data/Raw/Team.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
2 | {
3 | ///
4 | /// Enumeration of teams.
5 | ///
6 | public enum Team
7 | {
8 | Unknown = 0,
9 | Spectator = 1,
10 | Terrorists = 2,
11 | CounterTerrorists = 3,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Data/Raw/matrix3x4_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/mathlib/mathlib.h#L237
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct matrix3x4_t
10 | {
11 | public float m00; // xAxis.x
12 | public float m10; // yAxis.x
13 | public float m20; // zAxis.x
14 | public float m30; // vecOrigin.x
15 |
16 | public float m01; // xAxis.y
17 | public float m11; // yAxis.y
18 | public float m21; // zAxis.y
19 | public float m31; // vecOrigin.y
20 |
21 | public float m02; // xAxis.z
22 | public float m12; // yAxis.z
23 | public float m22; // zAxis.z
24 | public float m32; // vecOrigin.z
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Data/Raw/mstudiobbox_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L420
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobbox_t
11 | {
12 | public int bone;
13 | public int group; // intersection group
14 | public Vector3 bbmin; // bounding box
15 | public Vector3 bbmax;
16 | public int szhitboxnameindex; // offset to the name of the hitbox.
17 | public fixed int unused[3];
18 | public float radius; // when radius is -1 it's box, otherwise it's capsule (cylinder with spheres on the end)
19 | public fixed int pad[4];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Data/Raw/mstudiobone_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L238
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobone_t
11 | {
12 | public int sznameindex;
13 | public int parent; // parent bone
14 | public fixed int bonecontroller[6]; // bone controller index, -1 == none
15 | public Vector3 pos;
16 | public Quaternion quat;
17 | public Vector3 rot;
18 | public Vector3 posscale;
19 | public Vector3 rotscale;
20 | public matrix3x4_t poseToBone;
21 | public Quaternion qAlignment;
22 | public int flags;
23 | public int proctype;
24 | public int procindex; // procedural rule
25 | public int physicsbone; // index into physically simulated bone
26 | public int surfacepropidx; // index into string tablefor property name
27 | public int contents; // See BSPFlags.h for the contents flags
28 | public fixed int unused[8]; // remove as appropriat
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Data/Raw/mstudiohitboxset_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L1612
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct mstudiohitboxset_t
10 | {
11 | public int sznameindex;
12 | public int numhitboxes;
13 | public int hitboxindex;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Data/Raw/studiohdr_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L2050
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct studiohdr_t
11 | {
12 | public int id;
13 | public int version;
14 | public int checksum;
15 | public fixed byte name[64];
16 | public int length;
17 | public Vector3 eyeposition;
18 | public Vector3 illumposition;
19 | public Vector3 hull_min;
20 | public Vector3 hull_max;
21 | public Vector3 view_bbmin;
22 | public Vector3 view_bbmax;
23 | public int flags;
24 | public int numbones; // bones
25 | public int boneindex;
26 | public int numbonecontrollers; // bone controllers
27 | public int bonecontrollerindex;
28 | public int numhitboxsets;
29 | public int hitboxsetindex;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Features/EspSkeleton.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Data.Raw;
4 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
5 | using Graphics = RCi.Tutorials.Csgo.Cheat.External.Gfx.Graphics;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
8 | {
9 | ///
10 | /// ESP Skeleton.
11 | ///
12 | public static class EspSkeleton
13 | {
14 | ///
15 | /// Draw skeleton.
16 | ///
17 | public static void Draw(Graphics graphics)
18 | {
19 | foreach (var entity in graphics.GameData.Entities)
20 | {
21 | // validate
22 | if (!entity.IsAlive() || entity.AddressBase == graphics.GameData.Player.AddressBase)
23 | {
24 | continue;
25 | }
26 |
27 | // draw
28 | var color = entity.Team == Team.Terrorists ? Color.Gold : Color.DodgerBlue;
29 | Draw(graphics, entity, color);
30 | }
31 | }
32 |
33 | ///
34 | /// Draw skeleton of given entity.
35 | ///
36 | public static void Draw(Graphics graphics, Entity entity, Color color)
37 | {
38 | for (var i = 0; i < entity.SkeletonCount; i++)
39 | {
40 | var (from, to) = entity.Skeleton[i];
41 |
42 | // validate
43 | if (from == to || from < 0 || to < 0 || from >= Offsets.MAXSTUDIOBONES || to >= Offsets.MAXSTUDIOBONES)
44 | {
45 | continue;
46 | }
47 |
48 | // draw
49 | graphics.DrawPolylineWorld(color, entity.BonesPos[from], entity.BonesPos[to]);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Data/HardwareInput.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-hardwareinput
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct HardwareInput
10 | {
11 | public int uMsg;
12 | public short wParamL;
13 | public short wParamH;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Data/Input.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
7 | ///
8 | [StructLayout(LayoutKind.Explicit)]
9 | public struct Input
10 | {
11 | [FieldOffset(0)] public SendInputEventType type;
12 | [FieldOffset(4)] public MouseInput mi;
13 | [FieldOffset(4)] public KeybdInput ki;
14 | [FieldOffset(4)] public HardwareInput hi;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Data/KeybdInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-keybdinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct KeybdInput
11 | {
12 | public ushort wVk;
13 | public ushort wScan;
14 | public uint dwFlags;
15 | public uint time;
16 | public IntPtr dwExtraInfo;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Data/MouseEventFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
7 | ///
8 | [Flags]
9 | public enum MouseEventFlags : uint
10 | {
11 | MOUSEEVENTF_MOVE = 0x0001,
12 | MOUSEEVENTF_LEFTDOWN = 0x0002,
13 | MOUSEEVENTF_LEFTUP = 0x0004,
14 | MOUSEEVENTF_RIGHTDOWN = 0x0008,
15 | MOUSEEVENTF_RIGHTUP = 0x0010,
16 | MOUSEEVENTF_MIDDLEDOWN = 0x0020,
17 | MOUSEEVENTF_MIDDLEUP = 0x0040,
18 | MOUSEEVENTF_XDOWN = 0x0080,
19 | MOUSEEVENTF_XUP = 0x0100,
20 | MOUSEEVENTF_WHEEL = 0x0800,
21 | MOUSEEVENTF_VIRTUALDESK = 0x4000,
22 | MOUSEEVENTF_ABSOLUTE = 0x8000
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Data/MouseInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct MouseInput
11 | {
12 | public int dx;
13 | public int dy;
14 | public uint mouseData;
15 | public MouseEventFlags dwFlags;
16 | public uint time;
17 | public IntPtr dwExtraInfo;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Data/SendInputEventType.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
2 | {
3 | ///
4 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
5 | ///
6 | public enum SendInputEventType
7 | {
8 | InputMouse,
9 | InputKeyboard,
10 | InputHardware
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Utils/FpsCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Class for measuring fps.
8 | ///
9 | public class FpsCounter
10 | {
11 | #region // storage
12 |
13 | ///
14 | /// One second timespan.
15 | ///
16 | private static readonly TimeSpan TimeSpanFpsUpdate = new TimeSpan(0, 0, 0, 1);
17 |
18 | ///
19 | /// Stopwatch for measuring time.
20 | ///
21 | private Stopwatch FpsTimer { get; } = Stopwatch.StartNew();
22 |
23 | ///
24 | /// Frame count since last timer restart.
25 | ///
26 | private int FpsFrameCount { get; set; }
27 |
28 | ///
29 | /// Average fps (frames per second).
30 | ///
31 | public double Fps { get; private set; }
32 |
33 | #endregion
34 |
35 | #region // routines
36 |
37 | ///
38 | /// Trigger frame update.
39 | ///
40 | public void Update()
41 | {
42 | var fpsTimerElapsed = FpsTimer.Elapsed;
43 | if (fpsTimerElapsed > TimeSpanFpsUpdate)
44 | {
45 | Fps = FpsFrameCount / fpsTimerElapsed.TotalSeconds;
46 | FpsTimer.Restart();
47 | FpsFrameCount = 0;
48 | }
49 | FpsFrameCount++;
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tutorial 008 - Trigger Bot/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Game data retrieved from process.
9 | ///
10 | public class GameData :
11 | ThreadedComponent
12 | {
13 | #region // storage
14 |
15 | ///
16 | protected override string ThreadName => nameof(GameData);
17 |
18 | ///
19 | private GameProcess GameProcess { get; set; }
20 |
21 | ///
22 | public Player Player { get; set; }
23 |
24 | ///
25 | public Entity[] Entities { get; private set; }
26 |
27 | #endregion
28 |
29 | #region // ctor
30 |
31 | ///
32 | public GameData(GameProcess gameProcess)
33 | {
34 | GameProcess = gameProcess;
35 | Player = new Player();
36 | Entities = Enumerable.Range(0, 64).Select(index => new Entity(index)).ToArray();
37 | }
38 |
39 | ///
40 | public override void Dispose()
41 | {
42 | base.Dispose();
43 |
44 | Entities = default;
45 | Player = default;
46 | GameProcess = default;
47 | }
48 |
49 | #endregion
50 |
51 | ///
52 | protected override void FrameAction()
53 | {
54 | if (!GameProcess.IsValid)
55 | {
56 | return;
57 | }
58 |
59 | Player.Update(GameProcess);
60 | foreach (var entity in Entities)
61 | {
62 | entity.Update(GameProcess);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Data/Raw/Team.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
2 | {
3 | ///
4 | /// Enumeration of teams.
5 | ///
6 | public enum Team
7 | {
8 | Unknown = 0,
9 | Spectator = 1,
10 | Terrorists = 2,
11 | CounterTerrorists = 3,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Data/Raw/matrix3x4_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/mathlib/mathlib.h#L237
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct matrix3x4_t
10 | {
11 | public float m00; // xAxis.x
12 | public float m10; // yAxis.x
13 | public float m20; // zAxis.x
14 | public float m30; // vecOrigin.x
15 |
16 | public float m01; // xAxis.y
17 | public float m11; // yAxis.y
18 | public float m21; // zAxis.y
19 | public float m31; // vecOrigin.y
20 |
21 | public float m02; // xAxis.z
22 | public float m12; // yAxis.z
23 | public float m22; // zAxis.z
24 | public float m32; // vecOrigin.z
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Data/Raw/mstudiobbox_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L420
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobbox_t
11 | {
12 | public int bone;
13 | public int group; // intersection group
14 | public Vector3 bbmin; // bounding box
15 | public Vector3 bbmax;
16 | public int szhitboxnameindex; // offset to the name of the hitbox.
17 | public fixed int unused[3];
18 | public float radius; // when radius is -1 it's box, otherwise it's capsule (cylinder with spheres on the end)
19 | public fixed int pad[4];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Data/Raw/mstudiobone_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L238
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobone_t
11 | {
12 | public int sznameindex;
13 | public int parent; // parent bone
14 | public fixed int bonecontroller[6]; // bone controller index, -1 == none
15 | public Vector3 pos;
16 | public Quaternion quat;
17 | public Vector3 rot;
18 | public Vector3 posscale;
19 | public Vector3 rotscale;
20 | public matrix3x4_t poseToBone;
21 | public Quaternion qAlignment;
22 | public int flags;
23 | public int proctype;
24 | public int procindex; // procedural rule
25 | public int physicsbone; // index into physically simulated bone
26 | public int surfacepropidx; // index into string tablefor property name
27 | public int contents; // See BSPFlags.h for the contents flags
28 | public fixed int unused[8]; // remove as appropriat
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Data/Raw/mstudiohitboxset_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L1612
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct mstudiohitboxset_t
10 | {
11 | public int sznameindex;
12 | public int numhitboxes;
13 | public int hitboxindex;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Data/Raw/studiohdr_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L2050
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct studiohdr_t
11 | {
12 | public int id;
13 | public int version;
14 | public int checksum;
15 | public fixed byte name[64];
16 | public int length;
17 | public Vector3 eyeposition;
18 | public Vector3 illumposition;
19 | public Vector3 hull_min;
20 | public Vector3 hull_max;
21 | public Vector3 view_bbmin;
22 | public Vector3 view_bbmax;
23 | public int flags;
24 | public int numbones; // bones
25 | public int boneindex;
26 | public int numbonecontrollers; // bone controllers
27 | public int bonecontrollerindex;
28 | public int numhitboxsets;
29 | public int hitboxsetindex;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Features/EspSkeleton.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Data.Raw;
4 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
5 | using Graphics = RCi.Tutorials.Csgo.Cheat.External.Gfx.Graphics;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
8 | {
9 | ///
10 | /// ESP Skeleton.
11 | ///
12 | public static class EspSkeleton
13 | {
14 | ///
15 | /// Draw skeleton.
16 | ///
17 | public static void Draw(Graphics graphics)
18 | {
19 | foreach (var entity in graphics.GameData.Entities)
20 | {
21 | // validate
22 | if (!entity.IsAlive() || entity.AddressBase == graphics.GameData.Player.AddressBase)
23 | {
24 | continue;
25 | }
26 |
27 | // draw
28 | var color = entity.Team == Team.Terrorists ? Color.Gold : Color.DodgerBlue;
29 | Draw(graphics, entity, color);
30 | }
31 | }
32 |
33 | ///
34 | /// Draw skeleton of given entity.
35 | ///
36 | public static void Draw(Graphics graphics, Entity entity, Color color)
37 | {
38 | for (var i = 0; i < entity.SkeletonCount; i++)
39 | {
40 | var (from, to) = entity.Skeleton[i];
41 |
42 | // validate
43 | if (from == to || from < 0 || to < 0 || from >= Offsets.MAXSTUDIOBONES || to >= Offsets.MAXSTUDIOBONES)
44 | {
45 | continue;
46 | }
47 |
48 | // draw
49 | graphics.DrawPolylineWorld(color, entity.BonesPos[from], entity.BonesPos[to]);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Data/HardwareInput.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-hardwareinput
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct HardwareInput
10 | {
11 | public int uMsg;
12 | public short wParamL;
13 | public short wParamH;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Data/Input.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
7 | ///
8 | [StructLayout(LayoutKind.Explicit)]
9 | public struct Input
10 | {
11 | [FieldOffset(0)] public SendInputEventType type;
12 | [FieldOffset(4)] public MouseInput mi;
13 | [FieldOffset(4)] public KeybdInput ki;
14 | [FieldOffset(4)] public HardwareInput hi;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Data/KeybdInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-keybdinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct KeybdInput
11 | {
12 | public ushort wVk;
13 | public ushort wScan;
14 | public uint dwFlags;
15 | public uint time;
16 | public IntPtr dwExtraInfo;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Data/MouseEventFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
7 | ///
8 | [Flags]
9 | public enum MouseEventFlags : uint
10 | {
11 | MOUSEEVENTF_MOVE = 0x0001,
12 | MOUSEEVENTF_LEFTDOWN = 0x0002,
13 | MOUSEEVENTF_LEFTUP = 0x0004,
14 | MOUSEEVENTF_RIGHTDOWN = 0x0008,
15 | MOUSEEVENTF_RIGHTUP = 0x0010,
16 | MOUSEEVENTF_MIDDLEDOWN = 0x0020,
17 | MOUSEEVENTF_MIDDLEUP = 0x0040,
18 | MOUSEEVENTF_XDOWN = 0x0080,
19 | MOUSEEVENTF_XUP = 0x0100,
20 | MOUSEEVENTF_WHEEL = 0x0800,
21 | MOUSEEVENTF_VIRTUALDESK = 0x4000,
22 | MOUSEEVENTF_ABSOLUTE = 0x8000
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Data/MouseInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct MouseInput
11 | {
12 | public int dx;
13 | public int dy;
14 | public uint mouseData;
15 | public MouseEventFlags dwFlags;
16 | public uint time;
17 | public IntPtr dwExtraInfo;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Data/SendInputEventType.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
2 | {
3 | ///
4 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
5 | ///
6 | public enum SendInputEventType
7 | {
8 | InputMouse,
9 | InputKeyboard,
10 | InputHardware
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Utils/FpsCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Class for measuring fps.
8 | ///
9 | public class FpsCounter
10 | {
11 | #region // storage
12 |
13 | ///
14 | /// One second timespan.
15 | ///
16 | private static readonly TimeSpan TimeSpanFpsUpdate = new TimeSpan(0, 0, 0, 1);
17 |
18 | ///
19 | /// Stopwatch for measuring time.
20 | ///
21 | private Stopwatch FpsTimer { get; } = Stopwatch.StartNew();
22 |
23 | ///
24 | /// Frame count since last timer restart.
25 | ///
26 | private int FpsFrameCount { get; set; }
27 |
28 | ///
29 | /// Average fps (frames per second).
30 | ///
31 | public double Fps { get; private set; }
32 |
33 | #endregion
34 |
35 | #region // routines
36 |
37 | ///
38 | /// Trigger frame update.
39 | ///
40 | public void Update()
41 | {
42 | var fpsTimerElapsed = FpsTimer.Elapsed;
43 | if (fpsTimerElapsed > TimeSpanFpsUpdate)
44 | {
45 | Fps = FpsFrameCount / fpsTimerElapsed.TotalSeconds;
46 | FpsTimer.Restart();
47 | FpsFrameCount = 0;
48 | }
49 | FpsFrameCount++;
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tutorial 009 - Aim Bot (Mouse Calibration)/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Game data retrieved from process.
9 | ///
10 | public class GameData :
11 | ThreadedComponent
12 | {
13 | #region // storage
14 |
15 | ///
16 | protected override string ThreadName => nameof(GameData);
17 |
18 | ///
19 | private GameProcess GameProcess { get; set; }
20 |
21 | ///
22 | public Player Player { get; set; }
23 |
24 | ///
25 | public Entity[] Entities { get; private set; }
26 |
27 | #endregion
28 |
29 | #region // ctor
30 |
31 | ///
32 | public GameData(GameProcess gameProcess)
33 | {
34 | GameProcess = gameProcess;
35 | Player = new Player();
36 | Entities = Enumerable.Range(0, 64).Select(index => new Entity(index)).ToArray();
37 | }
38 |
39 | ///
40 | public override void Dispose()
41 | {
42 | base.Dispose();
43 |
44 | Entities = default;
45 | Player = default;
46 | GameProcess = default;
47 | }
48 |
49 | #endregion
50 |
51 | ///
52 | protected override void FrameAction()
53 | {
54 | if (!GameProcess.IsValid)
55 | {
56 | return;
57 | }
58 |
59 | Player.Update(GameProcess);
60 | foreach (var entity in Entities)
61 | {
62 | entity.Update(GameProcess);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Data/Raw/Team.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
2 | {
3 | ///
4 | /// Enumeration of teams.
5 | ///
6 | public enum Team
7 | {
8 | Unknown = 0,
9 | Spectator = 1,
10 | Terrorists = 2,
11 | CounterTerrorists = 3,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Data/Raw/matrix3x4_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/mathlib/mathlib.h#L237
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct matrix3x4_t
10 | {
11 | public float m00; // xAxis.x
12 | public float m10; // yAxis.x
13 | public float m20; // zAxis.x
14 | public float m30; // vecOrigin.x
15 |
16 | public float m01; // xAxis.y
17 | public float m11; // yAxis.y
18 | public float m21; // zAxis.y
19 | public float m31; // vecOrigin.y
20 |
21 | public float m02; // xAxis.z
22 | public float m12; // yAxis.z
23 | public float m22; // zAxis.z
24 | public float m32; // vecOrigin.z
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Data/Raw/mstudiobbox_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L420
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobbox_t
11 | {
12 | public int bone;
13 | public int group; // intersection group
14 | public Vector3 bbmin; // bounding box
15 | public Vector3 bbmax;
16 | public int szhitboxnameindex; // offset to the name of the hitbox.
17 | public fixed int unused[3];
18 | public float radius; // when radius is -1 it's box, otherwise it's capsule (cylinder with spheres on the end)
19 | public fixed int pad[4];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Data/Raw/mstudiobone_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L238
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobone_t
11 | {
12 | public int sznameindex;
13 | public int parent; // parent bone
14 | public fixed int bonecontroller[6]; // bone controller index, -1 == none
15 | public Vector3 pos;
16 | public Quaternion quat;
17 | public Vector3 rot;
18 | public Vector3 posscale;
19 | public Vector3 rotscale;
20 | public matrix3x4_t poseToBone;
21 | public Quaternion qAlignment;
22 | public int flags;
23 | public int proctype;
24 | public int procindex; // procedural rule
25 | public int physicsbone; // index into physically simulated bone
26 | public int surfacepropidx; // index into string tablefor property name
27 | public int contents; // See BSPFlags.h for the contents flags
28 | public fixed int unused[8]; // remove as appropriat
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Data/Raw/mstudiohitboxset_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L1612
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct mstudiohitboxset_t
10 | {
11 | public int sznameindex;
12 | public int numhitboxes;
13 | public int hitboxindex;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Data/Raw/studiohdr_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L2050
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct studiohdr_t
11 | {
12 | public int id;
13 | public int version;
14 | public int checksum;
15 | public fixed byte name[64];
16 | public int length;
17 | public Vector3 eyeposition;
18 | public Vector3 illumposition;
19 | public Vector3 hull_min;
20 | public Vector3 hull_max;
21 | public Vector3 view_bbmin;
22 | public Vector3 view_bbmax;
23 | public int flags;
24 | public int numbones; // bones
25 | public int boneindex;
26 | public int numbonecontrollers; // bone controllers
27 | public int bonecontrollerindex;
28 | public int numhitboxsets;
29 | public int hitboxsetindex;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Features/EspSkeleton.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Data.Raw;
4 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
5 | using Graphics = RCi.Tutorials.Csgo.Cheat.External.Gfx.Graphics;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
8 | {
9 | ///
10 | /// ESP Skeleton.
11 | ///
12 | public static class EspSkeleton
13 | {
14 | ///
15 | /// Draw skeleton.
16 | ///
17 | public static void Draw(Graphics graphics)
18 | {
19 | foreach (var entity in graphics.GameData.Entities)
20 | {
21 | // validate
22 | if (!entity.IsAlive() || entity.AddressBase == graphics.GameData.Player.AddressBase)
23 | {
24 | continue;
25 | }
26 |
27 | // draw
28 | var color = entity.Team == Team.Terrorists ? Color.Gold : Color.DodgerBlue;
29 | Draw(graphics, entity, color);
30 | }
31 | }
32 |
33 | ///
34 | /// Draw skeleton of given entity.
35 | ///
36 | public static void Draw(Graphics graphics, Entity entity, Color color)
37 | {
38 | for (var i = 0; i < entity.SkeletonCount; i++)
39 | {
40 | var (from, to) = entity.Skeleton[i];
41 |
42 | // validate
43 | if (from == to || from < 0 || to < 0 || from >= Offsets.MAXSTUDIOBONES || to >= Offsets.MAXSTUDIOBONES)
44 | {
45 | continue;
46 | }
47 |
48 | // draw
49 | graphics.DrawPolylineWorld(color, entity.BonesPos[from], entity.BonesPos[to]);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Gfx/Math/Plane3D.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DirectX;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Gfx.Math
4 | {
5 | public readonly struct Plane3D
6 | {
7 | #region // storage
8 |
9 | ///
10 | /// Plane's normal.
11 | ///
12 | public readonly Vector3 Normal;
13 |
14 | ///
15 | /// Distance from origin (0,0,0) to plane along its normal.
16 | ///
17 | public readonly float Distance;
18 |
19 | #endregion
20 |
21 | #region // ctor
22 |
23 | ///
24 | public Plane3D(Vector3 normal, float distance)
25 | {
26 | Normal = normal.Normalized();
27 | Distance = distance;
28 | }
29 |
30 | ///
31 | public Plane3D(Vector3 normal, Vector3 point) :
32 | this(normal, -normal.Dot(point))
33 | {
34 | }
35 |
36 | #endregion
37 |
38 | #region // routines
39 |
40 | ///
41 | /// Project point on a plane.
42 | ///
43 | ///
44 | /// planeOrigin - origin of a plane
45 | /// vector - Vector from plane origin to projected point
46 | ///
47 | public (Vector3 planeOrigin, Vector3 vector) ProjectVector(Vector3 vector)
48 | {
49 | var planeOrigin = ProjectPoint(new Vector3());
50 | return (planeOrigin, ProjectPoint(vector) - planeOrigin);
51 | }
52 |
53 | ///
54 | /// Project point on a plane.
55 | ///
56 | ///
57 | /// "https://en.wikipedia.org/wiki/3D_projection"
58 | /// "https://en.wikipedia.org/wiki/Projection_(linear_algebra)"
59 | ///
60 | public Vector3 ProjectPoint(Vector3 point)
61 | {
62 | return point - (Normal.Dot(point) + Distance) * Normal;
63 | }
64 |
65 | #endregion
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Data/HardwareInput.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-hardwareinput
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct HardwareInput
10 | {
11 | public int uMsg;
12 | public short wParamL;
13 | public short wParamH;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Data/Input.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
7 | ///
8 | [StructLayout(LayoutKind.Explicit)]
9 | public struct Input
10 | {
11 | [FieldOffset(0)] public SendInputEventType type;
12 | [FieldOffset(4)] public MouseInput mi;
13 | [FieldOffset(4)] public KeybdInput ki;
14 | [FieldOffset(4)] public HardwareInput hi;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Data/KeybdInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-keybdinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct KeybdInput
11 | {
12 | public ushort wVk;
13 | public ushort wScan;
14 | public uint dwFlags;
15 | public uint time;
16 | public IntPtr dwExtraInfo;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Data/MouseEventFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
7 | ///
8 | [Flags]
9 | public enum MouseEventFlags : uint
10 | {
11 | MOUSEEVENTF_MOVE = 0x0001,
12 | MOUSEEVENTF_LEFTDOWN = 0x0002,
13 | MOUSEEVENTF_LEFTUP = 0x0004,
14 | MOUSEEVENTF_RIGHTDOWN = 0x0008,
15 | MOUSEEVENTF_RIGHTUP = 0x0010,
16 | MOUSEEVENTF_MIDDLEDOWN = 0x0020,
17 | MOUSEEVENTF_MIDDLEUP = 0x0040,
18 | MOUSEEVENTF_XDOWN = 0x0080,
19 | MOUSEEVENTF_XUP = 0x0100,
20 | MOUSEEVENTF_WHEEL = 0x0800,
21 | MOUSEEVENTF_VIRTUALDESK = 0x4000,
22 | MOUSEEVENTF_ABSOLUTE = 0x8000
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Data/MouseInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct MouseInput
11 | {
12 | public int dx;
13 | public int dy;
14 | public uint mouseData;
15 | public MouseEventFlags dwFlags;
16 | public uint time;
17 | public IntPtr dwExtraInfo;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Data/SendInputEventType.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
2 | {
3 | ///
4 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
5 | ///
6 | public enum SendInputEventType
7 | {
8 | InputMouse,
9 | InputKeyboard,
10 | InputHardware
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Utils/FpsCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Class for measuring fps.
8 | ///
9 | public class FpsCounter
10 | {
11 | #region // storage
12 |
13 | ///
14 | /// One second timespan.
15 | ///
16 | private static readonly TimeSpan TimeSpanFpsUpdate = new TimeSpan(0, 0, 0, 1);
17 |
18 | ///
19 | /// Stopwatch for measuring time.
20 | ///
21 | private Stopwatch FpsTimer { get; } = Stopwatch.StartNew();
22 |
23 | ///
24 | /// Frame count since last timer restart.
25 | ///
26 | private int FpsFrameCount { get; set; }
27 |
28 | ///
29 | /// Average fps (frames per second).
30 | ///
31 | public double Fps { get; private set; }
32 |
33 | #endregion
34 |
35 | #region // routines
36 |
37 | ///
38 | /// Trigger frame update.
39 | ///
40 | public void Update()
41 | {
42 | var fpsTimerElapsed = FpsTimer.Elapsed;
43 | if (fpsTimerElapsed > TimeSpanFpsUpdate)
44 | {
45 | Fps = FpsFrameCount / fpsTimerElapsed.TotalSeconds;
46 | FpsTimer.Restart();
47 | FpsFrameCount = 0;
48 | }
49 | FpsFrameCount++;
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tutorial 010 - Aim Bot (Async)/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Game data retrieved from process.
9 | ///
10 | public class GameData :
11 | ThreadedComponent
12 | {
13 | #region // storage
14 |
15 | ///
16 | protected override string ThreadName => nameof(GameData);
17 |
18 | ///
19 | private GameProcess GameProcess { get; set; }
20 |
21 | ///
22 | public Player Player { get; set; }
23 |
24 | ///
25 | public Entity[] Entities { get; private set; }
26 |
27 | #endregion
28 |
29 | #region // ctor
30 |
31 | ///
32 | public GameData(GameProcess gameProcess)
33 | {
34 | GameProcess = gameProcess;
35 | Player = new Player();
36 | Entities = Enumerable.Range(0, 64).Select(index => new Entity(index)).ToArray();
37 | }
38 |
39 | ///
40 | public override void Dispose()
41 | {
42 | base.Dispose();
43 |
44 | Entities = default;
45 | Player = default;
46 | GameProcess = default;
47 | }
48 |
49 | #endregion
50 |
51 | ///
52 | protected override void FrameAction()
53 | {
54 | if (!GameProcess.IsValid)
55 | {
56 | return;
57 | }
58 |
59 | Player.Update(GameProcess);
60 | foreach (var entity in Entities)
61 | {
62 | entity.Update(GameProcess);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Data/Raw/Team.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
2 | {
3 | ///
4 | /// Enumeration of teams.
5 | ///
6 | public enum Team
7 | {
8 | Unknown = 0,
9 | Spectator = 1,
10 | Terrorists = 2,
11 | CounterTerrorists = 3,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Data/Raw/matrix3x4_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/mathlib/mathlib.h#L237
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct matrix3x4_t
10 | {
11 | public float m00; // xAxis.x
12 | public float m10; // yAxis.x
13 | public float m20; // zAxis.x
14 | public float m30; // vecOrigin.x
15 |
16 | public float m01; // xAxis.y
17 | public float m11; // yAxis.y
18 | public float m21; // zAxis.y
19 | public float m31; // vecOrigin.y
20 |
21 | public float m02; // xAxis.z
22 | public float m12; // yAxis.z
23 | public float m22; // zAxis.z
24 | public float m32; // vecOrigin.z
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Data/Raw/mstudiobbox_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L420
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobbox_t
11 | {
12 | public int bone;
13 | public int group; // intersection group
14 | public Vector3 bbmin; // bounding box
15 | public Vector3 bbmax;
16 | public int szhitboxnameindex; // offset to the name of the hitbox.
17 | public fixed int unused[3];
18 | public float radius; // when radius is -1 it's box, otherwise it's capsule (cylinder with spheres on the end)
19 | public fixed int pad[4];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Data/Raw/mstudiobone_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L238
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobone_t
11 | {
12 | public int sznameindex;
13 | public int parent; // parent bone
14 | public fixed int bonecontroller[6]; // bone controller index, -1 == none
15 | public Vector3 pos;
16 | public Quaternion quat;
17 | public Vector3 rot;
18 | public Vector3 posscale;
19 | public Vector3 rotscale;
20 | public matrix3x4_t poseToBone;
21 | public Quaternion qAlignment;
22 | public int flags;
23 | public int proctype;
24 | public int procindex; // procedural rule
25 | public int physicsbone; // index into physically simulated bone
26 | public int surfacepropidx; // index into string tablefor property name
27 | public int contents; // See BSPFlags.h for the contents flags
28 | public fixed int unused[8]; // remove as appropriat
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Data/Raw/mstudiohitboxset_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L1612
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct mstudiohitboxset_t
10 | {
11 | public int sznameindex;
12 | public int numhitboxes;
13 | public int hitboxindex;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Data/Raw/studiohdr_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L2050
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct studiohdr_t
11 | {
12 | public int id;
13 | public int version;
14 | public int checksum;
15 | public fixed byte name[64];
16 | public int length;
17 | public Vector3 eyeposition;
18 | public Vector3 illumposition;
19 | public Vector3 hull_min;
20 | public Vector3 hull_max;
21 | public Vector3 view_bbmin;
22 | public Vector3 view_bbmax;
23 | public int flags;
24 | public int numbones; // bones
25 | public int boneindex;
26 | public int numbonecontrollers; // bone controllers
27 | public int bonecontrollerindex;
28 | public int numhitboxsets;
29 | public int hitboxsetindex;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Features/EspSkeleton.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Data.Raw;
4 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
5 | using Graphics = RCi.Tutorials.Csgo.Cheat.External.Gfx.Graphics;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
8 | {
9 | ///
10 | /// ESP Skeleton.
11 | ///
12 | public static class EspSkeleton
13 | {
14 | ///
15 | /// Draw skeleton.
16 | ///
17 | public static void Draw(Graphics graphics)
18 | {
19 | foreach (var entity in graphics.GameData.Entities)
20 | {
21 | // validate
22 | if (!entity.IsAlive() || entity.AddressBase == graphics.GameData.Player.AddressBase)
23 | {
24 | continue;
25 | }
26 |
27 | // draw
28 | var color = entity.Team == Team.Terrorists ? Color.Gold : Color.DodgerBlue;
29 | Draw(graphics, entity, color);
30 | }
31 | }
32 |
33 | ///
34 | /// Draw skeleton of given entity.
35 | ///
36 | public static void Draw(Graphics graphics, Entity entity, Color color)
37 | {
38 | for (var i = 0; i < entity.SkeletonCount; i++)
39 | {
40 | var (from, to) = entity.Skeleton[i];
41 |
42 | // validate
43 | if (from == to || from < 0 || to < 0 || from >= Offsets.MAXSTUDIOBONES || to >= Offsets.MAXSTUDIOBONES)
44 | {
45 | continue;
46 | }
47 |
48 | // draw
49 | graphics.DrawPolylineWorld(color, entity.BonesPos[from], entity.BonesPos[to]);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Gfx/Math/Plane3D.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DirectX;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Gfx.Math
4 | {
5 | public readonly struct Plane3D
6 | {
7 | #region // storage
8 |
9 | ///
10 | /// Plane's normal.
11 | ///
12 | public readonly Vector3 Normal;
13 |
14 | ///
15 | /// Distance from origin (0,0,0) to plane along its normal.
16 | ///
17 | public readonly float Distance;
18 |
19 | #endregion
20 |
21 | #region // ctor
22 |
23 | ///
24 | public Plane3D(Vector3 normal, float distance)
25 | {
26 | Normal = normal.Normalized();
27 | Distance = distance;
28 | }
29 |
30 | ///
31 | public Plane3D(Vector3 normal, Vector3 point) :
32 | this(normal, -normal.Dot(point))
33 | {
34 | }
35 |
36 | #endregion
37 |
38 | #region // routines
39 |
40 | ///
41 | /// Project point on a plane.
42 | ///
43 | ///
44 | /// planeOrigin - origin of a plane
45 | /// vector - Vector from plane origin to projected point
46 | ///
47 | public (Vector3 planeOrigin, Vector3 vector) ProjectVector(Vector3 vector)
48 | {
49 | var planeOrigin = ProjectPoint(new Vector3());
50 | return (planeOrigin, ProjectPoint(vector) - planeOrigin);
51 | }
52 |
53 | ///
54 | /// Project point on a plane.
55 | ///
56 | ///
57 | /// "https://en.wikipedia.org/wiki/3D_projection"
58 | /// "https://en.wikipedia.org/wiki/Projection_(linear_algebra)"
59 | ///
60 | public Vector3 ProjectPoint(Vector3 point)
61 | {
62 | return point - (Normal.Dot(point) + Distance) * Normal;
63 | }
64 |
65 | #endregion
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/HardwareInput.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-hardwareinput
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct HardwareInput
10 | {
11 | public int uMsg;
12 | public short wParamL;
13 | public short wParamH;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/HookProc.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nc-winuser-hookproc
7 | ///
8 | public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
9 | }
10 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/HookType.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
2 | {
3 | ///
4 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowshookexa
5 | ///
6 | public enum HookType
7 | {
8 | WH_JOURNALRECORD = 0,
9 | WH_JOURNALPLAYBACK = 1,
10 | WH_KEYBOARD = 2,
11 | WH_GETMESSAGE = 3,
12 | WH_CALLWNDPROC = 4,
13 | WH_CBT = 5,
14 | WH_SYSMSGFILTER = 6,
15 | WH_MOUSE = 7,
16 | WH_HARDWARE = 8,
17 | WH_DEBUG = 9,
18 | WH_SHELL = 10,
19 | WH_FOREGROUNDIDLE = 11,
20 | WH_CALLWNDPROCRET = 12,
21 | WH_KEYBOARD_LL = 13,
22 | WH_MOUSE_LL = 14
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/Input.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
7 | ///
8 | [StructLayout(LayoutKind.Explicit)]
9 | public struct Input
10 | {
11 | [FieldOffset(0)] public SendInputEventType type;
12 | [FieldOffset(4)] public MouseInput mi;
13 | [FieldOffset(4)] public KeybdInput ki;
14 | [FieldOffset(4)] public HardwareInput hi;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/KeybdInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-keybdinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct KeybdInput
11 | {
12 | public ushort wVk;
13 | public ushort wScan;
14 | public uint dwFlags;
15 | public uint time;
16 | public IntPtr dwExtraInfo;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/MouseEventFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
7 | ///
8 | [Flags]
9 | public enum MouseEventFlags : uint
10 | {
11 | MOUSEEVENTF_MOVE = 0x0001,
12 | MOUSEEVENTF_LEFTDOWN = 0x0002,
13 | MOUSEEVENTF_LEFTUP = 0x0004,
14 | MOUSEEVENTF_RIGHTDOWN = 0x0008,
15 | MOUSEEVENTF_RIGHTUP = 0x0010,
16 | MOUSEEVENTF_MIDDLEDOWN = 0x0020,
17 | MOUSEEVENTF_MIDDLEUP = 0x0040,
18 | MOUSEEVENTF_XDOWN = 0x0080,
19 | MOUSEEVENTF_XUP = 0x0100,
20 | MOUSEEVENTF_WHEEL = 0x0800,
21 | MOUSEEVENTF_VIRTUALDESK = 0x4000,
22 | MOUSEEVENTF_ABSOLUTE = 0x8000
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/MouseInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct MouseInput
11 | {
12 | public int dx;
13 | public int dy;
14 | public uint mouseData;
15 | public MouseEventFlags dwFlags;
16 | public uint time;
17 | public IntPtr dwExtraInfo;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/MouseMessage.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
2 | {
3 | ///
4 | /// "https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644986(v%3Dvs.85)"
5 | ///
6 | public enum MouseMessage
7 | {
8 | WM_LBUTTONDOWN = 0x0201,
9 | WM_LBUTTONUP = 0x0202,
10 | WM_MOUSEMOVE = 0x0200,
11 | WM_MOUSEWHEEL = 0x020A,
12 | WM_RBUTTONDOWN = 0x0204,
13 | WM_RBUTTONUP = 0x0205,
14 | WM_MBUTTONDOWN = 0x0207,
15 | WM_MBUTTONUP = 0x0208,
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Data/SendInputEventType.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
2 | {
3 | ///
4 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
5 | ///
6 | public enum SendInputEventType
7 | {
8 | InputMouse,
9 | InputKeyboard,
10 | InputHardware
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 |
15 | ///
16 | /// Retrieves a module handle for the specified module. The module must have been loaded by the calling process.
17 | /// To avoid the race conditions described in the Remarks section, use the GetModuleHandleEx function.
18 | ///
19 | [DllImport("kernel32.dll", SetLastError = true)]
20 | public static extern IntPtr GetModuleHandle(string lpModuleName);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Utils/FpsCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Class for measuring fps.
8 | ///
9 | public class FpsCounter
10 | {
11 | #region // storage
12 |
13 | ///
14 | /// One second timespan.
15 | ///
16 | private static readonly TimeSpan TimeSpanFpsUpdate = new TimeSpan(0, 0, 0, 1);
17 |
18 | ///
19 | /// Stopwatch for measuring time.
20 | ///
21 | private Stopwatch FpsTimer { get; } = Stopwatch.StartNew();
22 |
23 | ///
24 | /// Frame count since last timer restart.
25 | ///
26 | private int FpsFrameCount { get; set; }
27 |
28 | ///
29 | /// Average fps (frames per second).
30 | ///
31 | public double Fps { get; private set; }
32 |
33 | #endregion
34 |
35 | #region // routines
36 |
37 | ///
38 | /// Trigger frame update.
39 | ///
40 | public void Update()
41 | {
42 | var fpsTimerElapsed = FpsTimer.Elapsed;
43 | if (fpsTimerElapsed > TimeSpanFpsUpdate)
44 | {
45 | Fps = FpsFrameCount / fpsTimerElapsed.TotalSeconds;
46 | FpsTimer.Restart();
47 | FpsFrameCount = 0;
48 | }
49 | FpsFrameCount++;
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tutorial 011 - Global Hook/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Data/GameData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Utils;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Data
6 | {
7 | ///
8 | /// Game data retrieved from process.
9 | ///
10 | public class GameData :
11 | ThreadedComponent
12 | {
13 | #region // storage
14 |
15 | ///
16 | protected override string ThreadName => nameof(GameData);
17 |
18 | ///
19 | private GameProcess GameProcess { get; set; }
20 |
21 | ///
22 | public Player Player { get; set; }
23 |
24 | ///
25 | public Entity[] Entities { get; private set; }
26 |
27 | #endregion
28 |
29 | #region // ctor
30 |
31 | ///
32 | public GameData(GameProcess gameProcess)
33 | {
34 | GameProcess = gameProcess;
35 | Player = new Player();
36 | Entities = Enumerable.Range(0, 64).Select(index => new Entity(index)).ToArray();
37 | }
38 |
39 | ///
40 | public override void Dispose()
41 | {
42 | base.Dispose();
43 |
44 | Entities = default;
45 | Player = default;
46 | GameProcess = default;
47 | }
48 |
49 | #endregion
50 |
51 | ///
52 | protected override void FrameAction()
53 | {
54 | if (!GameProcess.IsValid)
55 | {
56 | return;
57 | }
58 |
59 | Player.Update(GameProcess);
60 | foreach (var entity in Entities)
61 | {
62 | entity.Update(GameProcess);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Data/Raw/Team.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
2 | {
3 | ///
4 | /// Enumeration of teams.
5 | ///
6 | public enum Team
7 | {
8 | Unknown = 0,
9 | Spectator = 1,
10 | Terrorists = 2,
11 | CounterTerrorists = 3,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Data/Raw/matrix3x4_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/mathlib/mathlib.h#L237
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct matrix3x4_t
10 | {
11 | public float m00; // xAxis.x
12 | public float m10; // yAxis.x
13 | public float m20; // zAxis.x
14 | public float m30; // vecOrigin.x
15 |
16 | public float m01; // xAxis.y
17 | public float m11; // yAxis.y
18 | public float m21; // zAxis.y
19 | public float m31; // vecOrigin.y
20 |
21 | public float m02; // xAxis.z
22 | public float m12; // yAxis.z
23 | public float m22; // zAxis.z
24 | public float m32; // vecOrigin.z
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Data/Raw/mstudiobbox_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L420
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobbox_t
11 | {
12 | public int bone;
13 | public int group; // intersection group
14 | public Vector3 bbmin; // bounding box
15 | public Vector3 bbmax;
16 | public int szhitboxnameindex; // offset to the name of the hitbox.
17 | public fixed int unused[3];
18 | public float radius; // when radius is -1 it's box, otherwise it's capsule (cylinder with spheres on the end)
19 | public fixed int pad[4];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Data/Raw/mstudiobone_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L238
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct mstudiobone_t
11 | {
12 | public int sznameindex;
13 | public int parent; // parent bone
14 | public fixed int bonecontroller[6]; // bone controller index, -1 == none
15 | public Vector3 pos;
16 | public Quaternion quat;
17 | public Vector3 rot;
18 | public Vector3 posscale;
19 | public Vector3 rotscale;
20 | public matrix3x4_t poseToBone;
21 | public Quaternion qAlignment;
22 | public int flags;
23 | public int proctype;
24 | public int procindex; // procedural rule
25 | public int physicsbone; // index into physically simulated bone
26 | public int surfacepropidx; // index into string tablefor property name
27 | public int contents; // See BSPFlags.h for the contents flags
28 | public fixed int unused[8]; // remove as appropriat
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Data/Raw/mstudiohitboxset_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
4 | {
5 | ///
6 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L1612
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct mstudiohitboxset_t
10 | {
11 | public int sznameindex;
12 | public int numhitboxes;
13 | public int hitboxindex;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Data/Raw/studiohdr_t.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using Microsoft.DirectX;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Data.Raw
5 | {
6 | ///
7 | /// https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/studio.h#L2050
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public unsafe struct studiohdr_t
11 | {
12 | public int id;
13 | public int version;
14 | public int checksum;
15 | public fixed byte name[64];
16 | public int length;
17 | public Vector3 eyeposition;
18 | public Vector3 illumposition;
19 | public Vector3 hull_min;
20 | public Vector3 hull_max;
21 | public Vector3 view_bbmin;
22 | public Vector3 view_bbmax;
23 | public int flags;
24 | public int numbones; // bones
25 | public int boneindex;
26 | public int numbonecontrollers; // bone controllers
27 | public int bonecontrollerindex;
28 | public int numhitboxsets;
29 | public int hitboxsetindex;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Features/EspSkeleton.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using RCi.Tutorials.Csgo.Cheat.External.Data.Internal;
3 | using RCi.Tutorials.Csgo.Cheat.External.Data.Raw;
4 | using RCi.Tutorials.Csgo.Cheat.External.Gfx;
5 | using Graphics = RCi.Tutorials.Csgo.Cheat.External.Gfx.Graphics;
6 |
7 | namespace RCi.Tutorials.Csgo.Cheat.External.Features
8 | {
9 | ///
10 | /// ESP Skeleton.
11 | ///
12 | public static class EspSkeleton
13 | {
14 | ///
15 | /// Draw skeleton.
16 | ///
17 | public static void Draw(Graphics graphics)
18 | {
19 | foreach (var entity in graphics.GameData.Entities)
20 | {
21 | // validate
22 | if (!entity.IsAlive() || entity.AddressBase == graphics.GameData.Player.AddressBase)
23 | {
24 | continue;
25 | }
26 |
27 | // draw
28 | var color = entity.Team == Team.Terrorists ? Color.Gold : Color.DodgerBlue;
29 | Draw(graphics, entity, color);
30 | }
31 | }
32 |
33 | ///
34 | /// Draw skeleton of given entity.
35 | ///
36 | public static void Draw(Graphics graphics, Entity entity, Color color)
37 | {
38 | for (var i = 0; i < entity.SkeletonCount; i++)
39 | {
40 | var (from, to) = entity.Skeleton[i];
41 |
42 | // validate
43 | if (from == to || from < 0 || to < 0 || from >= Offsets.MAXSTUDIOBONES || to >= Offsets.MAXSTUDIOBONES)
44 | {
45 | continue;
46 | }
47 |
48 | // draw
49 | graphics.DrawPolylineWorld(color, entity.BonesPos[from], entity.BonesPos[to]);
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Gfx/Math/Plane3D.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.DirectX;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Gfx.Math
4 | {
5 | public readonly struct Plane3D
6 | {
7 | #region // storage
8 |
9 | ///
10 | /// Plane's normal.
11 | ///
12 | public readonly Vector3 Normal;
13 |
14 | ///
15 | /// Distance from origin (0,0,0) to plane along its normal.
16 | ///
17 | public readonly float Distance;
18 |
19 | #endregion
20 |
21 | #region // ctor
22 |
23 | ///
24 | public Plane3D(Vector3 normal, float distance)
25 | {
26 | Normal = normal.Normalized();
27 | Distance = distance;
28 | }
29 |
30 | ///
31 | public Plane3D(Vector3 normal, Vector3 point) :
32 | this(normal, -normal.Dot(point))
33 | {
34 | }
35 |
36 | #endregion
37 |
38 | #region // routines
39 |
40 | ///
41 | /// Project point on a plane.
42 | ///
43 | ///
44 | /// planeOrigin - origin of a plane
45 | /// vector - Vector from plane origin to projected point
46 | ///
47 | public (Vector3 planeOrigin, Vector3 vector) ProjectVector(Vector3 vector)
48 | {
49 | var planeOrigin = ProjectPoint(new Vector3());
50 | return (planeOrigin, ProjectPoint(vector) - planeOrigin);
51 | }
52 |
53 | ///
54 | /// Project point on a plane.
55 | ///
56 | ///
57 | /// "https://en.wikipedia.org/wiki/3D_projection"
58 | /// "https://en.wikipedia.org/wiki/Projection_(linear_algebra)"
59 | ///
60 | public Vector3 ProjectPoint(Vector3 point)
61 | {
62 | return point - (Normal.Dot(point) + Distance) * Normal;
63 | }
64 |
65 | #endregion
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RCi.Tutorials.Csgo.Cheat.External")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("RCi.Tutorials.Csgo.Cheat.External")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("38e14c7b-e232-4b4e-9e71-7b875bf7a8f3")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/HardwareInput.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-hardwareinput
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct HardwareInput
10 | {
11 | public int uMsg;
12 | public short wParamL;
13 | public short wParamH;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/HookProc.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nc-winuser-hookproc
7 | ///
8 | public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
9 | }
10 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/HookType.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
2 | {
3 | ///
4 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowshookexa
5 | ///
6 | public enum HookType
7 | {
8 | WH_JOURNALRECORD = 0,
9 | WH_JOURNALPLAYBACK = 1,
10 | WH_KEYBOARD = 2,
11 | WH_GETMESSAGE = 3,
12 | WH_CALLWNDPROC = 4,
13 | WH_CBT = 5,
14 | WH_SYSMSGFILTER = 6,
15 | WH_MOUSE = 7,
16 | WH_HARDWARE = 8,
17 | WH_DEBUG = 9,
18 | WH_SHELL = 10,
19 | WH_FOREGROUNDIDLE = 11,
20 | WH_CALLWNDPROCRET = 12,
21 | WH_KEYBOARD_LL = 13,
22 | WH_MOUSE_LL = 14
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/Input.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
7 | ///
8 | [StructLayout(LayoutKind.Explicit)]
9 | public struct Input
10 | {
11 | [FieldOffset(0)] public SendInputEventType type;
12 | [FieldOffset(4)] public MouseInput mi;
13 | [FieldOffset(4)] public KeybdInput ki;
14 | [FieldOffset(4)] public HardwareInput hi;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/KeybdInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-keybdinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct KeybdInput
11 | {
12 | public ushort wVk;
13 | public ushort wScan;
14 | public uint dwFlags;
15 | public uint time;
16 | public IntPtr dwExtraInfo;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/Margins.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/uxtheme/ns-uxtheme-_margins
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public class Margins
10 | {
11 | public int Left, Right, Top, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/MouseEventFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
7 | ///
8 | [Flags]
9 | public enum MouseEventFlags : uint
10 | {
11 | MOUSEEVENTF_MOVE = 0x0001,
12 | MOUSEEVENTF_LEFTDOWN = 0x0002,
13 | MOUSEEVENTF_LEFTUP = 0x0004,
14 | MOUSEEVENTF_RIGHTDOWN = 0x0008,
15 | MOUSEEVENTF_RIGHTUP = 0x0010,
16 | MOUSEEVENTF_MIDDLEDOWN = 0x0020,
17 | MOUSEEVENTF_MIDDLEUP = 0x0040,
18 | MOUSEEVENTF_XDOWN = 0x0080,
19 | MOUSEEVENTF_XUP = 0x0100,
20 | MOUSEEVENTF_WHEEL = 0x0800,
21 | MOUSEEVENTF_VIRTUALDESK = 0x4000,
22 | MOUSEEVENTF_ABSOLUTE = 0x8000
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/MouseInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
5 | {
6 | ///
7 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct MouseInput
11 | {
12 | public int dx;
13 | public int dy;
14 | public uint mouseData;
15 | public MouseEventFlags dwFlags;
16 | public uint time;
17 | public IntPtr dwExtraInfo;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/MouseMessage.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
2 | {
3 | ///
4 | /// "https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644986(v%3Dvs.85)"
5 | ///
6 | public enum MouseMessage
7 | {
8 | WM_LBUTTONDOWN = 0x0201,
9 | WM_LBUTTONUP = 0x0202,
10 | WM_MOUSEMOVE = 0x0200,
11 | WM_MOUSEWHEEL = 0x020A,
12 | WM_RBUTTONDOWN = 0x0204,
13 | WM_RBUTTONUP = 0x0205,
14 | WM_MBUTTONDOWN = 0x0207,
15 | WM_MBUTTONUP = 0x0208,
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | public int X, Y;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
4 | {
5 | ///
6 | /// https://docs.microsoft.com/en-us/windows/win32/api/windef/ns-windef-rect
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | public int Left, Top, Right, Bottom;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Data/SendInputEventType.cs:
--------------------------------------------------------------------------------
1 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys.Data
2 | {
3 | ///
4 | /// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-taginput
5 | ///
6 | public enum SendInputEventType
7 | {
8 | InputMouse,
9 | InputKeyboard,
10 | InputHardware
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Dwmapi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using RCi.Tutorials.Csgo.Cheat.External.Sys.Data;
4 |
5 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
6 | {
7 | public static class Dwmapi
8 | {
9 | ///
10 | /// Extends the window frame into the client area.
11 | ///
12 | [DllImport("dwmapi.dll", SetLastError = true)]
13 | public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Sys/Kernel32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Sys
5 | {
6 | public static class Kernel32
7 | {
8 | ///
9 | /// Reads data from an area of memory in a specified process.
10 | /// The entire area to be read must be accessible or the operation fails.
11 | ///
12 | [DllImport("kernel32.dll", SetLastError = true)]
13 | public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer, int dwSize, out int lpNumberOfBytesRead);
14 |
15 | ///
16 | /// Retrieves a module handle for the specified module. The module must have been loaded by the calling process.
17 | /// To avoid the race conditions described in the Remarks section, use the GetModuleHandleEx function.
18 | ///
19 | [DllImport("kernel32.dll", SetLastError = true)]
20 | public static extern IntPtr GetModuleHandle(string lpModuleName);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Utils/FpsCounter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Class for measuring fps.
8 | ///
9 | public class FpsCounter
10 | {
11 | #region // storage
12 |
13 | ///
14 | /// One second timespan.
15 | ///
16 | private static readonly TimeSpan TimeSpanFpsUpdate = new TimeSpan(0, 0, 0, 1);
17 |
18 | ///
19 | /// Stopwatch for measuring time.
20 | ///
21 | private Stopwatch FpsTimer { get; } = Stopwatch.StartNew();
22 |
23 | ///
24 | /// Frame count since last timer restart.
25 | ///
26 | private int FpsFrameCount { get; set; }
27 |
28 | ///
29 | /// Average fps (frames per second).
30 | ///
31 | public double Fps { get; private set; }
32 |
33 | #endregion
34 |
35 | #region // routines
36 |
37 | ///
38 | /// Trigger frame update.
39 | ///
40 | public void Update()
41 | {
42 | var fpsTimerElapsed = FpsTimer.Elapsed;
43 | if (fpsTimerElapsed > TimeSpanFpsUpdate)
44 | {
45 | Fps = FpsFrameCount / fpsTimerElapsed.TotalSeconds;
46 | FpsTimer.Restart();
47 | FpsFrameCount = 0;
48 | }
49 | FpsFrameCount++;
50 | }
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tutorial 012 - Aim Bot (Sync)/Utils/Module.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace RCi.Tutorials.Csgo.Cheat.External.Utils
5 | {
6 | ///
7 | /// Wrapper for .
8 | ///
9 | public class Module :
10 | IDisposable
11 | {
12 | #region // storage
13 |
14 | ///
15 | public Process Process { get; private set; }
16 |
17 | ///
18 | public ProcessModule ProcessModule { get; private set; }
19 |
20 | #endregion
21 |
22 | #region // ctor
23 |
24 | ///
25 | public Module(Process process, ProcessModule processModule)
26 | {
27 | Process = process;
28 | ProcessModule = processModule;
29 | }
30 |
31 | ///
32 | public void Dispose()
33 | {
34 | Process = default;
35 |
36 | ProcessModule.Dispose();
37 | ProcessModule = default;
38 | }
39 |
40 | #endregion
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/Microsoft.DirectX.Direct3D.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rciworks/RCi.Tutorials.Csgo.Cheat.External/f1cff7c74cbbbe643ee02f597e1444473b33a65c/lib/Microsoft.DirectX.Direct3D.dll
--------------------------------------------------------------------------------
/lib/Microsoft.DirectX.Direct3DX.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rciworks/RCi.Tutorials.Csgo.Cheat.External/f1cff7c74cbbbe643ee02f597e1444473b33a65c/lib/Microsoft.DirectX.Direct3DX.dll
--------------------------------------------------------------------------------
/lib/Microsoft.DirectX.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rciworks/RCi.Tutorials.Csgo.Cheat.External/f1cff7c74cbbbe643ee02f597e1444473b33a65c/lib/Microsoft.DirectX.dll
--------------------------------------------------------------------------------
/offsets.txt:
--------------------------------------------------------------------------------
1 | // https://github.com/frk1/hazedumper/blob/master/csgo.cs
2 |
3 | dwClientState = 0x58ECFC
4 | dwClientState_ViewAngles = 0x4D88
5 | dwEntityList = 0x4D05AF4
6 | dwLocalPlayer = 0xCF3A4C
7 | dwViewMatrix = 0x4CF7524
8 | m_aimPunchAngle = 0x302C
9 | m_bDormant = 0xED
10 | m_dwBoneMatrix = 0x26A8
11 | m_iFOV = 0x31E4
12 | m_iHealth = 0x100
13 | m_iTeamNum = 0xF4
14 | m_lifeState = 0x25F
15 | m_pStudioHdr = 0x294C
16 | m_vecOrigin = 0x138
17 | m_vecViewOffset = 0x108
--------------------------------------------------------------------------------
/preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rciworks/RCi.Tutorials.Csgo.Cheat.External/f1cff7c74cbbbe643ee02f597e1444473b33a65c/preview.png
--------------------------------------------------------------------------------