Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

629 lines
19 KiB

  1. //===== Copyright 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef INPUTSYSTEM_H
  9. #define INPUTSYSTEM_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #define DONT_DEFINE_DWORD
  14. #include "platform.h"
  15. #include "basetypes.h"
  16. #ifdef PLATFORM_WINDOWS_PC
  17. #define OEMRESOURCE //for OCR_* cursor junk
  18. #define _WIN32_WINNT 0x502
  19. #include <windows.h>
  20. #include <zmouse.h>
  21. #include "xbox/xboxstubs.h"
  22. #include "../../dx9sdk/include/XInput.h"
  23. #endif
  24. #if defined( _WIN32 ) && defined( USE_SDL )
  25. #include "appframework/ilaunchermgr.h"
  26. #endif
  27. #if defined(PLATFORM_POSIX) && !defined(_PS3)
  28. #ifdef PLATFORM_OSX
  29. #define DWORD DWORD
  30. #define CARBON_WORKAROUND
  31. #include <CoreFoundation/CoreFoundation.h>
  32. #include <Carbon/Carbon.h>
  33. #include <IOKit/IOKitLib.h>
  34. #include <IOKit/IOCFPlugIn.h>
  35. #include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
  36. #include <IOKit/hid/IOHIDLib.h>
  37. #include <IOKit/hid/IOHIDKeys.h>
  38. #include <ForceFeedback/ForceFeedback.h>
  39. #include <ForceFeedback/ForceFeedbackConstants.h>
  40. #undef DWORD
  41. #else
  42. typedef char xKey_t;
  43. #endif // OSX
  44. #include "posix_stubs.h"
  45. #endif // POSIX
  46. #include "appframework/ilaunchermgr.h"
  47. #include "inputsystem/iinputsystem.h"
  48. #include "tier2/tier2.h"
  49. #ifdef _PS3
  50. #include "ps3/ps3_platform.h"
  51. #include "ps3/ps3_win32stubs.h"
  52. #include "ps3/ps3_core.h"
  53. #include "ps3/ps3stubs.h"
  54. #include <cell/pad.h>
  55. #endif
  56. #include "tier1/UtlStringMap.h"
  57. #include "inputsystem/ButtonCode.h"
  58. #include "inputsystem/AnalogCode.h"
  59. #include "bitvec.h"
  60. #include "tier1/utlvector.h"
  61. #include "tier1/utlflags.h"
  62. #include "input_device.h"
  63. #include "steam/steam_api.h"
  64. #if defined( _X360 )
  65. #include "xbox/xbox_win32stubs.h"
  66. #include "xbox/xbox_console.h"
  67. #endif
  68. enum
  69. {
  70. INPUT_TYPE_GENERIC_JOYSTICK = 0,
  71. INPUT_TYPE_STEAMCONTROLLER,
  72. };
  73. //-----------------------------------------------------------------------------
  74. // Implementation of the input system
  75. //-----------------------------------------------------------------------------
  76. class CInputSystem : public CTier2AppSystem< IInputSystem >
  77. {
  78. typedef CTier2AppSystem< IInputSystem > BaseClass;
  79. public:
  80. // Constructor, destructor
  81. CInputSystem();
  82. virtual ~CInputSystem();
  83. // Inherited from IAppSystem
  84. virtual InitReturnVal_t Init();
  85. virtual bool Connect( CreateInterfaceFn factory );
  86. virtual void Shutdown();
  87. // Inherited from IInputSystem
  88. virtual void AttachToWindow( void* hWnd );
  89. virtual void DetachFromWindow( );
  90. virtual void EnableInput( bool bEnable );
  91. virtual void EnableMessagePump( bool bEnable );
  92. virtual int GetPollTick() const;
  93. virtual void PollInputState( bool bIsInGame = false );
  94. virtual bool IsButtonDown( ButtonCode_t code ) const;
  95. virtual int GetButtonPressedTick( ButtonCode_t code ) const;
  96. virtual int GetButtonReleasedTick( ButtonCode_t code ) const;
  97. virtual int GetAnalogValue( AnalogCode_t code ) const;
  98. virtual int GetAnalogDelta( AnalogCode_t code ) const;
  99. virtual int GetEventCount() const;
  100. virtual bool MotionControllerActive() const;
  101. virtual Quaternion GetMotionControllerOrientation() const;
  102. virtual float GetMotionControllerPosX() const;
  103. virtual float GetMotionControllerPosY() const;
  104. virtual int GetMotionControllerDeviceStatus() const;
  105. virtual uint64 GetMotionControllerDeviceStatusFlags() const;
  106. virtual void SetMotionControllerDeviceStatus( int nStatus );
  107. virtual void SetMotionControllerCalibrationInvalid( void );
  108. virtual void StepMotionControllerCalibration( void );
  109. virtual void ResetMotionControllerScreenCalibration( void );
  110. virtual const InputEvent_t* GetEventData( ) const;
  111. virtual void PostUserEvent( const InputEvent_t &event );
  112. virtual int GetJoystickCount() const;
  113. virtual void EnableJoystickInput( int nJoystick, bool bEnable );
  114. virtual void EnableJoystickDiagonalPOV( int nJoystick, bool bEnable );
  115. virtual void SampleDevices( void );
  116. virtual void SetRumble( float fLeftMotor, float fRightMotor, int userId );
  117. virtual void StopRumble( int userId = INVALID_USER_ID );
  118. virtual void ResetInputState( void );
  119. virtual const char *ButtonCodeToString( ButtonCode_t code ) const;
  120. virtual const char *AnalogCodeToString( AnalogCode_t code ) const;
  121. virtual ButtonCode_t StringToButtonCode( const char *pString ) const;
  122. virtual AnalogCode_t StringToAnalogCode( const char *pString ) const;
  123. virtual ButtonCode_t VirtualKeyToButtonCode( int nVirtualKey ) const;
  124. virtual int ButtonCodeToVirtualKey( ButtonCode_t code ) const;
  125. virtual ButtonCode_t ScanCodeToButtonCode( int lParam ) const;
  126. virtual void SleepUntilInput( int nMaxSleepTimeMS );
  127. virtual int GetPollCount() const;
  128. virtual void SetCursorPosition( int x, int y );
  129. void GetRawMouseAccumulators( int& accumX, int& accumY );
  130. virtual void GetCursorPosition( int *pX, int *pY );
  131. virtual void SetMouseCursorVisible( bool bVisible );
  132. virtual void AddUIEventListener();
  133. virtual void RemoveUIEventListener();
  134. virtual PlatWindow_t GetAttachedWindow() const;
  135. virtual InputCursorHandle_t GetStandardCursor( InputStandardCursor_t id );
  136. virtual InputCursorHandle_t LoadCursorFromFile( const char *pFileName, const char *pPathID = NULL );
  137. virtual void SetCursorIcon( InputCursorHandle_t hCursor );
  138. virtual void EnableMouseCapture( PlatWindow_t hWnd );
  139. virtual void DisableMouseCapture();
  140. #ifdef PLATFORM_WINDOWS
  141. LRESULT WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  142. #elif defined(PLATFORM_OSX)
  143. // helper function for callbacks
  144. struct JoystickInfo_t;
  145. void HIDAddElement(CFTypeRef refElement, JoystickInfo_t &info );
  146. #endif
  147. #ifdef _PS3
  148. virtual void SetPS3CellPadDataHook( BCellPadDataHook_t hookFunc );
  149. virtual void SetPS3CellPadNoDataHook( BCellPadNoDataHook_t hookFunc );
  150. virtual void SetPS3StartButtonIdentificationMode();
  151. virtual bool GetPS3CursorPos( int &x, int &y );
  152. virtual void DisableHardwareCursor( void );
  153. virtual void EnableHardwareCursor( void );
  154. void ExitHardwareCursor( void );
  155. #endif
  156. #if defined( USE_SDL )
  157. virtual void DisableHardwareCursor( void );
  158. virtual void EnableHardwareCursor( void );
  159. #endif
  160. virtual void ResetCursorIcon();
  161. // handles the connected input devices
  162. virtual InputDevice_t GetConnectedInputDevices( void ); // returns the bitfield of all connected devices
  163. virtual bool IsInputDeviceConnected( InputDevice_t device );
  164. virtual void SetInputDeviceConnected( InputDevice_t device, bool connected = true );
  165. virtual InputDevice_t IsOnlySingleDeviceConnected( void );
  166. // handles the selected "current" primary input device
  167. virtual bool IsDeviceReadingInput( InputDevice_t device ) const; // returns whether the passed in device is the current device. Returns true if no current device is defined
  168. virtual InputDevice_t GetCurrentInputDevice( void ); // returns the enum referring to the one currently selected device
  169. virtual void SetCurrentInputDevice( InputDevice_t device );
  170. virtual void ResetCurrentInputDevice( void ); // sets the input device to the platform default
  171. virtual void SampleInputToFindCurrentDevice( bool ); // looks for the next 'significant' button press to determine and set the current input device
  172. virtual bool IsSamplingForCurrentDevice( void );
  173. void InitPlatfromInputDeviceInfo( void );
  174. private:
  175. enum
  176. {
  177. STICK1_AXIS_X,
  178. STICK1_AXIS_Y,
  179. STICK2_AXIS_X,
  180. STICK2_AXIS_Y,
  181. MAX_STICKAXIS
  182. };
  183. enum
  184. {
  185. INPUT_STATE_QUEUED = 0,
  186. INPUT_STATE_CURRENT,
  187. INPUT_STATE_COUNT,
  188. };
  189. public:
  190. #if defined(PLATFORM_OSX)
  191. struct OSXInputValue_t
  192. {
  193. bool m_bSet;
  194. int m_MinVal;
  195. int m_MaxVal;
  196. int m_MinReport;
  197. int m_MaxReport;
  198. int m_Cookie;
  199. uint32 m_Usage;
  200. CFTypeRef m_RefElement;
  201. };
  202. #define MAX_JOYSTICK_BUTTONS 32
  203. #endif
  204. struct JoystickInfo_t
  205. {
  206. #if defined(PLATFORM_WINDOWS) || defined(_GAMECONSOLE)
  207. JOYINFOEX m_JoyInfoEx;
  208. #elif defined(PLATFORM_OSX)
  209. FFDeviceObjectReference m_FFInterface;
  210. IOHIDDeviceInterface **m_Interface;
  211. long usage; // from IOUSBHID Parser.h
  212. long usagePage; // from IOUSBHID Parser.h
  213. CInputSystem *m_pParent;
  214. bool m_bRemoved;
  215. bool m_bXBoxRumbleEnabled;
  216. OSXInputValue_t m_xaxis;
  217. OSXInputValue_t m_yaxis;
  218. OSXInputValue_t m_zaxis;
  219. OSXInputValue_t m_raxis;
  220. OSXInputValue_t m_uaxis;
  221. OSXInputValue_t m_vaxis;
  222. OSXInputValue_t m_POV;
  223. OSXInputValue_t m_Buttons[MAX_JOYSTICK_BUTTONS];
  224. #elif defined(LINUX)
  225. void *m_pDevice; // Really an SDL_GameController*, NULL if not present.
  226. void *m_pHaptic; // Really an SDL_Haptic*
  227. float m_fCurrentRumble;
  228. bool m_bRumbleEnabled;
  229. #else
  230. #error
  231. #endif
  232. int m_nButtonCount;
  233. int m_nAxisFlags;
  234. int m_nDeviceId;
  235. bool m_bHasPOVControl;
  236. bool m_bDiagonalPOVControlEnabled;
  237. unsigned int m_nFlags;
  238. unsigned int m_nLastPolledButtons;
  239. unsigned int m_nLastPolledAxisButtons;
  240. unsigned int m_nLastPolledPOVState;
  241. unsigned long m_pLastPolledAxes[MAX_JOYSTICK_AXES];
  242. };
  243. private:
  244. struct xdevice_t
  245. {
  246. int userId;
  247. byte type;
  248. byte subtype;
  249. word flags;
  250. bool active;
  251. XINPUT_STATE states[2];
  252. int newState;
  253. // track Xbox stick keys from previous frame
  254. xKey_t lastStickKeys[MAX_STICKAXIS];
  255. int stickThreshold[MAX_STICKAXIS];
  256. float stickScale[MAX_STICKAXIS];
  257. int quitTimeout;
  258. int dpadLock;
  259. // rumble
  260. XINPUT_VIBRATION vibration;
  261. bool pendingRumbleUpdate;
  262. };
  263. struct appKey_t
  264. {
  265. int repeats;
  266. int sample;
  267. };
  268. struct InputState_t
  269. {
  270. // Analog states
  271. CBitVec<BUTTON_CODE_LAST> m_ButtonState;
  272. int m_ButtonPressedTick[ BUTTON_CODE_LAST ];
  273. int m_ButtonReleasedTick[ BUTTON_CODE_LAST ];
  274. int m_pAnalogDelta[ ANALOG_CODE_LAST ];
  275. int m_pAnalogValue[ ANALOG_CODE_LAST ];
  276. CUtlVector< InputEvent_t > m_Events;
  277. bool m_bDirty;
  278. };
  279. // Steam Controller
  280. struct steampad_t
  281. {
  282. steampad_t()
  283. {
  284. m_nHardwareIndex = 0;
  285. m_nJoystickIndex = INVALID_USER_ID;
  286. m_nLastPacketIndex = 0;
  287. active = false;
  288. memset( lastAnalogKeys, 0, sizeof( lastAnalogKeys ) );
  289. }
  290. bool active;
  291. sKey_t lastAnalogKeys[MAX_STEAMPADAXIS];
  292. appKey_t m_appSKeys[ SK_MAX_KEYS ];
  293. // Hardware index and joystick index don't necessarily match
  294. // Joystick index will depend on the order of multiple initialized devices
  295. // Which could include other controller types
  296. // Hardware index should line up 1:1 with the order they're polled
  297. // and could change based on removing devices, unlike Joystick Index
  298. uint32 m_nHardwareIndex;
  299. int m_nJoystickIndex;
  300. uint32 m_nLastPacketIndex;
  301. };
  302. steampad_t m_SteamControllerDevice[MAX_STEAM_CONTROLLERS];
  303. uint32 m_unNumSteamControllerConnected;
  304. bool m_bControllerModeActive;
  305. int m_nControllerType[MAX_JOYSTICKS+MAX_STEAM_CONTROLLERS];
  306. //Steam controllers start after this index.
  307. int m_nJoystickBaseline;
  308. public:
  309. // Initializes all Xbox controllers
  310. void InitializeXDevices( void );
  311. // Opens an Xbox controller
  312. void OpenXDevice( xdevice_t* pXDevice, int userId );
  313. // Closes an Xbox controller
  314. void CloseXDevice( xdevice_t* pXDevice );
  315. // Samples the Xbox controllers
  316. void PollXDevices( void );
  317. // Samples console mouse
  318. void PollXMouse();
  319. // Samples console keyboard
  320. void PollXKeyboard();
  321. // Helper function used by ReadXDevice to handle stick direction events
  322. void HandleXDeviceAxis( xdevice_t *pXDevice, int nAxisValue, xKey_t negativeKey, xKey_t positiveKey, int axisID );
  323. // Samples an Xbox controller and queues input events
  324. void ReadXDevice( xdevice_t* pXDevice );
  325. // Submits force feedback data to an Xbox controller
  326. void WriteToXDevice( xdevice_t* pXDevice );
  327. // Sets rumble values for an Xbox controller
  328. void SetXDeviceRumble( float fLeftMotor, float fRightMotor, int userId );
  329. #if !defined( _CERT ) && !defined(LINUX)
  330. CON_COMMAND_MEMBER_F( CInputSystem, "press_x360_button", PressX360Button, "Press the specified Xbox 360 controller button (lt, rt, st[art], ba[ck], lb, rb, a, b, x, y, l[eft], r[right], u[p], d[own])", 0 );
  331. void PollPressX360Button( void );
  332. uint32 m_press_x360_buttons[ 2 ];
  333. #endif
  334. #if defined( _PS3 )
  335. void PS3_PollKeyboard( void );
  336. void PS3_PollMouse( void );
  337. void PS3_XInputPollEverything( BCellPadDataHook_t hookFunc, BCellPadNoDataHook_t hookNoDataFunc );
  338. DWORD PS3_XInputGetState( DWORD dwUserIndex, PXINPUT_STATE pState );
  339. void HandlePS3SharpshooterButtons( void );
  340. void HandlePS3Move( PXINPUT_STATE& pState );
  341. virtual void PS3SetupHardwareCursor( void* image );
  342. #endif
  343. void QueueMoveControllerRumble( float fRightMotor );
  344. // Posts an Xbox key event, ignoring key repeats
  345. void PostXKeyEvent( int nUserId, xKey_t xKey, int nSample );
  346. // Dispatches all joystick button events through the game's window procs
  347. void ProcessEvent( UINT uMsg, WPARAM wParam, LPARAM lParam );
  348. // Initializes SteamControllers - Returns true if steam is running and finds controllers, otherwise false
  349. bool InitializeSteamControllers( void );
  350. // Samples all Steam Controllers - returns true if active this frame
  351. bool PollSteamControllers( void );
  352. // Initializes joysticks
  353. void InitializeJoysticks( void );
  354. // Samples the joystick
  355. void PollJoystick( void );
  356. // Update the joystick button state
  357. void UpdateJoystickButtonState( int nJoystick );
  358. // Update the joystick POV control
  359. void UpdateJoystickPOVControl( int nJoystick );
  360. // Record button state and post the event
  361. void JoystickButtonEvent( ButtonCode_t button, int sample );
  362. bool IsSteamControllerActive() const;
  363. void SetSteamControllerMode( const char *pSteamControllerMode, const void *obj );
  364. private:
  365. // Purpose: Get raw joystick sample along axis
  366. #if defined(LINUX)
  367. void AxisAnalogButtonEvent( ButtonCode_t buttonCode, bool state, int nLastSampleTick );
  368. #elif defined(OSX)
  369. unsigned int AxisValue( JoystickAxis_t axis, JoystickInfo_t &info );
  370. #else
  371. unsigned int AxisValue( JoystickAxis_t axis, JOYINFOEX& ji );
  372. #endif
  373. // Chains the window message to the previous wndproc
  374. LRESULT ChainWindowMessage( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  375. // Post an event to the queue
  376. void PostEvent( int nType, int nTick, int nData = 0, int nData2 = 0, int nData3 = 0 );
  377. // Deals with app deactivation (sends a bunch of button released messages)
  378. void ActivateInputSystem( bool bActivated );
  379. // Determines all mouse button presses
  380. int ButtonMaskFromMouseWParam( WPARAM wParam, ButtonCode_t code = BUTTON_CODE_INVALID, bool bDown = false ) const;
  381. // Updates the state of all mouse buttons
  382. void UpdateMouseButtonState( int nButtonMask, ButtonCode_t dblClickCode = BUTTON_CODE_INVALID );
  383. // Copies the input state record over
  384. void CopyInputState( InputState_t *pDest, const InputState_t &src, bool bCopyEvents );
  385. // Post an button press/release event to the queue
  386. void PostButtonPressedEvent( InputEventType_t nType, int nTick, ButtonCode_t scanCode, ButtonCode_t virtualCode );
  387. void PostButtonReleasedEvent( InputEventType_t nType, int nTick, ButtonCode_t scanCode, ButtonCode_t virtualCode );
  388. // Release all buttons
  389. void ReleaseAllButtons( int nFirstButton = 0, int nLastButton = BUTTON_CODE_LAST - 1 );
  390. // Zero analog state
  391. void ZeroAnalogState( int nFirstState, int nLastState );
  392. // Converts xbox keys to button codes
  393. ButtonCode_t XKeyToButtonCode( int nUserId, int nXKey ) const;
  394. // Converts SteamController keys to button codes
  395. ButtonCode_t SKeyToButtonCode( int nUserId, int nXKey ) const;
  396. // Computes the sample tick
  397. int ComputeSampleTick();
  398. // Clears the input state, doesn't generate key-up messages
  399. void ClearInputState( bool bPurgeState );
  400. // Called for mouse move events. Sets the current x and y and posts events for the mouse moving.
  401. void UpdateMousePositionState( InputState_t &state, short x, short y );
  402. // Should we generate UI events?
  403. bool ShouldGenerateUIEvents() const;
  404. // Generates LocateMouseClick messages
  405. void LocateMouseClick( LPARAM lParam );
  406. // Initializes, shuts down cursors
  407. void InitCursors();
  408. void ShutdownCursors();
  409. #ifdef WIN32
  410. void PollInputState_Windows();
  411. #endif
  412. // Poll input state for different OSes.
  413. #if defined( PLATFORM_OSX )
  414. void PollInputState_OSX();
  415. void HIDGetElementInfo( CFTypeRef refElement, OSXInputValue_t &input );
  416. bool HIDBuildDevice( io_object_t ioHIDDeviceObject, JoystickInfo_t &info );
  417. bool HIDCreateOpenDeviceInterface( io_object_t hidDevice, JoystickInfo_t &info );
  418. void HIDGetDeviceInfo( io_object_t hidDevice, CFMutableDictionaryRef hidProperties, JoystickInfo_t &info );
  419. void HIDGetElements( CFTypeRef refElementCurrent, JoystickInfo_t &info );
  420. void HIDGetCollectionElements( CFMutableDictionaryRef deviceProperties, JoystickInfo_t &info );
  421. void HIDDisposeDevice( JoystickInfo_t &info );
  422. int HIDGetElementValue( JoystickInfo_t &info, OSXInputValue_t &value );
  423. int HIDScaledCalibratedValue( JoystickInfo_t &info, OSXInputValue_t &value );
  424. void HIDSortJoystickButtons( JoystickInfo_t &info );
  425. #elif defined(LINUX)
  426. public:
  427. void PollInputState_Linux();
  428. void JoystickHotplugAdded( int joystickIndex );
  429. void JoystickHotplugRemoved( int joystickId );
  430. void JoystickButtonPress( int joystickId, int button ); // button is a SDL_CONTROLLER_BUTTON;
  431. void JoystickButtonRelease( int joystickId, int button ); // same as above.
  432. void JoystickAxisMotion( int joystickId, int axis, int value );
  433. #endif
  434. private:
  435. #if defined( USE_SDL ) || defined( OSX )
  436. ILauncherMgr *m_pLauncherMgr;
  437. #endif
  438. WNDPROC m_ChainedWndProc;
  439. HWND m_hAttachedHWnd;
  440. HWND m_hLastIMEHWnd;
  441. bool m_bEnabled;
  442. bool m_bPumpEnabled;
  443. bool m_bIsPolling;
  444. bool m_bIMEComposing;
  445. bool m_bIsInGame;
  446. // Current button state
  447. InputState_t m_InputState[INPUT_STATE_COUNT];
  448. DWORD m_StartupTimeTick;
  449. int m_nLastPollTick;
  450. int m_nLastSampleTick;
  451. int m_nPollCount;
  452. // Mouse wheel hack
  453. UINT m_uiMouseWheel;
  454. // Joystick info
  455. CUtlFlags<unsigned short> m_JoysticksEnabled;
  456. int m_nJoystickCount;
  457. bool m_bXController;
  458. bool m_bSteamController;
  459. float m_flLastSteamControllerInput;
  460. float m_flLastControllerPollTime;
  461. public:
  462. JoystickInfo_t m_pJoystickInfo[ MAX_JOYSTICKS ];
  463. private:
  464. // Xbox controller info
  465. appKey_t m_appXKeys[ XUSER_MAX_COUNT ][ XK_MAX_KEYS ];
  466. xdevice_t m_XDevices[ XUSER_MAX_COUNT ];
  467. // Used to determine whether to generate UI events
  468. int m_nUIEventClientCount;
  469. // raw mouse input
  470. bool m_bRawInputSupported;
  471. int m_mouseRawAccumX, m_mouseRawAccumY;
  472. // Current mouse capture window
  473. PlatWindow_t m_hCurrentCaptureWnd;
  474. // For the 'SleepUntilInput' feature
  475. HANDLE m_hEvent;
  476. // Cursors, foiled again!
  477. InputCursorHandle_t m_pDefaultCursors[ INPUT_CURSOR_COUNT ];
  478. CUtlStringMap< InputCursorHandle_t > m_UserCursors;
  479. CSysModule *m_pXInputDLL;
  480. CSysModule *m_pRawInputDLL;
  481. // NVNT falcon module
  482. CSysModule *m_pNovintDLL;
  483. private:
  484. bool m_bCursorVisible;
  485. bool m_bMotionControllerActive;
  486. Quaternion m_qMotionControllerOrientation;
  487. float m_fMotionControllerPosX;
  488. float m_fMotionControllerPosY;
  489. Vector m_vecMotionControllerPos;
  490. int m_nMotionControllerStatus;
  491. uint64 m_nMotionControllerStatusFlags;
  492. public:
  493. InputCursorHandle_t m_hCursor;
  494. #ifdef _PS3
  495. BCellPadDataHook_t m_pPS3CellPadDataHook;
  496. BCellPadNoDataHook_t m_pPS3CellNoPadDataHook;
  497. bool m_PS3KeyboardConnected;
  498. bool m_PS3MouseConnected;
  499. #endif
  500. // describes all connected devices. A bitmask of InputDevice entries
  501. InputDevice_t m_currentlyConnectedInputDevices;
  502. // describes the current default input device
  503. InputDevice_t m_currentInputDevice;
  504. // number of different input devices on this platform
  505. bool m_setCurrentInputDeviceOnNextButtonPress;
  506. };
  507. // Should we generate UI events?
  508. inline bool CInputSystem::ShouldGenerateUIEvents() const
  509. {
  510. return m_nUIEventClientCount > 0;
  511. }
  512. #endif // INPUTSYSTEM_H