Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #SingleInstance Force
- #MaxHotkeysPerInterval 140
- ; Note the Right stick must be mapped to Up Down Left Right Currently. and check the long comments below for mouse button Mapping
- CoordMode, Mouse, Window
- SystemCursor("I")
- OnExit, ShowCursor ; Ensure the cursor is made visible when the script exits.
- Toggle := False
- Return
- ChangeMouse:
- MouseGetPos, CurX, CurY
- DifX:=Floor(winW/2 - CurX), DifY:=Floor(winH/2 - CurY)
- Send, % "{" . (DifX > 4 ? "Left Down" : "Left Up") . "}"
- Send, % "{" . (DifX < -4 ? "Right Down" : "Right Up") . "}"
- Send, % "{" . (DifY > 4 ? "Up Down" : "Up Up") . "}"
- Send, % "{" . (DifY < -4 ? "Down Down" : "Down Up") . "}"
- MouseMove, % winW/2, % winH/2
- Return
- #IF Toggle
- LButton::Numpad5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Change here what you want Left mouse button to map to ( Numpad5 is where i have 'Y' mapped in CEMU )
- RButton::NumpadMult ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Same for Right mouse button ( NumpadMult is where I have 'ZR' or whatever the Bow aim in BotW is
- MButton::MButton ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Middle Button
- XButton1::XButton1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Button 4
- XButton2::XButton2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Button 5
- WheelUp::WheelUp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Wheel Up
- WheelDown::WheelDown ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Wheel Down
- WheelLeft::WheelLeft ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Wheel Left
- WheelRight::WheelRight ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Wheel Right
- ;; IF you haven't changed the camera from the arrow keys leave this next section alone, as it makes using the keys while active smoother.
- $Down::
- Thread, NoTimers
- Send {Down Down}
- While (GetKeyState("Down", "P"))
- Continue
- Send {Down Up}
- Return
- $Up::
- Thread, NoTimers
- Send {Up Down}
- While (GetKeyState("Up", "P"))
- Continue
- Send {Up Up}
- Return
- $Left::
- Thread, NoTimers
- Send {Left Down}
- While (GetKeyState("Left", "P"))
- Continue
- Send {Left Up}
- Return
- $Right::
- Thread, NoTimers
- Send {Right Down}
- While (GetKeyState("Right", "P"))
- Continue
- Send {Right Up}
- Return
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- #IFWinActive Cemu
- F1::
- WinGetPos, winX, winY, winW, winH, A
- SetTimer, ChangeMouse, % (Toggle:=!Toggle) ? 15 : "Off"
- SetTimer, WinFocusLoop, % (Toggle) ? 100 : "Off"
- SystemCursor("T")
- Send {Right Up}
- Send {Left Up}
- Send {Up Up}
- Send {Down Up}
- Return
- #IFWinActive
- ~F1::
- Critical
- SetTimer, WinFocusLoop, Off
- SetTimer, ChangeMouse, Off
- Toggle := False
- SystemCursor("On")
- Send {Right Up}
- Send {Left Up}
- Send {Up Up}
- Send {Down Up}
- Return
- ShowCursor:
- SystemCursor("On")
- ExitApp
- WinFocusLoop()
- {
- Static S_LastProcess := ""
- WinGet, CurProc, ProcessName, A
- If (CurProc != S_LastProcess)
- {
- ;Handle Losing Focus
- Focus_Func := "OnLoseFocus_" . RegExReplace(S_LastProcess,A_Space,"_")
- If (IsLabel(Focus_Func))
- GoSub, %Focus_Func%
- ; Handle Gaining Focus.
- Focus_Func := "OnGainFocus_" . RegExReplace(CurProc,A_Space,"_")
- If (IsLabel(Focus_Func))
- GoSub, %Focus_Func%
- ; Reset the last process to the current one.
- S_LastProcess := CurProc
- }
- Return
- }
- OnLoseFocus_Cemu.exe:
- Critical
- SetTimer, WinFocusLoop, Off
- SetTimer, ChangeMouse, Off
- Toggle := False
- SystemCursor("On")
- Send {Right Up}
- Send {Left Up}
- Send {Up Up}
- Send {Down Up}
- Return
- SystemCursor(OnOff=0) ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others
- {
- static AndMask, XorMask, $, h_cursor
- ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; system cursors
- , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 ; blank cursors
- , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 ; handles of default cursors
- if (OnOff = "Init" or OnOff = "I" or $ = "") ; init when requested or at first call
- {
- $ = h ; active default cursors
- VarSetCapacity( h_cursor,4444, 1 )
- VarSetCapacity( AndMask, 32*4, 0xFF )
- VarSetCapacity( XorMask, 32*4, 0 )
- system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650
- StringSplit c, system_cursors, `,
- Loop %c0%
- {
- h_cursor := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% )
- h%A_Index% := DllCall( "CopyImage", "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 )
- b%A_Index% := DllCall("CreateCursor","uint",0, "int",0, "int",0
- , "int",32, "int",32, "uint",&AndMask, "uint",&XorMask )
- }
- }
- if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T"))
- $ = b ; use blank cursors
- else
- $ = h ; use the saved cursors
- Loop %c0%
- {
- h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 )
- DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement