Wireless Joystick Problem

BlitzMax Forums/BlitzMax Beginners Area/Wireless Joystick Problem

Michel R.(Posted 2013) [#1]
Hello,
Well, first of all, I'm French and my english is not very good so excuse me for language errors...

I'm trying to create my first game with Blitzmax and I've a problem with the joystick management. I'm using a XBOX 360 wireless joystick (Microsoft). This joystick needs to be switch on to be seen by the PC before starting my game.
I can then use it in my game without problem; BUT if I don't use it for a while (maybe 1 minute) the joystick automatically switches off (to economise the battery) and at that time my program crashes on the instruction
FlushJoy()

I've tried to replace this line with:

If Joycount() then FlushJoy()

but the problem is the same (with a crash on Joycount())

I didn't see any solution in the forums. Does anyone can help me ?

Thanks in advance


Derron(Posted 2013) [#2]
Hmm... yesterday (for me it is 7:30 am) there was a response to your post -- do not know where that is stored now ...

the one asked, whether it happens too when running a sample think he thought of: blitzmax/mod/pub.mod/freejoy.mod/doc/joycount.bmx

"Joycount()" is directly accessing a function in freejoy.win32/linux.c so there may the fault be created.

FlushJoy is using "for i=0 to JoyCount()" - so "if JoyCount() then FlushJoy" is really useless and will crash too when reaching the JoyCount()-part.

Does it crash on the line
"print JoyCount()"
or only on "If JoyCount() then FlushJoy()"?

Just to get the function call which is not working properly.



bye
Ron


edit: Ok, you double posted and I am traversing down the forum for new posts... so hmpf