-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGFZoom.au3
177 lines (157 loc) · 5.67 KB
/
GFZoom.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <NomadMemory.au3>
HotKeySet("!q", "_Exit")
HotKeySet("!z", "_inputZoom")
Func _Exit()
Exit
EndFunc ;==>_Exit
Func _inputZoom()
$newZoom = InputBox("Zoom Value", "Input zoom value", $currentZoom)
WriteMemoryOffset($newZoom, $zoomPointer, 0, "float")
EndFunc ;==>_inputZoom
#include <GUIConstants.au3>
Global Const $tagTRACKMOUSEEVENT = "dword Size;dword Flags;hwnd hWndTrack;dword HoverTime"
; See http://msdn2.microsoft.com/en-us/library/ms645617.aspx for more info on WM_MOUSEWHEEL
Global Const $WM_LBUTTONDBLCLK = 0x203
Global Const $WM_LBUTTONDOWN = 0x201
Global Const $WM_LBUTTONUP = 0x202
Global Const $WM_MBUTTONDBLCLK = 0x209
Global Const $WM_MBUTTONDOWN = 0x207
Global Const $WM_MBUTTONUP = 0x208
;~ Global Const $WM_MOUSEACTIVATE = 0x21
Global Const $WM_MOUSEHOVER = 0x2A1
Global Const $WM_MOUSELEAVE = 0x2A3
Global Const $WM_MOUSEMOVE = 0x200
Global Const $WM_MOUSEWHEEL = 0x020A
;~ Global Const $WM_NCHITTEST = 0x84
;~ Global Const $WM_NCLBUTTONDBLCLK = 0xA3
;~ Global Const $WM_NCLBUTTONDOWN = 0xA1
;~ Global Const $WM_NCLBUTTONUP = 0xA2
;~ Global Const $WM_NCMBUTTONDBLCLK = 0xA9
;~ Global Const $WM_NCMBUTTONDOWN = 0xA7
;~ Global Const $WM_NCMBUTTONUP = 0xA8
Global Const $WM_NCMOUSEHOVER = 0x2A0
Global Const $WM_NCMOUSELEAVE = 0x2A2
;~ Global Const $WM_NCMOUSEMOVE = 0xA0
;~ Global Const $WM_NCRBUTTONDBLCLK = 0xA6
;~ Global Const $WM_NCRBUTTONDOWN = 0xA4
;~ Global Const $WM_NCRBUTTONUP = 0xA5
Global Const $WM_NCXBUTTONDBLCLK = 0xAD
Global Const $WM_NCXBUTTONDOWN = 0xAB
Global Const $WM_NCXBUTTONUP = 0xAC
Global Const $WM_RBUTTONDBLCLK = 0x206
Global Const $WM_RBUTTONDOWN = 0x204
Global Const $WM_RBUTTONUP = 0x205
Global Const $WM_XBUTTONDBLCLK = 0x20D
Global Const $WM_XBUTTONDOWN = 0x20B
Global Const $WM_XBUTTONUP = 0x20C
Global Const $MK_CONTROL = 0x8
Global Const $MK_LBUTTON = 0x1
Global Const $MK_MBUTTON = 0x10
Global Const $MK_RBUTTON = 0x2
Global Const $MK_SHIFT = 0x4
Global Const $MK_XBUTTON1 = 0x20
Global Const $MK_XBUTTON2 = 0x40
Global Const $TME_CANCEL = 0x80000000
Global Const $TME_HOVER = 0x1
Global Const $TME_LEAVE = 0x2
Global Const $TME_NONCLIENT = 0x10
Global Const $TME_QUERY = 0x40000000
Global Const $HOVER_DEFAULT = 0xFFFFFFFF
Global $X_Prev, $Y_Prev, $mid, $processName = "Grand Fantasia", $pid = -1, $zoomPointer = StringSplit(IniRead("GFZoom.ini", "Setting", "ZoomPointer", "0x009BB078,58"), ",")
Global $currentZoom = 0
$hGui = GUICreate("GFZoom", 200, 30)
$LabelId = GUICtrlCreateLabel("Zoom:", 10, 10, 40, 30)
$LabelZoom = GUICtrlCreateLabel("0", 50, 10, 30, 30)
$LabelState = GUICtrlCreateLabel("H+Shift 10x - Alt+Z", 80, 10, 150, 30)
GUISetState()
$hDLL = DllOpen("user32.dll")
If Not _TrackMouseEvent() Then Exit
GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL")
While 1
$MsgId = GUIGetMsg()
If $MsgId = $GUI_EVENT_CLOSE Then
Exit
ElseIf $pid == -1 And WinExists($processName) Then
$pid = WinGetProcess($processName)
$mid = _MemoryOpen($pid)
ElseIf $pid <> -1 Then
$currentZoom = Round(ReadMemoryOffset($zoomPointer, 0, "float"), 2)
If $currentZoom <> GUICtrlRead($LabelZoom) Then
GUICtrlSetData($LabelZoom, $currentZoom)
EndIf
EndIf
WEnd
DllClose($hDLL)
Func WM_MOUSEWHEEL($hWndGui, $MsgId, $WParam, $LParam)
Dim $shift = 1
If BitAND(BitAND($WParam, 0xFFFF), $MK_SHIFT) Then $shift = 10
$X = BitShift($LParam, 16)
$Y = BitAND($LParam, 0xFFFF)
;ToolTip("Wheel Delta: " & BitShift($WParam, 16), Default, Default, "Mouse", 1, 1)
If BitShift($WParam, 16) < 0 Then
WriteMemoryOffset($currentZoom + $shift, $zoomPointer, 0, "float")
Else
WriteMemoryOffset($currentZoom - $shift, $zoomPointer, 0, "float")
EndIf
Return 0
EndFunc ;==>WM_MOUSEWHEEL
Func _TrackMouseEvent()
Local $pMouseEvent, $iResult, $iMouseEvent
Local $tMouseEvent = DllStructCreate($tagTRACKMOUSEEVENT)
$iMouseEvent = DllStructGetSize($tMouseEvent)
DllStructSetData($tMouseEvent, "Flags", $TME_HOVER)
DllStructSetData($tMouseEvent, "hWndTrack", $hGui)
DllStructSetData($tMouseEvent, "HoverTime", $HOVER_DEFAULT) ; 400 milliseconds
DllStructSetData($tMouseEvent, "Size", $iMouseEvent)
$ptrMouseEvent = DllStructGetPtr($tMouseEvent)
$iResult = DllCall($hDLL, "int", "TrackMouseEvent", "ptr", $ptrMouseEvent)
Return $iResult[0] <> 0
EndFunc ;==>_TrackMouseEvent
Func ReadMemoryOffset($pointer, $offset = 0, $type = "dword")
Dim $tmp
If IsArray($pointer) Then
$tmp = ReadMemoryOffset($pointer[1])
For $i = 2 To UBound($pointer) - 1
If UBound($pointer) - 1 == $i Then
$tmp = ReadMemoryOffset($tmp, $pointer[$i], $type)
Else
$tmp = ReadMemoryOffset($tmp, $pointer[$i])
EndIf
Next
Return $tmp
Else
If $offset == 0 Then
$tmp = $pointer
Else
$tmp = "0x" & Hex($pointer + Dec($offset))
EndIf
Return _MemoryRead($tmp, $mid, $type)
EndIf
EndFunc ;==>ReadMemoryOffset
Func WriteMemoryOffset($data, $pointer, $offset = 0, $type = 'dword')
Dim $tmp
If IsArray($pointer) Then
$tmp = ReadMemoryOffset($pointer[1])
For $i = 2 To UBound($pointer) - 1
If UBound($pointer) - 1 == $i Then
$tmp = WriteMemoryOffset($data, $tmp, $pointer[$i], $type)
Else
$tmp = ReadMemoryOffset($tmp, $pointer[$i])
EndIf
Next
Return $tmp
Else
If $offset == 0 Then
$tmp = $pointer
Else
$tmp = "0x" & Hex($pointer + Dec($offset))
EndIf
Return _MemoryWrite($tmp, $mid, $data, $type)
EndIf
EndFunc ;==>WriteMemoryOffset