forked from gunslingermod/gunslinger_wpnpatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAN94Patch.pas
86 lines (77 loc) · 2 KB
/
AN94Patch.pas
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
unit AN94Patch;
//Ðåàëèçàöèÿ óâåëè÷åííîãî òåìïà ñòðåëüáû äëÿ ïåðâûõ âûñòðåëîâ
{$IFDEF FPC}{$MODE DELPHI}{$ENDIF}
interface
function Init:boolean;
implementation
uses BaseGameData, gunsl_config, HudItemUtils;
var rpm_loading_patch_addr:cardinal;
const
base_dispersioned_bullets_time_delta:PChar='base_dispersioned_bullets_time_delta';
singleshoots_time_delta:PChar='singleshoots_time_delta';
procedure AN94_RPM_Patch; stdcall;
asm
//äåëàåì âûðåçàííîå
movss xmm0, [esi+$35c]
//íà÷èíàåì øàìàíñòâà
pushad
pushfd
//Ñíà÷àëà ïîñìîòðèì, íå ñòðåëÿåì ëè ìû îäèíî÷íûìè
cmp [esi+$770], 01
ja @queue
push esi
call GetSection
mov ebx, eax
//Ïîñìîòðèì, åñòü ëè â íåé ïàðàìåòð singleshoots_time_delta
push singleshoots_time_delta
push ebx
call game_ini_line_exist
cmp al, 0
je @finish
//Ïðî÷èòàåì åãî è ïîäìåíèì ñêîðîñòðåëüíîñòü
push singleshoots_time_delta
push ebx
call game_ini_r_single
jmp @write
@queue:
mov eax, [esi+$774] //ñêîëüêî óæå âûñòðåëèëè â î÷åðåäè
mov ebx, [esi+$778] //ñêîëüêî ïóëü ñ áàçîâûìè ïàðàìåòðàìè âûïóñêàåì
cmp ebx, 0
je @finish
sub ebx, 1
cmp eax, ebx
jae @finish
//Ïðî÷èòàåì òåêóùóþ ñåêöèþ îðóæèÿ
push esi
call GetSection
mov ebx, eax
//Ïîñìîòðèì, åñòü ëè â íåé ïàðàìåòð base_dispersioned_bullets_rpm
push base_dispersioned_bullets_time_delta
push ebx
call game_ini_line_exist
cmp al, 0
je @finish
//Ïðî÷èòàåì åãî è ïîäìåíèì ñêîðîñòðåëüíîñòü
push base_dispersioned_bullets_time_delta
push ebx
call game_ini_r_single
jmp @write;
@write:
//Çàïèøåì äàííûå, èñïîëüçóÿ â êà÷åñòâå áóôåðà ñòåê
sub esp, 4
fstp dword ptr [esp]
movss xmm0, [esp]
add esp, 4
@finish:
popfd
popad
jmp rpm_loading_patch_addr
end;
function Init:boolean;
begin
result:=false;
rpm_loading_patch_addr:=xrGame_addr+$2D062F;
if not WriteJump(rpm_loading_patch_addr, cardinal(@AN94_RPM_Patch), 8) then exit;
result:=true;
end;
end.