Professional Documents
Culture Documents
110th Street Rascals
110th Street Rascals
#include <Misc.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <ColorConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <SliderConstants.au3>
#include <Array.au3>
#include <Math.au3>
GetMouseSpeed()
GetMouseAccel()
MakeGUI()
Func MakeGUI()
AccessAccelRadio($idRadio0,$idRadio1,$idRadio2,"set")
HotKeySet( IniRead("hotkey.ini","Hotkeys","IncrementSens","!{=}") ,
"IncrementSens" )
HotKeySet( IniRead("hotkey.ini","Hotkeys","DecrementSens","!{-}") ,
"DecrementSens" )
HotKeySet( IniRead("hotkey.ini","Hotkeys","CenterSens" ,"!{0}") , "CenterSens"
)
HotKeySet( IniRead("hotkey.ini","Hotkeys","EnableAccel" ,"!+{\}"), "EnableAccel"
)
HotKeySet( IniRead("hotkey.ini","Hotkeys","DisableAccel" ,"!{\}") ,
"DisableAccel" )
Local $lastSliderSpeed=GUICtrlRead($lSlider)
Local $lastAccelRadio=AccessAccelRadio($idRadio0,$idRadio1,$idRadio2)
Local $idMsg
GUISetState(@SW_SHOW,$idGUI)
While 1
Sleep(10)
$gCycle+=1
If $gCycle>=25 Then
$gCycle=0
If $gPoll Then
GetMouseSpeed()
GetMouseAccel()
If ($lastSliderSpeed <> $Speed)+($lastAccelRadio <> $Accel[2]) Then
GUICtrlSetData($sMode,CalculateMultiplier())
GUICtrlSetData($sThresh1 ,$Accel[0])
GUICtrlSetData($sThresh2 ,$Accel[1])
AccessAccelRadio($idRadio0,$idRadio1,$idRadio2,"set")
GUICtrlSetData($lSlider,$Speed)
$lastSliderSpeed = $Speed
$lastAccelRadio = $Accel[2]
GUICtrlSetState($idApply,$GUI_DISABLE)
GUICtrlSendMsg($sThresh1,$EM_SETREADONLY,NOT($Accel[2]=2),0)
GUICtrlSendMsg($sThresh2,$EM_SETREADONLY,NOT($Accel[2]=2),0)
EndIf
EndIf
EndIf
If $lastSliderSpeed - GUICtrlRead($lSlider) Then
$lastSliderSpeed = GUICtrlRead($lSlider)
If $lastSliderSpeed == 0 Then
$lastSliderSpeed = 1
GUICtrlSetData($lSlider, $lastSliderSpeed)
EndIf
GUICtrlSetData($sMode,CalculateMultiplier(GUICtrlRead($lSlider),AccessAccelRadio($i
dRadio0,$idRadio1,$idRadio2)))
$gPoll=0
EndIf
$idMsg = GUIGetMsg()
Switch $idMsg
Case $GUI_EVENT_CLOSE
Exit
GUICtrlSetData($sMode,CalculateMultiplier(GUICtrlRead($lSlider),AccessAccelRadio($i
dRadio0,$idRadio1,$idRadio2)))
If $lastAccelRadio Then
GUICtrlSetData($sThresh1, 6)
GUICtrlSetData($sThresh2, 10)
Else
GUICtrlSetData($sThresh1, 0)
GUICtrlSetData($sThresh2, 0)
EndIf
GUICtrlSendMsg($sThresh1,$EM_SETREADONLY,NOT($lastAccelRadio=2),0)
GUICtrlSendMsg($sThresh2,$EM_SETREADONLY,NOT($lastAccelRadio=2),0)
EndIf
GetMouseSpeed()
GetMouseAccel()
If ( GUICtrlRead($lSlider)=$Speed ) _
AND (AccessAccelRadio($idRadio0,$idRadio1,$idRadio2)=$Accel[2]) _
AND ( _GetNumberFromString(GuiCtrlRead($sThresh2))=$Accel[1]) _
AND ( _GetNumberFromString(GuiCtrlRead($sThresh1))=$Accel[0]) Then
GUICtrlSetState($idApply,$GUI_DISABLE)
$gPoll=1
EndIf
Case $idApply
if ( _StringIsNumber(GuiCtrlRead($sThresh1)) +
_StringIsNumber(GuiCtrlRead($sThresh2)) ) == 2 Then
$gPoll = 1
$Speed = GUICtrlRead($lSlider)
$Accel[0] = _GetNumberFromString(GuiCtrlRead($sThresh1))
$Accel[1] = _GetNumberFromString(GuiCtrlRead($sThresh2))
$Accel[2] = AccessAccelRadio($idRadio0,$idRadio1,$idRadio2)
SetMouseSpeed()
SetMouseAccel()
GetMouseSpeed()
GetMouseAccel()
SetMouseSpeed()
SetMouseAccel()
CalculateMultiplier()
GUICtrlSetData($sMode ,CalculateMultiplier())
GUICtrlSetData($lSlider ,$Speed )
GUICtrlSetData($sThresh1 ,$Accel[0])
GUICtrlSetData($sThresh2 ,$Accel[1])
GUICtrlSendMsg($sThresh1,$EM_SETREADONLY,NOT($Accel[2]=2),0)
GUICtrlSendMsg($sThresh2,$EM_SETREADONLY,NOT($Accel[2]=2),0)
AccessAccelRadio($idRadio0,$idRadio1,$idRadio2,"set")
GUICtrlSetState($idApply,$GUI_DISABLE)
Else
MsgBox(0, "Error", "Must be a number")
EndIf
Case $idCustomize
AutoItSetOption ( "GUICoordMode", 0 )
$idGUICustomize = GUICreate("Customize Windows Accel Curve", 513, 242)
AutoItSetOption ( "GUICoordMode", 1 )
GUISetState(@SW_SHOW ,$idGUICustomize)
GUISetState(@SW_DISABLE,$idGUI)
GUISetState(@SW_HIDE ,$idGUI)
CustomizeAccel($idGUICustomize, 513, 242)
GUISetState(@SW_SHOW ,$idGUI)
GUISetState(@SW_ENABLE ,$idGUI)
GUISetState(@SW_RESTORE,$idGUI)
GUIDelete( $idGUICustomize)
Case $idInfo
MsgBox(0,"About",$appletVersion)
EndSwitch
WEnd
EndFunc
; initializing variables
Local $regCurveX = RegRead("HKEY_CURRENT_USER\Control Panel\
Mouse","SmoothMouseXCurve")
Local $regCurveY = RegRead("HKEY_CURRENT_USER\Control Panel\
Mouse","SmoothMouseYCurve")
Local $line
For $i = 0 to 3 Step 1
$line = $i + 1
$AccelCurveX[$i] = SmoothMouseBinaryToFloat($regCurveX, $line)
$AccelCurveY[$i] = SmoothMouseBinaryToFloat($regCurveY, $line)
Next
Case $idZoomIn
if $PointsToDraw > 1 then
$PointsToDraw -= 1
DrawMousePlot($graphMode, $AccelCurveX, $AccelCurveY, $dpi, $nominalHz,
$PointsToDraw, $graphElements, $graphPosX, $graphPosY)
endif
Case $idZoomOut
if $PointsToDraw < 4 then
$PointsToDraw += 1
DrawMousePlot($graphMode, $AccelCurveX, $AccelCurveY, $dpi, $nominalHz,
$PointsToDraw, $graphElements, $graphPosX, $graphPosY)
endif
Case $idGraphMode
Switch $graphMode
Case 1
$graphMode = 2
GUICtrlSetData($idGraphMode,"gain")
Case 2
$graphMode = 3
GUICtrlSetData($idGraphMode,"scale")
Case 3
$graphMode = 1
GUICtrlSetData($idGraphMode,"pixel")
EndSwitch
DrawMousePlot($graphMode, $AccelCurveX, $AccelCurveY, $dpi, $nominalHz,
$PointsToDraw, $graphElements, $graphPosX, $graphPosY)
Case $idLinearize
for $i = 0 to 3 step 1
$AccelCurveY[$i] = $AccelCurveYprime[$i]
$AccelCurveX[$i] = int($dpi * 65536 / $nominalHz ) *
$AccelCurveYprime[$i] / 65536 / 3.5
GUICtrlSetData($idX[$i],$AccelCurveX[$i])
GUICtrlSetData($idY[$i],$AccelCurveY[$i])
next
DrawMousePlot($graphMode, $AccelCurveX, $AccelCurveY, $dpi, $nominalHz,
$PointsToDraw, $graphElements, $graphPosX, $graphPosY)
GUICtrlSetState($idApply,$GUI_ENABLE)
; future complete implementation should be SomeFunctionName($AccelCurveY,
$AccelCurveX) byref in the loop then setdata
Case $idDefault
for $i = 0 to 3 step 1
$AccelCurveX[$i] = $AccelCurveXdefault[$i]
if $nominalHz == 120 then
$AccelCurveY[$i] = $AccelCurveYdefaultW10[$i]
elseif $nominalHz == 150 then
$AccelCurveY[$i] = $AccelCurveYdefaultW7[$i]
endif
GUICtrlSetData($idX[$i],$AccelCurveX[$i])
GUICtrlSetData($idY[$i],$AccelCurveY[$i])
next
DrawMousePlot($graphMode, $AccelCurveX, $AccelCurveY, $dpi, $nominalHz,
$PointsToDraw, $graphElements, $graphPosX, $graphPosY)
GUICtrlSetState($idApply,$GUI_ENABLE)
Case $idApply
$regCurveX = BinaryMid(0,1,4) + BinaryMid(0,1,4)
$regCurveY = BinaryMid(0,1,4) + BinaryMid(0,1,4)
$idValid = 1
For $i = 0 to 3 step 1
$AccelCurveX[$i] = GUICtrlRead($idX[$i])
$AccelCurveY[$i] = GUICtrlRead($idY[$i])
If ( _StringIsNumber($AccelCurveX[$i]) +
_StringIsNumber($AccelCurveY[$i]) + IsNumber($AccelCurveX[$i]) +
IsNumber($AccelCurveY[$i]) ) == 2 Then
$regCurveX += CoordinateToSmoothMouseBinary( number( $AccelCurveX[$i] )
)
$regCurveY += CoordinateToSmoothMouseBinary( number( $AccelCurveY[$i] )
)
Else
$idValid = 0
EndIf
Next
if $idValid then
RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse", "SmoothMouseXCurve",
"REG_BINARY", $regCurveX)
RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse", "SmoothMouseYCurve",
"REG_BINARY", $regCurveY)
$regCurveX = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse",
"SmoothMouseXCurve")
$regCurveY = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse",
"SmoothMouseYCurve")
For $i = 0 to 3 Step 1
$line = $i + 1
if SmoothMouseBinaryToFloat($regCurveX, $line) -
Number($AccelCurveX[$i]) then
$AccelCurveX[$i] = SmoothMouseBinaryToFloat($regCurveX, $line)
GUICtrlSetData($idX[$i], $AccelCurveX[$i])
EndIf
if SmoothMouseBinaryToFloat($regCurveY, $line) -
Number($AccelCurveY[$i]) then
$AccelCurveY[$i] = SmoothMouseBinaryToFloat($regCurveY, $line)
GUICtrlSetData($idY[$i], $AccelCurveY[$i])
EndIf
Next
MsgBox(0,"Success","Successfully written the following data to the
Registry:" & @crlf & @crlf & "HKCU\Control Panel\Mouse\SmoothMouseXCurve: " &
$regCurveX & @crlf & @crlf & "HKCU\Control Panel\Mouse\SmoothMouseYCurve: " &
$regCurveY & @crlf & @crlf & "Customization will take effect on next logon.")
GUICtrlSetState($idApply,$GUI_DISABLE)
Else
$regCurveX = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse",
"SmoothMouseXCurve")
$regCurveY = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse",
"SmoothMouseYCurve")
MsgBox(0,"Error","Must be a number")
EndIf
Case $idHelp
MsgBox( -1, "Help", "The grey line on the plot indicates the identity line
(along which your mouse input to pixel movement is 1-to-1.)" _
& @crlf & @crlf & "Nominal mouse/pointer speeds are in units of IPS
(inches per second) where Microsoft assumes a 400 CPI @ 125 Hz mouse is being used
on a certain DPI monitor. In actuality, only the raw counts are considered when the
acceleration algorithm is applied." _
& @crlf & @crlf & "MarkC's fix essentially modifies (linearizes) the
Windows mouse accel function such that it inverts the calculations in the mouse
accel algorithm and compensates for binary truncation errors (hence the messy
decimals), resulting in unmodified pointer counts." _
& @crlf & @crlf & "The appropriate MarkC fix applied depends on your
display scaling due to the aforementioned truncation error, as well as your Windows
Version due to Microsoft changing the algorithm going from Win7 to Win8 & onwards."
_
& @crlf & @crlf & "Technically, if you have your pointer speed slider set
to anything other than the central notch (5/10 in Control Panel), the truncation
compensation would need to be be different once again. The fix applied here assumes
that you're leaving it at the centre notch." _
& @crlf & @crlf & "For a more complete customization feature set, check
out MarkC's Fix Builder which lets you do things like using the accel algorithm to
set arbitrary pointer multiplier to downscale your effective cursor CPI on the
desktop only, instead of using Povohat's driver which affects raw input programs
too. Povohat's driver is still pretty kick-ass though, I highly recommend checking
that out too." _
& @crlf & @crlf & "Trivia: the Pointer Options Control Panel applet is
physically located at C:\WINDOWS\System32\main.cpl, which includes both the Mouse
settings applet as well as the key repeat applet." _
& @crlf & @crlf & "Check out FilterKeysSetter for natively making your
key repeat/delay more responsive. I personally use a delay of 150ms whereas Windows
doesn't typically let you go below 250ms even at the lowest setting in the Control
Panel applet." _
& @crlf & @crlf & "Important notice: Windows Precision Trackpad uses the
Accel curve here regardless of whether Enhance Pointer Precision is enabled or not.
This means that changing the curve here, even if you're not using the accel with
your mouse, will affect how the trackpad feels if it's using the Precision
driver.")
EndSwitch
WEnd
EndFunc
; Where did 1.28 come from? Why does it keep popping up everywhere?
;win10 Y = win7 Y * 1.28
; = win7 Y * 153.6 / 120
; = win7 Y * 96 / 75
; = win7 Y * (200 * 96 / 125) / 120
; = win7 Y * (100 * 96 / 125) / 60
; = (X*56/16*1.25) * (100 * 96 / 125) / 60
; 1.28 = MarkC win10 linearize first X / 10
; 1.28 = 153.6 / 120 = smoothmouse y of w7 over w10
; 1.28 = 3.2 / 2.5 = 2 * 400/125 / 5
Switch $graphMode
Case 1
$yScale = 200/$pointerSpeedBound
AutoItSetOption ( "GUICoordMode", 0 )
GUICtrlSetBkColor($idGraph, 0xffffff)
GUICtrlSetGraphic($idGraph, $GUI_GR_COLOR, 0xdddddd)
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE , 1,200)
GUICtrlSetGraphic($idGraph, $GUI_GR_LINE , _min(200,200/$slopeScale), 201 -
_min(200,200/$slopeScale)*$slopeScale)
GUICtrlSetGraphic($idGraph, $GUI_GR_COLOR, 0x000000)
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE , 1,200)
GUICtrlSetGraphic($idGraph, $GUI_GR_DOT , 1,200)
For $i = 0 to $PointsToDraw-1 step 1
GUICtrlSetGraphic($idGraph, $GUI_GR_DOT , $valueX[$i]*$xScale, 201-
$valueY[$i]*$yScale)
GUICtrlSetGraphic($idGraph, $GUI_GR_LINE, $valueX[$i]*$xScale, 201-
$valueY[$i]*$yScale)
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE, $valueX[$i]*$xScale, 201-
$valueY[$i]*$yScale)
Next
GUICtrlSetGraphic($idGraph, $GUI_GR_REFRESH, 100, 50)
AutoItSetOption ( "GUICoordMode", 1 )
$idXlabel = GUICtrlCreatelabel( round($mouseSpeedBound*$countScale,2)
, $xPos+202-40, $yPos+202, 40, -1, $SS_RIGHT)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$idYlabel = GUICtrlCreatelabel(
round($mouseSpeedBound*$countScale/$slopeScale,2), $xPos-42 , $yPos-2 , 40, -1,
$SS_RIGHT)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Case 2
$yScale = 200/$pointerGainBound
AutoItSetOption ( "GUICoordMode", 0 )
GUICtrlSetBkColor($idGraph, 0xffffff)
GUICtrlSetGraphic($idGraph, $GUI_GR_COLOR, 0xdddddd)
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE, 1 , 201-$yScale*$gainScale)
GUICtrlSetGraphic($idGraph, $GUI_GR_LINE, 200, 201-$yScale*$gainScale)
GUICtrlSetGraphic($idGraph, $GUI_GR_COLOR, 0x000000)
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE , 1 , 201-
$yScale*$gain[0])
GUICtrlSetGraphic($idGraph, $GUI_GR_LINE , 1+$xScale*$valueX[0], 201-
$yScale*$gain[0])
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE , 1+$xScale*$valueX[0], 201-
$yScale*$gain[0])
For $i = 1 to $PointsToDraw-1 step 1
GUICtrlSetGraphic($idGraph, $GUI_GR_LINE, 1+$xScale*$valueX[$i-1], 201-
$yScale*$gain[$i])
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE, 1+$xScale*$valueX[$i-1], 201-
$yScale*$gain[$i])
GUICtrlSetGraphic($idGraph, $GUI_GR_LINE, 1+$xScale*$valueX[$i] , 201-
$yScale*$gain[$i])
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE, 1+$xScale*$valueX[$i] , 201-
$yScale*$gain[$i])
Next
For $i = 1 to 3 step 1
GUICtrlSetGraphic($idGraph, $GUI_GR_PIXEL, $i, 201-$yScale*$maxGain)
Next
GUICtrlSetGraphic($idGraph, $GUI_GR_REFRESH, 100, 50)
AutoItSetOption ( "GUICoordMode", 1 )
$idXlabel = GUICtrlCreatelabel( round($mouseSpeedBound*$countScale, 2),
$xPos+202-40, $yPos+202 , 40, -1, $SS_RIGHT)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$idYlabel = GUICtrlCreatelabel( round($maxGain/$gainScale, 2) ,
$xPos-42 , $yPos+198-($yScale*$maxGain), 40, -1, $SS_RIGHT)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Case 3
$yScale = 200/$pointerGainBound
Local $effSens, $transferFunction
Local $interval = 0
AutoitSetOption ( "GUICoordMode", 0 )
GUICtrlSetBkColor($idGraph, 0xffffff)
GUICtrlSetGraphic($idGraph, $GUI_GR_COLOR, 0xdddddd)
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE, 1 , 201-$yScale*$gainScale)
GUICtrlSetGraphic($idGraph, $GUI_GR_LINE, 200, 201-$yScale*$gainScale)
GUICtrlSetGraphic($idGraph, $GUI_GR_COLOR, 0x000000)
For $j = 1 to 200 step 1
if $j/$xScale > $valueX[$interval] then
$interval += 1
endif
$transferFunction = $valueY[$interval] - ( $gain[$interval] *
($valueX[$interval] - $j/$xScale) )
$effSens = $transferFunction / $j * $xScale
if $j == 1 then
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE, 1, round(201-
$yScale*$effSens,1))
endif
GUICtrlSetGraphic($idGraph, $GUI_GR_LINE , $j, round(201-
$yScale*$effSens,1))
GUICtrlSetGraphic($idGraph, $GUI_GR_PIXEL, $j, round(201-
$yScale*$effSens,1))
GUICtrlSetGraphic($idGraph, $GUI_GR_MOVE , $j, round(201-
$yScale*$effSens,1))
Next
For $i = 1 to 200 step 1
if $i/2 - int($i/2) then
GUICtrlSetGraphic($idGraph, $GUI_GR_PIXEL, $i, 201-$yScale*$maxGain)
endif
Next
GUICtrlSetGraphic($idGraph, $GUI_GR_REFRESH, 100, 50)
AutoitSetOption ( "GUICoordMode", 1 )
$idXlabel = GUICtrlCreatelabel( round($mouseSpeedBound*$countScale, 2),
$xPos+202-40, $yPos+202 , 40, -1, $SS_RIGHT)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$idYlabel = GUICtrlCreatelabel( round($maxGain/$gainScale, 2) ,
$xPos-42 , $yPos+198-($yScale*$maxGain), 40, -1, $SS_RIGHT)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
EndSwitch
DllStructSetData($graphElements, "idGraph" , $idGraph )
DllStructSetData($graphElements, "idXlabel", $idXlabel)
DllStructSetData($graphElements, "idYlabel", $idYlabel)
EndFunc
Func IncrementSens()
GetMouseSpeed()
If $Speed < 20 Then
$Speed+= 1
SetMouseSpeed()
$gCycle=50
$gPoll=1
EndIf
EndFunc
Func DecrementSens()
GetMouseSpeed()
If $Speed > 1 Then
$Speed-= 1
SetMouseSpeed()
$gCycle=50
$gPoll=1
EndIf
EndFunc
Func CenterSens()
$Speed=10
SetMouseSpeed()
$gCycle=50
$gPoll=1
EndFunc
Func DisableAccel()
$Accel[2]=0
SetMouseAccel()
$gCycle=50
$gPoll=1
EndFunc
Func EnableAccel()
$Accel[2]=1
SetMouseAccel()
$gCycle=50
$gPoll=1
EndFunc
Func GetMouseSpeed()
Local $Action = 0x0070
DllCall("user32.dll", "none", "SystemParametersInfo", _
"uint", $Action, _
"uint", 0, _
"ptr", DllStructGetPtr($pSpeed), _
"uint", 0)
$Speed = DllStructGetData($pSpeed, "speed")
EndFunc
Func GetMouseAccel()
Local $Action = 0x0003
DllCall("user32.dll", "none", "SystemParametersInfo", _
"uint", $Action, _
"uint", 0, _
"ptr", DllStructGetPtr($pAccel), _
"uint", 0)
$Accel[0] = DllStructGetData($pAccel, "thresh1")
$Accel[1] = DllStructGetData($pAccel, "thresh2")
$Accel[2] = DllStructGetData($pAccel, "accel")
EndFunc
Func SetMouseSpeed()
Local $Action = 0x0071
DllCall("user32.dll", "none", "SystemParametersInfo", _
"uint", $Action, _
"uint", 0, _
"uint", $Speed, _
"uint", 0)
RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse", "MouseSensitivity", "REG_SZ",
string($Speed))
EndFunc
Func SetMouseAccel()
Local $Action = 0x0004
DllStructSetData($pAccel, "thresh1", $Accel[0])
DllStructSetData($pAccel, "thresh2", $Accel[1])
DllStructSetData($pAccel, "accel", $Accel[2])
DllCall("user32.dll", "none", "SystemParametersInfo", _
"uint", $Action, _
"uint", 0, _
"ptr", DllStructGetPtr($pAccel), _
"uint", 0)
RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse", "MouseThreshold1", "REG_SZ",
string($Accel[0]))
RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse", "MouseThreshold2", "REG_SZ",
string($Accel[1]))
RegWrite("HKEY_CURRENT_USER\Control Panel\Mouse", "MouseSpeed" , "REG_SZ",
string($Accel[2]))
EndFunc
Func SmoothMouseBinaryToFloat($input,$line)
Local $float
$float += Dec(Hex(BinaryMid($input,($line*8)+1,1))) / 65536
$float += Dec(Hex(BinaryMid($input,($line*8)+2,1))) / 256
$float += Dec(Hex(BinaryMid($input,($line*8)+3,1)))
$float += Dec(Hex(BinaryMid($input,($line*8)+4,1))) * 256
return $float
EndFunc
Func CoordinateToSmoothMouseBinary($input)
Local $byte1, $byte2, $byte3, $byte4
$byte4 = int( $input / 256 )
$byte3 = int( $input - ($byte4*256) )
$byte2 = int( ( $input - ($byte4*256) - $byte3 ) * 256 )
$byte1 = round( ( $input - ($byte4*256) - $byte3 - ($byte2/256) ) * 65536 ) ;
needs to be round since this is our last bit of precision
if $byte4 > 255 then
$byte4 = 255 ;
make sure int is one byte
EndIf
Local $output = BinaryMid(binary($byte1),1,1) + BinaryMid(binary($byte2),1,1) +
BinaryMid(binary($byte3),1,1) + BinaryMid(binary($byte4),1,1)
For $i = 1 to 4 step 1
$output += BinaryMid(0,1,1)
Next
Return $output
EndFunc
Func AccessAccelRadio($idRadio0,$idRadio1,$idRadio2,$accessMode="read")
If $accessMode = "set" then
Switch $Accel[2]
Case 2
GUICtrlSetState($idRadio2, $GUI_CHECKED)
Case 1
GUICtrlSetState($idRadio1, $GUI_CHECKED)
Case 0
GUICtrlSetState($idRadio0, $GUI_CHECKED)
EndSwitch
Else
If GUICtrlRead($idRadio0)=$GUI_CHECKED Then
return 0
ElseIf GUICtrlRead($idRadio1)=$GUI_CHECKED Then
return 1
ElseIf GUICtrlRead($idRadio2)=$GUI_CHECKED Then
return 2
EndIf
Endif
EndFunc
Func CalculateMultiplier($lMouseSpeed=$Speed,$lAccelMode=$Accel[2])
Local $multiplier = "?"
Local $mode = "Pointer Speed:"
if $lAccelMode Then
$mode = "Pointer Acc Multiplier:"
$multiplier = StringFormat("%.1f",$lMouseSpeed/10)
Else
$mode = "Pointer Speed Factor:"
Switch $lMouseSpeed
Case 0 to 1
$multiplier = "1/32"
Case 2
$multiplier = "1/16"
Case 3 to 9
$multiplier = String($lMouseSpeed-2)&"/8"
Case 10, 14, 18
$multiplier = String($lMouseSpeed/4-1.5)
Case 11 to 13
$multiplier = "1 "&String($lMouseSpeed-10)&"/4"
Case 15 to 17
$multiplier = "2 "&String($lMouseSpeed-14)&"/4"
Case 19 to 20
$multiplier = "3 "&String($lMouseSpeed-18)&"/4"
EndSwitch
EndIf
return $mode&" "&$multiplier
EndFunc