-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathps2-sens.py
39 lines (28 loc) · 1.19 KB
/
ps2-sens.py
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
class PS2Sensitivity:
def __init__(self, dpi: int):
self.dpi = dpi
def to_float(self, cm: float, zoom: float = None) -> float:
if zoom:
return round(-0.3 + 11.7581 / (cm * self.dpi / (1.6* zoom)) ** (1 / 3), 6)
return round(-0.3 + 11.7581 / (cm * self.dpi) ** (1 / 3), 6)
def to_ini(self, cm: float, zoom: float = None) -> str:
key = ''
if zoom:
if zoom < 3.4:
key = 'ADSMouseSensitivity'
elif zoom >= 3.4:
key = 'ScopedMouseSensitivity'
else:
key = 'MouseSensitivity'
return f'{key}={self.to_float(cm, zoom)}'
if __name__ == '__main__':
senses = []
my_sens = PS2Sensitivity(400)
base_cm = 35
senses.append(f'; dpi: {my_sens.dpi}, cm360: {base_cm}/{base_cm*2}/{base_cm*4}')
senses.append(my_sens.to_ini(base_cm))
senses.append(my_sens.to_ini(base_cm*2, 1.35))
senses.append(my_sens.to_ini(base_cm*4, 4))
#senses.append(f'VehicleGunnerMouseSensitivity={my_sens.to_float(base_cm)}')
#senses.append(f'VehicleMouseSensitivity={my_sens.to_float(base_cm, 1+1/3)}')
print('\n'.join(senses))