#include "_InjectDll_v2.au3"
#include <GUIConstants.au3>
Opt("GUICloseOnEsc", 0)
Opt("GUIOnEventMode", 1)
HotKeySet("{END}", "ToggleSpeeder")
;MsgBox(64, "RET", _InjectDll(ProcessExists("DarkagesMI.exe"), @ScriptDir & "\speedhack.dll", 1))
Global $speedvalue = 200, $speedenabled = False
Global $speedhack = DllOpen("speedhack.dll")
Global $timer, $disconnectcheck
;disable the speeder
DllCall($speedhack, "none", "SetSpeedEnabled", "int", 0)
#region GUI
;THE GUI
Global $gui = GUICreate("SpeedHandler", 300, 120, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Closing")
;THE SPEEDHANDLER SLIDER GROUP
Global $g_groupSpeedHandler = GUICtrlCreateGroup("SpeedHandler", 5, 0, 290, 50)
;THE SLIDER
Global $g_sliderSpeedHandler = GUICtrlCreateSlider(10, 15, 280, 15)
GUICtrlSetOnEvent(-1, "g_sliderSpeedHandler")
GUICtrlSetLimit(-1, 100, 0)
GUICtrlSetData(-1, 20)
;THE LABEL
Global $g_labelSpeedHandler = GUICtrlCreateLabel("Value: 2.00", 10, 30, 280, 15)
;THE INJECTION GROUP
Global $g_groupInjection = GUICtrlCreateGroup("Injection", 5, 50, 290, 66)
;THE INJECTION LABEL
Global $g_labelProcessList = GUICtrlCreateLabel("Process to inject:", 10, 65, 120, 15)
;THE PROCESS LIST COMBO BOX
Global $g_comboProcessList = GUICtrlCreateCombo("Choose a process...", 95, 60, 195, 15)
GUICtrlSetData(-1, _FormatProcessList())
;THE INJECT BUTTON
Global $g_btnInject = GUICtrlCreateButton("Inject", 10, 85, 135, 25)
GUICtrlSetOnEvent(-1, "g_btnInjectHandler")
;THE PROCESS LIST REFRESH BUTTON
Global $g_btnRefresh = GUICtrlCreateButton("Refresh Process List", 150, 85, 135, 25)
GUICtrlSetOnEvent(-1, "g_btnRefreshHandler")
#endregion
GUISetState(@SW_SHOW)
While 1
Sleep(500)
WEnd
Func ToggleSpeeder()
$speedenabled = Not $speedenabled
DllCall($speedhack, "none", "SetSpeedEnabled", "int", $speedenabled)
If $speedenabled Then
$timer = TimerInit()
$disconnectcheck = True
AdlibRegister("SpeedTimer")
Else
$disconnectcheck = False
AdlibUnRegister()
EndIf
EndFunc
Func SpeedTimer()
If $disconnectcheck And TimerDiff($timer) >= 3000 Then
DllCall($speedhack, "none", "SetSpeedEnabled", "int", False)
$timer = TimerInit()
$disconnectcheck = False
ElseIf Not $disconnectcheck And TimerDiff($timer) >= 1000 Then
DllCall($speedhack, "none", "SetSpeedEnabled", "int", True)
$timer = TimerInit()
$disconnectcheck = True
EndIf
EndFunc
Func _FormatProcessList()
Local $list = ProcessList()
Local $retstr = 0
For $i = 1 To $list[0][0]
$retstr = $retstr & $list[$i][0]
If $i < $list[0][0] Then $retstr = $retstr & "|"
Next
Return $retstr
EndFunc
Func OnAutoItExit()
DllClose($speedhack)
EndFunc
Func _Closing()
Exit
EndFunc
Func g_sliderSpeedHandler()
$speedvalue = GUICtrlRead($g_sliderSpeedHandler)
DllCall($speedhack, "none", "SetSpeedFactor", "uint", $speedvalue * 10)
GUICtrlSetData($g_labelSpeedHandler, "Value: " & StringFormat("%.02f", $speedvalue/10))
EndFunc
Func g_btnInjectHandler()
If StringRight(StringLower(GUICtrlRead($g_comboProcessList)), 4) = ".exe" Then
_InjectDll(ProcessExists(GUICtrlRead($g_comboProcessList)), @ScriptDir & "\speedhack.dll", 1)
EndIf
EndFunc
Func g_btnRefreshHandler()
GUICtrlSetData($g_comboProcessList, "")
GUICtrlSetData($g_comboProcessList, "Choose a process...")
GUICtrlSetData($g_comboProcessList, _FormatProcessList())
EndFunc