Guest User

GTA V racing wheel FreePIE

a guest
Sep 29th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. if starting:
  2. joystick[1].setRange(0,65535)
  3. joystick[0].setRange(-1000,1000)
  4. i = 0
  5. j = 0
  6. k = 0
  7. l = 0
  8. m = 0
  9.  
  10.  
  11. xoutput[0].Start = joystick[1].getDown(7)
  12. xoutput[0].Back = joystick[1].getDown(6)
  13. xoutput[0].Guide = joystick[1].getDown(12)
  14. xoutput[0].A = joystick[1].getDown(4)
  15. xoutput[0].B = joystick[1].getDown(8)
  16. xoutput[0].X = joystick[1].getDown(2)
  17. xoutput[0].Y = joystick[1].getDown(9)
  18. xoutput[0].L1 = joystick[1].getDown(0)
  19. xoutput[0].R1 = joystick[1].getDown(1)
  20. xoutput[0].L3 = joystick[1].getDown(5)
  21. xoutput[0].R3 = joystick[1].getDown(10)
  22.  
  23. #pedals
  24. if joystick[1].y != 65535:
  25. xoutput[0].L2 = (65535 - joystick[1].y)*255/65535
  26. i = 1
  27. if joystick[1].zRotation != 65535:
  28. xoutput[0].R2 = (65535 - joystick[1].zRotation)*255/65535
  29. i = -1
  30. if joystick[0].y == 65535 and joystick[1].zRotation == 65535:
  31. xoutput[0].R2 == 0
  32. xoutput[0].L2 == 0
  33. i = 0
  34.  
  35. #wheel
  36. if joystick[1].x != 32768:
  37. if joystick[1].x < 32768:
  38. xoutput[0].lx = ((joystick[1].x) ** 2)/32768 - 32768
  39. j = -1
  40. if joystick[1].x > 32768:
  41. xoutput[0].lx = -((joystick[1].x - 65535) ** 2)/32768 + 32768
  42. j = 1
  43. else:
  44. j = 0
  45.  
  46. #remaining joystick axises used once only for calibration
  47. if joystick[0].y != 0:
  48. xoutput[0].ry = 32768*joystick[0].y/1000
  49. l = 1
  50. else:
  51. l = 0
  52. if joystick[0].x != 1:
  53. xoutput[0].rx = 32768*joystick[0].x/1000
  54. m = 1
  55. else:
  56. m = 0
  57. if joystick[0].yRotation != -4:
  58. xoutput[0].ly = 32768*joystick[0].yRotation/1000
  59. k = 1
  60. else:
  61. xoutput[0].ly = 0
  62. k = 0
  63.  
  64. #useful for testing but not neccessary
  65. diagnostics.watch(joystick[1].x)
  66. diagnostics.watch(joystick[1].y)
  67. diagnostics.watch(joystick[1].zRotation)
  68.  
  69. diagnostics.watch(joystick[0].x)
  70. diagnostics.watch(joystick[0].y)
  71. diagnostics.watch(joystick[0].yRotation)
  72.  
  73. diagnostics.watch(xoutput[0].lx)
  74. diagnostics.watch(xoutput[0].ly)
  75. diagnostics.watch(xoutput[0].ry)
  76. diagnostics.watch(xoutput[0].rx)
  77. diagnostics.watch(xoutput[0].L2)
  78. diagnostics.watch(xoutput[0].R2)
  79.  
  80. diagnostics.watch(i)
  81. diagnostics.watch(j)
  82. diagnostics.watch(k)
  83. diagnostics.watch(l)
  84. diagnostics.watch(m)
Add Comment
Please, Sign In to add comment