Using A TeensyLC To Emulate The XBOX 360 Controller

After the release of Mortal Kombat X, [Zachery’s] gaming group wanted to branch out into the fighter genre. They quickly learned that in order to maximize their experience, they would need a better controller than a standard gamepad. A keyboard wasn’t going to cut it either. They wanted a fight stick. These are large controllers that look very much like arcade fighting controls and include a joystick and large buttons. [Zachery’s] group decided to build their own fight stick for use with a PC.

[Zachery] based his build around the TeensyLC, which is a 32 bit development board with an ARM processor. It’s also compatible with Arduino. The original version of his project setup the controller as a HID, essentially emulating a keyboard. This worked for a while until they ran into compatibility issues with some games. [Zachery] learned that his controller was compatible with DirectInput, which has been deprecated. The new thing is Xinput, and it was going to require more work.

Using Xinput meant that [Zachery] could no longer use the generic Microsoft HID driver. Rather than write his own drivers, he decided to emulate the XBOX 360 controller. When the fight stick is plugged into the computer, it shows up as an XBOX 360 controller and Windows easily installs the pre-built driver. To perform the emulation, [Zachery] first had to set the VID and PID of the device to be identical to the XBOX controller. This is what allows the Microsoft driver to recognize the device.

Next, the device descriptor and configuration descriptor had to be added to the Teensy’s firmware. The device descriptor includes information such as USB version, device class, protocol, etc. The configuration descriptor includes additional information about the device configuration. [Zachery] used Microsoft Message Analyzer to pull the configuration descriptor from a real XBOX 360 controller, then used the same data in his own custom controller.

[Zachery] programmed the TeensyLC using the Arduino IDE. He ran into some trouble here because the IDE did not include the correct device type for an Xinput device. [Zachery] had to edit the boards.txt file and add three lines of code in order to add a new hardware device to the IDE’s menu. Several other files also had to be modified to make sure the compiler knew what an Xinput device type was.  With all of that out of the way, [Zachery] was finally able to write the code for his controller.

11 thoughts on “Using A TeensyLC To Emulate The XBOX 360 Controller

  1. Excellent build. There are plenty of cheaper, easier, and more flexible (and various combinations of the three) ways to do this; Cthulhu boards with more cross-platform interoperability, cheap ebay PS3 “encoder” boards + Xinput emulation, PS360+ boards with Xbox 360 + PS3 compatibility, etc.) But nothing beats building something up yourself.

    That said, and it looks like the source article kept this in mind, this is NOT emulating a 360 controller — this is emulating an XInput controller. Unless I missed something, this isn’t attempting to emulate the security chip that MS requires 360 controllers to utilize, so it won’t register on a console. It’s perfectly fine for PC games that use Xinput, though.

    Attractive build, too!

    1. x360 emulator essentially any joystick game wheel etc you can connect can be emulated mapped as a xbox 360 controller
      asfaik Win 32/64 only
      thoughts: was kind of a pain to find the right dxdll (xinput hook dll basically) to use for my game but once I did no problems whatsoever it even featured a database with common button configurations if I so choose.
      Not sure of the status of the project but I’d try it first again If I had another xinput crippled game.

    2. I looked at a Cthulhu and the PS360+. Both were much higher than the $13 we paid for each teensyLC. Just didn’t seem worth the extra cash to support platforms we didn’t own and had no intention of using. Plus I mention that originally I figured I would just be creating a HID joystick which took all of 30 minutes to set up haha! Like you said though, it ended up being a lot of fun completing this project and then making the writeup and showing others is a really fun experience as well!

      I tried to be as clear as I could that I was not attempting to crack the Infineon chip. I chose to still refer to this as emulating the 360 controller only because of how the hack works. The PC thinks I am a 360 controller and I do pretend to be one. It just doesn’t also work on the 360 because of the handshake, unfortunately. If the teensy arduino environment had USB host support, it would be neat to combine BrandonW’s salamax project into this. Perhaps in the future though!

      1. Something else that sparks my interest is the infineon chip itself. I wonder how the interface works. Would be really cool to be able to desolder the security chips from broken controllers and use them with this project.

  2. Cool project.

    I went further and built a dual analog stick controller (from scratch) using a wii u pro controller as a base, and bluetooth wireless adapter that makes it function as an xbox 360. From there, using a cronusmax, I can use it for Wii U games (mario, etc), PC, Xbox One, PS4, etc… all wirelessly. And program in rapid fire / turbo / combos / whatever.

    It cost me over 500 bucks all told (the analog sticks are VERY expensive), but I wanted to be able to play Mario Bros on my Wii U with everyone and it works great. Plus I can play Gauntlet with it, Geometry Wars, it’s really fun. Only problem is the right analog stick needs a trigger so I can shoot without taking my hands off it.

    I might share it but it looks pretty awesome. I really want to add that right stick trigger somehow. I did all the custom wiring from the wii u pro controller using eurostyle connectors. The analog sticks were super easy to hook up to 150 dollar Suzo-Happ sticks that use 5k pots but it doesn’t matter because the resistance is negated since your modulating the potential between the two leads, not the resistance.

    The joystick that most of these arcade sticks use are digital switches (on/off) and therefore useless for most games requiring precise control, you basically can’t play anything except fighting games with them. Not to mention lacking a second stick altogether.

  3. I ran into compatibility issues when I tried to do this. Windows Street Fighter 4 was fine as long as you pretended to be a 360 controller instead of a generic one, but for some reason Windows Street Fighter 4 AE wouldn’t even recognize an third party 360 controller I tried, let alone my board.

    In the end I just gave up and soldered in a PCB from an official 360 controller. I’d be interested to hear what games you’ve tried yours with so far, as I’m not expecting the solder job on those microscopic traces to last forever and a neater solution would be nice.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.