Xbox 360 Controllers for Windows diff coming to TGE 1.3 / T2D
by Jason Cahill · in Torque Game Builder · 11/21/2005 (12:24 am) · 49 replies
Who wants it? Because I'm putting the finishing touches on this sweet little bad boy (which will be ready before Thanksgiving on TDN). And, I'm not talking about doing it the crappy way (using the driver's built-in Joystick emulation). I'm talking about using the actual MS XInput APIs to go right to the device! That means actual mappings to things like:
actionMap.bind("xinput0", "A", "APressed();" "AReleased();");
actionMap.bind("xinput0", "START", "StartPressed();" "StartReleased();");
Oh yeah, that means graceful connection & disconnection of gamepads, support for up to four controllers on a single PC (mapped to "xinput0" to "xinput3"), the analog triggers work correctly (unlike the Joystick driver)... and wait for it... RUMBLE!
My source diff will also fix up TGE 1.3's poor support for traditional gamepads and also supports "fixed function" force-feedback rumble, in case you have an older Xbox 1 controller that you modded for your PC with XBCD drivers, or a PS-compatible dual strike controller with rumble.
In any event... it's all goodness for you guys. All I ask in return? That we politely voice our words of support to our GG gate keepers to get us a build of T2D 1.1. :-)
See... I'm a reasonable guy. I have something to offer quid... pro... quo.
actionMap.bind("xinput0", "A", "APressed();" "AReleased();");
actionMap.bind("xinput0", "START", "StartPressed();" "StartReleased();");
Oh yeah, that means graceful connection & disconnection of gamepads, support for up to four controllers on a single PC (mapped to "xinput0" to "xinput3"), the analog triggers work correctly (unlike the Joystick driver)... and wait for it... RUMBLE!
My source diff will also fix up TGE 1.3's poor support for traditional gamepads and also supports "fixed function" force-feedback rumble, in case you have an older Xbox 1 controller that you modded for your PC with XBCD drivers, or a PS-compatible dual strike controller with rumble.
In any event... it's all goodness for you guys. All I ask in return? That we politely voice our words of support to our GG gate keepers to get us a build of T2D 1.1. :-)
See... I'm a reasonable guy. I have something to offer quid... pro... quo.
Disclaimer: This diff will only work on Windows PCs running Windows 2000 or above with Direct X 9 (October 2005 edition) available for download right now at MSDN... You will need to purchase an Xbox 360 Game Controller (wired) or and Xbox 360 Game Controller (wireless) with the optional USB plug+charge cable attached... Sorry, no wireless controllers to the PC. :-(
About the author
#42
I simply copied the files from: http://tdn.garagegames.com/wiki/Torque/EngineMods/Xbox360ControllerSupport
I have Microsoft DirectX SDK (April 2006) installed and linked
I have an XBox360 Controller with the Drivers from the CD installed.
I simply copy the engine directory over to my Base TGE directory. Say "Yes to all" and then I rebuild the system.
I am getting the following errors:
\engine\console\consolefunctions.cc(1278) : error C2039: 'findMatchMultiExprs' : is not a member of 'ResManager'
1>\engine\core\resmanager.h(325) : see declaration of 'ResManager'
1>\engine\console\consolefunctions.cc(1432) : error C3861: 'dPathCopy': identifier not found
1>\engine\console\consolefunctions.cc(1497) : error C2039: 'getExecutableName' : is not a member of 'Platform'
1>\engine\platform\platform.h(279) : see declaration of 'Platform'
1>\engine\console\consolefunctions.cc(1497) : error C3861: 'getExecutableName': identifier not found
What am I mising?
Thanks.
06/26/2006 (3:31 pm)
OK, I am trying to get this resouce to work under TGE 1.4. I simply copied the files from: http://tdn.garagegames.com/wiki/Torque/EngineMods/Xbox360ControllerSupport
I have Microsoft DirectX SDK (April 2006) installed and linked
I have an XBox360 Controller with the Drivers from the CD installed.
I simply copy the engine directory over to my Base TGE directory. Say "Yes to all" and then I rebuild the system.
I am getting the following errors:
1>
1>
1>
1>
1>
What am I mising?
Thanks.
#43
I simply took the functions that were missing from in TGE and put them in from T2D/TGB. It compiled after few minutes of yelling at the code -- tweak here/tweak there. I don't know if this fully worked, or what effects in the long run it will have on TGE, but I guess I will find out.
I was going to tweak the resource to work based on the Engine (meaning remove the functions the Resource says it needs)...but due to me being new to the inner workings of TGE I didn't want to do funny things to the Resource since it worked as it was given to us. So bending TGE seemed like the way to go to me.
If there is a cleaner way to do this in TGE please let me know.
By the way, it just worked in T2D/TGB -- AWESOME resource!!!
Thanks.
06/27/2006 (11:05 am)
I have a fix, but it makes me feel a little dirty :)I simply took the functions that were missing from in TGE and put them in from T2D/TGB. It compiled after few minutes of yelling at the code -- tweak here/tweak there. I don't know if this fully worked, or what effects in the long run it will have on TGE, but I guess I will find out.
I was going to tweak the resource to work based on the Engine (meaning remove the functions the Resource says it needs)...but due to me being new to the inner workings of TGE I didn't want to do funny things to the Resource since it worked as it was given to us. So bending TGE seemed like the way to go to me.
If there is a cleaner way to do this in TGE please let me know.
By the way, it just worked in T2D/TGB -- AWESOME resource!!!
Thanks.
#44
I'm just wondering if there's a newer version of this resource available for TGB (T2D v1.1.2, TGB v1.1.1)? It seems that some of the files are older than the shipped ones, and I'm getting compiler errors. I'm going to go through file-by-file and try to manually insert all the new/modified chunks, but if anyone has done this already... ;)
- Matthew Durante
EDIT: Link error actually:
7>guiCanvas.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Input::setCursorPos(int,int)" (?setCursorPos@Input@@SAXHH@Z) referenced in function "public: virtual void __thiscall GuiCanvas::setCursorPos(class Point2I const &)" (?setCursorPos@GuiCanvas@@UAEXABVPoint2I@@@Z)
I might be able to track this down (just started playing with the source), but I'm worried there may be other important changes in the newer files being overwritten by the resource, so I think it pays to be careful...
11/28/2006 (8:56 am)
Hello!I'm just wondering if there's a newer version of this resource available for TGB (T2D v1.1.2, TGB v1.1.1)? It seems that some of the files are older than the shipped ones, and I'm getting compiler errors. I'm going to go through file-by-file and try to manually insert all the new/modified chunks, but if anyone has done this already... ;)
- Matthew Durante
EDIT: Link error actually:
7>guiCanvas.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Input::setCursorPos(int,int)" (?setCursorPos@Input@@SAXHH@Z) referenced in function "public: virtual void __thiscall GuiCanvas::setCursorPos(class Point2I const &)" (?setCursorPos@GuiCanvas@@UAEXABVPoint2I@@@Z)
I might be able to track this down (just started playing with the source), but I'm worried there may be other important changes in the newer files being overwritten by the resource, so I think it pays to be careful...
#45
7>guiCanvas.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Input::setCursorPos(int,int)" (?setCursorPos@Input@@SAXHH@Z)
Any ideas??
I'm using the december 2006 redistributable, since that is what I have installed and you cannot revert.
I am also using it with tge 1.5...
02/11/2007 (12:02 pm)
I'm having the same error as Matthew:7>guiCanvas.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Input::setCursorPos(int,int)" (?setCursorPos@Input@@SAXHH@Z)
Any ideas??
I'm using the december 2006 redistributable, since that is what I have installed and you cannot revert.
I am also using it with tge 1.5...
#46
winInput.cc:
//------------------------------------------------------------------------------
// This function is missing from the xbox 360 stuff!!!!
void Input::setCursorPos(S32 x, S32 y)
{
POINT pt;
pt.x = x;
pt.y = y;
ClientToScreen(winState.appWindow, &pt);
SetCursorPos(pt.x, pt.y);
}
- Matthew Durante
02/11/2007 (1:02 pm)
I ended up manually merging all the code in the xbox 360 controller resource, manually modifying existing files with the changes in the resource files. It took awhile, and in some area I think I had to do some guesswork, but I did eventually succeed.winInput.cc:
//------------------------------------------------------------------------------
// This function is missing from the xbox 360 stuff!!!!
void Input::setCursorPos(S32 x, S32 y)
{
POINT pt;
pt.x = x;
pt.y = y;
ClientToScreen(winState.appWindow, &pt);
SetCursorPos(pt.x, pt.y);
}
- Matthew Durante
#47
Now I'm receiving an error that it cannot find the function enableXInput in the tge console on the examples.
Any clue??
I receive no errors on compile.
02/11/2007 (2:10 pm)
That worked great! Thanks!Now I'm receiving an error that it cannot find the function enableXInput in the tge console on the examples.
Any clue??
I receive no errors on compile.
#49
I tested in on TGE 1.5 and TGB 1.1.3 on my XP computer. If I remember correctly, it does work on Windows2000 after installing the driver from Microsoft, but it has been some time. I do not know if it works on Mac or Linux. In theory, as long as the system can recognize the controller, that map should work. Is there anyone will to test it?
02/19/2007 (9:55 pm)
You guys do know that the Xbox 360 Controller is indirectly supported by the engine as is. I have not found anything about rumble/feedback, but all the inputs can be mapped. I tested the script on TGE and TGB and it can be found on the TDN. I tested in on TGE 1.5 and TGB 1.1.3 on my XP computer. If I remember correctly, it does work on Windows2000 after installing the driver from Microsoft, but it has been some time. I do not know if it works on Mac or Linux. In theory, as long as the system can recognize the controller, that map should work. Is there anyone will to test it?
Torque Owner Dave "Jellybit" Freeman