Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (511)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Multiple Identifiers of the same type reported  (Read 2328 times)
0 Members and 1 Guest are viewing this topic.
Offline Conzar

Junior Duke




There is nothing common about common sense


« Posted 2007-05-12 02:13:11 »

Hey guys,
  So I am having an issue where multiple Identifier types are being reported for a controller (Saitek X45).
I've posted the output that I get for the ReadText test program using the linux version of jinput.  Notice that Component 29: rz and Component 31: rz are both being reported as rz types.  There are also a few buttons that are being reported as  UNKNOWN

So is there an easy way to distinquish which component is reporting back even if they have the same Identifiers?

Thanks!


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
Controller Env = net.java.games.input.DefaultControllerEnvironment@c53dce
Linux plugin claims to have found 4 controllers
Saitek Saitek X45
Type: Stick
Component Count: 33
Component 0: Trigger
    Identifier: Trigger
    ComponentType: Absolute Digital
Component 1: Thumb
    Identifier: Thumb
    ComponentType: Absolute Digital
Component 2: Thumb 2
    Identifier: Thumb 2
    ComponentType: Absolute Digital
Component 3: Top
    Identifier: Top
    ComponentType: Absolute Digital
Component 4: Top 2
    Identifier: Top 2
    ComponentType: Absolute Digital
Component 5: Pinkie
    Identifier: Pinkie
    ComponentType: Absolute Digital
Component 6: Base
    Identifier: Base
    ComponentType: Absolute Digital
Component 7: Base 2
    Identifier: Base 2
    ComponentType: Absolute Digital
Component 8: Base 3
    Identifier: Base 3
    ComponentType: Absolute Digital
Component 9: Base 4
    Identifier: Base 4
    ComponentType: Absolute Digital
Component 10: Base 5
    Identifier: Base 5
    ComponentType: Absolute Digital
Component 11: Base 6
    Identifier: Base 6
    ComponentType: Absolute Digital
Component 12: Unknown
    Identifier: Unknown
    ComponentType: Absolute Digital
Component 13: Unknown
    Identifier: Unknown
    ComponentType: Absolute Digital
Component 14: Unknown
    Identifier: Unknown
    ComponentType: Absolute Digital
Component 15: Dead
    Identifier: Dead
    ComponentType: Absolute Digital
Component 16: A
    Identifier: A
    ComponentType: Absolute Digital
Component 17: B
    Identifier: B
    ComponentType: Absolute Digital
Component 18: C
    Identifier: C
    ComponentType: Absolute Digital
Component 19: X
    Identifier: X
    ComponentType: Absolute Digital
Component 20: Y
    Identifier: Y
    ComponentType: Absolute Digital
Component 21: Z
    Identifier: Z
    ComponentType: Absolute Digital
Component 22: Left Thumb
    Identifier: Left Thumb
    ComponentType: Absolute Digital
Component 23: Right Thumb
    Identifier: Right Thumb
    ComponentType: Absolute Digital
Component 24: Left Thumb 2
    Identifier: Left Thumb 2
    ComponentType: Absolute Digital
Component 25: Right Thumb 2
    Identifier: Right Thumb 2
    ComponentType: Absolute Digital
Component 26: x
    Identifier: x
    ComponentType: Absolute Analog
Component 27: y
    Identifier: y
    ComponentType: Absolute Analog
Component 28: rx
    Identifier: rx
    ComponentType: Absolute Analog
Component 29: rz
    Identifier: rz
    ComponentType: Absolute Analog
Component 30: slider
    Identifier: slider
    ComponentType: Absolute Analog
Component 31: rz
    Identifier: rz
    ComponentType: Absolute Analog
Component 32: pov
    Identifier: pov
    ComponentType: Absolute Digital

Ubuntu
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #1 - Posted 2007-05-12 10:12:01 »

Hi

Currently, we just set the name from the identifier. Short term I think you need to get the index in the component[] to identify it.

I wonder if we should have an index on there when more than one axis of the same type is detected. This could also be an issue if you have say 2 joysticks plugged in that are the same. The OS might not assign an instance ID. And the name would be the same.

I think maybe the safest way to fix both of these is to have an index of some kind on both controllers and components. The controller indexes are unique across all devices currently connected, and he component index is unique across that controller.

It doesn't even have to be an index, that would imply that a component knows where it sits in the controller, which I'm not sure is a good idea. Maybe just some kind of hash that the plugin assigns that controller/component.

If it's a hash, would it have to be consistant across executions?, would people end up using it for saving player settings?

Lets see if we can get a nice solution for this.

Endolf

Offline elias

Senior Duke





« Reply #2 - Posted 2007-05-12 12:41:16 »

I'm not sure I understand the problem - Identifiers are just structured names for components and there's no guarantee there is only component for each identifier. If you need input from a particular component, ask it directly. If you're using events, the component that triggered an event is included with the event.

The problem of persisting controller settings is not solved of course, as there's no component/controller identification that is guaranteed stable between jinput invocations.

 - elias

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #3 - Posted 2007-05-12 13:20:20 »

I guess currently the only unique identifier is the Component object itself, which like Elias pointed out, you can always get.

Endolf

Offline Conzar

Junior Duke




There is nothing common about common sense


« Reply #4 - Posted 2007-05-13 13:50:30 »

Yea, persisting the controller settings is exactly my problem.  Currently I read the Identifier and associate that with an event.  Save that out to an xml file.  The next time the player runs the game, the xml file is read in and events are associated based on the identifiers.

So certainly you could match the Component object with an event; however, this won't work on multiple executions of the program.

I've thought about tieing  the order in which buttons/axis are reported but is there any gaurantee that the controller will report the buttons in the same order every time?

Thanks

Ubuntu
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #5 - Posted 2007-05-13 14:18:35 »

Hi

The plugin just does what the native layer (OS) tells it, in my experience it's always the same, but I guess there is no gaurantee.

Endolf

Offline Conzar

Junior Duke




There is nothing common about common sense


« Reply #6 - Posted 2007-05-14 12:47:05 »

Do you happen to know if its "always the same" across platform too?  Meaning, will the button layouts be the same on Linux as they are in Windows?

I was thinking it would be cool to have pre-defined controller layouts - for instance, if you have an XBox360 Controller, then a player's controls would default to a standard config for this controller (of course the player could change this if they wanted to).  In order to have such a profile, its necessary to be able to identify the buttons/axis the same way regardless of OS and what other devices are plugged in.

Ubuntu
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #7 - Posted 2007-05-14 16:33:01 »

Hi

Across platforms even the name of the controller changes, this is down to the OS drivers. The axis on joysticks/gamepads differ too. I have one device that IIRC, one of the axis on windows shows up as a throttle (giving two throttles) and under linux it's an rz (given 2 rz), again, it's a driver level thing. Without writing our own drivers or driver wrappers, there isn't alot we can do about this, and jinput is supposed to be the lowest level of interaction, so we just hand to the developers using JInput what we get from the OS.

Endolf

Offline Conzar

Junior Duke




There is nothing common about common sense


« Reply #8 - Posted 2007-05-14 18:02:34 »

Ah, so what about this:

Make profiles OS dependent.  So an XBox360 Controller would essentially have 3 versions of a profile, 1 for linux, 1 for OSX, and 1 for XP.

What do you think about that?

Ubuntu
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #9 - Posted 2007-05-14 20:54:07 »

Hi

That should work. Of course driver updates might screw up axis names and/or the order they are enumerated, but you can't cover everything Smiley

Doing profiles per platform sounds like your best bet.

HTH

Endolf

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (36 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (56 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!