Skip to content

Commit f1e1fc3

Browse files
ATXATX
authored andcommitted
Add project files.
1 parent e8ca71a commit f1e1fc3

20 files changed

+2483
-0
lines changed

App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>

App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="VeninethTrainer.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:VeninethTrainer"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

App.xaml.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace VeninethTrainer
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}

DeepPointer.cs

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Runtime.InteropServices;
6+
using System.Text;
7+
#pragma warning disable 1591
8+
9+
// Note: Please be careful when modifying this because it could break existing components!
10+
11+
namespace VeninethTrainer
12+
{
13+
using OffsetT = Int32;
14+
15+
public class DeepPointer
16+
{
17+
private IntPtr _absoluteBase;
18+
private bool _usingAbsoluteBase;
19+
20+
private OffsetT _base;
21+
private List<OffsetT> _offsets;
22+
private string _module;
23+
24+
public DeepPointer(IntPtr absoluteBase, params OffsetT[] offsets)
25+
{
26+
_absoluteBase = absoluteBase;
27+
_usingAbsoluteBase = true;
28+
29+
InitializeOffsets(offsets);
30+
}
31+
32+
public DeepPointer(string module, OffsetT base_, params OffsetT[] offsets)
33+
: this(base_, offsets)
34+
{
35+
_module = module.ToLower();
36+
}
37+
38+
public DeepPointer(OffsetT base_, params OffsetT[] offsets)
39+
{
40+
_base = base_;
41+
InitializeOffsets(offsets);
42+
}
43+
44+
public T Deref<T>(Process process, T default_ = default(T)) where T : struct // all value types including structs
45+
{
46+
T val;
47+
if (!Deref(process, out val))
48+
val = default_;
49+
return val;
50+
}
51+
52+
public bool Deref<T>(Process process, out T value) where T : struct
53+
{
54+
IntPtr ptr;
55+
if (!DerefOffsets(process, out ptr)
56+
|| !process.ReadValue(ptr, out value))
57+
{
58+
value = default(T);
59+
return false;
60+
}
61+
62+
return true;
63+
}
64+
65+
public byte[] DerefBytes(Process process, int count)
66+
{
67+
byte[] bytes;
68+
if (!DerefBytes(process, count, out bytes))
69+
bytes = null;
70+
return bytes;
71+
}
72+
73+
public bool DerefBytes(Process process, int count, out byte[] value)
74+
{
75+
IntPtr ptr;
76+
if (!DerefOffsets(process, out ptr)
77+
|| !process.ReadBytes(ptr, count, out value))
78+
{
79+
value = null;
80+
return false;
81+
}
82+
83+
return true;
84+
}
85+
86+
public string DerefString(Process process, int numBytes, string default_ = null)
87+
{
88+
string str;
89+
if (!DerefString(process, ReadStringType.AutoDetect, numBytes, out str))
90+
str = default_;
91+
return str;
92+
}
93+
94+
public string DerefString(Process process, ReadStringType type, int numBytes, string default_ = null)
95+
{
96+
string str;
97+
if (!DerefString(process, type, numBytes, out str))
98+
str = default_;
99+
return str;
100+
}
101+
102+
public bool DerefString(Process process, int numBytes, out string str)
103+
{
104+
return DerefString(process, ReadStringType.AutoDetect, numBytes, out str);
105+
}
106+
107+
public bool DerefString(Process process, ReadStringType type, int numBytes, out string str)
108+
{
109+
var sb = new StringBuilder(numBytes);
110+
if (!DerefString(process, type, sb))
111+
{
112+
str = null;
113+
return false;
114+
}
115+
str = sb.ToString();
116+
return true;
117+
}
118+
119+
public bool DerefString(Process process, StringBuilder sb)
120+
{
121+
return DerefString(process, ReadStringType.AutoDetect, sb);
122+
}
123+
124+
public bool DerefString(Process process, ReadStringType type, StringBuilder sb)
125+
{
126+
IntPtr ptr;
127+
if (!DerefOffsets(process, out ptr)
128+
|| !process.ReadString(ptr, type, sb))
129+
{
130+
return false;
131+
}
132+
return true;
133+
}
134+
135+
public bool DerefOffsets(Process process, out IntPtr ptr)
136+
{
137+
bool is64Bit = process.Is64Bit();
138+
139+
if (!string.IsNullOrEmpty(_module))
140+
{
141+
ProcessModuleWow64Safe module = process.ModulesWow64Safe()
142+
.FirstOrDefault(m => m.ModuleName.ToLower() == _module);
143+
if (module == null)
144+
{
145+
ptr = IntPtr.Zero;
146+
return false;
147+
}
148+
149+
ptr = module.BaseAddress + _base;
150+
}
151+
else if (_usingAbsoluteBase)
152+
{
153+
ptr = _absoluteBase;
154+
}
155+
else
156+
{
157+
ptr = process.MainModuleWow64Safe().BaseAddress + _base;
158+
}
159+
160+
for (int i = 0; i < _offsets.Count - 1; i++)
161+
{
162+
if (!process.ReadPointer(ptr + _offsets[i], is64Bit, out ptr)
163+
|| ptr == IntPtr.Zero)
164+
{
165+
return false;
166+
}
167+
}
168+
169+
ptr = ptr + _offsets[_offsets.Count - 1];
170+
return true;
171+
}
172+
173+
private void InitializeOffsets(params OffsetT[] offsets)
174+
{
175+
_offsets = new List<OffsetT>();
176+
_offsets.Add(0); // deref base first
177+
_offsets.AddRange(offsets);
178+
}
179+
}
180+
181+
[StructLayout(LayoutKind.Sequential)]
182+
public struct Vector3f
183+
{
184+
public float X { get; set; }
185+
public float Y { get; set; }
186+
public float Z { get; set; }
187+
188+
public int IX { get { return (int)X; } }
189+
public int IY { get { return (int)Y; } }
190+
public int IZ { get { return (int)Z; } }
191+
192+
public Vector3f(float x, float y, float z) : this()
193+
{
194+
X = x;
195+
Y = y;
196+
Z = z;
197+
}
198+
199+
public float Distance(Vector3f other)
200+
{
201+
float result = (X - other.X) * (X - other.X) +
202+
(Y - other.Y) * (Y - other.Y) +
203+
(Z - other.Z) * (Z - other.Z);
204+
return (float)Math.Sqrt(result);
205+
}
206+
207+
public float DistanceXY(Vector3f other)
208+
{
209+
float result = (X - other.X) * (X - other.X) +
210+
(Y - other.Y) * (Y - other.Y);
211+
return (float)Math.Sqrt(result);
212+
}
213+
214+
public bool BitEquals(Vector3f other)
215+
{
216+
return X.BitEquals(other.X)
217+
&& Y.BitEquals(other.Y)
218+
&& Z.BitEquals(other.Z);
219+
}
220+
221+
public bool BitEqualsXY(Vector3f other)
222+
{
223+
return X.BitEquals(other.X)
224+
&& Y.BitEquals(other.Y);
225+
}
226+
227+
public override string ToString()
228+
{
229+
return X + " " + Y + " " + Z;
230+
}
231+
}
232+
}

