Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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  
  DX8 Controller assertion?  (Read 2579 times)
0 Members and 1 Guest are viewing this topic.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Posted 2003-10-13 16:33:33 »

I'm giving JInput's support for controllers a whirl, however I get a funny assertion poping up.

Triggering the assert from:
1  
2  
3  
            ControllerEnvironment env = ControllerEnvironment.getDefaultEnvironment();
            Controller[] controllers = env.getControllers();
            System.out.println("Found "+controllers.length+" controllers.");

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  
java.lang.AssertionError
      at net.java.games.input.DirectInputEnvironmentPlugin.addDevice(DirectInputEnvironmentPlugin.java:165)
      at net.java.games.input.DirectInputEnvironmentPlugin.enumDevices(Native Method)
      at net.java.games.input.DirectInputEnvironmentPlugin.enumControllers(DirectInputEnvironmentPlugin.java:133)
      at net.java.games.input.DirectInputEnvironmentPlugin.<init>(DirectInputEnvironmentPlugin.java:113)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
      at java.lang.Class.newInstance0(Class.java:296)
      at java.lang.Class.newInstance(Class.java:249)
      at net.java.games.input.DefaultControllerEnvironment.scanControllersAt(DefaultControllerEnvironment.java:188)
      at net.java.games.input.DefaultControllerEnvironment.scanControllers(DefaultControllerEnvironment.java:169)
      at net.java.games.input.DefaultControllerEnvironment.access$000(DefaultControllerEnvironment.java:57)
      at net.java.games.input.DefaultControllerEnvironment$1.run(DefaultControllerEnvironment.java:108)
      at java.security.AccessController.doPrivileged(Native Method)
      at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:106)
      at com.vecript.core.entity.DefaultRootEntity.<init>(DefaultRootEntity.java:36)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
      at java.lang.Class.newInstance0(Class.java:296)
      at java.lang.Class.newInstance(Class.java:249)
      at com.vecript.core.entity.EntityFactory.createEntity(EntityFactory.java:78)
      at com.vecript.core.entity.EntityFactory.createEntity(EntityFactory.java:64)
      at com.vecript.core.Scene.<init>(Scene.java:33)
      at com.vecript.core.Vecript.initialise(Vecript.java:183)
      at com.vecript.core.Vecript.main(Vecript.java:289)


The offending code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
    private void addDevice(ArrayList list, long lpDevice,
        int type, String productName, String instanceName, boolean polled) {
        Controller c;
        int category = GET_DIDEVICE_TYPE(type);
        int subtype = GET_DIDEVICE_SUBTYPE(type);
        //System.out.println("Category = "+category);
       if (category == DI8DEVTYPE_MOUSE) {
            c = DirectInputMouse.createMouse(lpDevice, subtype, productName,
                instanceName);
        } else if (category == DI8DEVTYPE_KEYBOARD) {
            c = DirectInputKeyboard.createKeyboard(lpDevice, subtype,
                productName, instanceName);
        } else {
            assert category == DI8DEVTYPE_JOYSTICK; // Asserts here!
           c = DirectInputDevice.createDevice(lpDevice, subtype, productName,
                instanceName,polled);
        }
        if (c != null) {
            list.add(c);
        }
    }


A quick check in the debugger shows that the final else statement checks the catergory is a joystick. Well, close enough its a gamecube joypad hooked up via usb. But the actual catergory is DI8DEVTYPE_1STPERSON  Shocked Is this possibly because its a 6-axis controller?

Running without asserts I obviously don't get the assertion, but I also don't get any values back Sad All the Controller axies return 0.0 (although it gets a full 18 axies, I assumes this is 6 analog axies + 12 buttons).

Anyone any ideas?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #1 - Posted 2003-10-14 06:13:24 »

Hi
 I have an idea, raise it as a bug on the jinput.dev.java.net issues list Smiley, that way, someone might take a look Smiley. I have some ideas, but havn't got anything to test with, i'll add it to my todo list once the issue has been raised *prod*, unless Jeff has a free second Smiley

Endolf

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #2 - Posted 2003-10-14 07:17:58 »

Cheers, Its raised as issue 2: https://games.dev.java.net/issues/show_bug.cgi?id=2

Checking out other stuff, its seems like it doesn't find any rumblers for the pad either Sad Should return one rumbler I think. Is this a known issue?

Assuming I can get the time to get my system building JInput itself, is there anything specific I could try to see whats going on?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #3 - Posted 2003-10-14 09:25:01 »

I've raised this over here where it belongs (jinput.dev.java.net).

If you buy me a gamecube so I can test the controller, i'll fix it for you Tongue

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #4 - Posted 2003-10-14 09:37:30 »

Hi
 I've just had a quick look at the code and have a reasonable guess at what might be happening, if you can get jinput building we can work something out (off the list, else it will get noisy in here) where I mail you code, and you mail me results, it won't be quick, but we can probably fix it this way. I don't have access to a gamecube controller (or any gamepad) and I think that a 'normal' PC gamepad won't show the same error (although some might have troubles). If it comes to it I can mail you the controller plugin bits, but i'm on very restricted bandwidth for personal code (9600bps) as my phone line hasn't been activated yet.

Endolf

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #5 - Posted 2003-10-14 09:42:52 »

Well i'm downloading the whoppingly large DX9 SDK at the moment, i'll give you a message when I get things building ok Smiley

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Jeff

JGO Coder




Got any cats?


« Reply #6 - Posted 2003-10-15 00:34:28 »

