aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/events/androidsdl/androidsdl-events.cpp84
-rw-r--r--backends/events/androidsdl/androidsdl-events.h37
-rw-r--r--backends/graphics/androidsdl/androidsdl-graphics.cpp42
-rw-r--r--backends/graphics/androidsdl/androidsdl-graphics.h34
-rw-r--r--backends/module.mk6
-rw-r--r--backends/platform/androidsdl/androidsdl-main.cpp42
-rw-r--r--backends/platform/androidsdl/androidsdl-sdl.cpp37
-rw-r--r--backends/platform/androidsdl/androidsdl-sdl.h38
-rw-r--r--backends/platform/androidsdl/androidsdl.mk11
-rw-r--r--backends/platform/androidsdl/module.mk13
-rw-r--r--backends/platform/sdl/posix/posix-main.cpp2
11 files changed, 345 insertions, 1 deletions
diff --git a/backends/events/androidsdl/androidsdl-events.cpp b/backends/events/androidsdl/androidsdl-events.cpp
new file mode 100644
index 0000000000..bd8045ec62
--- /dev/null
+++ b/backends/events/androidsdl/androidsdl-events.cpp
@@ -0,0 +1,84 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+
+#if defined(ANDROIDSDL)
+
+#include "backends/events/androidsdl/androidsdl-events.h"
+#include "backends/platform/androidsdl/androidsdl-sdl.h"
+#include <SDL_screenkeyboard.h>
+
+bool AndroidSdlEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT)
+ event.type = Common::EVENT_LBUTTONDOWN;
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONDOWN;
+#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
+ else if (ev.button.button == SDL_BUTTON_WHEELUP)
+ event.type = Common::EVENT_WHEELUP;
+ else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
+ event.type = Common::EVENT_WHEELDOWN;
+#endif
+#if defined(SDL_BUTTON_MIDDLE)
+ else if (ev.button.button == SDL_BUTTON_MIDDLE) {
+ event.type = Common::EVENT_MBUTTONDOWN;
+
+ static int show_onscreen=0;
+ if (show_onscreen==0) {
+ SDL_ANDROID_SetScreenKeyboardShown(0);
+ show_onscreen++;
+ }
+ else if (show_onscreen==1) {
+ SDL_ANDROID_SetScreenKeyboardShown(1);
+ show_onscreen++;
+ }
+ if (show_onscreen==2)
+ show_onscreen=0;
+ }
+#endif
+ else
+ return false;
+
+ processMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
+
+bool AndroidSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
+ if (false) {}
+
+ if (ev.key.keysym.sym == SDLK_LCTRL) {
+ ev.key.keysym.sym = SDLK_F5;
+ } else {
+ // Let the events fall through if we didn't change them, this may not be the best way to
+ // set it up, but i'm not sure how sdl would like it if we let if fall through then redid it though.
+ // and yes i have an huge terminal size so i dont wrap soon enough.
+ event.type = Common::EVENT_KEYDOWN;
+ event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
+ event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
+ }
+
+ return false;
+}
+
+#endif
diff --git a/backends/events/androidsdl/androidsdl-events.h b/backends/events/androidsdl/androidsdl-events.h
new file mode 100644
index 0000000000..bca712e579
--- /dev/null
+++ b/backends/events/androidsdl/androidsdl-events.h
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#if !defined(BACKEND_EVENTS_SDL_ANDROIDSDL_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER)
+#define BACKEND_EVENTS_SDL_ANDROIDSDL_H
+
+#include "backends/events/sdl/sdl-events.h"
+
+/**
+ * SDL events manager for ANDROIDSDL
+ */
+class AndroidSdlEventSource : public SdlEventSource {
+protected:
+ virtual bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
+ virtual bool remapKey(SDL_Event &ev, Common::Event &event);
+};
+
+#endif
diff --git a/backends/graphics/androidsdl/androidsdl-graphics.cpp b/backends/graphics/androidsdl/androidsdl-graphics.cpp
new file mode 100644
index 0000000000..23a1a86dd6
--- /dev/null
+++ b/backends/graphics/androidsdl/androidsdl-graphics.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+
+#if defined(ANDROIDSDL)
+
+#include "backends/graphics/androidsdl/androidsdl-graphics.h"
+#include "backends/events/androidsdl/androidsdl-events.h"
+#include "common/mutex.h"
+#include "common/textconsole.h"
+#include "graphics/font.h"
+#include "graphics/fontman.h"
+#include "graphics/scaler.h"
+#include "graphics/scaler/aspect.h"
+#include "graphics/scaler/downscaler.h"
+#include "graphics/surface.h"
+
+AndroidSdlGraphicsManager::AndroidSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window)
+ : SurfaceSdlGraphicsManager(sdlEventSource, window) {
+}
+
+#endif
diff --git a/backends/graphics/androidsdl/androidsdl-graphics.h b/backends/graphics/androidsdl/androidsdl-graphics.h
new file mode 100644
index 0000000000..b7ca7c1de8
--- /dev/null
+++ b/backends/graphics/androidsdl/androidsdl-graphics.h
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BACKENDS_GRAPHICS_SDL_ANDROIDSDL_H
+#define BACKENDS_GRAPHICS_SDL_ANDROIDSDL_H
+
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
+
+class AndroidSdlGraphicsManager : public SurfaceSdlGraphicsManager {
+public:
+ AndroidSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window);
+
+};
+
+#endif
diff --git a/backends/module.mk b/backends/module.mk
index 2e100d215d..7574db4009 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -122,6 +122,12 @@ MODULE_OBJS += \
taskbar/win32/win32-taskbar.o
endif
+ifeq ($(BACKEND),androidsdl)
+MODULE_OBJS += \
+ events/androidsdl/androidsdl-events.o \
+ graphics/androidsdl/androidsdl-graphics.o
+endif
+
ifdef AMIGAOS
MODULE_OBJS += \
fs/amigaos4/amigaos4-fs.o \
diff --git a/backends/platform/androidsdl/androidsdl-main.cpp b/backends/platform/androidsdl/androidsdl-main.cpp
new file mode 100644
index 0000000000..26a73579c0
--- /dev/null
+++ b/backends/platform/androidsdl/androidsdl-main.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "backends/platform/androidsdl/androidsdl-sdl.h"
+#include "base/main.h"
+
+int main(int argc, char *argv[]) {
+
+ // Create our OSystem instance
+ g_system = new OSystem_ANDROIDSDL();
+ assert(g_system);
+
+ // Pre initialize the backend
+ ((OSystem_POSIX *)g_system)->init();
+
+ // Invoke the actual ScummVM main entry point:
+ int res = scummvm_main(argc, argv);
+
+ // Free OSystem
+ delete (OSystem_ANDROIDSDL *)g_system;
+
+ return res;
+}
diff --git a/backends/platform/androidsdl/androidsdl-sdl.cpp b/backends/platform/androidsdl/androidsdl-sdl.cpp
new file mode 100644
index 0000000000..5e0eaa0408
--- /dev/null
+++ b/backends/platform/androidsdl/androidsdl-sdl.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "backends/platform/androidsdl/androidsdl-sdl.h"
+#include "backends/events/androidsdl/androidsdl-events.h"
+#include "backends/graphics/androidsdl/androidsdl-graphics.h"
+
+void OSystem_ANDROIDSDL::initBackend() {
+ // Create the backend custom managers
+ if (_eventSource == 0)
+ _eventSource = new AndroidSdlEventSource();
+
+ if (_graphicsManager == 0)
+ _graphicsManager = new AndroidSdlGraphicsManager(_eventSource, _window);
+
+ // Call parent implementation of this method
+ OSystem_POSIX::initBackend();
+}
diff --git a/backends/platform/androidsdl/androidsdl-sdl.h b/backends/platform/androidsdl/androidsdl-sdl.h
new file mode 100644
index 0000000000..6ebe5022eb
--- /dev/null
+++ b/backends/platform/androidsdl/androidsdl-sdl.h
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PLATFORM_SDL_ANDROIDSDL_H
+#define PLATFORM_SDL_ANDROIDSDL_H
+
+#include "backends/platform/sdl/posix/posix.h"
+
+class OSystem_ANDROIDSDL : public OSystem_POSIX {
+public:
+ virtual void initBackend();
+
+#ifdef ENABLE_KEYMAPPER
+ // FIXME: This just calls parent methods, is it needed?
+ virtual Common::HardwareInputSet *getHardwareInputSet();
+#endif
+};
+
+#endif
diff --git a/backends/platform/androidsdl/androidsdl.mk b/backends/platform/androidsdl/androidsdl.mk
new file mode 100644
index 0000000000..1defb81b97
--- /dev/null
+++ b/backends/platform/androidsdl/androidsdl.mk
@@ -0,0 +1,11 @@
+# Special target to create an AndroidSDL snapshot
+androidsdl:
+ $(MKDIR) release
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) release
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) release
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip release
+ zip -j scummvm190-git-appdata.zip release/*
+ split -d -b 1000000 scummvm190-git-appdata.zip scummvm190-git-appdata.zip0
+ $(RM) -r scummvm190-git-appdata.zip
+
+.PHONY: androidsdl
diff --git a/backends/platform/androidsdl/module.mk b/backends/platform/androidsdl/module.mk
new file mode 100644
index 0000000000..df927163b8
--- /dev/null
+++ b/backends/platform/androidsdl/module.mk
@@ -0,0 +1,13 @@
+MODULE := backends/platform/androidsdl
+
+MODULE_OBJS := \
+ androidsdl-main.o \
+ androidsdl-sdl.o
+
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
+
+# Hack to ensure the SDL backend is built so we can use OSystem_SDL.
+-include $(srcdir)/backends/platform/sdl/module.mk
diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/posix/posix-main.cpp
index d07db11b0c..5deebb0ae3 100644
--- a/backends/platform/sdl/posix/posix-main.cpp
+++ b/backends/platform/sdl/posix/posix-main.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3)
+#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(ANDROIDSDL)
#include "backends/platform/sdl/posix/posix.h"
#include "backends/plugins/sdl/sdl-provider.h"