Component Identifier Question

Hello all,

I have started working with JInput recently for a new 2D game project. From what I can gather from the api docs and this forum, I should be using the Component Identifier in theory to uniquely identify buttons on a device. Running the test code seems to report good values for all the keyboard buttons, but I’m having problems with gaming-specific devices like my joystick and gamepads. All the directional pads/analog sticks are detected correctly, but I receive UNKNOWN for all the button IDs. The button names seem reasonable however, with things such as “Button 0”, “Button 1”, etc. I’m assuming though that using the Component Name is not guarenteed to be consistent across all devices and all platforms, so mapping keys based on name is a bad idea. I was wondering if this is a known issue with JInput at this time or if I’m just missing something?

Other less important things I noticed include my gamepads being reported as joystick types and all the port type values are UNKNOWN as well.

My current setup:

Windows XP Service Pack 2
DirectX 9.0c
Microsoft Sidewinder Precision 2 Joystick
Gravis Gamepad Pro
Logitech Dual Action Gamepad

Thanks in advance,
Chris

Hi

Can you post the output you get when running the ControllerReadTest class please?

Thanks

Endolf

I don’t have my gamepads with me at the moment, but this is the output for the joystick.

OS name is: Windows XP
DX8 plugin is supported
OS name is: Windows XP
DX8 plugin is supported
Creating Microsoft SideWinder Precision 2 polling = false
Component count = 3
Component count = 5
Component count = 124
Component count = 13

Hi

Can we have the whole thing, including all the axis and buttons for each device, right from the top to the bottom.

Thanks

Endolf

I’m sorry, but that is all that was printed to standard out for the ControllerReadTest…Do you mean the ControllerTextTest? If so that is included below. I had to split the output up into 2 posts because of the forum max character limit. I will hopefully be able to get the gamepad info sometime later today as well.

Controller Env = net.java.games.input.DefaultControllerEnvironment@1d1acd3
OS name is: Windows XP
DX8 plugin is supported
OS name is: Windows XP
DX8 plugin is supported
Creating Microsoft SideWinder Precision 2 polling = false
Mouse Mouse
Type: mouse
Component Count: 0

Keyboard (Keyboard)
Type: buttons
Component Count: 124
Component 0: Void
Identifier: Void
ComponentType: Absolute Digital
Component 1: Esc
Identifier: Escape
ComponentType: Absolute Digital
Component 2: 1
Identifier: 1
ComponentType: Absolute Digital
Component 3: 2
Identifier: 2
ComponentType: Absolute Digital
Component 4: 3
Identifier: 3
ComponentType: Absolute Digital
Component 5: 4
Identifier: 4
ComponentType: Absolute Digital
Component 6: 5
Identifier: 5
ComponentType: Absolute Digital
Component 7: 6
Identifier: 6
ComponentType: Absolute Digital
Component 8: 7
Identifier: 7
ComponentType: Absolute Digital
Component 9: 8
Identifier: 8
ComponentType: Absolute Digital
Component 10: 9
Identifier: 9
ComponentType: Absolute Digital
Component 11: 0
Identifier: 0
ComponentType: Absolute Digital
Component 12: -

Identifier: -
ComponentType: Absolute Digital

