Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1021: OVR GlueGen Mapping: Handle non-existent native oculusvr li…
…b gracefully - query isAvailable() in ovr_Initialize(), ovrHmd_Create(..) and ovrHmd_CreateDebug(..) and return appropriate values.
- Loading branch information
Showing
2 changed files
with
35 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,33 @@ | ||
|
||
static { | ||
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()) { | ||
throw new RuntimeException("Couln't load native OVR library"); | ||
} */ | ||
if(!bundle.isLibComplete()) { | ||
throw new RuntimeException("Couln't load native OVR/JNI glue library"); | ||
} | ||
if( !initializeImpl() ) { | ||
throw new RuntimeException("Initialization failure"); | ||
} | ||
return bundle; | ||
} } ); | ||
} | ||
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; } | ||
|