Cheers guys.  if there's anything I can do to help now that I'm back, ping me!

Jeff

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #7 - Posted 2003-10-15 07:12:04 »

Quote


That is a busy issues list, isn't it?  I raised issue 1 back in August and it's obviously still being got around to... Roll Eyes Grin

Hellomynameis Charlie Dobbie.
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #8 - Posted 2003-10-15 09:21:55 »

Quote
Cheers guys.  if there's anything I can do to help now that I'm back, ping me!


PING

hows about a game cube controller Tongue

while yer at it, maybe some force feedback kit, I can see that i'm gonna end up in rumbler/ff code, in both linux and windows Smiley, and just as I was getting back into 3d with xith3d Smiley

and whilst the wish list is going. A house away from this dump called london with a nice view, somewhere up in scotland maybe, with a nice big broadband connection, and a salary to write jinput code for as long as I want Smiley, that way I can do my own code in the evenings Smiley. Ahh, the stuff dreams are made of

/me slaps Orangey Tang for interupting his coding plans Smiley

Endolf

Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #9 - Posted 2003-10-15 11:50:06 »

I've now got things set up at home with Mac OS X 10.2.8 (soon 10.3 yay!) (powerbook G4),  WinXP, and RedHat Linux 9.

I have an iShock II game controller with rumblers that works on Mac and Windows.  I haven't a clue how to try it on Linux.  I also have a Wingman Extreme joystick with tophat switch that I can try on XP and Linux.  Along with PS/2 mouse/keyboard and USB mouse/keyboard.

I don't have much time to contribute to development, but I will certainly run tests and collect debug output for anyone.  Hopefully I can get up to speed with at least the WinXP and MacOS native code and start contributing more there.
I would like to get the rumbler support working.

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

JGO Coder




Got any cats?


« Reply #10 - Posted 2003-10-15 15:53:26 »

Hey End,

If a 3rd party game cube controllers would do, I'll see what i can do. (Sorry, I can't afford to buy you a whole game cube just for the controller.)

On the rest, well, if I had funding for a JInput programmer, you'ld certainly be tops on the list.  We can keep an ear out for folks who might be looking for a Java and Games savvy engineer but I can't promise much beyond that I'm afraid Sad

JK

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #11 - Posted 2003-10-15 16:17:45 »

Quote

If a 3rd party game cube controllers would do, I'll see what i can do.


Unfortunatly its not that simple.. To actually plug the thing into a usb port you need an adapter, and the only one avalible I could find I had to import from japan via lik-sang.com.

And before anyone starts pointing fingers at my freaky choice of hardware, LWJGL managed to support it without a hitch Tongue

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #12 - Posted 2003-10-15 18:48:31 »

Quote
Unfortunatly its not that simple..


Is it ever??? Smiley

Having got some more debug (thanks muchly), dx is failing when it calls the native poll with a DI_NOTATTACHED. This puts the readtest application on alert and it marks the device as disabled. The reason for this isn't yet established. Further research to get things playing ball is needed.

Endolf

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #13 - Posted 2003-10-15 18:54:29 »

Quote
Hey End,

If a 3rd party game cube controllers would do, I'll see what i can do.

Thanks for the offer, but as orangy tang pointed out, it's far to simple a solution Smiley, and I have am wondering right now if there is more to this than jinput getting things wrong, also, sending things from the US is painfully slow and/or expensive, my girlfriends parents who live in deleware sent her some mail by non airmail, it took almost 2 months to arrive (erg). The alternative was rather expensive for the item being sent.

Endolf

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #14 - Posted 2003-10-17 13:48:49 »

Boo
 In a vague effort to try and work out wtf is going on, I'm off to try and get a wingman rumblepad cordless USB thingy, which OrangyTang has said is playing silly buggers too. Hopefully next week when i get back from home I can either reproduce it, or give it up as a configuration error and pretend the world is a wonderful place Tongue. On the plus side for you lot (and the down side for me) either way I will have a controller with rumblers in it, so can start playing with windows and linux rumbler support.

Endolf

Edit: Gamepad purchased, PC world for 40 quid, damn I hope it's broken OrangyTang, or you get the bill Tongue, depending on how long I get stuck in traffic, I might start testing tonight, if not, I should be able to try it tomorrow evening after work.

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #15 - Posted 2003-10-20 05:54:04 »

Morning
 I played with the controller last night, I get the same problem as Orangy Tang, yet it works fine in fs2004. I did a quick bit of research and found that if I comment out lines 457, 458 and 459 in the input.cpp, where it sets the poll attribute to true, then poll remains at false and it all works fine. I will look into this more tonight, but it looks like we are getting closer now. Orangy Tang, can you try it on your box and let me know if it also fixes the gamecube controller?

Cheers

Endolf

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #16 - Posted 2003-10-20 17:02:47 »

Fixed Smiley

commited to cvs

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.

UprightPath (20 views)
2014-09-20 20:14:06

BurntPizza (26 views)
2014-09-19 03:14:18

Dwinin (40 views)
2014-09-12 09:08:26

Norakomi (70 views)
2014-09-10 13:57:51

TehJavaDev (95 views)
2014-09-10 06:39:09

Tekkerue (49 views)
2014-09-09 02:24:56

mitcheeb (70 views)
2014-09-08 06:06:29

BurntPizza (52 views)
2014-09-07 01:13:42

Longarmx (39 views)
2014-09-07 01:12:14

Longarmx (45 views)
2014-09-07 01:11:22
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!