Component 13: =
Identifier: =
ComponentType: Absolute Digital
Component 14: Backspace
Identifier: Back
ComponentType: Absolute Digital
Component 15: Tab
Identifier: Tab
ComponentType: Absolute Digital
Component 16: Q
Identifier: Q
ComponentType: Absolute Digital
Component 17: W
Identifier: W
ComponentType: Absolute Digital
Component 18: E
Identifier: E
ComponentType: Absolute Digital
Component 19: R
Identifier: R
ComponentType: Absolute Digital
Component 20: T
Identifier: T
ComponentType: Absolute Digital
Component 21: Y
Identifier: Y
ComponentType: Absolute Digital
Component 22: U
Identifier: U
ComponentType: Absolute Digital
Component 23: I
Identifier: I
ComponentType: Absolute Digital
Component 24: O
Identifier: O
ComponentType: Absolute Digital
Component 25: P
Identifier: P
ComponentType: Absolute Digital
Component 26: [
Identifier: [
ComponentType: Absolute Digital
Component 27: ]
Identifier: ]
ComponentType: Absolute Digital
Component 28: Enter
Identifier: Return
ComponentType: Absolute Digital
Component 29: Ctrl
Identifier: Left Control
ComponentType: Absolute Digital
Component 30: A
Identifier: A
ComponentType: Absolute Digital
Component 31: S
Identifier: S
ComponentType: Absolute Digital
Component 32: D
Identifier: D
ComponentType: Absolute Digital
Component 33: F
Identifier: F
ComponentType: Absolute Digital
Component 34: G
Identifier: G
ComponentType: Absolute Digital
Component 35: H
Identifier: H
ComponentType: Absolute Digital
Component 36: J
Identifier: J
ComponentType: Absolute Digital
Component 37: K
Identifier: K
ComponentType: Absolute Digital
Component 38: L
Identifier: L
ComponentType: Absolute Digital
Component 39: ;
Identifier: ;
ComponentType: Absolute Digital
Component 40: ’
Identifier: ’
ComponentType: Absolute Digital
Component 41: `
Identifier: ~
ComponentType: Absolute Digital
Component 42: Shift
Identifier: Left Shift
ComponentType: Absolute Digital
Component 43:
Identifier:
ComponentType: Absolute Digital
Component 44: Z
Identifier: Z
ComponentType: Absolute Digital
Component 45: X
Identifier: X
ComponentType: Absolute Digital
Component 46: C
Identifier: C
ComponentType: Absolute Digital
Component 47: V
Identifier: V
ComponentType: Absolute Digital
Component 48: B
Identifier: B
ComponentType: Absolute Digital
Component 49: N
Identifier: N
ComponentType: Absolute Digital
Component 50: M
Identifier: M
ComponentType: Absolute Digital
Component 51: ,
Identifier: ,
ComponentType: Absolute Digital
Component 52: .
Identifier: .
ComponentType: Absolute Digital
Component 53: /
Identifier: /
ComponentType: Absolute Digital
Component 54: Right Shift
Identifier: Right Shift
ComponentType: Absolute Digital
Component 55: *
Identifier: Multiply
ComponentType: Absolute Digital
Component 56: Alt
Identifier: Left Alt
ComponentType: Absolute Digital
Component 57: Space
Identifier:
ComponentType: Absolute Digital
Component 58: Caps Lock
Identifier: Caps Lock
ComponentType: Absolute Digital
Component 59: F1
Identifier: F1
ComponentType: Absolute Digital
Component 60: F2
Identifier: F2
ComponentType: Absolute Digital
Component 61: F3
Identifier: F3
ComponentType: Absolute Digital
Component 62: F4
Identifier: F4
ComponentType: Absolute Digital
Component 63: F5
Identifier: F5
ComponentType: Absolute Digital
Component 64: F6
Identifier: F6
ComponentType: Absolute Digital
Component 65: F7
Identifier: F7
ComponentType: Absolute Digital
Component 66: F8
Identifier: F8
ComponentType: Absolute Digital
Component 67: F9
Identifier: F9
ComponentType: Absolute Digital
Component 68: F10
Identifier: F10
ComponentType: Absolute Digital
Component 69: Num Lock
Identifier: Num Lock
ComponentType: Absolute Digital
Component 70: Scroll Lock
Identifier: Scroll Lock
ComponentType: Absolute Digital
Component 71: Num 7
Identifier: Num 7
ComponentType: Absolute Digital
Component 72: Num 8
Identifier: Num 8
ComponentType: Absolute Digital
Component 73: Num 9
Identifier: Num 9
ComponentType: Absolute Digital
Component 74: -
Identifier: Num -
ComponentType: Absolute Digital
Component 75: Num 4
Identifier: Num 4
ComponentType: Absolute Digital
Component 76: Num 5
Identifier: Num 5
ComponentType: Absolute Digital
Component 77: Num 6
Identifier: Num 6
ComponentType: Absolute Digital
Component 78: +
Identifier: Num +
ComponentType: Absolute Digital
Component 79: Num 1
Identifier: Num 1
ComponentType: Absolute Digital
Component 80: Num 2
Identifier: Num 2
ComponentType: Absolute Digital
Component 81: Num 3
Identifier: Num 3
ComponentType: Absolute Digital
Component 82: Num 0
Identifier: Num 0
ComponentType: Absolute Digital
Component 83: Num Del
Identifier: Num .
ComponentType: Absolute Digital
Component 84: F11
Identifier: F11
ComponentType: Absolute Digital
Component 85: F12
Identifier: F12
ComponentType: Absolute Digital
Component 86: F13
Identifier: F13
ComponentType: Absolute Digital
Component 87: F11
Identifier: F14
ComponentType: Absolute Digital
Component 88: F12
Identifier: F15
ComponentType: Absolute Digital
Component 89: Key 89
Identifier: Key 89
ComponentType: Absolute Digital
Component 90: Key 90
Identifier: Key 90
ComponentType: Absolute Digital
Component 91: Key 91
Identifier: Key 91
ComponentType: Absolute Digital
Component 92: Key 92
Identifier: Key 92
ComponentType: Absolute Digital
Component 93: Num =
Identifier: Num =
ComponentType: Absolute Digital
Component 94: Key 94
Identifier: Key 94
ComponentType: Absolute Digital
Component 95: Key 95
Identifier: Key 95
ComponentType: Absolute Digital
Component 96: Key 96
Identifier: Key 96
ComponentType: Absolute Digital
Component 97: Key 97
Identifier: Key 97
ComponentType: Absolute Digital
Component 98: Key 98
Identifier: Key 98
ComponentType: Absolute Digital
Component 99: Key 99
Identifier: Key 99
ComponentType: Absolute Digital

Component 100: Key 100
Identifier: Key 100
ComponentType: Absolute Digital
Component 101: Key 101
Identifier: Key 101
ComponentType: Absolute Digital
Component 102: Num Enter
Identifier: Num Enter
ComponentType: Absolute Digital
Component 103: Right Control
Identifier: Right Control
ComponentType: Absolute Digital
Component 104: Num ,
Identifier: Num ,
ComponentType: Absolute Digital
Component 105: Num /
Identifier: Num /
ComponentType: Absolute Digital
Component 106: Key 106
Identifier: Key 106
ComponentType: Absolute Digital
Component 107: Right Alt
Identifier: Right Alt
ComponentType: Absolute Digital
Component 108: Pause
Identifier: Pause
ComponentType: Absolute Digital
Component 109: Home
Identifier: Home
ComponentType: Absolute Digital
Component 110: Up
Identifier: Up
ComponentType: Absolute Digital
Component 111: Pg Up
Identifier: Pg Up
ComponentType: Absolute Digital
Component 112: Left
Identifier: Left
ComponentType: Absolute Digital
Component 113: Right
Identifier: Right
ComponentType: Absolute Digital
Component 114: End
Identifier: End
ComponentType: Absolute Digital
Component 115: Down
Identifier: Down
ComponentType: Absolute Digital
Component 116: Pg Down
Identifier: Pg Down
ComponentType: Absolute Digital
Component 117: Insert
Identifier: Insert
ComponentType: Absolute Digital
Component 118: Delete
Identifier: Delete
ComponentType: Absolute Digital
Component 119: Left Windows
Identifier: Left Windows
ComponentType: Absolute Digital
Component 120: Right Windows
Identifier: Right Windows
ComponentType: Absolute Digital
Component 121: Key 121
Identifier: Key 121
ComponentType: Absolute Digital
Component 122: Power
Identifier: Power
ComponentType: Absolute Digital
Component 123: Sleep
Identifier: Sleep
ComponentType: Absolute Digital

Microsoft SideWinder Precision 2 Microsoft SideWinder Precision 2
Type: stick
Component Count: 13
Component 0: Y Axis
Identifier: y
ComponentType: Absolute Analog
Component 1: X Axis
Identifier: x
ComponentType: Absolute Analog
Component 2: Slider
Identifier: slider
ComponentType: Absolute Analog
Component 3: Z Rotation
Identifier: rz
ComponentType: Absolute Analog
Component 4: Button 0
Identifier: Unknown
ComponentType: Absolute Digital
Component 5: Button 1
Identifier: Unknown
ComponentType: Absolute Digital
Component 6: Button 2
Identifier: Unknown
ComponentType: Absolute Digital
Component 7: Button 3
Identifier: Unknown
ComponentType: Absolute Digital
Component 8: Button 4
Identifier: Unknown
ComponentType: Absolute Digital
Component 9: Button 5
Identifier: Unknown
ComponentType: Absolute Digital
Component 10: Button 6
Identifier: Unknown
ComponentType: Absolute Digital
Component 11: Button 7
Identifier: Unknown
ComponentType: Absolute Digital
Component 12: Hat Switch
Identifier: pov
ComponentType: Absolute Digital

Hi

Thanks

I’ll take a look.

Endolf

Here is the additional output for the Gravis gamepad and Logitech gamepad, respectively.

GamePad Pro USB GamePad Pro USB
Type: stick
Component Count: 12
Component 0: Y Axis
Identifier: y
ComponentType: Absolute Analog
Component 1: X Axis
Identifier: x
ComponentType: Absolute Analog
Component 2: Button 0
Identifier: Unknown
ComponentType: Absolute Digital
Component 3: Button 1
Identifier: Unknown
ComponentType: Absolute Digital
Component 4: Button 2
Identifier: Unknown
ComponentType: Absolute Digital
Component 5: Button 3
Identifier: Unknown
ComponentType: Absolute Digital
Component 6: Button 4
Identifier: Unknown
ComponentType: Absolute Digital
Component 7: Button 5
Identifier: Unknown
ComponentType: Absolute Digital
Component 8: Button 6
Identifier: Unknown
ComponentType: Absolute Digital
Component 9: Button 7
Identifier: Unknown
ComponentType: Absolute Digital
Component 10: Button 8
Identifier: Unknown
ComponentType: Absolute Digital
Component 11: Button 9
Identifier: Unknown
ComponentType: Absolute Digital

Logitech Dual Action Logitech Dual Action
Type: stick
Component Count: 17
Component 0: Z Rotation
Identifier: rz
ComponentType: Absolute Analog
Component 1: Z Axis
Identifier: z
ComponentType: Absolute Analog
Component 2: Y Axis
Identifier: y
ComponentType: Absolute Analog
Component 3: X Axis
Identifier: x
ComponentType: Absolute Analog
Component 4: Hat Switch
Identifier: pov
ComponentType: Absolute Digital
Component 5: Button 0
Identifier: Unknown
ComponentType: Absolute Digital
Component 6: Button 1
Identifier: Unknown
ComponentType: Absolute Digital
Component 7: Button 2
Identifier: Unknown
ComponentType: Absolute Digital
Component 8: Button 3
Identifier: Unknown
ComponentType: Absolute Digital
Component 9: Button 4
Identifier: Unknown
ComponentType: Absolute Digital
Component 10: Button 5
Identifier: Unknown
ComponentType: Absolute Digital
Component 11: Button 6
Identifier: Unknown
ComponentType: Absolute Digital
Component 12: Button 7
Identifier: Unknown
ComponentType: Absolute Digital
Component 13: Button 8
Identifier: Unknown
ComponentType: Absolute Digital
Component 14: Button 9
Identifier: Unknown
ComponentType: Absolute Digital
Component 15: Button 10
Identifier: Unknown
ComponentType: Absolute Digital
Component 16: Button 11
Identifier: Unknown
ComponentType: Absolute Digital

Hi

Thanks.

I’m away over the weekend and have another jinput issue to resolve also (I know the problem so should be easy to fix). I’ll have to spend some time digging on this one.

Endolf

Hi

I think I might know why it’s happening now.

Furthur investigation is required to figure out how to solve this.

Endolf

Hi

new test build for windows up at the NewDawn site. The webstart has been updated too.

Endolf

A side note btw is that for JNWN I went the reverse way, which is what many games do.

For the kesy I do a search on the string to find the key, but then I bind it througha “virtual key” such that it can be re-bound by the user. I also wrote a “scan” system so the suer cna say “rebind this” and then press a key on the keyboard and the scan finds the key pressed and binds it to the virtual button.

@Endolf

I tried the webstart demo just now and it looks like there is still a bug at this point. I get the following results from the test for the gamepad:

“Button 0” through “Button 8” still have an “Unknown” identifier.

Then, “Button 9” through “Button 11” do have an id which is better than before, but it might not be correct:
Button 9(0)
Button 10(1)
Button 11(2)

The joystick shows “Unknown” for “Button 0” through “Button 7”, which is all the buttons it has.

@Jeff

I agree, the design you describe is a good way to handle input mapping. I didn’t add user customization, but I did implement the virtual keys part already in case I wanted to later. My project isn’t very far along though, so for now I just wanted to provide a default mapping for the virtual keys, which is why I got into the identifier issue in the first place :).

Chris

Erg.

I think directx is reporting some strange things :slight_smile:

Would you be able to run some test code for me if I upload it?

Thanks

Endolf

Sure that’s no problem at all. I will be watching this thread for whatever you want me to try.

Chris