Torque/EngineMods/Xbox360ControllerSupport

From TDN

Contents

Joysticks, Xbox 360 Controllers for Windows, and Rumble!

This project is a series of TAP 1.4 engine modifications (TAP is the core engine that underlies TGB, TGE, and TSE) to enable:

  • Improved support for traditional PC gamepads on Windows (d-pads now work properly as POV hats)
  • Support for fixed-function force feedback, or "rumble," on joysticks which support it and have an appropriate driver. I've tested my support on two different controllers: an Xbox S Controller that I modded for my PC using the XBCD drivers (freely available) and a PC-based PS DUAL STRIKE controller with rumble, bought at EB Games for $10.
  • Support for wired Xbox 360 Game Controllers using the new Microsoft XInput APIs for the best possibile performance and reliability.
  • Support for rumble on Xbox 360 Game Controllers
  • Supports up to four simultaneous Xbox 360 Controllers and gracefully handles connecting and disconnecting during gameplay



If you want to build a "console-like" game, this engine patch is a must have and it's easy to install and use. I've also included a pack of 4 samples:

  • SimpleJoystick: a basic sample showing how to read a joystick w/ all the fixings
  • RumbleJoystick: a sample showing how to use force feedback-based rumble on traditional PC joysticks
  • SimpleXInput: a sample showing how to work with up to four Xbox 360 Controllers simultaneously. Plug 'em in and out while the sample is running!
  • RumbleXInput: a sample showing how to rumble up to four Xbox 360 Controllers simultaneously.

Requirements

Source Code

The source code is available here.

For simplicitly, I've included full versions of the affected source files. Simply drop these over the equivalent copy in your source code and rebuild. I currently build these files with Microsoft Visual Studio 2005 with no compiler warnings or errors against T2D 1.1 Beta 1.1 platform sources (this uses TGE 1.4 as its base).

Samples Ready to Run w/ Full Source Code

The Torque samples with full source code are available here.

A precompiled SHIP build of TGB 1.1 Beta 2 with XInput mod applied is available here.

To use these samples: 1. Download the zip files and expand to a directory on your computer. 1. Go into the expanded folder and run one of the four sample .bat file starters: runSimpleJoystick.bat, runRumbleJoystick.bat, runSimpleXInput.bat, and runRumbleXInput.bat

Enjoy!