Jump to content


Photo

Xinput Dll For Game Maker


  • Please log in to reply
60 replies to this topic

#1 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 20 February 2008 - 09:18 PM

Game Maker compatible XInput Dll (GMXInput)
Note: This project is discontinued, though it should not contain any bugs. Feel free to post if you run into a problem, but note that the support I can offer is limited, as it's been a long time since I created this Dll. I strongly recommend using Sinaz' extension if possible, which is linked in the note section below.

XInput is a DirectX input method designed for Xbox Controllers (in case you didn't know)

Since forum searches only resulted in a GEX extension for XInput support, and I'm still sticking with GM6.1 Registered, I made this Dll in Visual Studio with a little help of source codes.

Requirements

DirectX 9.0 or higher
Game Maker 6.1 Registered

For people playing your game:
Xbox 360 Wireless Controller with wireless receiver
Old rewired Xbox controller with XBCD driver might work too (I doubt it)

Benefits

Seperate trigger support instead of one axis (Z-axis)
Xbox Force Feedback support! (rumble)

Download

Release+Example

Source

Credits

Microsoft for DirectX 9 SDK

39ster for 39dll source code, which gave me a nice view on the Dll layout Game Maker supports. (exporting/importing doubles, etc.)

Notes

XInput GEX I noted: SinazXInput

Yellowsix

Edited by yellowsix, 27 September 2010 - 11:20 AM.

  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#2 AvibeGames

AvibeGames

    GMC Member

  • New Member
  • 113 posts

Posted 21 February 2008 - 10:09 AM

So this can rumble the gamepad as well?

XInput is a DirectX input method designed for Xbox Controllers (in case you didn't know)

Doesn't also apply for normal controllers as well?
  • 0

#3 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 21 February 2008 - 12:21 PM

Yes, it does! I made a little game the last few days, and the rumble really adds something.
But like I said, XInput was specially made for Xbox, and probably won't apply to any other gamepads. Some DirectInput gamepads do have force feedback, though.
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#4 ad134

ad134

    The Ad man

  • New Member
  • 413 posts
  • Version:Unknown

Posted 28 February 2008 - 05:43 PM

Absolutely brilliant! Just what I was looking for!
  • 0

#5 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 29 February 2008 - 08:56 AM

Thanks!
Great I could help.
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#6 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 05 March 2008 - 08:17 PM

Wow...
The Dll was downloaded 26 times, the source 9 times, and only two feedback replies? :huh:
Thats, like, bad... :P
But nevermind. I'm still glad I could help you people, although you don't give feedback. ^_^

Ow, BTW: *BUMP*! :D
(I just had to)

Edited by yellowsix, 06 March 2008 - 01:24 PM.

  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#7 AvibeGames

AvibeGames

    GMC Member

  • New Member
  • 113 posts

Posted 07 March 2008 - 02:46 PM

The Dll was downloaded 26 times, the source 9 times, and only two feedback replies?


That's the GMC alright. I suggest if you need more feedback to post in an other forum as well.

Ow, BTW: *BUMP*!
(I just had to)


I believe bumps are allowed only when useful information about a dll is posted.

*spank*

But nevermind. I'm still glad I could help you people, although you don't give feedback.


Maybe it's just that most people in here do not have an XBox gamepad to test.

Edited by AvibeGames, 07 March 2008 - 02:51 PM.

  • 0

#8 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 07 March 2008 - 07:35 PM

Yeah, sorry. I didn't really have helpful information about the Dll, and I didn't know of any problems/suggestions since there was no feedback.
Well, at least it was more than just "*bump*".
With the feedback 'problem' I meant that it was downloaded, but not commented. I don't really care much though.
I'm also aware of the small numbers of people who actually have the gamepad, it's just that it was downloaded a few times.
I assume that people downloading the example do have the gamepad.

Thanks, though.
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#9 nightmare

nightmare

    Game Maker Oldbie

  • GMC Member
  • 435 posts
  • Version:GM:Studio

Posted 11 April 2008 - 08:46 PM

This DLL is very nice :)

Now I'm including XBOX 360 controller support (And XBOX 360 Dance Mat) support into D-A-N-C-E Revenge (DANCE2).

Rumbling when you miss a step adds a lot to the experience, thanks! ;)
  • 0

2nq6rnq.jpg


#10 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 12 April 2008 - 10:08 AM

This DLL is very nice :)

Now I'm including XBOX 360 controller support (And XBOX 360 Dance Mat) support into D-A-N-C-E Revenge (DANCE2).

Rumbling when you miss a step adds a lot to the experience, thanks! :)

Thanks!
Good luck with your game!
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#11 11alex

11alex

    GMC Member

  • New Member
  • 77 posts

Posted 30 April 2008 - 07:44 PM

How do you: if you press space iit rumbles but if you release it, it stops?
  • 0

#12 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 07 May 2008 - 04:05 PM

How do you: if you press space iit rumbles but if you release it, it stops?

Sorry for the late response, I was a week off to Greece.
The rumble function sets the motor frequencies when its called, so the following should work fine:

-[[Press space event
setrumble([insert value here],[insert value here])
-[[Release space event
setrumble(0,0)

Edited by yellowsix, 11 May 2008 - 11:14 AM.

  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#13 grumpymonkey

grumpymonkey

    GMC Member

  • GMC Member
  • 1011 posts

Posted 04 June 2008 - 12:06 PM

aww i wish i could do use this but i dont have gamepad just controllers TT_TT
  • 0

Posted Image


#14 WadeMcGillis

WadeMcGillis

    wademcgillis.com

  • GMC Member
  • 971 posts

Posted 11 June 2008 - 03:22 PM

If they are XBOX 360 controllers, they will work
  • 0

#15 morno

morno

    GMC Member

  • New Member
  • 193 posts

Posted 23 June 2008 - 04:29 PM

i have a Xbox 360 USB connected. do the Rumble work of that too? if it dose can i import it into somting like a Program where i can use the Controller?
  • 0
------------------------------------------------------------
Game Maker PRO User!


#16 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 24 June 2008 - 11:33 AM

i have a Xbox 360 USB connected. do the Rumble work of that too? if it dose can i import it into somting like a Program where i can use the Controller?

If it uses an XInput compatible driver, then yes, it supports rumble. To use it in your game, you need to call the DLL functions from Game Maker. If you study the example a bit, it should be pretty self-explanatory.
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#17 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 30 June 2008 - 05:12 PM

Can XInput work with .ffe files?
  • 0
GM 8.1 / GM:HTML5 User

#18 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 01 July 2008 - 07:20 PM

Can XInput work with .ffe files?

My Dll has no support for ffe files, so I'm afraid you'll have to find your own way of reading the files, and porting the data to the controller.
As far as I know, XInput has no direct support for ffe files, even though the tool for creating them is included in the SDK.

Edited by yellowsix, 02 July 2008 - 09:25 AM.

  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#19 JanDeis

JanDeis

    GMC Member

  • New Member
  • 42 posts

Posted 22 July 2008 - 09:21 PM

I think this is what I've been looking for for my JamSession program. I'm using the Rock Band controllers for the XBox 360. I'll be back with a report on how it goes :P

edit: tested it out and it works perfectly with the Rock Band guitar. I'll have to find something else for the drums though. I think the normal joystick_button_check code works there though. All of the buttons using the same number won't work for how my drum sounds are going to play, but it is more than perfect for my guitar. Now I can even use the pickup switch on the controller for different effects.

This is going to save my ass with this program. Great DLL :P

Edited by JanDeis, 22 July 2008 - 09:49 PM.

  • 0

#20 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 23 July 2008 - 03:51 PM

Good to see that it works with other types of controllers too. I'm glad you like it.
Thanks :rambo
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#21 Iruka

Iruka

    KopyKon - Kitso

  • GMC Member
  • 310 posts

Posted 23 July 2008 - 06:06 PM

Will this work with a regular moded xbox controler(replaced the xbox male end with a usb male end)? It would be nice if the dll worked with it...
I know on the first post it says it could work, but does any one know for shure?
Thank you,
-Iruka

Edited by Iruka, 23 July 2008 - 06:10 PM.

  • 0

:: I Use ::
Game Maker 8 Pro | Code::Blocks with GCC/MinGW | Eclipse Galileo with JDK 6 | Bluefish 2
Windows 7 Ultimate | Ubuntu 10.10
Firefox 3.6

* Did I help you? If so, press the Posted Image button in the bottom right corner of the post :P thanks.


#22 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 24 July 2008 - 12:09 PM

There's a driver available for the old Xbox controllers. It's called XBCD, and you can download it here.
I doubt if this driver supports XInput though. It's always worth a try, of course.
If it doesn't work, you could try to look for a DirectInput dll that supports Force Feedback. The XBCD driver has rumble support, but probably won't work with XInput.
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#23 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 24 July 2008 - 08:05 PM

I just got an XBox controller for PC and it works great. With this and my dll I'll be able to deliver rumble and controls for all gamepads!
  • 0
GM 8.1 / GM:HTML5 User

#24 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 25 July 2008 - 02:52 PM

I just got an XBox controller for PC and it works great. With this and my dll I'll be able to deliver rumble and controls for all gamepads!

I'm glad to hear that. I saw you got the ffe files to work too.
Good job :P
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#25 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 26 July 2008 - 03:59 PM

XNA is so easy to work with, I hope the DirectX API was the same.

One question though, XInput needs DX9 to work, right? If the user doesn't have DX9 but DX8, does the dll degrade gracefully or throw up runtime errors to the player?

Edited by Sindarin, 26 July 2008 - 04:03 PM.

  • 0
GM 8.1 / GM:HTML5 User

#26 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 27 July 2008 - 10:46 AM

Quote from Microsoft MSDN:

Can I mix the use of DirectX 9 components and DirectX 8 or earlier components within the same application?
You can freely mix different components of differing version; for example, you could use DirectInput 8 with Direct3D 9 in the same application. However, you generally cannot mix different versions of the same component within the same application; for example, you cannot mix DirectDraw 7 with Direct3D 9 (since these are effectively the same component as DirectDraw has been subsumed into Direct3D as of DirectX 8). There are exceptions, however, such as the use of Direct3D 9 and Direct3D 10 together in the same application, which is allowed.

According to this, my bet is that DirectX will nicely keep it's mouth shut. I'm not sure though, since in your case it's quite the opposite. (new API calls on older DirectX versions)

Edited by yellowsix, 27 July 2008 - 10:47 AM.

  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#27 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 27 July 2008 - 12:56 PM

According to this, my bet is that DirectX will nicely keep it's mouth shut. I'm not sure though, since in your case it's quite the opposite. (new API calls on older DirectX versions)


Well I always make a small seperate launcher application for the game settings, so I guess an option there won't hurt.


I have a request though, can you make a more straightforward example? I have trouble understanding how your example works.

EDIT: Not necessary, I figured it out, checkbutton() does all the work.
Now my game is xinput compatible. Whew, keyboard, joystick and xinput joystick. What more a player could want?

Edited by Sindarin, 27 July 2008 - 06:10 PM.

  • 0
GM 8.1 / GM:HTML5 User

#28 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 28 July 2008 - 10:20 AM

What more a player could want?

Wii-mote support?
Nah, just kidding. :medieval:
Glad I could help! :P
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#29 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 16 September 2008 - 10:07 AM

[EDIT]
I tried to make a GEX, but nevermind... GEX is kicking my Dll's ass... :/

Edited by yellowsix, 17 September 2008 - 10:54 AM.

  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#30 Johnnsen

Johnnsen

    Braaaains

  • New Member
  • 418 posts

Posted 02 October 2008 - 12:16 PM

[EDIT]
I tried to make a GEX, but nevermind... GEX is kicking my Dll's ass... :/

Although I'd love something for GM7, since the other project with a gex is discontinued.
  • 0
I can't hear "ZIP FILE PLZ" anymore. Install Winrar or 7zip, it can extract them all.

#31 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 03 October 2008 - 07:26 AM

[EDIT]
I tried to make a GEX, but nevermind... GEX is kicking my Dll's ass... :/

Although I'd love something for GM7, since the other project with a gex is discontinued.

Yeah sorry.
I might try it again, but GEX was really acting up weird. I got no errors, but the values it returned weren't correct.
I used a converted version of the GML instead of direct DLL calls, so that might be the problem here.
Anyway, I saw that Sinaz recontinued the GEX again.
Have fun programming! :whistle:
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#32 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 19 November 2008 - 03:29 PM

I just tried on a work computer that doesn't have DirectX 9. The application complains that it can't find the xinput dll (the one bundled with DX9) and shuts down. So it seems if someone wants to use it in their game, they should have it disabled at start and an option in game to enable it to avoid problems with people that do not want to use an Xbox controller.

Edited by Sindarin, 19 November 2008 - 03:30 PM.

  • 0
GM 8.1 / GM:HTML5 User

#33 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 20 November 2008 - 04:11 PM

I just tried on a work computer that doesn't have DirectX 9. The application complains that it can't find the xinput dll (the one bundled with DX9) and shuts down. So it seems if someone wants to use it in their game, they should have it disabled at start and an option in game to enable it to avoid problems with people that do not want to use an Xbox controller.

Yeah, bad thing about my Dll is that it's plainly a direct wrapper for the DirectX functions, and therefore lacks error handling.
It would be a good idea to check for DX9 before loading the Dll, so you can throw your own error instead of Game Maker's "Unexpected" one.
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#34 Dexter-W

Dexter-W

    GMC Member

  • New Member
  • 48 posts

Posted 29 November 2008 - 10:50 AM

I have a problem. When I open the example with GM 7.0 Pro I got an error message:
_____________________________
ERROR in
action number 1
of Other Event: Game Start
for object obj_xinput:

Error defining an external function.

Its a big problem when the example doesn't work. If I remember right, I have used it on GM7 before without problem.
I have redownloaded it but it still doesn't work. Thats strange.
Do I have to do something special to make it work (something I probably did when it worked last time by accident)?
  • 0

#35 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 30 November 2008 - 02:19 PM

I have a problem. When I open the example with GM 7.0 Pro I got an error message:
_____________________________
ERROR in
action number 1
of Other Event: Game Start
for object obj_xinput:

Error defining an external function.

Its a big problem when the example doesn't work. If I remember right, I have used it on GM7 before without problem.
I have redownloaded it but it still doesn't work. Thats strange.
Do I have to do something special to make it work (something I probably did when it worked last time by accident)?

Is it possible that your DirectX installation somehow lacks XInput support? Considering that the example has worked before, my guess is that some system change might be causing the error.
I'm not sure if XInput is bundled with DX9, but you could try to reinstall the driver for the 360 controller.

To answer our question: apart from the Dll and XInput, there's nothing special you need.

I can't come up with anything that could cause the error, I'm afraid. I doubt if it's an error in the example, since I only uploaded it once.

I hope reinstalling the driver or DirectX itself solves this. Otherwise, you can always go with Sinaz' XInput GEX, which does pretty much the same thing as my Dll.

Good luck! ^_^

Yellowsix
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#36 remoladen

remoladen

    GMC Member

  • New Member
  • 147 posts

Posted 09 February 2009 - 01:55 AM

I tried it, and it didn't work?
I checked my direct x version and it's DirectX 9.0c (4.09.0000.0904)

Edited by remoladen, 09 February 2009 - 02:27 AM.

  • 0
Delphi DLL Maker = Me

<<Copy this into your sig if you're a Christian>>

#37 toopz

toopz

    Spriter

  • New Member
  • 782 posts
  • Version:GM:Studio

Posted 14 February 2009 - 09:10 AM

This is actually pretty awesome. I just need to find a way to convince myself to support both 360 controllers and normal pc controllers now. I doubt I can find the motivation to allow both, even though I really like the separate shoulder axes and vibration support. Oh well...
  • 0

#38 Juhkystar

Juhkystar

    GMC Member

  • New Member
  • 2 posts

Posted 12 March 2009 - 11:45 PM

Wait, so does this work for wired Xbox360 controllers as well? Because I'm getting problems with defining the external dll and I'm not sure if it's me not having directx9 or because my computer can't recognize the controller hardware...
  • 0

#39 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 13 March 2009 - 11:34 AM

Wait, so does this work for wired Xbox360 controllers as well? Because I'm getting problems with defining the external dll and I'm not sure if it's me not having directx9 or because my computer can't recognize the controller hardware...

As far as I know the wired versions use XInput as well, and should work with my Dll. Anyway, I'm pretty sure XInput is bundled with DirectX 9, and requires it to work. So to use the controller you'll probably need to install DX9.
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#40 prog

prog

    GMC Member

  • New Member
  • 1121 posts

Posted 29 March 2009 - 01:36 AM

How do you detect if a controller is disconnected?
  • 0
Progames

NEW WEBSITE!
I have a large collection of music on my website. If you need some, take a look.
If you need a script, PM me. I'll make you one for free.

#41 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 30 March 2009 - 06:59 AM

How do you detect if a controller is disconnected?

You can check the controller's status by using the getstate() function. It returns 0 if the controller is connected, and an error code if it's not.
The statement getstate(index)!=0 returns true if the controller is disconnected.
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#42 prog

prog

    GMC Member

  • New Member
  • 1121 posts

Posted 30 March 2009 - 08:09 PM

How do you detect if a controller is disconnected?

You can check the controller's status by using the getstate() function. It returns 0 if the controller is connected, and an error code if it's not.
The statement getstate(index)!=0 returns true if the controller is disconnected.


Thanks.
  • 0
Progames

NEW WEBSITE!
I have a large collection of music on my website. If you need some, take a look.
If you need a script, PM me. I'll make you one for free.

#43 prog

prog

    GMC Member

  • New Member
  • 1121 posts

Posted 04 April 2009 - 06:54 PM

Can the remote get the sound file when you plug in the headphones and microphone in the remote?
  • 0
Progames

NEW WEBSITE!
I have a large collection of music on my website. If you need some, take a look.
If you need a script, PM me. I'll make you one for free.

#44 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 09 April 2009 - 09:20 PM

Can the remote get the sound file when you plug in the headphones and microphone in the remote?

Well, since Game Maker has no way to use the sound handle it returns, I haven't even implemented the function in my Dll.
With a Dll that can use the sound handle it returns you might be able to use the headset, but it's unlikely to work in Game Maker.
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#45 Third Dimension Artist

Third Dimension Artist

    GMC Member

  • New Member
  • 11 posts

Posted 18 January 2010 - 03:40 PM

I love this DLL! When I combine this with the graphics of Ultimate3D, I feel like I'm playing on a real Xbox. Thanks a ton!
  • 0

#46 enandr

enandr

    GMC Member

  • GMC Member
  • 348 posts

Posted 25 February 2010 - 09:03 PM

when i try the example it says i get an error saying


___________________________________________
ERROR in
action number 1
of Other Event: Game Start
for object obj_xinput:

Error defining an external function.
___________________________________________


what should i do.
  • 0
Metal Warrior: Episode 1. Work in progress. If you can help with sprites, please pm me.

#47 darktree

darktree

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM8

Posted 22 September 2010 - 10:09 AM

Thank you so much for this DLL and example! I am having trouble trying to put it to practical use though. While the demo works perfectly, I am trying to make the rumble happen when I get hurt by an enemy in my game. Before that though, I am testing to see if I can indeed make my XBOX360 controller rumble just by hitting the spacebar. I cannot.

As per your instructions on page one of this thread, I:

1. Made a Press space event in the obj_xinput object
2. Executed a piece of code action with the following info:

setrumble(30000,30000)

I also tried different numbers for both values... I tried maxing both out at 65535, tried a value of 200 for both numbers, etc.

3. Added a Release Space Event with an execute code action:

setrumble(0,0)

Of course to no avail. If it does not rumble, there is nothing to stop.

Now, the rumble works perfectly still with the Left and Right triggers with leveled rumbling depending on how much I squeeze each trigger, I just cannot get rumble to work from any other action I set the rumble to.

Anyone here have any ideas?
  • 0

#48 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 23 September 2010 - 12:12 AM

Thank you so much for this DLL and example! I am having trouble trying to put it to practical use though. While the demo works perfectly, I am trying to make the rumble happen when I get hurt by an enemy in my game. Before that though, I am testing to see if I can indeed make my XBOX360 controller rumble just by hitting the spacebar. I cannot.

As per your instructions on page one of this thread, I:

1. Made a Press space event in the obj_xinput object
2. Executed a piece of code action with the following info:

setrumble(30000,30000)

I also tried different numbers for both values... I tried maxing both out at 65535, tried a value of 200 for both numbers, etc.

3. Added a Release Space Event with an execute code action:

setrumble(0,0)

Of course to no avail. If it does not rumble, there is nothing to stop.

Now, the rumble works perfectly still with the Left and Right triggers with leveled rumbling depending on how much I squeeze each trigger, I just cannot get rumble to work from any other action I set the rumble to.

Anyone here have any ideas?


The setrumble() function takes three arguments, rather than the two you are using. You need to specify which controller you want to set the force feedback for. Indices go from 0 to 3. Try using the following line of code:
setrumble(0, 30000, 30000)

  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein

#49 darktree

darktree

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM8

Posted 23 September 2010 - 09:42 AM

Thank you very much, yellowsix, I have it working now. I can only imagine how much work has gone into making this dll and making the example. Thank you, your efforts are not put to waste.
  • 0

#50 yellowsix

yellowsix

    GMC Member

  • New Member
  • 315 posts

Posted 23 September 2010 - 01:30 PM

Thank you very much, yellowsix, I have it working now. I can only imagine how much work has gone into making this dll and making the example. Thank you, your efforts are not put to waste.

You're welcome. ^^

Actually, the DLL itself is mostly a wrapper to the XInput API, and if you inspect the SDK, you'll see that pretty much every function is a direct port to an API function. When I created this DLL, I didn't have a lot of C++ experience. Glad I could help, regardless. :)
  • 0
"Go thy way, eat thy bread with joy, and drink thy wine with a merry heart; for God now accepeth thy works." - Ecclesiastes 9:7

English is not my native language. Please keep this in mind.

"The ruling class has the schools and press under its thumb. This enables it to sway the emotions of the masses." ~Albert Einstein