Could you profile your joypad please...

BlitzMax Forums/BlitzMax Programming/Could you profile your joypad please...

Dabz(Posted 2007) [#1]
Using what I think, is a bog standard joypad (A no-frills sidewinder), could you map your joypad against it:-



Here's a snippet to get the button presses:-

Import Pub.FreeJoy

Strict

If Not JoyCount() RuntimeError "No joystick found!"

Graphics 640,480

Const NO_JOYPAD_INPUT = -1

Local result:Int 


Repeat
Cls

result = GetJoyButton()

If result = NO_JOYPAD_INPUT
	DrawText "Button number:None",0,0
Else
	DrawText "Button number:"+result,0,0
End If

DrawText "D-Pad:-",0,25

DrawText "Hat:"+JoyHat(),0,50
DrawText "JoyX/JoyY:"+Int(JoyX())+"/"+Int(JoyY()),0,75

Flip 
Until KeyDown(KEY_ESCAPE)

Function GetJoyButton:Int(port=0)
Local loopJoyPress:Int
For loopJoyPress = 0 To 31
	If JoyDown(loopJoyPress) Then Return(loopJoyPress) 
Next
Return(NO_JOYPAD_INPUT)
End Function


I need this information, as I've noticed using both my joypads (sidewinder and saitek) that the button ID varies wildly, when they are set out in roughly the same layout.

So, I want to build up a profile of the most common joypad controls, no sticks. Please could you state your full joypad name in 'Control Panel/Game Controllers' thingy! ;)

Also, some D-Pads, work using JoyX/JoyY, my Saitek's D-Pad works on JoyHat... please state which gets a response when testing the D-Pad.

Here's my two to start:-

Joypad Name: SideWinder Game Pad USB version 1.0


Buttons:-

X 3
Y 4
Z 5
A 0
B 1
C 2
M 9
Start 8
L 6
R 7
D-Pad JoyX/JoyR

Joypad Name: Saitek P2600 Rumble Force Pad


X 0
Y 3
Z 9
A 1
B 2
C 8
M 10
Start 11
L 6
R 7
D-Pad Hat

Thank you! :D

Dabz

P.S. If there's anything I've missed, such as drivers knacking the basic controls up (Some pads convert the D-Pad to A/S/D/W keys, then just say)


MGE(Posted 2007) [#2]
"I need this information, as I've noticed using both my joypads (sidewinder and saitek) that the button ID varies wildly, when they are set out in roughly the same layout."

My experience with DirectX input is you are correct, no 2 pads/devices will be the same, so it's always best to have some kind of config screen where you allow the player to configure the buttons to do something in your game.


Dabz(Posted 2007) [#3]
I'm impletementing a configure feature now, to be honest, I'm totally rewriting the joypad handling altogether for future use.

I would of just liked to have a good few profiles bundled with it, so the user can just select his/her pad from a list and be ready to go.

Dabz