Skip to content

Commit 4a8cf47

Browse files
ATXATX
authored andcommitted
fix: support for latest patch
feat: upwards teleport
1 parent 38a2faa commit 4a8cf47

File tree

2 files changed

+82
-15
lines changed

2 files changed

+82
-15
lines changed

MainWindow.xaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
<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"/>
1616
<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>
1717
<TextBlock x:Name="positionBlock" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="78,41,0,0" Height="85" Width="116" FontSize="20" Foreground="White" TextAlignment="Right"/>
18-
<Button x:Name="godModeBtn" Content="[F2] God Mode" HorizontalAlignment="Left" Height="28" Margin="218,47,0,0" VerticalAlignment="Top" Width="200" FontSize="16" Background="#FF666666" Foreground="White" BorderBrush="#FF040404" Click="godModeBtn_Click" />
19-
<Label x:Name="godModeLabel" Content="OFF" HorizontalAlignment="Left" Height="35" Margin="423,46,0,0" VerticalAlignment="Top" Width="46" FontSize="16" FontWeight="Bold" Foreground="Red" RenderTransformOrigin="0.571,-1.489" />
20-
<Button x:Name="ammoBtn" Content="[F3] Unlimited Ammo" HorizontalAlignment="Left" Height="28" Margin="218,82,0,0" VerticalAlignment="Top" Width="200" FontSize="16" Background="#FF666666" Foreground="White" BorderBrush="#FF040404" Click="ammoBtn_Click" />
21-
<Label x:Name="ammoLabel" Content="OFF" HorizontalAlignment="Left" Height="35" Margin="423,81,0,0" VerticalAlignment="Top" Width="46" FontSize="16" FontWeight="Bold" Foreground="Red" RenderTransformOrigin="0.571,-1.489" />
18+
<Button x:Name="godModeBtn" Content="[F3] God Mode" HorizontalAlignment="Left" Height="28" Margin="218,78,0,0" VerticalAlignment="Top" Width="200" FontSize="16" Background="#FF666666" Foreground="White" BorderBrush="#FF040404" Click="godModeBtn_Click" />
19+
<Label x:Name="godModeLabel" Content="OFF" HorizontalAlignment="Left" Height="35" Margin="423,77,0,0" VerticalAlignment="Top" Width="46" FontSize="16" FontWeight="Bold" Foreground="Red" RenderTransformOrigin="0.571,-1.489" />
20+
<Button x:Name="ammoBtn" Content="[F4] Infinite Ammo" HorizontalAlignment="Left" Height="28" Margin="218,111,0,0" VerticalAlignment="Top" Width="200" FontSize="16" Background="#FF666666" Foreground="White" BorderBrush="#FF040404" Click="ammoBtn_Click" />
21+
<Label x:Name="ammoLabel" Content="OFF" HorizontalAlignment="Left" Height="35" Margin="423,110,0,0" VerticalAlignment="Top" Width="46" FontSize="16" FontWeight="Bold" Foreground="Red" RenderTransformOrigin="0.571,-1.489" />
22+
<Button x:Name="teleUpBtn" Content="[F2] Teleport Up" HorizontalAlignment="Left" Height="28" Margin="218,45,0,0" VerticalAlignment="Top" Width="200" FontSize="16" Background="#FF666666" Foreground="White" BorderBrush="#FF040404" Click="teleUpBtn_Click" />
2223

2324
</Grid>
2425

25-
</Window>
26+
</Window>

MainWindow.xaml.cs

Lines changed: 76 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ public partial class MainWindow : Window
1717
public bool hooked = false;
1818

1919
DeepPointer characterDP = new DeepPointer(0x02D5F688, 0x8, 0x8, 0x98, 0xA0, 0x1F0, 0x0);
20+
DeepPointer rotationDP = new DeepPointer(0x810, 0x0);
2021
DeepPointer statusDP = new DeepPointer(0x900);
2122

