diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java index b605716fa..6262fb27a 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/JNIdc.java @@ -44,4 +44,5 @@ public final class JNIdc public static void show_osd() { JNIdc.vjoy(13, 1,0,0,0); } + public static native void hideOsd(); } diff --git a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/VirtualJoystickDelegate.java b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/VirtualJoystickDelegate.java index eaf128f45..68f35545b 100644 --- a/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/VirtualJoystickDelegate.java +++ b/shell/android-studio/reicast/src/main/java/com/reicast/emulator/emu/VirtualJoystickDelegate.java @@ -2,6 +2,7 @@ package com.reicast.emulator.emu; import android.content.Context; import android.content.res.Configuration; +import android.os.Handler; import android.os.Vibrator; import android.view.InputDevice; import android.view.MotionEvent; @@ -20,6 +21,14 @@ public class VirtualJoystickDelegate { private int selectedVjoyElement = -1; private ScaleGestureDetector scaleGestureDetector; + private Handler handler = new Handler(); + private Runnable hideOsdRunnable = new Runnable() { + @Override + public void run() { + JNIdc.hideOsd(); + } + }; + private float[][] vjoy_d_custom; private static final float[][] vjoy = VJoy.baseVJoy(); @@ -154,6 +163,8 @@ public class VirtualJoystickDelegate { // Ignore real mice, trackballs, etc. return false; JNIdc.show_osd(); + this.handler.removeCallbacks(hideOsdRunnable); + this.handler.postDelayed(hideOsdRunnable, 10000); scaleGestureDetector.onTouchEvent(event); diff --git a/shell/android-studio/reicast/src/main/jni/src/Android.cpp b/shell/android-studio/reicast/src/main/jni/src/Android.cpp index b74274028..3558b55d8 100644 --- a/shell/android-studio/reicast/src/main/jni/src/Android.cpp +++ b/shell/android-studio/reicast/src/main/jni/src/Android.cpp @@ -16,6 +16,7 @@ #include "hw/pvr/Renderer_if.h" #include "profiler/profiler.h" #include "rend/TexCache.h" +#include "rend/gles/gles.h" #include "hw/maple/maple_devs.h" #include "hw/maple/maple_if.h" #include "hw/naomi/naomi_cart.h" @@ -97,6 +98,7 @@ JNIEXPORT jboolean JNICALL Java_com_reicast_emulator_emu_JNIdc_rendframeJava(JNI JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_rendtermJava(JNIEnv *env, jobject obj) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_vjoy(JNIEnv * env, jobject obj,int id,float x, float y, float w, float h) __attribute__((visibility("default"))); +JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_hideOsd(JNIEnv * env, jobject obj) __attribute__((visibility("default"))); JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_getControllers(JNIEnv *env, jobject obj, jintArray controllers, jobjectArray peripherals) __attribute__((visibility("default"))); @@ -485,6 +487,10 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_vjoy(JNIEnv * env, jo } } +JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_hideOsd(JNIEnv * env, jobject obj) { + HideOSD(); +} + JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_getControllers(JNIEnv *env, jobject obj, jintArray controllers, jobjectArray peripherals) { jint *controllers_body = env->GetIntArrayElements(controllers, 0);