diff --git a/mausuHoldo.ahk b/mausuHoldo.ahk index aff0590..3f1e33a 100644 --- a/mausuHoldo.ahk +++ b/mausuHoldo.ahk @@ -1,7 +1,13 @@ +;;eveentos down del teclado no paraban de joder porque paraban el unico hilo, so _h it was, its threading time +;;vaya puto apaņazo de mierda, flipas +;;obs lo rompe wtf??????????????? y relive caputrar la pantalla basically +;;TODO ugly af no entrar en el mutex. bro q te pasa, habia prisa pero...... #MaxThreadsPerHotkey 2 #HotkeyInterval 10000 #MaxHotkeysPerInterval 9999 #NoEnv +#WarnContinuableException Off +#Persistent ;;Process, Priority, , R ;;DllCall("mouse_event", "UInt", 1, "UInt", (rightMov + lefMov) , "UInt", upMov + downMov ) @@ -22,18 +28,19 @@ baseTime := baseTime ;;/ 1.0 mouseActive := 0 -rightMov := 0 -lefMov := 0 -upMov := 0 -downMov := 0 - rBtnHold := 0 mBtnHold := 0 lBtnHold := 0 speedUp := 1 speedUpFactor := 20 -mouseSpeed := speedUp * speedUpFactor + 3 + +test1 := 0 +test2 := 0 +test3 := 0 +test4 := 0 + +share:=CriticalObject({"lefMov" : 0,"rightMov" : 0,"downMov" : 0,"upMov" : 0,"mouseSpeed" : speedUp * speedUpFactor + 3}) ;;Toggle speed RCtrl & ,:: @@ -50,22 +57,57 @@ RCtrl & .:: ;;inputCleaning() return -mouseMovement(lefMov, rightMov, upMov, downMov, mouseSpeed) -{ - MouseMove, (rightMov + lefMov) * (mouseSpeed), (upMov + downMov) * (mouseSpeed), 0, R -} - +;;TODO DAVBID Y EL ENTER LAlt & RAlt:: RAlt & LAlt:: ;;<^>!LAlt:: ;;LAlt & RAlt:: - mouseActive := !(mouseActive) -#if mouseActive - -Loop -{ - if (mouseActive == 0) + mouseActive := !(mouseActive) + if (mouseActive == 1) { + mouseThread := AhkThread(" + ( + #Persistent + Process, Priority, , H + + DllCall(""SetThreadDpiAwarenessContext"", ""ptr"", -3, ""ptr"") + + freqUpdater := DllCall(""GetProcAddress"", ""Ptr"" , DllCall(""GetModuleHandle"", ""Str"", ""kernel32"", ""Ptr""), ""AStr"", ""QueryPerformanceCounter"", ""Ptr"") + ;;VarSetCapacity(baseTime, 2334423432128) + ;;VarSetCapacity(currentTime, 423523423128) + + DllCall(freqUpdater, ""Int64*"" , baseTime) + DllCall(freqUpdater, ""Int64*"" , currentTime) + DllCall(""QueryPerformanceFrequency"", ""Int64*"", updateRate) + updateRate := Floor(updateRate / 1000) + currentTime := currentTime ;;/ 1.0 + baseTime := baseTime ;;/ 1.0 + + + obj := CriticalObject(A_Args[1]) + + lefMov := obj.lefMov + rightMov := obj.rightMov + downMov := obj.downMov + upMov := obj.upMov + mouseSpeed := obj.mouseSpeed + + Loop + { + DllCall(freqUpdater, ""Int64*"" , currentTime) + if (currentTime - baseTime >= updateRate) { + MouseMove, (obj.rightMov + obj.lefMov) * (obj.mouseSpeed), (obj.upMov + obj.downMov) * (obj.mouseSpeed), 0, R + ;;DllCall(freqUpdater, ""Int64*"" , baseTime) + baseTime := currentTime + } + } + + )", &share "") + } + else + { + mouseThread.ahkTerminate() + ;;ahkthread_free(mouseThread) lefMov := 0 rightMov := 0 upMov := 0 @@ -73,85 +115,57 @@ Loop lBtnHold := 0 mBtnHold := 0 rBtnHold := 0 - break + ;;break } - DllCall(freqUpdater, "Int64*", currentTime) - if (currentTime - baseTime >= updateRate) - { - mouseMovement(lefMov, rightMov, upMov, downMov, mouseSpeed) - baseTime := currentTime - } -} -return -#if -return + return +#if mouseActive == 1 $j:: - if (mouseActive == 1) + if (test1 == 0) { - lefMov := -1 - } - else - { - SendInput, j + test1 := 1 + share.lefMov := -1 } return j Up:: - if (mouseActive == 1) - { - lefMov := 0 - } + share.lefMov := 0 + test1 := 0 return $sc027:: - if (mouseActive == 1) - { - rightMov := 1 - } - else - { - SendInput, {sc027} + if (test2 == 0) + { + test2 := 1 + share.rightMov := 1 } return sc027 Up:: - if (mouseActive == 1) - { - rightMov := 0 - } + share.rightMov := 0 + test2 := 0 return $l:: - if (mouseActive == 1) +if (test3 == 0) { - upMov := -1 - } - else - { - SendInput, l + test3 := 1 + share.upMov := -1 } return l Up:: - if (mouseActive == 1) - { - upMov := 0 - } + share.upMov := 0 + test3 := 0 return $k:: - if (mouseActive == 1) +if (test4 == 0) { - downMov := 1 - } - else - { - SendInput, k - } + test4 := 1 + share.downMov := 1 + } return k Up:: - if (mouseActive == 1) - { - downMov := 0 - } + share.downMov := 0 + test4 := 0 return $u:: @@ -283,6 +297,5 @@ $.:: return -;;#if - -return \ No newline at end of file +#if +return