22 #ifndef _ANDROID_JNI_H_ 23 #define _ANDROID_JNI_H_ 26 #include <semaphore.h> 29 #include "common/fs.h" 30 #include "common/archive.h" 31 #include "common/array.h" 32 #include "common/ustr.h" 46 static bool assets_updated;
49 static sem_t pause_sem;
51 static int surface_changeid;
52 static int egl_surface_width;
53 static int egl_surface_height;
54 static int egl_bits_per_pixel;
56 static bool virt_keyboard_state;
58 static int32 gestures_insets[4];
59 static int32 cutout_insets[4];
61 static jint onLoad(JavaVM *vm);
63 static inline JNIEnv *getEnv() {
64 JNIEnv *env = (JNIEnv*) pthread_getspecific(_env_tls);
72 static void attachThread();
73 static void detachThread();
75 static void setReadyForEvents(
bool ready);
76 static void wakeupForQuit();
83 typedef float DPIValues[3];
84 static void getDPI(DPIValues &values);
87 static bool hasTextInClipboard();
90 static bool isConnectionLimited();
91 static void showVirtualKeyboard(
bool enable);
92 static void showOnScreenControls(
int enableMask);
93 static void setTouchMode(
int touchMode);
94 static int getTouchMode();
95 static void setOrientation(
int touchMode);
101 static jint getAndroidSDKVersionId();
103 static void notifyHTTPService(
int localPort,
bool minimal);
105 static inline bool haveSurface();
106 static inline bool swapBuffers();
107 static bool initSurface();
108 static void deinitSurface();
109 static int eglVersion() {
113 return fetchEGLVersion();
126 static pthread_key_t _env_tls;
130 static jobject _jobj;
131 static jobject _jobj_egl;
132 static jobject _jobj_egl_display;
133 static jobject _jobj_egl_surface;
135 static int _egl_version;
140 static bool _ready_for_events;
142 static jmethodID _MID_getDPI;
143 static jmethodID _MID_displayMessageOnOSD;
144 static jmethodID _MID_openUrl;
145 static jmethodID _MID_hasTextInClipboard;
146 static jmethodID _MID_getTextFromClipboard;
147 static jmethodID _MID_setTextInClipboard;
148 static jmethodID _MID_isConnectionLimited;
149 static jmethodID _MID_setWindowCaption;
150 static jmethodID _MID_showVirtualKeyboard;
151 static jmethodID _MID_showOnScreenControls;
152 static jmethodID _MID_setTouchMode;
153 static jmethodID _MID_getTouchMode;
154 static jmethodID _MID_setOrientation;
155 static jmethodID _MID_getScummVMBasePath;
156 static jmethodID _MID_getScummVMConfigPath;
157 static jmethodID _MID_getScummVMLogPath;
158 static jmethodID _MID_setCurrentGame;
159 static jmethodID _MID_notifyHTTPService;
160 static jmethodID _MID_getSysArchives;
161 static jmethodID _MID_getAllStorageLocations;
162 static jmethodID _MID_initSurface;
163 static jmethodID _MID_deinitSurface;
164 static jmethodID _MID_eglVersion;
165 static jmethodID _MID_getNewSAFTree;
166 static jmethodID _MID_getSAFTrees;
167 static jmethodID _MID_findSAFTree;
168 static jmethodID _MID_exportBackup;
169 static jmethodID _MID_importBackup;
171 static jmethodID _MID_EGL10_eglSwapBuffers;
173 static const JNINativeMethod _natives[];
175 static void throwByName(JNIEnv *env,
const char *name,
const char *msg);
176 static void throwRuntimeException(JNIEnv *env,
const char *msg);
179 static void create(JNIEnv *env, jobject
self, jobject asset_manager,
180 jobject egl, jobject egl_display,
181 jboolean assets_updated_);
182 static void destroy(JNIEnv *env, jobject
self);
184 static void setSurface(JNIEnv *env, jobject
self, jint width, jint height, jint bpp);
185 static jint main(JNIEnv *env, jobject
self, jobjectArray args);
187 static void pushEvent(JNIEnv *env, jobject
self,
int type,
int arg1,
188 int arg2,
int arg3,
int arg4,
int arg5,
int arg6);
189 static void updateTouch(JNIEnv *env, jobject
self,
int action,
int ptr,
int x,
int y);
190 static void setupTouchMode(JNIEnv *env, jobject
self, jint oldValue, jint newValue);
191 static void syncVirtkeyboardState(JNIEnv *env, jobject
self, jboolean newState);
192 static void setPause(JNIEnv *env, jobject
self, jboolean value);
194 static void systemInsetsUpdated(JNIEnv *env, jobject
self, jintArray gestureInsets, jintArray systemInsets, jintArray cutoutInsets);
196 static void setDefaultAudioValues(JNIEnv *env, jclass clazz, jint sampleRate, jint framesPerBurst);
197 static void notifyAudioDisconnect(JNIEnv *env, jclass clazz);
199 static jstring getNativeVersionInfo(JNIEnv *env, jobject
self);
203 static JNIEnv *fetchEnv();
204 static int fetchEGLVersion();
207 inline bool JNI::haveSurface() {
208 return _jobj_egl_surface != 0;
211 inline bool JNI::swapBuffers() {
212 JNIEnv *env = JNI::getEnv();
214 return env->CallBooleanMethod(_jobj_egl, _MID_EGL10_eglSwapBuffers,
215 _jobj_egl_display, _jobj_egl_surface);
Definition: archive.h:141
Definition: archive.h:330
Definition: jni-android.h:40
Definition: formatinfo.h:28