aboutsummaryrefslogtreecommitdiffstats
path: root/make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java
blob: 281610a206106396d457b09d48b473cd00f28234 (plain)
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

    static final DynamicLibraryBundle dynamicLookupHelper;

    static {
        dynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() {
                    public DynamicLibraryBundle run() {
                        final DynamicLibraryBundle bundle =  new DynamicLibraryBundle(new OVRDynamicLibraryBundleInfo());
                        if(null==bundle) {
                          throw new RuntimeException("Null DynamicLibraryBundle");
                        }
                        /** No native tool library to load
                        if(!bundle.isToolLibLoaded()) {
                          System.err.println("Couln't load native OVR/JNI glue library");
                          return null;
                        } */
                        if(!bundle.isLibComplete()) {
                          System.err.println("Couln't load native OVR/JNI glue library");
                          return null;
                        }
                        if( !initializeImpl() ) {
                          System.err.println("Native initialization failure of OVR/JNI glue library");
                          return null;
                        }
                        return bundle;
                    } } );
    }

    /**
     * Accessor.
     * @returns true if OVR library is available on this machine.
     */
    public static boolean isAvailable() { return dynamicLookupHelper != null; }