2022-10-02 23:06:56 +02:00
|
|
|
#ifndef _UTILS_H_
|
|
|
|
|
#define _UTILS_H_
|
|
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
|
|
#include "defines.h"
|
|
|
|
|
|
|
|
|
|
struct handle_cache {
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID onCreate;
|
2022-11-08 21:12:41 +01:00
|
|
|
jmethodID onStart;
|
2022-10-26 18:39:04 +02:00
|
|
|
jmethodID onResume;
|
2022-10-02 23:06:56 +02:00
|
|
|
jmethodID onWindowFocusChanged;
|
|
|
|
|
jmethodID onDestroy;
|
2023-08-11 18:09:17 +02:00
|
|
|
jmethodID onStop;
|
|
|
|
|
jmethodID onPause;
|
2022-10-02 23:06:56 +02:00
|
|
|
} apk_main_activity;
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID getAttributeValue_string;
|
|
|
|
|
jmethodID getAttributeValue_int;
|
|
|
|
|
} attribute_set;
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID add;
|
|
|
|
|
jmethodID remove;
|
|
|
|
|
jmethodID get;
|
|
|
|
|
jmethodID size;
|
|
|
|
|
jmethodID clear;
|
|
|
|
|
} array_list;
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID getColor;
|
|
|
|
|
} paint;
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID constructor;
|
|
|
|
|
} motion_event;
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID constructor;
|
|
|
|
|
} canvas;
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID onSurfaceCreated;
|
|
|
|
|
jmethodID onSurfaceChanged;
|
|
|
|
|
jmethodID onDrawFrame;
|
|
|
|
|
} renderer;
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID onTouchEvent;
|
|
|
|
|
jmethodID wrap_EGLContextFactory_createContext;
|
|
|
|
|
jmethodID wrap_EGLConfigChooser_chooseConfig;
|
|
|
|
|
} gl_surface_view;
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID onPeriodicNotification;
|
|
|
|
|
} audio_track_periodic_listener;
|
2022-11-11 19:18:21 +01:00
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID onInputQueueCreated;
|
|
|
|
|
} input_queue_callback;
|
2022-12-27 17:14:30 +01:00
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID surfaceCreated;
|
|
|
|
|
} surface_holder_callback;
|
2022-10-02 23:06:56 +02:00
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID setLayoutParams;
|
2023-07-14 17:53:12 +02:00
|
|
|
jmethodID onDraw;
|
|
|
|
|
jmethodID onMeasure;
|
2023-08-22 14:18:33 +02:00
|
|
|
jmethodID onLayout;
|
|
|
|
|
jmethodID getMeasuredWidth;
|
|
|
|
|
jmethodID getMeasuredHeight;
|
|
|
|
|
jmethodID getSuggestedMinimumWidth;
|
|
|
|
|
jmethodID getSuggestedMinimumHeight;
|
|
|
|
|
jmethodID setMeasuredDimension;
|
2022-10-02 23:06:56 +02:00
|
|
|
} view;
|
2023-05-20 18:53:20 +02:00
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID extractFromAPK;
|
|
|
|
|
} asset_manager;
|
2023-08-12 13:09:33 +02:00
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID get_package_name;
|
|
|
|
|
} context;
|
|
|
|
|
struct {
|
|
|
|
|
jclass class;
|
|
|
|
|
jmethodID get_app_icon_path;
|
|
|
|
|
} application;
|
2022-10-02 23:06:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern struct handle_cache handle_cache;
|
|
|
|
|
|
2023-08-11 18:09:17 +02:00
|
|
|
JNIEnv * get_jni_env(void);
|
|
|
|
|
|
2022-10-02 23:06:56 +02:00
|
|
|
const char * attribute_set_get_string(JNIEnv *env, jobject attrs, char *attribute, char *schema);
|
|
|
|
|
int attribute_set_get_int(JNIEnv *env, jobject attrs, char *attribute, char *schema, int default_value);
|
2023-08-08 10:16:17 +02:00
|
|
|
void set_up_handle_cache(JNIEnv *env);
|
2023-05-20 18:53:20 +02:00
|
|
|
void extract_from_apk(const char *path, const char *target);
|
2022-10-02 23:06:56 +02:00
|
|
|
|
2023-08-08 10:16:17 +02:00
|
|
|
void prepare_main_looper(JNIEnv* env);
|
|
|
|
|
|
2022-10-02 23:06:56 +02:00
|
|
|
#endif
|