Advertisement
Guest User

Untitled

a guest
Aug 6th, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;///////////////////////////////////////////////////////////////////////////////
  2. ;// AutoOculusTouch - Helper library to provide AutoHotKey with Oculus Touch state.
  3. ;// Copyright (C) 2017 Kojack (rajetic@gmail.com)
  4. ;//
  5. ;// AutoOculusTouch is released under the MIT License  
  6. ;// https://opensource.org/licenses/MIT
  7. ;///////////////////////////////////////////////////////////////////////////////
  8.  
  9. ; Button enums
  10. ovrA         := 0x00000001      ; Touch-A            Remote-Select       Xbox-A
  11. ovrB         := 0x00000002      ; Touch-B            Remote-Back         Xbox-B
  12. ovrRThumb    := 0x00000004      ; Touch-Right Stick  Remote-None         Xbox-Right Thumbstick
  13. ovrRShoulder := 0x00000008      ; Touch-None         Remote-None         Xbox-Right Shoulder
  14. ovrX         := 0x00000100      ; Touch-X            Remote-None         Xbox-X
  15. ovrY         := 0x00000200      ; Touch-Y            Remote-None         Xbox-Y
  16. ovrLThumb    := 0x00000400      ; Touch-Left Stick   Remote-None         Xbox-Left Thumbstick
  17. ovrLShoulder := 0x00000800      ; Touch-None         Remote-None         Xbox-Left Shoulder
  18. ovrUp        := 0x00010000      ; Touch-None         Remote-Up           Xbox-Up
  19. ovrDown      := 0x00020000      ; Touch-None         Remote-Down         Xbox-Down
  20. ovrLeft      := 0x00040000      ; Touch-None         Remote-Left         Xbox-Left
  21. ovrRight     := 0x00080000      ; Touch-None         Remote-Right        Xbox-Right
  22. ovrEnter     := 0x00100000      ; Touch-Left Menu    Remote-None         Xbox-Start
  23. ovrBack      := 0x00200000      ; Touch-None         Remote-None         Xbox-Back
  24. ovrVolUp     := 0x00400000      ; Touch-None         Remote-Volume Up    Xbox-None
  25. ovrVolDown   := 0x00800000      ; Touch-None         Remote-Volume Down  Xbox-None
  26. ovrHome      := 0x01000000      ; Touch-Oculus       Remote-Oculus       Xbox-Home
  27.  
  28. ; Capacitive touch sensors
  29. ovrTouch_A              := 0x00000001
  30. ovrTouch_B              := 0x00000002
  31. ovrTouch_RThumb         := 0x00000004
  32. ovrTouch_RThumbRest     := 0x00000008
  33. ovrTouch_RIndexTrigger  := 0x00000010
  34. ovrTouch_X              := 0x00000100
  35. ovrTouch_Y              := 0x00000200
  36. ovrTouch_LThumb         := 0x00000400
  37. ovrTouch_LThumbRest     := 0x00000800
  38. ovrTouch_LIndexTrigger  := 0x00001000
  39.  
  40. ; Capacitive touch gestures
  41. ovrTouch_RIndexPointing := 0x00000020
  42. ovrTouch_RThumbUp       := 0x00000040
  43. ovrTouch_LIndexPointing := 0x00002000
  44. ovrTouch_LThumbUp       := 0x00004000
  45.  
  46. ; Controller types for vibration
  47. ovrControllerType_LTouch := 0x0001
  48. ovrControllerType_RTouch := 0x0002
  49. ovrControllerType_XBox   := 0x0010
  50.  
  51. ; Misc defines
  52. LeftHand  := 0
  53. RightHand := 1
  54. IndexTrigger := 0
  55. HandTrigger  := 1
  56. XAxis := 0
  57. YAxis := 1
  58.  
  59. ; Grab the library.
  60. hModule := DllCall("LoadLibrary", "Str", "auto_oculus_touch.dll", "Ptr")
  61.  
  62. ; Start the Oculus sdk.
  63. DllCall("auto_oculus_touch\initOculus")
  64.  
  65. ; Main polling loop.
  66. Loop {
  67.     ; Grab the latest Oculus input state (Touch, Remote and Xbox One).
  68.     DllCall("auto_oculus_touch\poll")
  69.  
  70.     pressed  := DllCall("auto_oculus_touch\getButtonsPressed")
  71.     released := DllCall("auto_oculus_touch\getButtonsReleased")
  72.  
  73.     ; Use the right thumbstick press as your keyboard 'C' button
  74.     if pressed & ovrRThumb
  75.         Send, {Insert down}
  76.     if released & ovrRThumb
  77.         Send, {Insert up}
  78.  
  79.     Sleep, 10
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement