Fix Gamepad crash when platform doesn't support the amount#4677
Fix Gamepad crash when platform doesn't support the amount#4677tomspilman merged 1 commit intoMonoGame:developfrom
Conversation
|
Hopefully no one depends on the exception to detect the maximum supported gamepad. At least we added |
Xna didn't call a crash when the gamepad was not supported(Windows Phone), but instead just returned an empty state, right? |
Well... it did return a gamepad state, but just for the back button detection. Don't know what happened if you asked for the second gamepad. |
From googling around I am 95% sure it returned an empty state. |
|
@dellis1972 @KonajuGames What do you think on this? |
|
So I did a little research on this before merging it. Under XNA a disconnected gamepad does not throw any exception. It just returns a disconnected state. If you are using XNA on WP7 The only case where So my conclusions from this: This PR is fine... we shouldn't throw exceptions from the indexed versions of the However we should consider following up this PR with another for the enum versions of these functions which validates that a correct |
|
Thanks @cra0zy ! |
Instead of throwing an exception we should just return an empty state, this also makes the style of this more XNAish.
http://community.monogame.net/t/monogame-3-5-gamepad-getstate/7288