Last bit of OpenXR tidy up

This commit is contained in:
Simon 2023-02-04 09:26:24 +00:00
parent dc17afde16
commit fa220af9f7
4 changed files with 20 additions and 19 deletions

View file

@ -377,7 +377,7 @@ bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection)
if (!vr.cgzoommode)
{
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
{
XrFovf fov = {};
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
@ -390,7 +390,8 @@ bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection)
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,
fov, zNear, zFar);
}
else
if (strstr(gAppState.OpenXRHMD, "pico") != NULL)
{
XrMatrix4x4f_CreateProjectionFov(
&(gAppState.ProjectionMatrices[eye]), GRAPHICS_OPENGL_ES,

View file

@ -928,7 +928,7 @@ void ovrApp_HandleSessionStateChanges(ovrApp* app, XrSessionState state) {
OXR(pfnPerfSettingsSetPerformanceLevelEXT(
app->Session, XR_PERF_SETTINGS_DOMAIN_GPU_EXT, gpuPerfLevel));
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
{
PFN_xrSetAndroidApplicationThreadKHR pfnSetAndroidApplicationThreadKHR = NULL;
OXR(xrGetInstanceProcAddr(
@ -1448,7 +1448,7 @@ void TBXR_InitRenderer( ) {
gAppState.Instance, gAppState.SystemId, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, &gAppState.ViewportConfig));
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
{
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;
@ -1565,7 +1565,7 @@ void TBXR_InitRenderer( ) {
gAppState.Projections[eye].type = XR_TYPE_VIEW;
}
if (strstr(gAppState.OpenXRHMDModel, "Quest") == NULL) // PICO
if (strstr(gAppState.OpenXRHMD, "meta") == NULL) // PICO
{
xrGetInstanceProcAddr(gAppState.Instance,"xrSetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrSetConfigPICO));
xrGetInstanceProcAddr(gAppState.Instance,"xrGetConfigPICO", (PFN_xrVoidFunction*)(&pfnXrGetConfigPICO));
@ -1598,7 +1598,7 @@ void TBXR_InitialiseOpenXR()
EglInitExtensions();
//First, find out which HMD we are using
gAppState.OpenXRHMDModel = (char*)getenv("OPENXR_HMD");
gAppState.OpenXRHMD = (char*)getenv("OPENXR_HMD");
PFN_xrInitializeLoaderKHR xrInitializeLoaderKHR;
xrGetInstanceProcAddr(
@ -1636,7 +1636,7 @@ void TBXR_InitialiseOpenXR()
instanceCreateInfo.applicationInfo = appInfo;
instanceCreateInfo.enabledApiLayerCount = 0;
instanceCreateInfo.enabledApiLayerNames = NULL;
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
{
instanceCreateInfo.enabledExtensionCount = numRequiredExtensions_meta;
instanceCreateInfo.enabledExtensionNames = requiredExtensionNames_meta;
@ -1689,7 +1689,7 @@ void TBXR_InitialiseOpenXR()
OXR(pfnGetOpenGLESGraphicsRequirementsKHR(gAppState.Instance, gAppState.SystemId,
&graphicsRequirements));
if (strstr(gAppState.OpenXRHMDModel, "Quest") != NULL)
if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
{
XrSystemColorSpacePropertiesFB colorSpacePropertiesFB = {};
colorSpacePropertiesFB.type = XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB;

View file

@ -224,7 +224,7 @@ typedef struct
bool Resumed;
bool Focused;
bool FrameSetup;
char* OpenXRHMDModel;
char* OpenXRHMD;
float Width;
float Height;

View file

@ -38,6 +38,7 @@ import java.util.Vector;
@SuppressLint("SdCardPath") public class GLES3JNIActivity extends Activity implements SurfaceHolder.Callback
{
private static String game = "";
private static String manufacturer = "";
private boolean hapticsEnabled = false;
@ -67,17 +68,19 @@ import java.util.Vector;
e.printStackTrace();
}
String manufacturer = Build.MANUFACTURER.toLowerCase(Locale.ROOT);
if (manufacturer.contains("oculus") ||
manufacturer.contains("meta"))
manufacturer = Build.MANUFACTURER.toLowerCase(Locale.ROOT);
if (manufacturer.contains("oculus")) // rename oculus to meta as this will probably happen in the future anyway
{
System.loadLibrary("openxr_loader_meta");
manufacturer = "meta";
}
else
try
{
//Load manufacturer specific loader
System.loadLibrary("openxr_loader_" + manufacturer);
}
setenv("OPENXR_HMD", manufacturer, true);
} catch (Exception e)
{}
System.loadLibrary( "openjk_" + game );
}
@ -225,8 +228,7 @@ import java.util.Vector;
copy_asset("/sdcard/JKQuest/JK3/base", "z_vr_assets_jka.pk3", true);
//Bummser's default configuration
String model = android.os.Build.MODEL;
if (model.contains("Quest")) {
if (manufacturer.contains("meta")) {
//Meta Quest
copy_asset_with_rename("/sdcard/JKQuest/JK2/base", "openjo_sp_quest.cfg", "openjo_sp.cfg", false);
} else {
@ -261,8 +263,6 @@ import java.util.Vector;
try {
setenv("JK_LIBDIR", getApplicationInfo().nativeLibraryDir, true);
setenv("OPENXR_HMD", model, true);
}
catch (Exception e)
{