You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
fix some gcc-reported warnings
This commit is contained in:
@@ -364,7 +364,7 @@ void Java_android_app_NativeActivity_unloadNativeCode(JNIEnv* env, jobject clazz
|
|||||||
{
|
{
|
||||||
printf("STUB - unloadNativeCode_native\n");
|
printf("STUB - unloadNativeCode_native\n");
|
||||||
/*if (handle != 0) {
|
/*if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
NativeCode_destroy(code);
|
NativeCode_destroy(code);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
@@ -372,7 +372,7 @@ void Java_android_app_NativeActivity_unloadNativeCode(JNIEnv* env, jobject clazz
|
|||||||
void Java_android_app_NativeActivity_onStartNative(JNIEnv* env, jobject clazz, jlong handle)
|
void Java_android_app_NativeActivity_onStartNative(JNIEnv* env, jobject clazz, jlong handle)
|
||||||
{
|
{
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onStart != NULL) {
|
if (code->callbacks.onStart != NULL) {
|
||||||
code->callbacks.onStart((ANativeActivity *)code);
|
code->callbacks.onStart((ANativeActivity *)code);
|
||||||
}
|
}
|
||||||
@@ -382,7 +382,7 @@ void Java_android_app_NativeActivity_onStartNative(JNIEnv* env, jobject clazz, j
|
|||||||
void Java_android_app_NativeActivity_onResumeNative(JNIEnv* env, jobject clazz, jlong handle)
|
void Java_android_app_NativeActivity_onResumeNative(JNIEnv* env, jobject clazz, jlong handle)
|
||||||
{
|
{
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onResume != NULL) {
|
if (code->callbacks.onResume != NULL) {
|
||||||
code->callbacks.onResume((ANativeActivity *)code);
|
code->callbacks.onResume((ANativeActivity *)code);
|
||||||
}
|
}
|
||||||
@@ -396,7 +396,7 @@ jbyteArray Java_android_app_NativeActivity_onSaveInstanceStateNative(JNIEnv* env
|
|||||||
jbyteArray array = NULL;
|
jbyteArray array = NULL;
|
||||||
|
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onSaveInstanceState != NULL) {
|
if (code->callbacks.onSaveInstanceState != NULL) {
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
jbyte* state = (jbyte*)code->callbacks.onSaveInstanceState((ANativeActivity *)code, &len);
|
jbyte* state = (jbyte*)code->callbacks.onSaveInstanceState((ANativeActivity *)code, &len);
|
||||||
@@ -418,7 +418,7 @@ jbyteArray Java_android_app_NativeActivity_onSaveInstanceStateNative(JNIEnv* env
|
|||||||
void Java_android_app_NativeActivity_onPauseNative(JNIEnv* env, jobject clazz, jlong handle)
|
void Java_android_app_NativeActivity_onPauseNative(JNIEnv* env, jobject clazz, jlong handle)
|
||||||
{
|
{
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onPause != NULL) {
|
if (code->callbacks.onPause != NULL) {
|
||||||
code->callbacks.onPause((ANativeActivity *)code);
|
code->callbacks.onPause((ANativeActivity *)code);
|
||||||
}
|
}
|
||||||
@@ -428,7 +428,7 @@ void Java_android_app_NativeActivity_onPauseNative(JNIEnv* env, jobject clazz, j
|
|||||||
void Java_android_app_NativeActivity_onStopNative(JNIEnv* env, jobject clazz, jlong handle)
|
void Java_android_app_NativeActivity_onStopNative(JNIEnv* env, jobject clazz, jlong handle)
|
||||||
{
|
{
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onStop != NULL) {
|
if (code->callbacks.onStop != NULL) {
|
||||||
code->callbacks.onStop((ANativeActivity *)code);
|
code->callbacks.onStop((ANativeActivity *)code);
|
||||||
}
|
}
|
||||||
@@ -439,7 +439,7 @@ void Java_android_app_NativeActivity_onConfigurationChangedNative(JNIEnv* env, j
|
|||||||
{
|
{
|
||||||
printf("STUB - onConfigurationChanged_native\n");
|
printf("STUB - onConfigurationChanged_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onConfigurationChanged != NULL) {
|
if (code->callbacks.onConfigurationChanged != NULL) {
|
||||||
code->callbacks.onConfigurationChanged((ANativeActivity *)code);
|
code->callbacks.onConfigurationChanged((ANativeActivity *)code);
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,7 @@ void Java_android_app_NativeActivity_onLowMemoryNative(JNIEnv* env, jobject claz
|
|||||||
{
|
{
|
||||||
printf("STUB - onLowMemory_native\n");
|
printf("STUB - onLowMemory_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onLowMemory != NULL) {
|
if (code->callbacks.onLowMemory != NULL) {
|
||||||
code->callbacks.onLowMemory((ANativeActivity *)code);
|
code->callbacks.onLowMemory((ANativeActivity *)code);
|
||||||
}
|
}
|
||||||
@@ -460,7 +460,7 @@ void Java_android_app_NativeActivity_onLowMemoryNative(JNIEnv* env, jobject claz
|
|||||||
void Java_android_app_NativeActivity_onWindowFocusChangedNative(JNIEnv* env, jobject clazz, jlong handle, jboolean focused)
|
void Java_android_app_NativeActivity_onWindowFocusChangedNative(JNIEnv* env, jobject clazz, jlong handle, jboolean focused)
|
||||||
{
|
{
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onWindowFocusChanged != NULL) {
|
if (code->callbacks.onWindowFocusChanged != NULL) {
|
||||||
code->callbacks.onWindowFocusChanged((ANativeActivity *)code, focused ? 1 : 0);
|
code->callbacks.onWindowFocusChanged((ANativeActivity *)code, focused ? 1 : 0);
|
||||||
}
|
}
|
||||||
@@ -471,7 +471,7 @@ void Java_android_app_NativeActivity_onSurfaceCreatedNative(JNIEnv* env, jobject
|
|||||||
{
|
{
|
||||||
printf("STUB - onSurfaceCreated_native\n");
|
printf("STUB - onSurfaceCreated_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
code->setSurface(surface);
|
code->setSurface(surface);
|
||||||
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowCreated != NULL) {
|
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowCreated != NULL) {
|
||||||
code->callbacks.onNativeWindowCreated((ANativeActivity *)code, code->nativeWindow.get());
|
code->callbacks.onNativeWindowCreated((ANativeActivity *)code, code->nativeWindow.get());
|
||||||
@@ -483,7 +483,7 @@ void Java_android_app_NativeActivity_onSurfaceChangedNative(JNIEnv* env, jobject
|
|||||||
jint format, jint width, jint height)
|
jint format, jint width, jint height)
|
||||||
{
|
{
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode *code = (struct NativeCode *)handle;
|
struct NativeCode *code = (struct NativeCode*)_PTR(handle);
|
||||||
ANativeWindow *oldNativeWindow = code->nativeWindow;
|
ANativeWindow *oldNativeWindow = code->nativeWindow;
|
||||||
NativeCode_setSurface(code, surface);
|
NativeCode_setSurface(code, surface);
|
||||||
if (oldNativeWindow != code->nativeWindow) {
|
if (oldNativeWindow != code->nativeWindow) {
|
||||||
@@ -514,7 +514,7 @@ void Java_android_app_NativeActivity_onSurfaceRedrawNeededNative(JNIEnv* env, jo
|
|||||||
{
|
{
|
||||||
printf("STUB - onSurfaceRedrawNeeded_native\n");
|
printf("STUB - onSurfaceRedrawNeeded_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowRedrawNeeded != NULL) {
|
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowRedrawNeeded != NULL) {
|
||||||
code->callbacks.onNativeWindowRedrawNeeded((ANativeActivity *)code, code->nativeWindow.get());
|
code->callbacks.onNativeWindowRedrawNeeded((ANativeActivity *)code, code->nativeWindow.get());
|
||||||
}
|
}
|
||||||
@@ -525,7 +525,7 @@ void Java_android_app_NativeActivity_onSurfaceDestroyedNative(JNIEnv* env, jobje
|
|||||||
{
|
{
|
||||||
printf("STUB - onSurfaceDestroyed_native\n");
|
printf("STUB - onSurfaceDestroyed_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowDestroyed != NULL) {
|
if (code->nativeWindow != NULL && code->callbacks.onNativeWindowDestroyed != NULL) {
|
||||||
code->callbacks.onNativeWindowDestroyed(code,
|
code->callbacks.onNativeWindowDestroyed(code,
|
||||||
code->nativeWindow.get());
|
code->nativeWindow.get());
|
||||||
@@ -538,9 +538,9 @@ void Java_android_app_NativeActivity_onInputQueueCreatedNative(JNIEnv* env, jobj
|
|||||||
{
|
{
|
||||||
printf("STUB - onInputChannelCreated_native\n");
|
printf("STUB - onInputChannelCreated_native\n");
|
||||||
if (handle != 0) {
|
if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onInputQueueCreated != NULL) {
|
if (code->callbacks.onInputQueueCreated != NULL) {
|
||||||
code->callbacks.onInputQueueCreated((ANativeActivity *)code, (AInputQueue *)queue);
|
code->callbacks.onInputQueueCreated((ANativeActivity *)code, (AInputQueue *)_PTR(queue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -549,7 +549,7 @@ void Java_android_app_NativeActivity_onInputQueueDestroyedNative(JNIEnv* env, jo
|
|||||||
{
|
{
|
||||||
printf("STUB - onInputChannelDestroyed_native\n");
|
printf("STUB - onInputChannelDestroyed_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onInputQueueDestroyed != NULL) {
|
if (code->callbacks.onInputQueueDestroyed != NULL) {
|
||||||
AInputQueue* queue = reinterpret_cast<AInputQueue*>(queuePtr);
|
AInputQueue* queue = reinterpret_cast<AInputQueue*>(queuePtr);
|
||||||
code->callbacks.onInputQueueDestroyed((ANativeActivity *)code, queue);
|
code->callbacks.onInputQueueDestroyed((ANativeActivity *)code, queue);
|
||||||
@@ -562,7 +562,7 @@ void Java_android_app_NativeActivity_onContentRectChangedNative(JNIEnv* env, job
|
|||||||
{
|
{
|
||||||
printf("STUB - onContentRectChanged_native\n");
|
printf("STUB - onContentRectChanged_native\n");
|
||||||
/* if (handle != 0) {
|
/* if (handle != 0) {
|
||||||
struct NativeCode* code = (struct NativeCode*)handle;
|
struct NativeCode* code = (struct NativeCode*)_PTR(handle);
|
||||||
if (code->callbacks.onContentRectChanged != NULL) {
|
if (code->callbacks.onContentRectChanged != NULL) {
|
||||||
ARect rect;
|
ARect rect;
|
||||||
rect.left = x;
|
rect.left = x;
|
||||||
|
|||||||
@@ -411,10 +411,9 @@ JNIEXPORT void JNICALL Java_android_content_res_AssetManager_setConfiguration(
|
|||||||
JNIEXPORT jobjectArray JNICALL Java_android_content_res_AssetManager_list(JNIEnv *env, jobject this, jstring _path)
|
JNIEXPORT jobjectArray JNICALL Java_android_content_res_AssetManager_list(JNIEnv *env, jobject this, jstring _path)
|
||||||
{
|
{
|
||||||
DIR *d;
|
DIR *d;
|
||||||
int fd;
|
|
||||||
struct dirent *dir;
|
struct dirent *dir;
|
||||||
|
|
||||||
char* path_rel = _CSTRING(_path);
|
const char* path_rel = _CSTRING(_path);
|
||||||
char *app_data_dir = get_app_data_dir();
|
char *app_data_dir = get_app_data_dir();
|
||||||
char *path_abs = malloc(strlen(app_data_dir) + strlen(ASSET_DIR) + strlen(path_rel) + 1);
|
char *path_abs = malloc(strlen(app_data_dir) + strlen(ASSET_DIR) + strlen(path_rel) + 1);
|
||||||
|
|
||||||
@@ -441,7 +440,7 @@ JNIEXPORT jobjectArray JNICALL Java_android_content_res_AssetManager_list(JNIEnv
|
|||||||
for (i = 0; i < assets->len; i++)
|
for (i = 0; i < assets->len; i++)
|
||||||
{
|
{
|
||||||
const char *asset = g_array_index(assets, const char *, i);
|
const char *asset = g_array_index(assets, const char *, i);
|
||||||
(*env)->SetObjectArrayElement(env, array, i, (*env)->NewString(env, asset, strlen(asset)));
|
(*env)->SetObjectArrayElement(env, array, i, (*env)->NewStringUTF(env, asset));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_array_free(assets, TRUE);
|
g_array_free(assets, TRUE);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ JNIEXPORT jboolean JNICALL Java_com_google_android_gles_1jni_EGLImpl_native_1egl
|
|||||||
jint* num_config_base = get_int_array_crit(env, num_config);
|
jint* num_config_base = get_int_array_crit(env, num_config);
|
||||||
|
|
||||||
ret = eglChooseConfig(_PTR(egl_display), attrib_base, egl_configs ? _PTR(configs_base) : NULL, config_size, num_config_base);
|
ret = eglChooseConfig(_PTR(egl_display), attrib_base, egl_configs ? _PTR(configs_base) : NULL, config_size, num_config_base);
|
||||||
printf(".. eglChooseConfig: egl_display: %ld, egl_configs: %p, _PTR(configs_base): %p, config_size: %d, num_config_base[0]: %d\n", egl_display, egl_configs, _PTR(configs_base), config_size, num_config_base[0]);
|
printf(".. eglChooseConfig: egl_display: %w64x, egl_configs: %p, _PTR(configs_base): %p, config_size: %d, num_config_base[0]: %d\n", egl_display, egl_configs, _PTR(configs_base), config_size, num_config_base[0]);
|
||||||
|
|
||||||
release_int_array_crit(env, attrib_list, attrib_base);
|
release_int_array_crit(env, attrib_list, attrib_base);
|
||||||
release_long_array_crit(env, egl_configs, configs_base);
|
release_long_array_crit(env, egl_configs, configs_base);
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "looper.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
AINPUT_EVENT_TYPE_KEY = 1,
|
AINPUT_EVENT_TYPE_KEY = 1,
|
||||||
AINPUT_EVENT_TYPE_MOTION = 2,
|
AINPUT_EVENT_TYPE_MOTION = 2,
|
||||||
@@ -162,7 +164,7 @@ struct AInputEvent fixme_ugly_current_event;
|
|||||||
|
|
||||||
static inline void make_touch_event(GdkEvent* event, GtkEventControllerLegacy* event_controller, struct AInputEvent *ainput_event)
|
static inline void make_touch_event(GdkEvent* event, GtkEventControllerLegacy* event_controller, struct AInputEvent *ainput_event)
|
||||||
{
|
{
|
||||||
GtkWidget *window = gtk_event_controller_get_widget(event_controller);
|
GtkWidget *window = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(event_controller));
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
|
||||||
gdk_event_get_position(event, &ainput_event->x, &ainput_event->y);
|
gdk_event_get_position(event, &ainput_event->x, &ainput_event->y);
|
||||||
@@ -210,7 +212,12 @@ static gboolean on_event(GtkEventControllerLegacy* self, GdkEvent* event, int in
|
|||||||
make_touch_event(event, self, &ainput_event);
|
make_touch_event(event, self, &ainput_event);
|
||||||
write(input_queue_pipe_fd, &ainput_event, sizeof(struct AInputEvent));
|
write(input_queue_pipe_fd, &ainput_event, sizeof(struct AInputEvent));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME put this in a header file
|
// FIXME put this in a header file
|
||||||
@@ -222,8 +229,9 @@ struct input_queue {
|
|||||||
void AInputQueue_attachLooper(struct input_queue* queue, struct ALooper* looper, int ident, Looper_callbackFunc callback, void* data)
|
void AInputQueue_attachLooper(struct input_queue* queue, struct ALooper* looper, int ident, Looper_callbackFunc callback, void* data)
|
||||||
{
|
{
|
||||||
struct android_poll_source *poll_source = (struct android_poll_source *)data;
|
struct android_poll_source *poll_source = (struct android_poll_source *)data;
|
||||||
printf("AInputQueue_attachLooper called: queue: %p, looper: %p, ident: %d, callback %p, data: %p, process_func: %p\n", queue, looper, ident, callback, poll_source, poll_source->process);
|
//printf("AInputQueue_attachLooper called: queue: %p, looper: %p, ident: %d, callback %p, data: %p, process_func: %p\n", queue, looper, ident, callback, poll_source, poll_source ? poll_source->process : 0);
|
||||||
|
if (poll_source == NULL)
|
||||||
|
return;
|
||||||
int input_queue_pipe[2];
|
int input_queue_pipe[2];
|
||||||
if (pipe(input_queue_pipe)) {
|
if (pipe(input_queue_pipe)) {
|
||||||
fprintf(stderr, "could not create pipe: %s", strerror(errno));
|
fprintf(stderr, "could not create pipe: %s", strerror(errno));
|
||||||
@@ -231,7 +239,7 @@ void AInputQueue_attachLooper(struct input_queue* queue, struct ALooper* looper,
|
|||||||
}
|
}
|
||||||
fcntl(input_queue_pipe[0], F_SETFL, O_NONBLOCK);
|
fcntl(input_queue_pipe[0], F_SETFL, O_NONBLOCK);
|
||||||
ALooper_addFd(looper, input_queue_pipe[0], ident, (1 << 0)/*? ALOOPER_EVENT_INPUT*/, callback, data);
|
ALooper_addFd(looper, input_queue_pipe[0], ident, (1 << 0)/*? ALOOPER_EVENT_INPUT*/, callback, data);
|
||||||
g_signal_connect(queue->controller, "event", G_CALLBACK(on_event), (gpointer)input_queue_pipe[1]);
|
g_signal_connect(queue->controller, "event", G_CALLBACK(on_event), GINT_TO_POINTER(input_queue_pipe[1]));
|
||||||
queue->fd = input_queue_pipe[0];
|
queue->fd = input_queue_pipe[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +263,7 @@ void AInputQueue_finishEvent(AInputQueue* queue, struct AInputEvent* event, int
|
|||||||
// should we do something here?
|
// should we do something here?
|
||||||
}
|
}
|
||||||
|
|
||||||
void AKeyEvent_getKeyCode (struct AInputEvent *event)
|
int32_t AKeyEvent_getKeyCode(struct AInputEvent *event)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* TODO: Minecraft PE misuses this function on an event
|
* TODO: Minecraft PE misuses this function on an event
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
#include "looper.h"
|
#include "looper.h"
|
||||||
|
|
||||||
typedef int (*Looper_callbackFunc)(int fd, int events, void* data);
|
|
||||||
|
|
||||||
// dummy strong pointer class
|
// dummy strong pointer class
|
||||||
struct sp {
|
struct sp {
|
||||||
ALooper *ptr;
|
ALooper *ptr;
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
#define LOOPER_H
|
#define LOOPER_H
|
||||||
|
|
||||||
typedef void ALooper;
|
typedef void ALooper;
|
||||||
|
typedef int (*Looper_callbackFunc)(int fd, int events, void* data);
|
||||||
|
|
||||||
ALooper * ALooper_prepare(int opts);
|
ALooper * ALooper_prepare(int opts);
|
||||||
void ALooper_wake(ALooper *looper);
|
void ALooper_wake(ALooper *looper);
|
||||||
bool ALooper_isPolling(ALooper *looper);
|
bool ALooper_isPolling(ALooper *looper);
|
||||||
int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
|
int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
|
||||||
|
int ALooper_addFd(ALooper* looper, int fd, int ident, int events, Looper_callbackFunc callback, void* data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -578,7 +578,7 @@ struct XrGraphicsBindingOpenGLESAndroidKHR {
|
|||||||
|
|
||||||
XrResult bionic_xrCreateSession(XrInstance instance, XrSessionCreateInfo *createInfo, XrSession *session)
|
XrResult bionic_xrCreateSession(XrInstance instance, XrSessionCreateInfo *createInfo, XrSession *session)
|
||||||
{
|
{
|
||||||
struct XrGraphicsBindingOpenGLESAndroidKHR *android_bind = createInfo->next;
|
struct XrGraphicsBindingOpenGLESAndroidKHR *android_bind = (struct XrGraphicsBindingOpenGLESAndroidKHR *)createInfo->next;
|
||||||
XrGraphicsBindingEGLMNDX egl_bind = {XR_TYPE_GRAPHICS_BINDING_EGL_MNDX};
|
XrGraphicsBindingEGLMNDX egl_bind = {XR_TYPE_GRAPHICS_BINDING_EGL_MNDX};
|
||||||
|
|
||||||
if (android_bind->type == XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR) {
|
if (android_bind->type == XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR) {
|
||||||
@@ -620,11 +620,10 @@ XrResult bionic_xrCreateInstance(XrInstanceCreateInfo *createInfo, XrInstance *i
|
|||||||
"XR_EXT_local_floor",
|
"XR_EXT_local_floor",
|
||||||
};
|
};
|
||||||
|
|
||||||
char **old_names = createInfo->enabledExtensionNames, **new_names;
|
const char * const*old_names = createInfo->enabledExtensionNames;
|
||||||
|
const char **new_names;
|
||||||
int new_count = createInfo->enabledExtensionCount + ARRRAY_SIZE(extra_exts);
|
int new_count = createInfo->enabledExtensionCount + ARRRAY_SIZE(extra_exts);
|
||||||
|
|
||||||
printf("eee xrCreateInstance\n");
|
|
||||||
|
|
||||||
//FIXME: Leak?
|
//FIXME: Leak?
|
||||||
new_names = malloc(sizeof(*new_names) * new_count);
|
new_names = malloc(sizeof(*new_names) * new_count);
|
||||||
memcpy(new_names, old_names, createInfo->enabledExtensionCount * sizeof(*old_names));
|
memcpy(new_names, old_names, createInfo->enabledExtensionCount * sizeof(*old_names));
|
||||||
@@ -647,12 +646,9 @@ XrResult bionic_xrCreateInstance(XrInstanceCreateInfo *createInfo, XrInstance *i
|
|||||||
return xr_lazy_call("xrCreateInstance", createInfo, instance);
|
return xr_lazy_call("xrCreateInstance", createInfo, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
XrResult bionic_xrCreateReferenceSpace(
|
XrResult bionic_xrCreateReferenceSpace(XrSession session, const XrReferenceSpaceCreateInfo *createInfo, XrSpace *space)
|
||||||
XrSession session,
|
|
||||||
const XrReferenceSpaceCreateInfo* createInfo,
|
|
||||||
XrSpace* space)
|
|
||||||
{
|
{
|
||||||
fprintf(stderr, "xrCreateReferenceSpace(s=0x%x, info={rs_type=%d})\n", session, createInfo->referenceSpaceType);
|
fprintf(stderr, "xrCreateReferenceSpace(s=0x%w64x, info={rs_type=%d})\n", (uint64_t)session, createInfo->referenceSpaceType);
|
||||||
|
|
||||||
//FIXME: this is sad for oculus refspace extension it assumes we have...
|
//FIXME: this is sad for oculus refspace extension it assumes we have...
|
||||||
if (createInfo->referenceSpaceType > 100)
|
if (createInfo->referenceSpaceType > 100)
|
||||||
@@ -684,7 +680,7 @@ struct xr_proc_override {
|
|||||||
PFN_xrVoidFunction *func;
|
PFN_xrVoidFunction *func;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define XR_PROC_BIONIC(name) {#name, bionic_ ## name }
|
#define XR_PROC_BIONIC(name) {#name, (void (**)(void))bionic_ ## name }
|
||||||
|
|
||||||
/* Please keep the alphabetical order */
|
/* Please keep the alphabetical order */
|
||||||
static const struct xr_proc_override xr_proc_override_tbl[] = {
|
static const struct xr_proc_override xr_proc_override_tbl[] = {
|
||||||
@@ -700,10 +696,12 @@ XrResult bionic_xrGetInstanceProcAddr(XrInstance instance, const char *name, PFN
|
|||||||
printf("xrGetInstanceProcAddr(%s)\n", name);
|
printf("xrGetInstanceProcAddr(%s)\n", name);
|
||||||
|
|
||||||
struct xr_proc_override *match = bsearch(name, xr_proc_override_tbl,
|
struct xr_proc_override *match = bsearch(name, xr_proc_override_tbl,
|
||||||
ARRRAY_SIZE(xr_proc_override_tbl), sizeof(xr_proc_override_tbl[0]), strcmp);
|
ARRRAY_SIZE(xr_proc_override_tbl),
|
||||||
|
sizeof(xr_proc_override_tbl[0]),
|
||||||
|
(int (*)(const void *, const void *))strcmp);
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
*func = match->func;
|
*func = (PFN_xrVoidFunction)match->func;
|
||||||
return XR_SUCCESS;
|
return XR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user