-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathautoServer.cpp
136 lines (114 loc) · 2.76 KB
/
autoServer.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
#include "stdafx.h"
void (__cdecl *sub_43B4D0) (); //äëÿ õîñòà
void (__cdecl *parseGamedataBinPre) ();
int (__cdecl *noxCheckGameFlags) (int);
void (__cdecl *noxSetGameFlags) (int);
void (__cdecl *noxClearGameFlags) (int);
void (__cdecl *sub_461440)(int);
void (__cdecl *sub_4D6F40)(int);
void (__cdecl *sub_4D6F90)(int);
void (__cdecl *sub_4D6F60)(int);
void (__cdecl *sub_4D6F80)(int);
void (__cdecl *sub_473670)();
void (__cdecl *sub_472520)(int);
void (__cdecl *sub_43AF50)(int);
void *dword_748260;
int *dword_69B55C=(int*)0x0069B55C;
int *noxGameFlags;
extern void InjectOffs(DWORD Addr,void *Fn);
extern void InjectJumpTo(DWORD Addr,void *Fn);
namespace
{
void __declspec(naked) asmHostWhenStart() // õîñòèì ñåðâåð êîãäà ñòàðòóåò èãðà
{
__asm
{
mov eax,dword_69B55C
mov [eax+0],1
push ecx
mov ecx,noxGameFlags
mov eax,[ecx+0]
and eax,0FFFFFFDFh
or eax,10h
mov [ecx],eax
pop ecx
push 2000h
call noxSetGameFlags
push 10000h
call noxSetGameFlags
push 800h
// call noxClearGameFlags
// push 1000000h
call noxClearGameFlags
add esp,0Ch
push 0
call sub_461440
push 0
call sub_4D6F90
push 0
call sub_4D6F60
push 0
call sub_4D6F80
call sub_473670
push 8FCh
call sub_472520
push 0
call sub_43AF50
add esp,18h
call parseGamedataBinPre
call sub_43B4D0
mov eax,1
push 004AB14Ch
ret
}
}
void __cdecl checkAutoSrvFlag(char *str)
{
if (strcmp(str,"-autosrv")==0)
{
InjectJumpTo(0x004AB147,&asmHostWhenStart);
byte OperatorJmps=0xEB;
byte *bt=(byte*)(0x004AB105);
DWORD OldProtect;
VirtualProtect(bt,1,PAGE_EXECUTE_READWRITE,&OldProtect);
memcpy((byte*)bt,&OperatorJmps,1); // óáèðàåì çàñòàâî÷êè
VirtualProtect(bt,1,OldProtect,&OldProtect);
}
if (strcmp(str, "-debug") == 0)
{
*noxGameFlags = *noxGameFlags | 0x1000000;
}
}
void __declspec(naked) asmCheckAutoSrvFlag() // ôëàã ïðîâåðÿåì
{
__asm
{
push ebp
call checkAutoSrvFlag
add esp,4
sbb eax,eax
sbb eax,0FFFFFFFFh
push 004012B8h
ret
}
}
}
void autoServer()
{
ASSIGN(sub_43B4D0,0x43B4D0);
ASSIGN(sub_461440,0x00461440);
ASSIGN(sub_4D6F40,0x4D6F40);
ASSIGN(sub_4D6F90,0x4D6F90);
ASSIGN(sub_4D6F60,0x4D6F60);
ASSIGN(sub_4D6F80,0x4D6F80);
ASSIGN(sub_473670,0x473670);
ASSIGN(sub_472520,0x472520);
ASSIGN(sub_43AF50,0x0043AF50); // âëèÿåò íà âèäèìîñòü èãðû
ASSIGN(dword_748260,0x00748260);
ASSIGN(parseGamedataBinPre,0x004D1630);
ASSIGN(noxGameFlags,0x0085B7A0);
ASSIGN(noxCheckGameFlags,0x0040A5C0);
ASSIGN(noxSetGameFlags,0x0040A4D0);
ASSIGN(noxClearGameFlags,0x0040A540);
InjectJumpTo(0x004012B3,&asmCheckAutoSrvFlag);
}