Ghostrunner_101.ico

21.8 KB
Binary file not shown.

MainWindow.xaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Window x:Class="VeninethTrainer.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:VeninethTrainer"
7+
mc:Ignorable="d"
8+
Title="Venineth Trainer" Height="266" Width="485" Icon="Ghostrunner_101.ico" ResizeMode="CanMinimize">
9+
<Grid Background="#FF292929">
10+
<Button x:Name="noclipBtn" Content="[F1] NoClip" HorizontalAlignment="Left" Height="28" Margin="218,12,0,0" VerticalAlignment="Top" Width="200" FontSize="16" Background="#FF666666" Foreground="White" BorderBrush="#FF040404" Click="noclipBtn_Click"/>
11+
<Button x:Name="saveBtn" Content="[F5] Save Position" HorizontalAlignment="Left" Height="27" Margin="218,150,0,0" VerticalAlignment="Top" Width="240" FontSize="16" Background="#FF666666" Foreground="White" BorderBrush="#FF040404" Click="saveBtn_Click"/>
12+
<Button x:Name="teleBtn" Content="[F6] Teleport" HorizontalAlignment="Left" Height="28" Margin="218,182,0,0" VerticalAlignment="Top" Width="240" FontSize="16" Background="#FF666666" Foreground="White" BorderBrush="#FF040404" Click="teleBtn_Click"/>
13+
<Label x:Name="noclipLabel" Content="OFF" HorizontalAlignment="Left" Height="35" Margin="423,11,0,0" VerticalAlignment="Top" Width="46" FontSize="16" FontWeight="Bold" Foreground="Red" RenderTransformOrigin="0.571,-1.489"/>
14+
<Label x:Name="speedLabel" Content="Speed" HorizontalAlignment="Left" Height="35" Margin="10,177,0,0" VerticalAlignment="Top" Width="68" FontSize="20" Foreground="White" FontWeight="Bold"/>
15+
<TextBlock x:Name="speedBlock" HorizontalAlignment="Left" Text="10.99 m/s" VerticalAlignment="Top" Margin="86,182,0,0" Height="31" Width="108" FontSize="20" Foreground="White" TextAlignment="Right"/>
16+
<Label x:Name="positionLabel" Content="Position" HorizontalAlignment="Left" Height="35" Margin="10,3,0,0" VerticalAlignment="Top" Width="196" FontSize="20" Foreground="White" FontWeight="Bold"/>
17+
<TextBlock x:Name="positionLabelBlock" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="17,41,0,0" Height="85" Width="61" FontSize="20" Foreground="White" TextAlignment="Left"><Run Text="x"/><LineBreak/><Run Text="y"/><LineBreak/><Run Text="z"/></TextBlock>
18+
<TextBlock x:Name="positionBlock" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="78,41,0,0" Height="85" Width="116" FontSize="20" Foreground="White" TextAlignment="Right"/>
19+
<Button x:Name="gameSpeedBtn" Content="[F4] Game Speed" HorizontalAlignment="Left" Height="28" Margin="218,109,0,0" VerticalAlignment="Top" Width="200" FontSize="16" Background="#FF666666" Foreground="White" BorderBrush="#FF040404" Click="gameSpeedBtn_Click"/>
20+
<Label x:Name="gameSpeedLabel" Content="1.0x" HorizontalAlignment="Left" Height="35" Margin="423,108,0,0" VerticalAlignment="Top" Width="46" FontSize="16" FontWeight="Bold" Foreground="White" RenderTransformOrigin="0.478,0.543" Background="#00000000"/>
21+
22+
</Grid>
23+
24+
</Window>

0 commit comments

Comments
 (0)