22-
IntPtr xVelPtr, yVelPtr, zVelPtr, xPosPtr, yPosPtr, zPosPtr, godPtr, ammoPtr;
23+
IntPtr xVelPtr, yVelPtr, zVelPtr, xPosPtr, yPosPtr, zPosPtr, godPtr, ammoPtr, rotAPtr, rotBPtr;
2324

24-
bool god, ammo, teleFw = false;
25+
bool god, ammo, teleFw, teleUp = false;
2526
float[] storedPos = new float[5] { 0f, 0f, 0f, 0f, 0f };
2627

2728

28-
float xVel, yVel, zVel, xPos, yPos, zPos;
29+
float xVel, yVel, zVel, xPos, yPos, zPos, rotA, rotB;
2930

3031
private void teleportFwBtn_Click(object sender, RoutedEventArgs e)
3132
{
@@ -45,6 +46,17 @@ private void ammoBtn_Click(object sender, RoutedEventArgs e)
4546
ToggleAmmo();
4647
}
4748

49+
private void Button_Click(object sender, RoutedEventArgs e)
50+
{
51+
TestFunction();
52+
}
53+
54+
private void teleUpBtn_Click(object sender, RoutedEventArgs e)
55+
{
56+
e.Handled = true;
57+
TeleportUpward();
58+
}
59+
4860
private void saveBtn_Click(object sender, RoutedEventArgs e)
4961
{
5062
e.Handled = true;
@@ -96,7 +108,6 @@ private void Update(object sender, EventArgs e)
96108
return;
97109
}
98110

99-
Debug.WriteLine(game.Modules.Count);
100111

101112
game.ReadValue<float>(xPosPtr, out xPos);
102113
game.ReadValue<float>(yPosPtr, out yPos);
@@ -107,6 +118,9 @@ private void Update(object sender, EventArgs e)
107118
game.ReadValue<float>(zVelPtr, out zVel);
108119
double hVel = (Math.Sqrt(xVel * xVel + yVel * yVel));
109120

121+
game.ReadValue<float>(rotAPtr, out rotA);
122+
game.ReadValue<float>(rotBPtr, out rotB);
123+
110124
game.ReadValue<bool>(godPtr, out god);
111125
game.ReadValue<bool>(ammoPtr, out ammo);
112126

@@ -121,6 +135,10 @@ private void Update(object sender, EventArgs e)
121135
{
122136
TeleportForward();
123137
}
138+
if (teleUp)
139+
{
140+
TeleportUpward();
141+
}
124142
}
125143

126144
private bool Hook()
@@ -179,6 +197,10 @@ private void DerefPointers()
179197
godPtr = statusBasePtr + 0x10;
180198
ammoPtr = statusBasePtr + 0x20;
181199

200+
rotationDP.DerefOffsets(game, out basePtr);
201+
rotAPtr = basePtr + 0x1B4;
202+
rotBPtr = basePtr + 0x1B8;
203+
182204
}
183205

184206
private void InputKeyDown(object sender, KeyEventArgs e)
@@ -189,9 +211,12 @@ private void InputKeyDown(object sender, KeyEventArgs e)
189211
teleFw = true;
190212
break;
191213
case Keys.F2:
192-
ToggleGod();
214+
teleUp = true;
193215
break;
194216
case Keys.F3:
217+
ToggleGod();
218+
break;
219+
case Keys.F4:
195220
ToggleAmmo();
196221
break;
197222
case Keys.F5:
@@ -227,9 +252,7 @@ private void TeleportForward()
227252
if (!hooked)
228253
return;
229254

230-
float a = new DeepPointer(0x3283134).Deref<float>(game);
231-
float b = new DeepPointer(0x3283138).Deref<float>(game);
232-
System.Windows.Media.Media3D.Quaternion q = new System.Windows.Media.Media3D.Quaternion(0, b, 0, a);
255+
System.Windows.Media.Media3D.Quaternion q = new System.Windows.Media.Media3D.Quaternion(0, rotB, 0, rotA);
233256
float angle = ((float)((q.Angle / 2) * -q.Axis.Y));
234257
angle = (float)(angle / 180 * Math.PI);
235258

