Xbox 360 controller - Z trigger problem
by Adios, Man! · in Torque Game Engine · 01/06/2006 (12:22 pm) · 7 replies
As many people have noted before; the left and right trigger buttons are bound together as the z-axis, and there is effectively no way to read them as separate buttons. Our temporary solution has us treating z=1 and z=0 as separate events, and linking them both to two functions that the player is unlikely to use at the same time.
Supposedly, the 360 controller works with marble blast ultra (with both triggers working?), and it is known that certain modifications have to be made to the input code to get it to work. We, for example, have mapped all of the SI_POV inputs to a single variable, which reports each of the 9 possible POV states.
As has been suggested, I've been trying to "intercept" input data from the controller. However, it seems as though once the data gets to DInputDevice::buildEvent, the triggers have already been routed to the z-axis. The problem begins right at the beginning: the controller is seen as having 5 axises, when it in fact has 6.
Is there a lower level where we can read the input data directly? Is there any use trying at all, as long as the windows drivers only see the 5 axises? I suspect that anything and everything input-wise comes through DInputDevice::processAsync, but I'm afraid of what would happen if I tried to manually read the eventBuffer.
(Then again, any data that came through processAsync that was not recognized would cause a fatal assert in findObjInstance...)
Supposedly, the 360 controller works with marble blast ultra (with both triggers working?), and it is known that certain modifications have to be made to the input code to get it to work. We, for example, have mapped all of the SI_POV inputs to a single variable, which reports each of the 9 possible POV states.
As has been suggested, I've been trying to "intercept" input data from the controller. However, it seems as though once the data gets to DInputDevice::buildEvent, the triggers have already been routed to the z-axis. The problem begins right at the beginning: the controller is seen as having 5 axises, when it in fact has 6.
Is there a lower level where we can read the input data directly? Is there any use trying at all, as long as the windows drivers only see the 5 axises? I suspect that anything and everything input-wise comes through DInputDevice::processAsync, but I'm afraid of what would happen if I tried to manually read the eventBuffer.
(Then again, any data that came through processAsync that was not recognized would cause a fatal assert in findObjInstance...)
#2
msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/dx9_xinput....
here is thier gamepad structure:
msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/XINPUT_GAME...
01/06/2006 (1:20 pm)
I believe if you switch from DirectInput to XInput then the triggers will be registered correctly:msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/dx9_xinput....
here is thier gamepad structure:
msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/XINPUT_GAME...
#3
I actually downloaded the December 2005 directx sdk right when it came out, but I was expecting the new 360 code to be included in directinput. Turns out that I had everything I needed back then; the XInput api and code samples were right there.
One thing, though. In the examples they give on the website, they use the WMI (windows management instrumentation) to poll the device for the id to check to see if it is an xbox controller, using that information to NOT ennumerate the device with directinput. From what I can tell, the WMI api doesn't work with VC6.
Reading the data via xinput couldn't be easier. It seems all you have to do is call XInputGetState, and use the result to determine which controllers and plugged in, and read the state at your convenience.
How to bolt xinput into toruqe with a minimum of effort? Who knows? Because I cannot NOT ennumerate the controller (without WMI), I could simply call XInputGetState on any and all connected joysticks, and take over processing in DInputDevice::processAsync(), sending the results back down the same pipe that torque already uses.
I'll post here my results.
01/06/2006 (2:37 pm)
Cool. Thanks Matt.I actually downloaded the December 2005 directx sdk right when it came out, but I was expecting the new 360 code to be included in directinput. Turns out that I had everything I needed back then; the XInput api and code samples were right there.
One thing, though. In the examples they give on the website, they use the WMI (windows management instrumentation) to poll the device for the id to check to see if it is an xbox controller, using that information to NOT ennumerate the device with directinput. From what I can tell, the WMI api doesn't work with VC6.
Reading the data via xinput couldn't be easier. It seems all you have to do is call XInputGetState, and use the result to determine which controllers and plugged in, and read the state at your convenience.
How to bolt xinput into toruqe with a minimum of effort? Who knows? Because I cannot NOT ennumerate the controller (without WMI), I could simply call XInputGetState on any and all connected joysticks, and take over processing in DInputDevice::processAsync(), sending the results back down the same pipe that torque already uses.
I'll post here my results.
#4
01/07/2006 (2:53 pm)
XInput is fantastic. I thought I saw someone who had done an XInput device for Torque, though I don't remember who, or where I saw it.
#5
01/07/2006 (4:37 pm)
I did, but it's only released to TDN users with T2D access. The reason is my redistributable includes the T2D exe with the compiled changes and I wasn't sure about EULA issues. Also, I can't seem to find a way to manage permissions to my TDN pages after the new update.
#6
01/08/2006 (1:11 am)
You can't manage permissions unless you're a sysop - if you toss me an e-mail I can adjust the appropriate permissions for you.
#7
Merci
02/18/2006 (5:29 pm)
Pardon my newbosity but would anyone be interested on doing a tutorial for this that could work with TGE (and others)? With the influx of new users I can see GG getting because of the XBLA press lately I think it would be a valuable resource.Merci
Associate Scott Burns
GG Alumni