DarthFahza

Working on a SpaceWars mod, with a wireless GamePad connected using the new Wireless GamePad for windows receiver.

I notice that:

Y button presses are not being picked up

& getting errors in Right Thumbstick

'XInputHelper.GamePads[PlayerIndex.One].ThumbStickRightX' threw an exception of type 'System.Collections.Generic.KeyNotFoundException'

'XInputHelper.GamePads[PlayerIndex.One].ThumbStickRightY' threw an exception of type 'System.Collections.Generic.KeyNotFoundException'

anyone else come across this

I'm going thru the GamePadHelper.cs class, and it looks consistent for Y with the other keys that work.



Re: XNA Game Studio Express Wireless GamePad in windows exceptions

Catalin Zima

'XInputHelper.GamePads[PlayerIndex.One].ThumbStickRightX'

gives exception on wired controller also.

This is because this was not used in spacewars, so no keyboard Keymapping has been defined. That's what gives you the error

The Y happens to wired also, but didn't investigate it yet, too lazy. I'll need it soon, though, so I'll look into it when the time comes





Re: XNA Game Studio Express Wireless GamePad in windows exceptions

DarthFahza

FYI

The YWasReleased value is updating correctly.





Re: XNA Game Studio Express Wireless GamePad in windows exceptions

waruwaru

Looks like a bug in SpaceWar starter kit for the Y button.  Also too lazy to investigate.  :P  But the following code seems to read Y properly:

[code]

while (true) {

int temp = 0;

GamePadState currentState = GamePad.GetState(PlayerIndex.One);

GamePadButtons gpb = currentState.Buttons;

if (gpb.A == ButtonState.Pressed)

temp = 1;

if (gpb.B == ButtonState.Pressed)

temp = 2;

if (gpb.X == ButtonState.Pressed)

temp = 3;

if (gpb.Y == ButtonState.Pressed)

temp = 4;

if (gpb.Back == ButtonState.Pressed)

break;

}

[/code]

EDIT: too lazy to fix post too






Re: XNA Game Studio Express Wireless GamePad in windows exceptions

DarthFahza

I posted the 3 places needed to be Modified to add support for the Right Thumbstick in the Space War started kit in this thread.

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1240910&SiteID=1&mode=1





Re: XNA Game Studio Express Wireless GamePad in windows exceptions

waruwaru

Aha, figured it out. In the SpacewarGame class's Update function, there is a

if (XInputHelper.GamePads[PlayerIndex.One].YPressed) {

}

that eats up the YPressed state. Change that to some other button, or take it out would work






Re: XNA Game Studio Express Wireless GamePad in windows exceptions

DarthFahza

nice find.

I remember looking at the line a couple days ago and making a note to revisit it. next time I better add a comment to remember





Re: XNA Game Studio Express Wireless GamePad in windows exceptions

Catalin Zima

Oh. Nice one.

I totally missed that





Re: XNA Game Studio Express Wireless GamePad in windows exceptions

waruwaru

Yeah, that was a little tough to track down. I didn't expect Callng *Pressed would actually change state within the same update iteration. I think I will rewrite the way it keeps previous states. I kinda miss bitmasks... ;)