summaryrefslogtreecommitdiffstats
path: root/make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java
blob: 81697419180473b3eab54181524affaa405982ed (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 = SecurityUtil.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("Couldn't load native OVR/JNI glue library");
                          return null;
                        } */
                        if(!bundle.isLibComplete()) {
                          System.err.println("Couldn'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; }