aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-11 00:30:02 -0400
committerMatthew Hoops2011-05-11 00:30:28 -0400
commita1d41da096c0bcf502a85919cb1cb1ee471719c5 (patch)
tree8c51419daa486f1d4833757db4715dadab6c3497 /backends/platform/android
parentaccb0c2a5d0c9e7b353cda4b74f511a498ed8073 (diff)
parent33c3e19cea2a08fbf26ecbe940763e8ee1c37d28 (diff)
downloadscummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.gz
scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.bz2
scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.zip
Merge remote branch 'upstream/master' into t7g-ios
Conflicts: audio/decoders/qdm2.h common/util.cpp engines/groovie/music.cpp engines/groovie/resource.h video/qt_decoder.cpp video/qt_decoder.h
Diffstat (limited to 'backends/platform/android')
-rw-r--r--backends/platform/android/android.cpp18
-rw-r--r--backends/platform/android/android.h1
-rw-r--r--backends/platform/android/asset-archive.cpp1
-rw-r--r--backends/platform/android/events.cpp25
-rw-r--r--backends/platform/android/gfx.cpp21
-rw-r--r--backends/platform/android/jni.cpp19
-rw-r--r--backends/platform/android/org/inodes/gus/scummvm/ScummVM.java2
-rw-r--r--backends/platform/android/texture.cpp33
8 files changed, 107 insertions, 13 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index bbfdb06b8d..b1d0727d1f 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -25,6 +25,23 @@
#if defined(__ANDROID__)
+// Allow use of stuff in <time.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+
+// Disable printf override in common/forbidden.h to avoid
+// clashes with log.h from the Android SDK.
+// That header file uses
+// __attribute__ ((format(printf, 3, 4)))
+// which gets messed up by our override mechanism; this could
+// be avoided by either changing the Android SDK to use the equally
+// legal and valid
+// __attribute__ ((format(printf, 3, 4)))
+// or by refining our printf override to use a varadic macro
+// (which then wouldn't be portable, though).
+// Anyway, for now we just disable the printf override globally
+// for the Android port
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/system_properties.h>
@@ -32,6 +49,7 @@
#include <unistd.h>
#include "common/util.h"
+#include "common/textconsole.h"
#include "common/rect.h"
#include "common/queue.h"
#include "common/mutex.h"
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 6eebdb97d9..109d252a99 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -31,6 +31,7 @@
#include "common/fs.h"
#include "common/archive.h"
#include "audio/mixer_intern.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "backends/base-backend.h"
#include "backends/plugins/posix/posix-provider.h"
diff --git a/backends/platform/android/asset-archive.cpp b/backends/platform/android/asset-archive.cpp
index 8e95029894..7c21b35281 100644
--- a/backends/platform/android/asset-archive.cpp
+++ b/backends/platform/android/asset-archive.cpp
@@ -35,6 +35,7 @@
#include "common/util.h"
#include "common/archive.h"
#include "common/debug.h"
+#include "common/textconsole.h"
#include "backends/platform/android/jni.h"
#include "backends/platform/android/asset-archive.h"
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp
index 09466b4d2f..0d74e1c524 100644
--- a/backends/platform/android/events.cpp
+++ b/backends/platform/android/events.cpp
@@ -25,6 +25,23 @@
#if defined(__ANDROID__)
+// Allow use of stuff in <time.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+
+// Disable printf override in common/forbidden.h to avoid
+// clashes with log.h from the Android SDK.
+// That header file uses
+// __attribute__ ((format(printf, 3, 4)))
+// which gets messed up by our override mechanism; this could
+// be avoided by either changing the Android SDK to use the equally
+// legal and valid
+// __attribute__ ((format(printf, 3, 4)))
+// or by refining our printf override to use a varadic macro
+// (which then wouldn't be portable, though).
+// Anyway, for now we just disable the printf override globally
+// for the Android port
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
#include "common/events.h"
#include "backends/platform/android/android.h"
@@ -444,8 +461,12 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3,
if (arg4 & JMETA_SHIFT)
e.kbd.flags |= Common::KBD_SHIFT;
- if (arg4 & JMETA_ALT)
- e.kbd.flags |= Common::KBD_ALT;
+ // JMETA_ALT is Fn on physical keyboards!
+ // when mapping this to ALT - as we know it from PC keyboards - all
+ // Fn combos will be broken (like Fn+q, which needs to end as 1 and
+ // not ALT+1). Do not want.
+ //if (arg4 & JMETA_ALT)
+ // e.kbd.flags |= Common::KBD_ALT;
if (arg4 & (JMETA_SYM | JMETA_CTRL))
e.kbd.flags |= Common::KBD_CTRL;
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 86232030ff..ebce58e291 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -25,6 +25,23 @@
#if defined(__ANDROID__)
+// Allow use of stuff in <time.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+
+// Disable printf override in common/forbidden.h to avoid
+// clashes with log.h from the Android SDK.
+// That header file uses
+// __attribute__ ((format(printf, 3, 4)))
+// which gets messed up by our override mechanism; this could
+// be avoided by either changing the Android SDK to use the equally
+// legal and valid
+// __attribute__ ((format(printf, 3, 4)))
+// or by refining our printf override to use a varadic macro
+// (which then wouldn't be portable, though).
+// Anyway, for now we just disable the printf override globally
+// for the Android port
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
#include "common/endian.h"
#include "graphics/conversion.h"
@@ -628,13 +645,13 @@ void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) {
GLTHREADCHECK;
const Graphics::Surface *surface = _overlay_texture->surface_const();
- assert(surface->bytesPerPixel == sizeof(buf[0]));
+ assert(surface->format.bytesPerPixel == sizeof(buf[0]));
const byte *src = (const byte *)surface->pixels;
uint h = surface->h;
do {
- memcpy(buf, src, surface->w * surface->bytesPerPixel);
+ memcpy(buf, src, surface->w * surface->format.bytesPerPixel);
src += surface->pitch;
// This 'pitch' is pixels not bytes
buf += pitch;
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index 08a1491998..13aef11fa2 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -25,9 +25,28 @@
#if defined(__ANDROID__)
+// Allow use of stuff in <time.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+
+// Disable printf override in common/forbidden.h to avoid
+// clashes with log.h from the Android SDK.
+// That header file uses
+// __attribute__ ((format(printf, 3, 4)))
+// which gets messed up by our override mechanism; this could
+// be avoided by either changing the Android SDK to use the equally
+// legal and valid
+// __attribute__ ((format(printf, 3, 4)))
+// or by refining our printf override to use a varadic macro
+// (which then wouldn't be portable, though).
+// Anyway, for now we just disable the printf override globally
+// for the Android port
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
#include "base/main.h"
#include "base/version.h"
#include "common/config-manager.h"
+#include "common/error.h"
+#include "common/textconsole.h"
#include "engines/engine.h"
#include "backends/platform/android/android.h"
diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
index 8bf40ac553..c4de6d62f8 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
@@ -35,7 +35,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
private String[] _args;
- final private native void create(AssetManager _asset_manager,
+ final private native void create(AssetManager asset_manager,
EGL10 egl, EGLDisplay egl_display,
AudioTrack audio_track,
int sample_rate, int buffer_size);
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index a6b28ca485..c830676c07 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -25,6 +25,23 @@
#if defined(__ANDROID__)
+// Allow use of stuff in <time.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+
+// Disable printf override in common/forbidden.h to avoid
+// clashes with log.h from the Android SDK.
+// That header file uses
+// __attribute__ ((format(printf, 3, 4)))
+// which gets messed up by our override mechanism; this could
+// be avoided by either changing the Android SDK to use the equally
+// legal and valid
+// __attribute__ ((format(printf, 3, 4)))
+// or by refining our printf override to use a varadic macro
+// (which then wouldn't be portable, though).
+// Anyway, for now we just disable the printf override globally
+// for the Android port
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
#include "base/main.h"
#include "graphics/surface.h"
@@ -147,7 +164,7 @@ void GLESBaseTexture::setLinearFilter(bool value) {
void GLESBaseTexture::allocBuffer(GLuint w, GLuint h) {
_surface.w = w;
_surface.h = h;
- _surface.bytesPerPixel = _pixelFormat.bytesPerPixel;
+ _surface.format = _pixelFormat;
if (w == _texture_width && h == _texture_height)
return;
@@ -241,14 +258,14 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) {
delete[] _buf;
delete[] _pixels;
- _pixels = new byte[w * h * _surface.bytesPerPixel];
+ _pixels = new byte[w * h * _surface.format.bytesPerPixel];
assert(_pixels);
_surface.pixels = _pixels;
fillBuffer(0);
- _buf = new byte[w * h * _surface.bytesPerPixel];
+ _buf = new byte[w * h * _surface.format.bytesPerPixel];
assert(_buf);
}
@@ -257,10 +274,10 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h,
setDirtyRect(Common::Rect(x, y, x + w, y + h));
const byte *src = (const byte *)buf;
- byte *dst = _pixels + y * _surface.pitch + x * _surface.bytesPerPixel;
+ byte *dst = _pixels + y * _surface.pitch + x * _surface.format.bytesPerPixel;
do {
- memcpy(dst, src, w * _surface.bytesPerPixel);
+ memcpy(dst, src, w * _surface.format.bytesPerPixel);
dst += _surface.pitch;
src += pitch_buf;
} while (--h);
@@ -301,10 +318,10 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
_tex = _buf;
byte *src = _pixels + _dirty_rect.top * _surface.pitch +
- _dirty_rect.left * _surface.bytesPerPixel;
+ _dirty_rect.left * _surface.format.bytesPerPixel;
byte *dst = _buf;
- uint16 l = dwidth * _surface.bytesPerPixel;
+ uint16 l = dwidth * _surface.format.bytesPerPixel;
for (uint16 i = 0; i < dheight; ++i) {
memcpy(dst, src, l);
@@ -373,7 +390,7 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) {
GLESBaseTexture::allocBuffer(w, h);
- _surface.bytesPerPixel = 1;
+ _surface.format = Graphics::PixelFormat::createFormatCLUT8();
_surface.pitch = w;
if (_surface.w == oldw && _surface.h == oldh) {