@@ -243,6 +266,22 @@ private void TeleportForward()
243266
game.WriteBytes(yPosPtr, BitConverter.GetBytes((float)(yPos + (float)(y * scale * 1))));
244267
}
245268

269+
private void TeleportUpward()
270+
{
271+
if (!hooked)
272+
return;
273+
274+
275+
float scale = 1f;
276+
if(zVel < 0.0f)
277+
{
278+
scale = Math.Abs(zVel) / 10;
279+
}
280+
281+
game.WriteBytes(zPosPtr, BitConverter.GetBytes((float)(zPos + (float)(scale * 1))));
282+
283+
}
284+
246285
private void Teleport()
247286
{
248287
if (!hooked)
@@ -285,6 +324,9 @@ private void InputKeyUp(object sender, KeyEventArgs e)
285324
case Keys.F1:
286325
teleFw = false;
287326
break;
327+
case Keys.F2:
328+
teleUp = false;
329+
break;
288330
}
289331
e.Handled = true;
290332
}
@@ -399,6 +441,12 @@ private bool WriteFunctionHooks()
399441
jumpCode = StringToByteArray("E9 " + IntPtrToASMString(new IntPtr((uint)jumpOffset), 4) + " 90");
400442
game.WriteBytes(consumeAmmoPtr, jumpCode);
401443

444+
SigScanTarget rotationTarget = new SigScanTarget("48 89 5D 28 48 8B D3 48 8D 0D ?? ?? ?? ??");
445+
IntPtr ptr = scanner.Scan(rotationTarget) + 0xA;
446+
ptr += game.ReadValue<int>(ptr) + 0x4;
447+
_ = new DeepPointer(0x810).DerefOffsets(game, out IntPtr newRotPtr);
448+
game.WriteBytes(newRotPtr, BitConverter.GetBytes(ptr.ToInt64()));
449+
402450
game.WriteValue<byte>(statusPtr, 0x1);
403451
return true;
404452
}
@@ -410,7 +458,7 @@ byte[] StringToByteArray(string input)
410458
byte[] output = new byte[byteStringArray.Length];
411459
for (int i = 0; i < byteStringArray.Length; i++)
412460
{
413-
output[i] = Byte.Parse(byteStringArray[i], System.Globalization.NumberStyles.HexNumber);
461+
output[i] = byte.Parse(byteStringArray[i], System.Globalization.NumberStyles.HexNumber);
414462
}
415463
return output;
416464
}
@@ -429,5 +477,23 @@ string IntPtrToASMString(IntPtr input, int length = 8)
429477
return output;
430478
}
431479

480+
481+
void TestFunction()
482+
{
483+
SignatureScanner scanner = new SignatureScanner(game, game.MainModule.BaseAddress, game.MainModule.ModuleMemorySize);
484+
/*
485+
Deathloop.exe+C0CDF5 - 42 89 04 37 - mov [rdi+r14],eax
486+
Deathloop.exe+C0CDF9 - 48 83 C3 20 - add rbx,20
487+
Deathloop.exe+C0CDFD - 48 89 5D 28 - mov [rbp+28],rbx
488+
Deathloop.exe+C0CE01 - 48 8B D3 - mov rdx,rbx
489+
Deathloop.exe+C0CE04 - 48 8D 0D A5616702 - lea rcx,[Deathloop.exe+3282FB0] <---
490+
*/
491+
SigScanTarget rotationTarget = new SigScanTarget("48 89 5D 28 48 8B D3 48 8D 0D ?? ?? ?? ??");
492+
IntPtr ptr = scanner.Scan(rotationTarget) + 0xA;
493+
ptr += game.ReadValue<int>(ptr) + 0x4;
494+
_ = new DeepPointer(0x810).DerefOffsets(game, out IntPtr newRotPtr);
495+
game.WriteBytes(newRotPtr, BitConverter.GetBytes(ptr.ToInt64()));
496+
}
497+
432498
}
433-
}
499+
}

0 commit comments

Comments
 (0)