Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
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 2336 times)
0 Members and 1 Guest are viewing this topic.
Agrv2236
Guest
« Posted 2008-06-06 17: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 11: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 14: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.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (130 views)
2013-05-17 21:29:12

alaslipknot (137 views)
2013-05-16 21:24:48

gouessej (168 views)
2013-05-16 00:53:38

gouessej (160 views)
2013-05-16 00:17:58

theagentd (172 views)
2013-05-15 15:01:13

theagentd (157 views)
2013-05-15 15:00:54

StreetDoggy (201 views)
2013-05-14 15:56:26

kutucuk (225 views)
2013-05-12 17:10:36

kutucuk (224 views)
2013-05-12 15:36:09

UnluckyDevil (228 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.225 seconds with 22 queries.