-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfloating_point_AA_script.CEA
83 lines (64 loc) · 1.13 KB
/
floating_point_AA_script.CEA
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
[ENABLE]
aobscanmodule(INJECT,GTA5.exe,B3 F3 0F 11 83 28 03 00 00) // should be unique
alloc(newmem,$2000,"GTA5.exe"+779E52)
alloc(mul,4)
alloc(limit,4)
alloc(fastbit,4)
registersymbol(fastbit)
label(code)
label(return)
newmem:
cmp [fastbit],1
jne code
// back up registers
sub rsp,20
movups [rsp],xmm0
movups [rsp+10],xmm1
// magnitude of 2d vec
movss xmm0,[rbx+320]
movss xmm1,[rbx+324]
mulss xmm0,xmm0
mulss xmm1,xmm1
addss xmm0,xmm1
sqrtss xmm0,xmm0
// compare limit
movss xmm1,[limit]
ucomiss xmm0,xmm1
jae code
// speeder:
movss xmm1,[mul]
movss xmm0,[rbx+320]
mulss xmm0,xmm1
movss [rbx+320],xmm0
movss xmm0,[rbx+324]
mulss xmm0,xmm1
movss [rbx+324],xmm0
code:
// restore registers
movups xmm0,[rsp]
movups xmm1,[rsp+10]
add rsp,20
// original code
mov [rbxptr],rbx
movss [rbx+328],xmm0
jmp return
mul:
dd (float)2
limit:
dd (float)5
INJECT+01:
jmp newmem
nop
nop
nop
return:
registersymbol(INJECT)
[DISABLE]
INJECT+01:
db F3 0F 11 83 28 03 00 00
unregistersymbol(INJECT)
dealloc(newmem)
dealloc(mul)
dealloc(limit)
dealloc(fastbit)
unregistersymbol(fastbit)