25#include <android/log.h>
28#include "common/archive.h"
29#include "common/mutex.h"
30#include "common/ustr.h"
31#include "backends/modular-backend.h"
32#include "backends/plugins/posix/posix-provider.h"
33#include "backends/fs/posix/posix-fs-factory.h"
34#include "backends/fs/posix/posix-fs-factory.h"
35#include "backends/log/log.h"
36#include "backends/platform/android/touchcontrols.h"
37#include "engines/engine.h"
47extern const char *android_log_tag;
49#define _ANDROID_LOG(prio, fmt, args...) __android_log_print(prio, android_log_tag, fmt, ## args)
50#define LOGD(fmt, args...) _ANDROID_LOG(ANDROID_LOG_DEBUG, fmt, ##args)
51#define LOGI(fmt, args...) _ANDROID_LOG(ANDROID_LOG_INFO, fmt, ##args)
52#define LOGW(fmt, args...) _ANDROID_LOG(ANDROID_LOG_WARN, fmt, ##args)
53#define LOGE(fmt, args...) _ANDROID_LOG(ANDROID_LOG_ERROR, fmt, ##args)
55#define MAX_ANDROID_SCUMMVM_LOG_FILESIZE_IN_BYTES (100*1024)
57#ifdef ANDROID_DEBUG_ENTER
58#define ENTER(fmt, args...) LOGD("%s(" fmt ")", __FUNCTION__, ##args)
60#define ENTER(fmt, args...) do { } while (false)
63#ifdef ANDROID_DEBUG_GL
64extern void checkGlError(
const char *expr,
const char *file,
int line);
66#ifdef ANDROID_DEBUG_GL_CALLS
67#define GLCALLLOG(x, before) \
70 LOGD("calling '%s' (%s:%d)", x, __FILE__, __LINE__); \
72 LOGD("returned from '%s' (%s:%d)", x, __FILE__, __LINE__); \
75#define GLCALLLOG(x, before) do { } while (false)
80 GLCALLLOG(#x, true); \
82 GLCALLLOG(#x, false); \
83 checkGlError(#x, __FILE__, __LINE__); \
86#define GLTHREADCHECK \
88 assert(dynamic_cast<OSystem_Android *>(g_system)->isRunningInMainThread()); \
92#define GLCALL(x) do { (x); } while (false)
93#define GLTHREADCHECK do { } while (false)
96void *androidGLgetProcAddress(
const char *name);
100 static const int kQueuedInputEventDelay = 50;
104 uint32 originTimeMillis;
107 uint32 referTimeMillis;
116 bool connectedTypeExecuted;
118 EventWithDelay() : originTimeMillis(0), referTimeMillis(0),
delayMillis(0), connectedType(Common::EVENT_INVALID), connectedTypeExecuted(
false) {
122 originTimeMillis = 0;
125 connectedType = Common::EVENT_INVALID;
126 connectedTypeExecuted =
false;
130 int _screen_changeid;
132 pthread_t _main_thread;
134 bool _timer_thread_exit;
135 pthread_t _timer_thread;
144 EventWithDelay _delayedMouseBtnUpEvent;
145 EventWithDelay _delayedMouseBtnDownEvent;
148 Common::Point _touch_pt_down, _touch_pt_scroll, _touch_pt_dt, _touch_pt_multi;
153 int _trackball_scale;
158 int _secondPointerId;
172#if defined(USE_OPENGL) && defined(USE_GLAD)
174 mutable void *_gles2DL;
177 static void *timerThreadFunc(
void *arg);
185 TOUCH_MODE_TOUCHPAD = 0,
186 TOUCH_MODE_MOUSE = 1,
187 TOUCH_MODE_GAMEPAD = 2,
192 SCREEN_ORIENTATION_UNSPECIFIED = 0xffffffff,
193 SCREEN_ORIENTATION_LANDSCAPE = 0,
194 SCREEN_ORIENTATION_PORTRAIT = 1
198 SHOW_ON_SCREEN_NONE = 0,
199 SHOW_ON_SCREEN_MENU = 1,
200 SHOW_ON_SCREEN_INPUT_MODE = 2,
201 SHOW_ON_SCREEN_ALL = 0xffffffff,
217 void setPause(
bool pause);
219 void pushEvent(
int type,
int arg1,
int arg2,
int arg3,
int arg4,
int arg5,
int arg6);
222 void pushDelayedTouchMouseBtnEvents();
225 void applyTouchSettings(
bool _3dMode,
bool overlayShown);
226 void setupTouchMode(
int oldValue,
int newValue);
228 void applyOrientationSettings();
230 void updateOnScreenControls();
262#if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
263 OpenGL::ContextType
getOpenGLType()
const override {
return OpenGL::kContextGLES2; }
266#if defined(USE_OPENGL) && defined(USE_GLAD)
267 void *getOpenGLProcAddress(
const char *name)
const override;
270#ifdef ANDROID_DEBUG_GL
271 bool isRunningInMainThread() {
return pthread_self() == _main_thread; }
Definition: keymapper-defaults.h:32
Definition: archive.h:330
Definition: modular-backend.h:48
Definition: modular-backend.h:152
void delayMillis(uint msecs) override
void initBackend() override
void engineInit() override
uint32 getMillis(bool skipRecord=false) override
bool hasTextInClipboard() override
void registerDefaultSettings(const Common::String &target) const override
void getTimeAndDate(TimeDate &td, bool skipRecord=false) const override
void updateStartSettings(const Common::String &executable, Common::String &command, Common::StringMap &startSettings, Common::StringArray &additionalArgs) override
bool hasFeature(OSystem::Feature f) override
bool openUrl(const Common::String &url) override
bool pollEvent(Common::Event &event) override
Common::U32String getTextFromClipboard() override
bool getFeatureState(OSystem::Feature f) override
void engineDone() override
void setWindowCaption(const Common::U32String &caption) override
Common::MutexInternal * createMutex() override
void logMessage(LogMessageType::Type type, const char *message) override
bool setTextInClipboard(const Common::U32String &text) override
Common::HardwareInputSet * getHardwareInputSet() override
bool isConnectionLimited() override
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority=0) override
Common::Path getDefaultConfigFileName() override
GUI::OptionsContainerWidget * buildBackendOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override
Common::KeymapperDefaultBindings * getKeymapperDefaultBindings() override
Common::KeymapArray getGlobalKeymaps() override
Common::String getSystemLanguage() const override
void setFeatureState(OSystem::Feature f, bool enable) override
void applyBackendSettings() override
Common::Path getDefaultLogFileName() override
const char *const * buildHelpDialogData() override
Definition: touchcontrols.h:41
EventType
Definition: events.h:49
Feature
Definition: system.h:415
virtual OpenGL::ContextType getOpenGLType() const
Definition: system.h:901
virtual Common::Array< uint > getSupportedAntiAliasingLevels() const
Definition: system.h:887