mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03:00
dirty vee arr stuff
This commit is contained in:
parent
004ba4ff00
commit
9b70b6266c
3 changed files with 46 additions and 1 deletions
|
@ -70,6 +70,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||
Constructor<? extends Activity> constructor = cls.getConstructor();
|
||||
Activity activity = constructor.newInstance();
|
||||
activity.window.native_window = native_window;
|
||||
activity.intent.putExtra("unity", "-scoreID=14913935");
|
||||
return activity;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class Build {
|
|||
/**
|
||||
* The manufacturer of the product/hardware.
|
||||
*/
|
||||
public static final String MANUFACTURER = "HTC"/* HTC picked at random; getString("ro.product.manufacturer")*/;
|
||||
public static final String MANUFACTURER = "Not oculus bro";// getString("ro.product.manufacturer");
|
||||
|
||||
/**
|
||||
* The brand (e.g., carrier) the software is customized for, if any.
|
||||
|
|
|
@ -557,6 +557,8 @@ typedef XrResult(*xr_func)();
|
|||
|
||||
#define ARRRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
static XrInstance xr_current_instance = NULL;
|
||||
|
||||
// avoid hard dependency on libopenxr_loader for the three functions that we only ever call when running a VR app
|
||||
static void *openxr_loader_handle = NULL;
|
||||
static inline __attribute__((__always_inline__)) XrResult xr_lazy_call(char *func_name, ...) {
|
||||
|
@ -568,7 +570,21 @@ static inline __attribute__((__always_inline__)) XrResult xr_lazy_call(char *fun
|
|||
return func(__builtin_va_arg_pack());
|
||||
}
|
||||
|
||||
static inline __attribute__((__always_inline__)) XrResult xr_lazy_call_getproc(char *func_name, ...) {
|
||||
if(!openxr_loader_handle) {
|
||||
openxr_loader_handle = dlopen("libopenxr_loader.so.1", RTLD_LAZY);
|
||||
}
|
||||
|
||||
xr_func func = NULL;
|
||||
XrResult ret = xr_lazy_call("xrGetInstanceProcAddr", xr_current_instance, func_name, &func);
|
||||
if (!func) {
|
||||
fprintf(stderr, "Failed to get %s: %d (instance=0x%x)\n", func_name, ret, xr_current_instance);
|
||||
return XR_ERROR_RUNTIME_FAILURE;
|
||||
}
|
||||
return func(__builtin_va_arg_pack());
|
||||
}
|
||||
static XrResult bionic_xrInitializeLoaderKHR(void *loaderInitInfo)
|
||||
|
||||
{
|
||||
fprintf(stderr, "STUB: xrInitializeLoaderKHR noop called\n");
|
||||
return XR_SUCCESS;
|
||||
|
@ -663,6 +679,13 @@ XrResult bionic_xrCreateReferenceSpace(XrSession session, const XrReferenceSpace
|
|||
return xr_lazy_call("xrCreateReferenceSpace", session, createInfo, space);
|
||||
}
|
||||
|
||||
static XrResult xrGetSwapchainStateFB(XrSwapchain swapchain, XrSwapchainStateBaseHeaderFB* state)
|
||||
{
|
||||
fprintf(stderr, "xrGetSwapchainStateFB(state->type == %d)\n", state->type);
|
||||
|
||||
return xr_lazy_call_getproc("xrGetSwapchainStateFB", swapchain, state);
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: Here we implement a NIH OpenXR API layer.
|
||||
*
|
||||
|
@ -687,6 +710,7 @@ struct xr_proc_override {
|
|||
};
|
||||
|
||||
#define XR_PROC_BIONIC(name) {#name, (void (**)(void))bionic_ ## name }
|
||||
#define XR_PROC_STATIC(name) {#name, name }
|
||||
|
||||
/* Please keep the alphabetical order */
|
||||
static const struct xr_proc_override xr_proc_override_tbl[] = {
|
||||
|
@ -694,6 +718,7 @@ static const struct xr_proc_override xr_proc_override_tbl[] = {
|
|||
XR_PROC_BIONIC(xrCreateReferenceSpace),
|
||||
XR_PROC_BIONIC(xrCreateSession),
|
||||
XR_PROC_BIONIC(xrGetInstanceProperties),
|
||||
XR_PROC_STATIC(xrGetSwapchainStateFB),
|
||||
XR_PROC_BIONIC(xrInitializeLoaderKHR),
|
||||
};
|
||||
|
||||
|
@ -701,6 +726,9 @@ XrResult bionic_xrGetInstanceProcAddr(XrInstance instance, const char *name, PFN
|
|||
{
|
||||
printf("xrGetInstanceProcAddr(%s)\n", name);
|
||||
|
||||
if (instance)
|
||||
xr_current_instance = instance;
|
||||
|
||||
struct xr_proc_override *match = bsearch(name, xr_proc_override_tbl,
|
||||
ARRRAY_SIZE(xr_proc_override_tbl),
|
||||
sizeof(xr_proc_override_tbl[0]),
|
||||
|
@ -721,3 +749,19 @@ void ANativeActivity_setWindowFormat(ANativeActivity *activity, int32_t format)
|
|||
{
|
||||
printf("STUB: %s called\n", __func__);
|
||||
}
|
||||
|
||||
/* HACK: This is for ovrplugin */
|
||||
|
||||
int bionic_ovrp_GetSystemMultiViewSupported2(bool *supported)
|
||||
{
|
||||
fprintf(stderr, "STUB: ovrp_GetSystemMultiViewSupported2 called. Returning FALSE!\n");
|
||||
*supported = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bionic_ovrp_GetSystemMultiViewSupported(void)
|
||||
{
|
||||
fprintf(stderr, "STUB: ovrp_GetSystemMultiViewSupported called. Returning FALSE!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue