-
Notifications
You must be signed in to change notification settings - Fork 1
/
asm.cpp
212 lines (190 loc) · 3.47 KB
/
asm.cpp
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#include "DevilPK.h"
DWORD __declspec(naked) __fastcall GetUnit_STUB(DWORD dwUnitId, DWORD dwUnitType)
{
__asm
{
pop eax;
push edx;
push eax;
shl edx, 9;
mov eax, D2CLIENT_GetUnitFromId_I;
add edx, eax;
mov eax, ecx;
and eax, 0x7F;
jmp D2CLIENT_GetUnitFromId_II;
}
}
DWORD __declspec(naked) __fastcall D2CLIENT_clickParty_ASM(DWORD RosterUnit, DWORD Mode)
{
__asm
{
mov eax, ecx
jmp D2CLIENT_clickParty_I
}
}
DWORD __declspec(naked) GetPlayerID(VOID)
{
__asm
{
MOV EAX,DWORD PTR DS:[0x6FBCC3D0]
MOV ECX,DWORD PTR DS:[EAX+0xC]
mov eax, ecx
ret
}
}
DWORD SendPacketAddr=0x91A0;
void SendGAMEPacket(BYTE* Packet,DWORD PacketSize)
{
DWORD size1 = PacketSize;
__asm
{
pushad
mov eax, Packet
push Packet
mov ebx, size1
mov edx, 0x6FB291A0
call edx
popad
}
}
DWORD p_D2CLIENT_pUnitTableM=0x11A960;
DWORD D2CLIENT_GetUnitFromId_M=0x1E550;
DWORD __declspec(naked) __fastcall D2CLIENT_GetUnitFromId_STUB(DWORD unitid, DWORD unittype)
{
__asm
{
pop eax;
push edx;
push eax;
shl edx, 9;
mov eax, p_D2CLIENT_pUnitTableM;
add edx, eax;
mov eax, ecx;
and eax, 0x7F;
jmp D2CLIENT_GetUnitFromId_M;
}
}
WORD GetPlayerX(DWORD ID)
{
UnitAny* pUnit=(UnitAny*)D2CLIENT_GetUnitFromId_STUB(ID,0);
if(pUnit!=NULL)
return pUnit->pPath->xPos;
return 0;
}
WORD GetPlayerY(DWORD ID)
{
UnitAny* pUnit=(UnitAny*)D2CLIENT_GetUnitFromId_STUB(ID,0);
if(pUnit!=NULL)
return pUnit->pPath->yPos;
return 0;
}
DWORD D2CLIENT_TestPvpFlag_M=0x30DD0;
DWORD __declspec(naked) __fastcall TestPvpFlag_STUB(DWORD planum1, DWORD planum2, DWORD flagmask)
{
__asm
{
push esi
push [esp+8]
mov esi, edx
mov edx, ecx
call D2CLIENT_TestPvpFlag_M
pop esi
ret 4
}
}
DWORD LifeAddr=0x6FD856E0;
DWORD __declspec(naked) GetCurrentLife()
{
__asm
{
mov eax, 0x6FBCC3D0
mov eax, [eax]
push 0
push 6
push eax
call DWORD PTR DS: [LifeAddr]
sar eax, 8
ret
}
}
DWORD __declspec(naked) GetMaxLife()
{
__asm
{
mov eax, 0x6FBCC3D0
mov eax, [eax]
push 0
push 7
push eax
call DWORD PTR DS: [LifeAddr]
sar eax, 8
ret
}
}
DWORD __declspec(naked) GetCurrentMana()
{
__asm
{
mov eax, 0x6FBCC3D0
mov eax, [eax]
push 0
push 8
push eax
call DWORD PTR DS: [LifeAddr]
sar eax, 8
ret
}
}
DWORD __declspec(naked) GetMaxMana()
{
__asm
{
mov eax, 0x6FBCC3D0
mov eax, [eax]
push 0
push 9
push eax
call DWORD PTR DS: [LifeAddr]
sar eax, 8
ret
}
}
void __fastcall NextGameNamePatch(Control* box, BOOL (__stdcall *FunCallBack)(Control*,DWORD,DWORD))
{
D2WIN_SetEditBoxText(box, wszGameName);
D2WIN_SelectEditBoxText(box);
D2WIN_SetEditBoxProc(box, FunCallBack);
}
void __fastcall NextGamePasswordPatch(Control* box, BOOL (__stdcall *FunCallBack)(Control*,DWORD,DWORD))
{
D2WIN_SetEditBoxText(box, wszGamePassword);
D2WIN_SelectEditBoxText(box);
D2WIN_SetEditBoxProc(box, FunCallBack);
}
DWORD __declspec(naked) __fastcall D2CLIENT_GetUIVar_STUB(DWORD varno)
{
__asm
{
mov eax, ecx;
jmp D2CLIENT_GetUiVar_I;
}
}
VOID __declspec(naked) GameShake1_STUB()
{
__asm
{
je OldCode;
add dword ptr [esp], 0xC;
ret;
OldCode:
mov [ecx], esi;
mov ecx, [esp + 0x1C];
ret;
}
}
VOID __stdcall GameShake(LPDWORD lpX, LPDWORD lpY)
{
D2CLIENT_CalculateShake(lpX, lpY);
*p_D2CLIENT_xShake = 0;
*p_D2CLIENT_yShake = 0;
}