Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, degenerate_762), 1,309 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Print Thread
Rate Thread
Page 1 of 2 1 2
Max joysticks #360317
02/23/11 14:54
02/23/11 14:54
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Hey, sorry to bother you, but in this thread I showed some trouble I was having getting more than 2 joysticks to work, and it has garnered very little interest and no assistance.

I don't use any of the engine's built-in joystick functions. I use joyGetPosEx to get all the information I need. It has been working great for the first two joysticks, and I assumed it'd work for the rest since I release and capture all joysticks in a loop. Having purchased a third joystick yesterday and tested it independently of the others, I know it works on its own, but my game still only detects 2 joysticks.

Is there something I'm missing? A limit imposed by the engine? Or am I just capturing them incorrectly?

I considered that joyGetPosEx might be working fine because the engine captures 2 joysticks anyway, and maybe it's my capture function that's failing, but I changed the code to release all joysticks first and then attempt to capture them all manually, and it still works fine.

Here's the loop I use in the main function to get the joysticks:
Code:
for (i=0; i<MAX_JOYSTICKS; i++) {
		joyReleaseCapture(i);
		hasJoystick[i] = (var)joySetCapture(hWnd, i, POLLING_PERIOD, JOYSTICKS_CHANGED);
		joystick[0] = JOYSTICK_SIZE;
		joystick[1] = JOY_CAL_READ5;
		if (hasJoystick[i] == 0)
			joyGetPosEx(i, (void*)joystick);
	}

I use the same loop in a separate function to recapture joysticks if the player needs to (for example if they connect a joystick after the game has started), and all that seems to successfully do is release them.

POLLING_PERIOD is #defined as NULL and JOYSTICKS_CHANGED as 1, but I've tried it with POLLING_PERIOD as 10 and JOYSTICKS_CHANGED as 0.

The fact that the recapture fails using the same code leads me to believe that the first capture fails as well, but the engine automatically captures 2 joysticks for me, since it uses 2 anyway. But surely that would happen in the first frame? And my first capture attempt occurs after a wait(1); in the main function.

Any help would really be appreciated.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Max joysticks [Re: JibbSmart] #360350
02/23/11 18:35
02/23/11 18:35
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I have no experience with joyGetPosEx, so I'm not sure that the code is correct. But maybe a user can help?

Re: Max joysticks [Re: jcl] #360358
02/23/11 19:10
02/23/11 19:10
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
The thing is, joyGetPosEx works great. It's not the issue. Apparently I'm doing something wrong when I'm trying to capture the joysticks, because my game can only ever see the 2 that A8 captures by default, even though I release and attempt to recapture the joysticks after the first frame.

Can you give me any hints as to how to correctly capture more joysticks? Or even better, built-in support for more joysticks laugh?

Thanks for your time,

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Max joysticks [Re: JibbSmart] #360369
02/23/11 19:39
02/23/11 19:39
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
Which error messages does joySetCapture return?
You are not using Windows NT ?!!

How many devices are seen in your application( joyGetNumDevs )
Have you tested all the stuff in another program than A8( own little Win32 program)

muffel

Re: Max joysticks [Re: muffel] #360377
02/23/11 19:56
02/23/11 19:56
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
joySetCapture returns 0 for the first 2, and 6 for the next 6 (my program doesn't try to connect more than 8).
I'm using Windows 7.
joyGetNumDevs returns 16.

I haven't tried yet in another application. I'll do that next.

Cheers,
Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Max joysticks [Re: JibbSmart] #360392
02/23/11 20:41
02/23/11 20:41
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
If im right 6 is the MMSYSERR_NODRIVER
Searching in the MMSystem Header of the WindowsSDK i get following results
Code:
MMSYSERR_NOERROR 0
JOYERR_NOERROR 0
MMSYSERR_NODRIVER 6
MMSYSERR_INVALID  11
JOYERR_PARAMS 165
JOYERR_NOCANDO 166
JOYERR_UNPLUGGED 167


so your programm doesnt find a driver for the last 6 joysticks

muffel

Re: Max joysticks [Re: muffel] #360398
02/23/11 20:49
02/23/11 20:49
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Thanks for the info. Why might the driver work for the first 2 and not for the rest?

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Max joysticks [Re: JibbSmart] #360426
02/23/11 21:42
02/23/11 21:42
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
I have no clue about the driver problem.
Maybe its Acknex or your PC. Now the test results of another program would be interesting for you.
But i have to admitt that i know nearly nothing about the joystick stuff- my knowlegde is based on quick msdn/file searches

muffel

Re: Max joysticks [Re: muffel] #360427
02/23/11 21:47
02/23/11 21:47
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline OP
Expert
JibbSmart  Offline OP
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Well you've been very helpful, I think laugh I was also searching around, and was much less useful to myself.

Thanks.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Max joysticks [Re: JibbSmart] #361289
03/02/11 09:32
03/02/11 09:32
Joined: Apr 2005
Posts: 3,815
Finland
Inestical Offline
Rabbit Developer
Inestical  Offline
Rabbit Developer

Joined: Apr 2005
Posts: 3,815
Finland
What joysticks / gamepads you have connected?

If you have Xbox controller or similiar, make sure you have XInput installed.


"Yesterday was once today's tomorrow."
Page 1 of 2 1 2

Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1