Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (593)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (646)
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  
  JOAL with JNLPAppletLauncher  (Read 2790 times)
0 Members and 1 Guest are viewing this topic.
Agrv2236
Guest
« Posted 2008-06-06 15:41:31 »

Using JOAL with the JNLPAppletLauncher does not work, I get the following exception if wrap_oal.dll and OpenAL32.dll are absent from the c:\windows\system32 folder :

java.lang.RuntimeException: Can not get proc address for method "alcCaptureCloseDevice": Couldn't set value of field "_addressof_alcCaptureCloseDevice" in class net.java.games.joal.impl.ALCProcAddressTable
   at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(ProcAddressHelper.java:68)
   at net.java.games.joal.impl.ALProcAddressLookup.resetALCProcAddressTable(ALProcAddressLookup.java:109)
   at net.java.games.joal.impl.ALCImpl.alcOpenDevice(ALCImpl.java:341)
   at imiuzetna.audio.AudioContext.<init>(Unknown Source)
   at imiuzetna.video.Interface.<init>(Unknown Source)
   at imiuzetna.Imiuzetna.playScene(Unknown Source)
   at auberge_emu.MainApplet.run(Unknown Source)
   at imiuzetna.ImiuzetnaApplet$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Unable to find and load OpenAL library
   at net.java.games.joal.impl.ALProcAddressLookup$DynamicLookup.dynamicLookupFunction(ALProcAddressLookup.java:66)
   at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(ProcAddressHelper.java:64)
   ... 8 more

With wrap_oal.dll and OpenAL32.dll in the c:\windows\system32 folder, I have sound in the applet.
When launching the same app with Java webstart on the same computer, JOAL woks without problems.
I think JOAL worked with the JOGLAppletLauncher without the need of the two dlls in the system folder, maybe there's some code from the JOGLAppletLauncher that is missing in the JNLPAppletLauncher.

Thanks for your help.
Offline Agrv

Junior Newbie





« Reply #1 - Posted 2008-06-09 09:12:30 »

(I changed my account name as I realised it was available again)

I think the loading of OpenAL32.dll and wrap_oal.dll works on the JOGLAppletLauncher thanks to this code :

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  
          if (haveJOAL) {
            // Turn off the System.loadLibrary call of the joal_native
            // library. It will still need to load the OpenAL library
            // internally via another mechanism.
            try {
              Class c = Class.forName("net.java.games.joal.impl.NativeLibLoader");
              c.getMethod("disableLoading", new Class[] {}).invoke(null, new Object[] {});
            } catch (Exception e) {
              e.printStackTrace();
            }

            // Append the installed native library directory to
            // java.library.path. This is the most convenient way to
            // make this directory available to the NativeLibrary code,
            // which needs it for loading OpenAL if present.
            String javaLibPath = System.getProperty("java.library.path");
            String absPath = nativeLibDir.getAbsolutePath();
            boolean shouldSet = false;
            if (javaLibPath == null) {
              javaLibPath = absPath;
              shouldSet = true;
            } else if (javaLibPath.indexOf(absPath) < 0) {
              javaLibPath = javaLibPath + File.pathSeparator + absPath;
              shouldSet = true;
            }
            if (shouldSet) {
              System.setProperty("java.library.path", javaLibPath);
            }

            // Load core JOAL native library
            loadLibrary(nativeLibDir, "joal_native");
          }


But the JNLPAppletLauncher does not extract the content of the joal-native-xxx.jar, so even if I add this code at the beginning of my app it will not work. Does anybody have an idea ?
Offline Agrv

Junior Newbie





« Reply #2 - Posted 2008-06-09 12:18:28 »

OK i found a workaround for those interested in this issue. I have added the following code in the "extractNativeLibs" method from the JNLPAppletLauncher, juste before the "nativeLibMap.put(libName, nativeLib.getAbsolutePath());" line (code is borrowed from the JOGLAppletLauncher) :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
                if(entryName.toLowerCase().equals("openal32.dll"))
                {
                    // Append the installed native library directory to
                    // java.library.path. This is the most convenient way to
                    // make this directory available to the NativeLibrary code,
                    // which needs it for loading OpenAL if present.
                    String javaLibPath = System.getProperty("java.library.path");
                    String absPath = nativeTmpDir.getAbsolutePath();
                    boolean shouldSet = false;
                    if (javaLibPath == null) {
                      javaLibPath = absPath;
                      shouldSet = true;
                    } else if (javaLibPath.indexOf(absPath) < 0) {
                      javaLibPath = javaLibPath + File.pathSeparator + absPath;
                      shouldSet = true;
                    }
                    if (shouldSet) {
                      System.setProperty("java.library.path", javaLibPath);
                    }
                    System.out.println(System.getProperty("java.library.path"));
                }
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
Riven (16 views)
2015-07-03 11:22:16

deepthought (44 views)
2015-06-30 15:39:44

deepthought (48 views)
2015-06-30 15:39:09

deepthought (58 views)
2015-06-30 15:36:52

Za\'Anzabar (28 views)
2015-06-29 05:44:54

TritonDreyja (44 views)
2015-06-24 17:10:40

CopyableCougar4 (43 views)
2015-06-23 00:34:45

BurntPizza (46 views)
2015-06-21 20:36:46

cookiecompiler (88 views)
2015-06-11 15:42:53

cookiecompiler (51 views)
2015-06-11 15:41:14
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14
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!