11using System ;
22using System . Collections . Generic ;
33using System . Diagnostics ;
4+ using System . IO ;
45using System . Linq ;
56using System . Windows ;
67using System . Windows . Forms ;
@@ -19,12 +20,16 @@ public partial class MainWindow : Window
1920 DeepPointer characterDP = new DeepPointer ( 0x02D5F688 , 0x8 , 0x8 , 0x98 , 0xA0 , 0x1F0 , 0x0 ) ;
2021 DeepPointer rotationDP = new DeepPointer ( 0x810 , 0x0 ) ;
2122 DeepPointer statusDP = new DeepPointer ( 0x900 ) ;
23+ DeepPointer gameSpeedDP = new DeepPointer ( "timewizardry.dll" , 0x63F8 ) ;
2224
23- IntPtr xVelPtr , yVelPtr , zVelPtr , xPosPtr , yPosPtr , zPosPtr , godPtr , ammoPtr , rotAPtr , rotBPtr ;
25+ IntPtr xVelPtr , yVelPtr , zVelPtr , xPosPtr , yPosPtr , zPosPtr , godPtr , ammoPtr , rotAPtr , rotBPtr , gameSpeedPtr ;
2426
2527 bool god , ammo , teleFw , teleUp = false ;
2628 float [ ] storedPos = new float [ 5 ] { 0f , 0f , 0f , 0f , 0f } ;
2729
30+ double gameSpeed , prefGameSpeed = 1.0 ;
31+
32+ bool speedhackActivated = false ;
2833
2934 float xVel , yVel , zVel , xPos , yPos , zPos , rotA , rotB ;
3035
@@ -57,12 +62,25 @@ private void teleUpBtn_Click(object sender, RoutedEventArgs e)
5762 TeleportUpward ( ) ;
5863 }
5964
65+ private void activateGameSpeedBtn_Click ( object sender , RoutedEventArgs e )
66+ {
67+ e . Handled = true ;
68+ ActivateSpeedhack ( ) ;
69+ }
70+
71+
6072 private void saveBtn_Click ( object sender , RoutedEventArgs e )
6173 {
6274 e . Handled = true ;
6375 StorePosition ( ) ;
6476 }
6577
78+ private void gameSpeedBtn_Click ( object sender , RoutedEventArgs e )
79+ {
80+ e . Handled = true ;
81+ SwitchPrefSpeed ( ) ;
82+ }
83+
6684 private void teleBtn_Click ( object sender , RoutedEventArgs e )
6785 {
6886 e . Handled = true ;
@@ -80,6 +98,8 @@ public MainWindow()
8098 kbHook . HookedKeys . Add ( System . Windows . Forms . Keys . F4 ) ;
8199 kbHook . HookedKeys . Add ( System . Windows . Forms . Keys . F5 ) ;
82100 kbHook . HookedKeys . Add ( System . Windows . Forms . Keys . F6 ) ;
101+ kbHook . HookedKeys . Add ( System . Windows . Forms . Keys . F7 ) ;
102+
83103
84104 updateTimer = new Timer
85105 {
@@ -109,7 +129,6 @@ private void Update(object sender, EventArgs e)
109129 return ;
110130 }
111131
112-
113132 game . ReadValue < float > ( xPosPtr , out xPos ) ;
114133 game . ReadValue < float > ( yPosPtr , out yPos ) ;
115134 game . ReadValue < float > ( zPosPtr , out zPos ) ;
@@ -140,6 +159,63 @@ private void Update(object sender, EventArgs e)
140159 {
141160 TeleportUpward ( ) ;
142161 }
162+
163+
164+
165+ if ( speedhackActivated )
166+ {
167+ activateGameSpeedBtn . Visibility = Visibility . Hidden ;
168+ gameSpeedBtn . Visibility = Visibility . Visible ;
169+ gameSpeedLabel . Visibility = Visibility . Visible ;
170+
171+ game . ReadValue < double > ( gameSpeedPtr , out gameSpeed ) ;
172+ if ( gameSpeed != prefGameSpeed )
173+ {
174+ game . WriteBytes ( gameSpeedPtr , BitConverter . GetBytes ( prefGameSpeed ) ) ;
175+ }
176+
177+ gameSpeedLabel . Content = prefGameSpeed . ToString ( "0.0" ) + "x" ;
178+ }
179+ else
180+ {
181+ activateGameSpeedBtn . Visibility = Visibility . Visible ;
182+ gameSpeedBtn . Visibility = Visibility . Hidden ;
183+ gameSpeedLabel . Visibility = Visibility . Hidden ;
184+ }
185+ }
186+
187+ private bool CheckSpeedhack ( )
188+ {
189+ foreach ( ProcessModule module in game . Modules )
190+ {
191+ if ( module . ModuleName == "timewizardry.dll" )
192+ return true ;
193+ }
194+ return false ;
195+ }
196+ private void SwitchPrefSpeed ( )
197+ {
198+ switch ( prefGameSpeed )
199+ {
200+ case 1.0f :
201+ prefGameSpeed = 2.0 ;
202+ break ;
203+ case 2.0f :
204+ prefGameSpeed = 4.0 ;
205+ break ;
206+ case 4.0f :
207+ prefGameSpeed = 8.0 ;
208+ break ;
209+ case 8.0f :
210+ prefGameSpeed = 0.5 ;
211+ break ;
212+ case 0.5f :
213+ prefGameSpeed = 1.0 ;
214+ break ;
215+ default :
216+ prefGameSpeed = 1.0 ;
217+ break ;
218+ }
143219 }
144220
145221 private bool Hook ( )
@@ -186,6 +262,7 @@ private bool Hook()
186262
187263 private void DerefPointers ( )
188264 {
265+
189266 characterDP . DerefOffsets ( game , out IntPtr basePtr ) ;
190267 xPosPtr = basePtr + 0x80 ;
191268 yPosPtr = basePtr + 0x84 ;
@@ -202,6 +279,16 @@ private void DerefPointers()
202279 rotAPtr = basePtr + 0x1B4 ;
203280 rotBPtr = basePtr + 0x1B8 ;
204281
282+ speedhackActivated = CheckSpeedhack ( ) ;
283+
284+
285+ gameSpeedDP . DerefOffsets ( game , out gameSpeedPtr ) ;
286+ speedhackActivated = gameSpeedPtr != IntPtr . Zero ;
287+ if ( speedhackActivated )
288+ {
289+ WinAPI . VirtualProtectEx ( game . Handle , gameSpeedPtr , ( UIntPtr ) 0x8 , MemPageProtect . PAGE_READWRITE , out _ ) ;
290+ }
291+
205292 }
206293
207294 private void InputKeyDown ( object sender , KeyEventArgs e )
@@ -226,6 +313,12 @@ private void InputKeyDown(object sender, KeyEventArgs e)
226313 case Keys . F6 :
227314 Teleport ( ) ;
228315 break ;
316+ case Keys . F7 :
317+ if ( speedhackActivated )
318+ SwitchPrefSpeed ( ) ;
319+ else
320+ ActivateSpeedhack ( ) ;
321+ break ;
229322 default :
230323 break ;
231324 }
@@ -496,5 +589,26 @@ void TestFunction()
496589 game . WriteBytes ( newRotPtr , BitConverter . GetBytes ( ptr . ToInt64 ( ) ) ) ;
497590 }
498591
592+
593+ private void ActivateSpeedhack ( )
594+ {
595+ if ( ! hooked || speedhackActivated ) return ;
596+
597+
598+ string dllPath = System . Windows . Forms . Application . StartupPath + "\\ timewizardry.dll" ;
599+
600+ if ( ! File . Exists ( dllPath ) )
601+ {
602+ System . Windows . MessageBox . Show ( "Could not find \" timewizardry.dll\" ." , "Error" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
603+ return ;
604+ }
605+
606+ bool result = Injector . InjectDLL ( dllPath , game ) ;
607+ if ( ! result )
608+ {
609+ System . Windows . MessageBox . Show ( "Injection Failed!" , "Error" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
610+ }
611+ }
612+
499613 }
500614}
0 commit comments