-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsole.pas
More file actions
214 lines (169 loc) · 4.18 KB
/
Console.pas
File metadata and controls
214 lines (169 loc) · 4.18 KB
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
213
214
unit Console;
interface
function Init(dwFlags:cardinal):boolean;
const SACE_BUILD = 0;
type
IConsole_Command_vftable = packed record
_destructor:pointer;
Execute:pointer;
Status:pointer;
Info:pointer;
Save:pointer;
end;
type
pIConsole_Command_vftable = ^IConsole_Command_vftable;
IConsole_Command = packed record
vftable:pIConsole_Command_vftable;
cName:PChar;
bEnabled:byte;
bLowerCaseArgs:byte;
bEmptyArgsHandled:byte;
_reserved:byte;
end;
pIConsole_Command = ^IConsole_Command;
CCC_Mask = packed record
base:IConsole_Command;
value:pcardinal;
mask:cardinal;
end;
pCCC_Mask = ^CCC_Mask;
CCC_Integer = packed record
base:IConsole_Command;
value:pinteger;
min:integer;
max:integer;
end;
pCCC_Integer= ^CCC_Integer;
pCCC_SV_Integer=pCCC_Integer;
CCC_Float = packed record
base:IConsole_Command;
value:psingle;
min:single;
max:single;
end;
pCCC_Float= ^CCC_Float;
pCCC_SV_Float=pCCC_Float;
CConsole = packed record
//TODO:fill
end;
pCConsole=^CConsole;
ppCConsole=^pCConsole;
var
g_ppConsole:ppCConsole;
c_snd_targets:pCCC_Integer;
c_g_fov:CCC_Float;
c_g_hud_fov:CCC_Float;
hud_fov:single;
{$IF SACE_BUILD>0}
fov:single;
{$ELSE}
g_fov:psingle;
{$IFEND}
psHUD_FOV:psingle;
c_snd_unlock:CCC_Mask;
flags:cardinal;
const
FLG_SNDUNLOCK:cardinal=1;
implementation
uses BaseGameData;
procedure CConsole__AddCommand(C:pIConsole_Command); stdcall;
asm
pushad
mov ecx, g_ppConsole
mov ecx, [ecx]
push C
mov eax, xrengine_addr
add eax, $4C830;
call eax //CConsole::AddCommand(IConsole_Command* C);
popad
end;
procedure CCC_Float__CCC_Float(this:pCCC_Float; name:PChar; value:psingle; min:single; max:single);stdcall;
asm
pushad
mov ecx, this
push max
push min
push value
push name
mov eax, xrengine_addr
add eax, $79B0
call eax
popad
end;
procedure CCC_Mask__CCC_Mask(this:pCCC_Mask; n:PChar; v:pcardinal; M:cardinal);stdcall;
asm
pushad
mov ecx, this
push m
push v
push n
mov eax, xrengine_addr
add eax, $7490
call eax
popad
end;
procedure Actions_After_CCC_Float(c:pCCC_Float); stdcall;
begin
{$IF SACE_BUILD>0}
psHUD_FOV^:=hud_fov/fov;
{$ELSE}
psHUD_FOV^:=hud_fov/g_fov^;
{$IFEND}
end;
procedure CCC_Float__Execute_Patch(); stdcall
asm
mov ecx, [esi+$0C]
movss [ecx], xmm0
pushad
push esi
call Actions_After_CCC_Float
popad
end;
function Init(dwFlags:cardinal):boolean;
var
addr:cardinal;
ptr:pointer;
begin
if dwFlags and FLG_PATCH_ENGINE >0 then begin
c_snd_targets:=pointer(xrEngine_addr+$9725C);
g_ppConsole:=pointer(xrEngine_addr+$96A24);
psHUD_FOV := psingle(xrEngine_addr+$94B98);
hud_fov:=30;
end;
if dwFlags and FLG_PATCH_GAME >0 then begin
{$IF SACE_BUILD>0}
fov:=67.50;
ptr:=@fov;
WriteBufAtAdr(xrgame_addr+$1FBD69, @ptr, sizeof(ptr));
WriteBufAtAdr(xrgame_addr+$1FBDE6, @ptr, sizeof(ptr));
WriteBufAtAdr(xrgame_addr+$24FE53, @ptr, sizeof(ptr));
WriteBufAtAdr(xrgame_addr+$254054, @ptr, sizeof(ptr));
WriteBufAtAdr(xrgame_addr+$262EF0, @ptr, sizeof(ptr));
WriteBufAtAdr(xrgame_addr+$26BD34, @ptr, sizeof(ptr));
WriteBufAtAdr(xrgame_addr+$26BDA4, @ptr, sizeof(ptr));
WriteBufAtAdr(xrgame_addr+$270E2D, @ptr, sizeof(ptr));
CCC_Float__CCC_Float(@c_g_fov, 'g_fov', @fov, 65, 90);
CCC_Float__CCC_Float(@c_g_hud_fov, 'g_hud_fov', @hud_fov, 25, 35);
{$ELSE}
g_fov:=psingle(xrGame_addr+$5DC8F8);
CCC_Float__CCC_Float(@c_g_fov, 'g_fov', g_fov, 65, 90);
CCC_Float__CCC_Float(@c_g_hud_fov, 'g_hud_fov', @hud_fov, 25, 35);
{$IFEND}
end;
if dwFlags and FLG_PATCH_ENGINE >0 then begin
CConsole__AddCommand(@c_g_fov);
CConsole__AddCommand(@c_g_hud_fov);
c_snd_targets.min:=128;
c_snd_targets.max:=20000;
if c_snd_targets.value^<128 then c_snd_targets.value^:=128;
//âîçìîæíîñòü îòêëþ÷åíèÿ ðàçáëîêèðîâàííûõ çâóêîâ
flags:=0;
CCC_Mask__CCC_Mask(@c_snd_unlock, 'snd_unlock', @flags,FLG_SNDUNLOCK);
CConsole__AddCommand(@c_snd_unlock);
//ìîäèôèöèðîâàíèå îáðàáîò÷èêà äëÿ ïåðåñ÷åòà ôîâà
addr:=xrEngine_addr+$7a4c;
if not WriteJump(addr, cardinal(@CCC_Float__Execute_Patch), 7, true) then exit;
end;
result:=true;
end;
end.