viewMatrix

This commit is contained in:
finn tews
2024-04-30 22:54:42 +02:00
parent 706348194d
commit cba3bbf83a
4 changed files with 146 additions and 23 deletions

View File

@@ -28,11 +28,15 @@ namespace GmodCheatx64s
const int viewangleX = 0x5D5370; //yaw rechts links
const int viewangleY = 0x5D536C; //pitch oben unten
const int viewMatrixP = 0x72FDA0;
const int viewMatrixOffset = 0x460;
const int hp = 0xC8;
const int x = 0x308;
const int y = 0x30C;
const int z = 0x310;
//IntPtr testViewMatrix = (IntPtr.Zero);
#endregion
public static void Main(string[] args)
@@ -55,20 +59,89 @@ namespace GmodCheatx64s
//Console.Write(swed.ReadFloat(enginebase, viewangleX));
//Console.Write(swed.ReadFloat(enginebase, viewangleY));
//Console.Write("\n");
if (GetAsyncKeyState(0x56) < 0)
if(renderer.enableAimbot)
{
//var EntityObj = swed.ReadPointer(moduleBase, entitybase + 0x20);
//Console.WriteLine(swed.ReadFloat(EntityObj, 0x308));
updatelocal();
updateEntities();
entityList = entityList.OrderBy(o => o.mag).ToList();
if (entityList.Count > 0)
if (GetAsyncKeyState(0x56) < 0)
{
//Console.WriteLine(entityList[0].health);
aim(entityList[0]);
//var EntityObj = swed.ReadPointer(moduleBase, entitybase + 0x20);
//Console.WriteLine(swed.ReadFloat(EntityObj, 0x308));
updatelocal();
updateEntities();
entityList = entityList.OrderBy(o => o.mag).ToList();
if (entityList.Count > 0)
{
//Console.WriteLine(entityList[0].health);
aim(entityList[0]);
}
Thread.Sleep(1);
}
}
Viewmatrix ReadMatrix()
{
var viewMatrix = new Viewmatrix();
var matrixPointer = swed.ReadPointer(enginebase, viewMatrixP);
var matrix = swed.ReadMatrix(matrixPointer + viewMatrixP);
viewMatrix.m11 = matrix[0];
viewMatrix.m12 = matrix[1];
viewMatrix.m13 = matrix[2];
viewMatrix.m14 = matrix[3];
viewMatrix.m21 = matrix[4];
viewMatrix.m22 = matrix[5];
viewMatrix.m23 = matrix[6];
viewMatrix.m24 = matrix[7];
viewMatrix.m31 = matrix[8];
viewMatrix.m32 = matrix[9];
viewMatrix.m33 = matrix[10];
viewMatrix.m34 = matrix[11];
viewMatrix.m41 = matrix[12];
viewMatrix.m42 = matrix[13];
viewMatrix.m43 = matrix[14];
viewMatrix.m44 = matrix[15];
return viewMatrix;
}
Vector2 WorldToScreen(Viewmatrix matrix, Vector3 pos, int width, int height)
{
var screenCoordinates = new Vector2();
//calculater screenW
float screenW = (matrix.m41 * pos.X) + (matrix.m42 * pos.Y) + (matrix.m43 * pos.Z) + matrix.m44;
if(screenW > 0.001f)
{
//calculatr screen x and y
float screenX = (matrix.m11 * pos.X) + (matrix.m12 * pos.Y) + (matrix.m13 * pos.Z) + matrix.m14;
float screenY = (matrix.m21 * pos.X) + (matrix.m22 * pos.Y) + (matrix.m23 * pos.Z) + matrix.m24;
// calculatr camera center
float camX = width / 2;
float camY = height / 2;
//perform perspective division and transformation
float X = camX + (camX * screenX / screenW);
float Y = camY + (camY * screenY / screenW);
screenCoordinates.X = X;
screenCoordinates.Y = Y;
return screenCoordinates;
}
else
{
return new Vector2(-99, -99);
}
Thread.Sleep(1);
}
void updatelocal()
@@ -128,8 +201,8 @@ namespace GmodCheatx64s
void aim(entity entity)
{
//Console.WriteLine("New");
//Console.WriteLine(entity.health);
Console.WriteLine("New");
Console.WriteLine(entity.health);
float deltaX = entity.x - player.x;
float deltaY = entity.y - player.y;
@@ -142,7 +215,8 @@ namespace GmodCheatx64s
float Y = -(float)(Math.Atan2(deltaZ, dist) * 180 / Math.PI);
var buffer = swed.ReadPointer(moduleBase, localPlayer);
Console.WriteLine(dist);
swed.WriteFloat(enginebase, viewangleX, X);
swed.WriteFloat(enginebase, viewangleY, Y);
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GmodCheatx64
{
public class Viewmatrix
{
public float m11, m12, m13, m14;
public float m21, m22, m23, m24;
public float m31, m32, m33, m34;
public float m41, m42, m43, m44;
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Swed64;
@@ -12,5 +13,7 @@ namespace GmodCheatx64
public int health;
public float x, y, z;
public float mag;
public Vector2 originScreenPosition { get; set; }
public Vector2 absScreenPosition { get; set; }
}
}

View File

@@ -1,6 +1,7 @@
using ClickableTransparentOverlay;
using GmodCheatx64s;
using ImGuiNET;
using Swed64;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -19,34 +20,61 @@ namespace GmodCheatx64
string input2 = "";
bool enableOverlay = false;
bool enableEsp = true;
bool enableEspLine = true;
bool enableEspBox = true;
public bool enableAimbot = false;
public bool enableHealthCheck = false;
Vector2 screenSize = new Vector2(2560, 1440);
Vector2 drawPosition = new Vector2(150, 150);
Vector2 drawMax = new Vector2(550, 550);
Vector2 LineOrigin = new Vector2(1920 / 2, 1080);
Vector2 windowCenter = new Vector2(1920/2 , 1080/2);
Vector4 enemyColor = new Vector4(1,0,0,1);
protected override void Render()
{
DrawMenu();
DrawOverlay();
}
void DrawMenu()
{
ImGui.Begin("Gmod x64 Made by Finn");
ImGui.Checkbox("Draw Overlay", ref enableOverlay);
ImGui.BeginChild("Aimbot");
ImGui.Checkbox("CheckIfEntityHealth 0", ref enableHealthCheck);
ImGui.EndChild();
ImGui.End();
}
if(ImGui.BeginTabBar("Tabs"))
{
if(ImGui.BeginTabItem("General"))
{
ImGui.Checkbox("ESP", ref enableEsp);
ImGui.Checkbox("Aimbot", ref enableAimbot);
ImGui.Checkbox("Draw Overlay", ref enableOverlay);
ImGui.Checkbox("CheckIfEntityHealth 0", ref enableHealthCheck);
ImGui.EndTabItem();
}
if(ImGui.BeginTabItem("ESP"))
{
ImGui.Checkbox("ESP Line", ref enableEspLine);
ImGui.Checkbox("ESP Box", ref enableEspBox);
ImGui.ColorPicker4("Enemy Color", ref enemyColor);
ImGui.EndTabItem();
}
ImGui.EndTabBar();
}
}
void DrawOverlay()
{
if (enableOverlay)
{
ImGui.SetNextWindowSize(screenSize);
ImGui.SetNextWindowPos(new Vector2(0, 0));
ImGui.Begin("Overlayxx", ImGuiWindowFlags.NoDecoration
ImGui.Begin("Overlay", ImGuiWindowFlags.NoDecoration
| ImGuiWindowFlags.NoBackground
| ImGuiWindowFlags.NoBringToFrontOnFocus
| ImGuiWindowFlags.NoMove
@@ -58,7 +86,8 @@ namespace GmodCheatx64
ImDrawListPtr drawList = ImGui.GetWindowDrawList();
drawList.AddCircle(drawPosition, 50,ImGui.ColorConvertFloat4ToU32(new Vector4(1,0,0,1))); //Red
//drawList.AddCircle(drawPosition, 50,ImGui.ColorConvertFloat4ToU32(new Vector4(1,0,0,1))); //Red
drawList.AddRect(drawPosition, drawMax ,ImGui.ColorConvertFloat4ToU32(new Vector4(1, 0, 0, 1)));
}
}
}