WIP / Full XBox 360 Controller DLL with Voice support |
| Author | Message | ||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Full XBox 360 Controller Library
For Dark Basic Professional And Dark GDK! NEW For August 30, 2010: CHATPADS: Unfortunately as of this date, Microsoft has yet to make drivers for chatpads to work for the PC. Found the info at the XNA site: http://forums.xna.com/forums/t/5003.aspx Notice to Wireless Controller Users: You may have a wireless controller that can work by itself with the PC, but unable to get connected accessories to work correctly through the wireless controller. After gathering a lot of info about different complaints on the web through google about wireless 360 controllers, most likely I will not be able to do anything about it with my library. The library simply takes info directly from the XInput.dll and gives it to you. There is no special separate XInput functionality and/or parameters for me to use/differentiate between wireless connections and wired connections. That's the XInput DLL's job because all we want is the data/info it gives us. Wired + Accessories works 100%, but wireless + Accessories don't? There's no special XInput option for me to enable for that. It doesn't work like that. Some problems found from the web about wireless controllers: Just in case, this is the direct instructions on how to connect a wireless controller with the PC receiver: X12-35608-01_NA_EN_FR_ES.pdf This is where I'm getting all these wireless issues from at google: wireless 360 gamepad PC Here's the Post about these findings if you want to discuss it more ------------------------------------------------------------------- NEW For August 29, 2010: You are now able to download latest XBox360 Controller Libraries at ExoDev.Com in the Downloads section. You do not have to register at the website to download. NEW For August 24, 2010: Beta Time! Introduced the XInput Keystroke Functionality! This should work if you want to use your XB360 ChatPad for instance. Go to this Post to go to the beta download. NEW For July 15,2010: Minor update on the DBPro version: String Name for XB360_CHECK_HEADSET_CONNECTIONS in Dll was not correctly written. ------------ NEW For May 15, 2010: Updated both DBPro and DarkGDK dlls so that the DPAD will return correct results. Docs updated. ------------ Documentation is in html format and pretty much complete. I probably could explain more things more clearly though. But, if you have any questions about it, please ask away! I consider this still work in progress because I dont know how well this voice support is done. Will it work good enough for you? Will the network programming guru's out there be able to take the current sound data and send it over the network to another user and be able to hear the voice sound data good enough? Like with XBox Live? For me, the sound data sounds good enough when played into my XBox 360 headset. But, It sounds sort of choppy when converted into a sound in a memblock for DBPro to play with Play Sound. Not that bad though. And ofcoarse, it's still wip because it needs to be tested by the masses! I want to make sure it works for all of you and not just me. * Note: This is not just for the XBox360 gamepad! It's for all xbox360 controllers like the guitar. Try it out. * Note: The "Guide" Button on the gamepad for example is for Microsoft use only. I am not able to supply a function for it's use as there is no XInput functionality for me to code it. FUNCTIONS for DBPro: + Code Snippet FUNCTIONS for Dark GDK: + Code Snippet * Download is in rar format. Don't have a utility to unrar rar files? Search google for Winrar! Extract XB360CL_DBPro_1_2.rar into your Dark Basic Professional Directory and/or extract XB360CL_DarkGDK_1_2.rar into your Dark GDK directory. It will extract to a folder with the same name. LICENSE You are now able to download latest XBox360 Controller Libraries at ExoDev.Com in the Downloads section. You do not have to register at the website to download. NOTE: This DLL was compiled with the March 2009 version of DirectX. Make sure you have the latest! I'm working with the DBPro version 7.5beta and DarkGDK 7.4 * Here's a thread link to an executable of the DarkGDK example program. Have a quick try at it to see how your xbox 360 controller works with it. Any feedback on it would be greatly apprieciated, thanks: http://forum.thegamecreators.com/?m=forum_view&t=156031&b=22 * Attached is a boring picture of what the example program looks like. It just shows the values of the xbox360 controllers functionality. ---------------------------- Games used in: Ghost Planetoid From Outer Space By: jfroco ExoDev.Com - A Game Development Community Website! Featuring: XBOX360 CONTROLLER LIBRARY |
||
| Back to top |
|||
|
blobby 101
User Joined: Sat Jun 17th 2006 Location: England, UK |
Brilliant! Am downloading now. I've been thinking of getting a 360 controller for windows for a while, this has just finnaly talked me into doing it EDIT: Would it be possible to add a command for detecting when the Guide button is pressed? Obviously on the PC, that's not needed normally, but there could be a use for it in games. Your signature has been erased by a mod because it's larger than 600x120 |
||
| Back to top |
|||
|
Rampage
User Joined: Mon Feb 4th 2008 Location: New Zealand |
Brilliant man. First time I've actually programmed for my Xbox controller ![]() Eidos! |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Thanks guys. Unfortunitely, The DirectX XInput library does not provide any way to access the "Guide" button. It's probably specific only for the XBox 360 console itself. In fact, I do remmember reading somewhere in the SDK documentation that it's not supported on the PC. Use Dark GDK with the latest DirectX SDK! C2Q2.66ghz, 8gb RAM, Geforce 9800 GX2, Vista 64-bit |
||
| Back to top |
|||
|
blobby 101
User Joined: Sat Jun 17th 2006 Location: England, UK |
ah, Oh well - It's not too important Your signature has been erased by a mod because it's larger than 600x120 |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Arg. XB360 DPAD (Integer 0-3),Returns:Boolean Should read: XB360 DPAD (Integer 0-3),Returns:Integer It actaully returns an integer value 0-4: 0 = nothing 1 = UP 2 = DOWN 3 = LEFT 4 = RIGHT which is correctly used in the provided example code. Ya gotta luv doing docs! Use Dark GDK with the latest DirectX SDK! C2Q2.66ghz, 8gb RAM, Geforce 9800 GX2, Vista 64-bit |
||
| Back to top |
|||
|
Deathead
User ![]() Joined: Sat Oct 14th 2006 Location: Cyberspace |
|
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Thanks Deathead. Also, I forgot to mention about the XB360 GET BATTERY LEVEL function. If somebody has a wireless controller and a wireless headset with that usb wifi hook-up accessory thing for the PC, can you test that for me with the provided example?? Unfortunitely I cant test that as I dont have that accessory. I might have to fix the return values. Thanks. I wish I could buy all that stuff. Use Dark GDK with the latest DirectX SDK! C2Q2.66ghz, 8gb RAM, Geforce 9800 GX2, Vista 64-bit |
||
| Back to top |
|||
|
Xenocythe
User Joined: Thu May 26th 2005 Location: You Essay. |
If you were to have sold this, you probably would have gotten enough money to buy all that stuff! |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
lol. I just couldn't justify selling it. Plus, it gives me a chance to share something free with the cool community here. Use Dark GDK with the latest DirectX SDK! C2Q2.66ghz, 8gb RAM, Geforce 9800 GX2, Vista 64-bit |
||
| Back to top |
|||
|
Randomness 128
User ![]() Joined: Tue Feb 13th 2007 Location: Cyberspace |
Quote: "It actaully returns an integer value 0-4:
Can it not recognize diagonals? 0 = nothing 1 = UP 2 = DOWN 3 = LEFT 4 = RIGHT" |
||
| Back to top |
|||
|
qshoper
User Joined: Sun May 20th 2007 Location: Cyberspace |
hey is it possible to use this for FPS CREATOR? I am working a project and was thinking of importing a controller. It would totally save me a lot of time if it was possible to use this. |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Randomness 128, Unfortunitely not. The data taken directly from the XInput library's XInputGetState function only gives direct up,down,left or right directions. qshoper, Yes ofcoarse. It's released under the zlib license( which the zlib license is explained in the provided html documentation). So basically it's free to use for whatever purpose, commercial or non-commericial. EDIT: This library adopted the creative commons license ( LICENSE ) instead of the zlib library as it is more fitting. This library is not open source. It is still free to use for commercial or non-commericial use with credit. EDIT: DPAD now returns correct results... diagonally works. Screwed up on how I was returning the results. ExoDev.Com |XBOX360 CONTROLLER LIBRARY|USE DARK GDK WITH LATEST DIRECTX| C2Q2.66, 8G RAM, GeFORCE 9800 X2, VISTA 64Bit |
||
| Back to top |
|||
|
blobby 101
User Joined: Sat Jun 17th 2006 Location: England, UK |
Actually, FPS Creator has no support for DLLs like this one, so it can't be used with FPSC. Your signature has been erased by a mod because it's larger than 600x120 |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Ah, I was thinking people who made those mods with the released FPSC source code could call third party dlls like mine? Use Dark GDK with the latest DirectX SDK! C2Q2.66ghz, 8gb RAM, Geforce 9800 GX2, Vista 64-bit |
||
| Back to top |
|||
|
blobby 101
User Joined: Sat Jun 17th 2006 Location: England, UK |
hm.. they probably can, but i thought he was talking about just using it in an FPSC game, not a mod or anything. Your signature has been erased by a mod because it's larger than 600x120 |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
|
||
| Back to top |
|||
|
Coldfire
User Joined: Wed Oct 22nd 2008 Location: Indiana |
Quote: "Unfortunitely, The DirectX XInput library does not provide any way to access the "Guide" button. It's probably specific only for the XBox 360 console itself. In fact, I do remmember reading somewhere in the SDK documentation that it's not supported on the PC."
Sure it is... ever play any Games 4 Windows Live games? That button DOES bring up the guide. Its not considered a regular joystick button however, no idea how to access it though, but I'm positive theres a way... btw Voice support owns. |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Quote: "btw Voice support owns. "
Thanks! I just hope it's good enough for the network coders to use. Quote: "... ever play any Games 4 Windows Live games? That button DOES bring up the guide. "
Interesting. But, as far as XInput goes( or at least the version they give us in the latest SDK ), it will not allow programmers to use it. ie: I just read a thread over at the xna forums saying exactly what you said about it. It is used for bringing up the guide for Games 4 Windows Live. So basically, Microsoft is being stingy with it and using it for themselfs. |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
|
||
| Back to top |
|||
|
Google Ad
AdBot Joined: Aug 26th 2002 Location: Everywhere |
|||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
I also have an executable attached to this thread: http://forum.thegamecreators.com/?m=forum_view&t=156031&b=22 if you don't want to compile it yet and just want to see how your xbox controller works with it, you can quickly try that. Any feedback on how it works for you would be greatly apprieciated! Thanks |
||
| Back to top |
|||
|
blobby 101
User Joined: Sat Jun 17th 2006 Location: England, UK |
great, my Xbox 36 controller for Windows has just arrived so i can finally test this! With the "Integer 0-3" bit next to the commands, does that mean it can support up to four 360 controllers? Your signature has been erased by a mod because it's larger than 600x120 |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
|
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
I know patience is a virtue, but before this thread gets auto locked from no active posting... I wanted to ask if anybody had a chance to actaully "test" this library out yet? Did it work for you? Any problems? Is this library even worth while having around? Any questions about it? If there are no posts from now to being auto-locked, after that I'll announce it in the program announcment forum and mark it as being able to work good for everybody. Thanks... |
||
| Back to top |
|||
|
blobby 101
User Joined: Sat Jun 17th 2006 Location: England, UK |
It's working great for me I started an RTS demo using it and I havn't had any problems so far. Thanks! Your signature has been erased by a mod because it's larger than 600x120 |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
|
||
| Back to top |
|||
|
ReiKumar
User Joined: Tue Sep 23rd 2008 Location: Cyberspace |
Hey, I'm having a little trouble with the library. It seems the when I'm pointing in the south direction and I try to move, the screen goes upside down. Below is all my code. Turn around and look at the stairs and move around. + Code Snippet Any ideas? |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Hi ReiKumar, is it possible for you to zip up the media you used with this program to download? Or is it stock media that's hidden somewhere in the Dark GDK directories? Thanks. I'm anxious to look at it. Unless somebody else beats me to the punch, I'll try to see what's going on once I get back from running errands. edit: ok, found the media... trying to find out what universe.dbo needs for it's textures... |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Ok, intriguing. I see what you are experiencing. Your code looks correct at first glance. I see how the world is flipping upside down and even the straffing gets messed up. From the "game level" example code, looks like the dbControlCameraUsingArrowKeys function handles this well( ie: without straffing ). Currently, I'm wondering if dbMoveCamera and the RotateCamera functions can't play well together. Still looking... |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Ok, instead of busting my brain out, I searched the forum and saw a code snippet that Jason P Sage had for rotating the camera. With that and without the straffing, it worked just liked that "game level" example code movement with the dbControlCameraUsingArrowKeys function, but still had a problem with the dbTurnCameraLeft function when straffing. It would somehow flip the map around and even would move the camera in a different direction based on what direction you would be moving forward from. So instead of using the dbTurnCameraLeft function for straffing, I used the RotateCamera functions for the job. So the "fly cam" movement with the strafe movement seems to work now... + Code Snippet |
||
| Back to top |
|||
|
ReiKumar
User Joined: Tue Sep 23rd 2008 Location: Cyberspace |
Thanks for the reply, that worked perfectly. I do have another piece of code I was hoping you'd look at. This has to do with rotation capping. For example when the user looks up, I only want him to be able to look directly up and not have the camera flip over to look behind him. The code I'm using limits him to 90 degrees (straight up) and -90 degrees (straight down), however this ends up not working because if you hold the direction stick down in that direction is ends up flipping after a few seconds. + Code Snippet |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Hi ReiKumar, dbText is your friend here. Using dbText to output values will help you debug situations like this and help you understand whats going on under the hood. Make sure you have a char array, txt, pre-defined before the loop starts: char txt[256]; And before the sync, write dbText output for both fCameraAngleX and fCameraAngleY: + Code Snippet Hopefully, you will see that rotating around the x and y axis of the camera result in values between 0-360. For me, my x axis, angle x, starts at 0. Rotating around the x axis via moving the camera facing downward, my x axis values starts to increment. Yet, if I'm facing forward and my angle x is at 0, and I start moving the camera facing upward, my x axis value immediately goes to value 359 and decrements downward. This 0-360 wrapped values are caused by the DarkGDK function "dbWrapValue". Looking at your code above, I assume you are thinking that the angle values actually go into the negatives. It won't. So, looking straight forward we roughly are at around 0 or 359 degress since dbWrapValue wraps the variable holding the value at this point. If we look straight up, we should have an angle of 270. If we look straight down, we should have an angle of 90. So, basically if we look straight back, we would be at 180 degrees, ofcoarse everthing is upside down at this point. We don't want that. Use those dbText outputs and make sure this is what you get with your program. If so, I would make an if statement using two OR'd conditions... something like: + Code Snippet This is base on the assumption that you are getting the current camera angles before calculating the angles. This is how I have it as shown in the code I gave in the above post: + Code Snippet Then after that I would do that if statement. If you are doing it the way I'm coding it and you are NOT getting the current angles before the calculation of the rotation axis, then the fCameraAngleX and fCameraAngleY will keep adding or subtracting from the last value it calculated which will mess things up. Try that. |
||
| Back to top |
|||
|
ReiKumar
User Joined: Tue Sep 23rd 2008 Location: Cyberspace |
Awesome thanks, that worked. |
||
| Back to top |
|||
|
LeeBamber
TGC Lead Developer ![]() Joined: Thu Aug 21st 2003 Location: England |
This thread has been un-locked to allow an update. I drink tea, and in my spare time I write software. |
||
| Back to top |
|||
|
Todd Riggins
User Joined: Fri Oct 29th 2004 Location: Texas, USA |
Thanks Lee. The Library is now updated to version 1.2 The only thing new is now the DPAD returns results correctly. As the documentation explains: XB360 DPAD (Integer 0-3),Returns: DWORD Check if the DPAD( ie: Directional Pad ) is being pressed or not. [FIRST PARAMETER] Controller ID [RETURNS] Integer * 0 = DPAD NOT being pressed * 0x00000001 = DPAD UP is being pressed * 0x00000002 = DPAD DOWN is being pressed * 0x00000004 = DPAD LEFT is being pressed * 0x00000008 = DPAD RIGHT is being pressed [EXAMPLE] * if (XB360 DPAD(i) && 0x00000001) then DPAD_UP=1 * if (XB360 DPAD(i) && 0x00000002) then DPAD_DWORD=1 * if (XB360 DPAD(i) && 0x00000004) then DPAD_LEFT=1 * if (XB360 DPAD(i) && 0x00000008) then DPAD_RIGHT=1 -------------- The hexadecimal results are directly from the XINPUT dll. I wasn't paying attention to what I was doing with the dll function before and only return boolean values instead of the values my c++ structure was getting filled with. So now DPAD can do diagonal direction stuff now. Thanks to Dr Tank for pushing me to see the error of my ways. ExoDev.Com |XBOX360 CONTROLLER LIBRARY|USE DARK GDK WITH LATEST DIRECTX| C2Q2.66, 8G RAM, GeFORCE 9800 X2, VISTA 64Bit |
||
| Back to top |
|||
|
Zipir
User Joined: Tue Aug 11th 2009 Location: Cyberspace |
tnx soo much |
||
| Back to top |
|||
|
Visigoth
3DMaster - Best Model ![]() ![]() Joined: Sat Jan 8th 2005 Location: Bakersfield, California |
Just wanted to say, if any of you are wanting to add xbox 360 controller functionality, Todd's .dll is the way to go. You can get the two big features that the stock Microsoft driver doesn't have: The ability to split the trigger axis,and the ability to have the rumble feature. And, you can even use the built in DBpro commands as well, so you could mix n match, whatever works. Talk about flexibility! Once you start playing around with one of these controllers, and Todd's dll, you'll wonder why you waited so long. So, go for it. Get a controller, get Todd's .dll, and PLAY! Thanks Todd for a great plugin. |
||
| Back to top |
|||
|
Dr Tank
User Joined: Wed Apr 1st 2009 Location: Southampton, UK |
Thanks for updating this. Being able to fully use the 360 controller is really great! It's the nearest thing the PC has to a "standard" controller, (not counting keyboard and mouse of course). I actually bought a wired controller for this, after an hour or so trying to get my PC to communicate with the wireless one via the plug and charge kit. This means I can emulate the controls of my favourite Xbox games, or equivalently PS, since the controllers are similar. It means I can have rumble, and analog triggers. It also means i'm a step closer to having the skills, experience or whatever to develop for XBLA if I ever get around to that. I recommend everybody gets a wireless reciever for their existing 360 pad, or wired 360 pad (only £17 on amazon). You'll need it to be awesome at Super Badass Spaceship X when I finish it. In ten years` time or something. Hurry. Thanks again Todd this DLL is totally sweet. It's also well documented with working help files and keywords. If you have a 360 pad you'd be crazy not to download this. |
||
| Back to top |
|||
|
Visigoth
3DMaster - Best Model ![]() ![]() Joined: Sat Jan 8th 2005 Location: Bakersfield, California |
Just a quick heads up on something. I went out and bought a MadCatz wired controller. It was the 4716 model. It has an icon on the packaging that shows it is "designed for Windows XP". Well, it didn't work. It was briefly recognized, then, was disabled. NothingI did would work, even tried XBCD driver. No driver at MadCatz, either. So, I took it back, thinking it was defective,and got another one. Same thing. So, I do not recommend the MadCatz controller, unless someone here knows something I don't. I also bought the Microsoft headset, I am going to play around with that tonight. Hopefully, that will work (I'm sure it will). I was really wanting to try two controllers, but that is going to have to wait because I am tired of driving back and forth. I'll pick up a used Microsoft one at Gamestop or something tomorrow. |
||
| Back to top |
|||
|
Visigoth
3DMaster - Best Model ![]() ![]() Joined: Sat Jan 8th 2005 Location: Bakersfield, California |
sorry for the double post, but I got the MadCatz controller to work. What I did was, I unplugged the controller, uninstalled the driver, then followed the directions I found here: http://www.madcatz.com/faq/default.asp?Action=Q&ID=89 After I installed it, I rebooted my pc, and then I plugged in the controller. And I just tested it with the test app, and it works, I have all functions! YEA! I just wish now I didn't take the first one back, because it was the last white one, this one is black. Oh well, at least I can tell the two apart real fast. I plugged in the Microsoft one, and it to is recognized, so I am going to modify the test app to work with multiple controllers. I'm also going to order the rechargeable wireless one from Walmart, they have them for 32.00. when I get that I'll let you know how it works. Sorry for the false alarm, hope this helps. |
||
| Back to top |
|||
You must be logged-in to post messages to this forum. You can register an account for free. Or click here to login.
Forum Search
Enter a word or phrase to search our Forum for:
|
|












