-
Notifications
You must be signed in to change notification settings - Fork 3
/
integer doubles.reg
149 lines (60 loc) · 2.74 KB
/
integer doubles.reg
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
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Cheat Engine\CustomTypes\Double (Integers)]
"Script"="// Courtesy of mgr.inz.Player
// http://forum.cheatengine.org/viewtopic.php?p=5735458#5735458
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(PreferedAlignment,4)
alloc(UsesFloat,1)
alloc(CallMethod,1)
TypeName:
db 'Double (Integers)',0
ByteSize:
dd 8
PreferedAlignment:
dd 4
UsesFloat:
db 1
CallMethod:
db 1
ConvertRoutine:
[64-bit]
movsd xmm0,[rcx]
[/64-bit]
[32-bit]
mov eax,[esp+4]
movsd xmm0,[eax]
[/32-bit]
cvtsd2ss xmm0,xmm0 // convert double to single
movd eax,xmm0
cvtps2dq xmm1,xmm0 // convert single to integer
cvtdq2ps xmm1,xmm1 // convert integer to single
ucomiss xmm0,xmm1
je @f
mov eax,NaN
@@:
ret
// cdecl void ConvertBackRoutine(int value, PTR_UINT address, void* output);
ConvertBackRoutine:
[64-bit]
push ecx
movss xmm0, [esp]
pop ecx
cvtss2sd xmm0,xmm0 // convert single to double
movsd [r8], xmm0
ret
[/64-bit]
[32-bit]
// [esp+00] = return value
// [esp+04] = value
// [esp+08] = address of value
// [esp+C] = output pointer
movss xmm0, [esp+4]
cvtss2sd xmm0,xmm0 // convert single to double
mov eax,[esp+C]
movsd [eax], xmm0
ret
[/32-bit]
"