Slick Forums

Discuss the Slick 2D Library
It is currently Sat May 18, 2013 1:31 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri Aug 22, 2008 1:53 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
I'd like to not require the jinput native libs, since my game doesn't do anything with controllers. If I just don't distrubte the libs everything works but I get this in the logs:

java.lang.UnsatisfiedLinkError: no jinput-dx8 in java.library.path

Is it possible to only depend on the lwjgl native lib and not the rest, without errors?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 7:09 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
The error is informational, it doesn't break anything not having those DLLs present. Just means controller input doesn't work.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 9:45 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
But... but, my logs! :cry:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 10:09 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
*chuckle*

Go on, post one more moan and I'll sort it so it just displays a warning or something if possible.

Think I've been round this loop before tho, the exception log might be something I can't prevent.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 3:41 pm 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
I know I'm moaning, but it looks like an error to users. :?

You're right, the exception happens in a PrivilegedAction so it can't be caught. Could use something like this in Input.java right before the call to "Controllers.create();"...

Code:
class LoadLibAction implements PrivilegedAction {
   boolean failed;

   public final Object run () {
      try {
         String lib_path = System.getProperty("net.java.games.input.librarypath");
         if (lib_path != null)
            System.load(lib_path + File.separator + System.mapLibraryName("jinput-dx8"));
         else
            System.loadLibrary("jinput-dx8");
      } catch (UnsatisfiedLinkError e) {
         failed = true;
      }
      return null;
   }
}
LoadLibAction action = new LoadLibAction();
AccessController.doPrivileged(action);
if (action.failed) {
   Log.info("Found 0 controllers (jinput not available)");
   return;
}


Maybe a simpler workaround would be a setting in Slick that turns off the controller support, so Slick will never try to call into the jinput stuff? With brief testing this seems to work...

Code:
/**
* Disables support for controllers. This means the jinput JAR and native libs are not required.
*/
static public void disableControllers () {
   controllersInited = true;
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 03, 2008 12:51 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
I second my own vote for the "disableControllers" method. :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2008 7:09 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
disabledControllers() in SVN.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2008 7:59 pm 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Yay! Thanks Kev! Also thanks for the lines fix. You ROCK! :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group