Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. [DllImport("xinput1_3.dll", EntryPoint = "#100")]
  2. static extern int secret_get_gamepad(int playerIndex, out XINPUT_GAMEPAD_SECRET struc);
  3.  
  4. public struct XINPUT_GAMEPAD_SECRET
  5. {
  6. public UInt32 eventCount;
  7. public ushort wButtons;
  8. public Byte bLeftTrigger;
  9. public Byte bRightTrigger;
  10. public short sThumbLX;
  11. public short sThumbLY;
  12. public short sThumbRX;
  13. public short sThumbRY;
  14. }
  15.  
  16. public XINPUT_GAMEPAD_SECRET xgs;
  17.  
  18. bool testHomeButton()
  19. {
  20. int stat;
  21. bool val;
  22.  
  23. for (int i = 0; i < 4; i++)
  24. {
  25. stat = secret_get_gamepad(0, out xgs);
  26. if (stat != 0) continue;
  27.  
  28. val = ((xgs.wButtons & 0x0400) != 0);
  29.  
  30. if (val) return true;
  31. }
  32.  
  33. return false;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement