From 877004dbdd967d2f57d494b1aaa1cb55aae0fd52 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 17 Apr 2011 21:14:19 +0200 Subject: BACKENDS: Adapt various backends code to set up Surface::format correctly. Note that this change is not tested at all (not even compile wise!). --- backends/platform/android/gfx.cpp | 4 ++-- backends/platform/android/texture.cpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'backends/platform/android') diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 86232030ff..fae428d29f 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -628,13 +628,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/texture.cpp b/backends/platform/android/texture.cpp index a6b28ca485..5931902906 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -148,6 +148,7 @@ 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 +242,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 +258,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 +302,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); @@ -374,6 +375,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) { -- cgit v1.2.3 From da734a4af024a72ee155bc25d6e45f994de6b060 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 17 Apr 2011 21:27:34 +0200 Subject: ALL/GRAPHICS: Remove Surface::bytesPerPixel. --- backends/platform/android/texture.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'backends/platform/android') diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index 5931902906..2d73783309 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -147,7 +147,6 @@ 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) @@ -374,7 +373,6 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { GLESBaseTexture::allocBuffer(w, h); - _surface.bytesPerPixel = 1; _surface.format = Graphics::PixelFormat::createFormatCLUT8(); _surface.pitch = w; -- cgit v1.2.3 From 1b681e85a8a0345d0ce848a7584a7654ad629f07 Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Thu, 28 Apr 2011 20:05:01 +0300 Subject: ANDROID: Fix compilation --- backends/platform/android/android.h | 1 + backends/platform/android/asset-archive.cpp | 1 + backends/platform/android/jni.cpp | 1 + 3 files changed, 3 insertions(+) (limited to 'backends/platform/android') 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/jni.cpp b/backends/platform/android/jni.cpp index 08a1491998..7962fa7b4b 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -28,6 +28,7 @@ #include "base/main.h" #include "base/version.h" #include "common/config-manager.h" +#include "common/textconsole.h" #include "engines/engine.h" #include "backends/platform/android/android.h" -- cgit v1.2.3 From 52c0b2e28c85658d0ae2d2522e6e2d02c4db8796 Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Thu, 28 Apr 2011 20:53:01 +0300 Subject: ANDROID: Another attempt at compilation fix --- backends/platform/android/jni.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'backends/platform/android') diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp index 7962fa7b4b..f23d71b2a4 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -28,6 +28,7 @@ #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" -- cgit v1.2.3 From 8feac89bc7329f002d3c4beba370d9c6ea05e798 Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 28 Apr 2011 20:02:01 +0200 Subject: ANDROID: Fix compilation some more --- backends/platform/android/android.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'backends/platform/android') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index bbfdb06b8d..c7f62f523b 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -32,6 +32,7 @@ #include #include "common/util.h" +#include "common/textconsole.h" #include "common/rect.h" #include "common/queue.h" #include "common/mutex.h" -- cgit v1.2.3 From ea547ca3fd09ccc2dcdc6af7026b24b0e1966859 Mon Sep 17 00:00:00 2001 From: dhewg Date: Mon, 2 May 2011 18:41:04 +0200 Subject: ANDROID: Style fix --- backends/platform/android/org/inodes/gus/scummvm/ScummVM.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/platform/android') 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); -- cgit v1.2.3 From 3d4e9fe674d2daf59ff4b481fc2f89f77b390a4f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 3 May 2011 11:27:44 +0200 Subject: BACKENDS: Allow various files to use stuff from time.h --- backends/platform/android/android.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'backends/platform/android') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index c7f62f523b..7cf1e988fc 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -25,6 +25,9 @@ #if defined(__ANDROID__) +// Allow use of stuff in +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h + #include #include #include -- cgit v1.2.3 From a50c36d1381be2e7d0748a2c734e41357fd4920f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 3 May 2011 14:29:01 +0200 Subject: ANDROID: Fix various forbidden symbol clashes --- backends/platform/android/android.cpp | 14 ++++++++++++++ backends/platform/android/events.cpp | 17 +++++++++++++++++ backends/platform/android/gfx.cpp | 17 +++++++++++++++++ backends/platform/android/jni.cpp | 17 +++++++++++++++++ backends/platform/android/texture.cpp | 17 +++++++++++++++++ 5 files changed, 82 insertions(+) (limited to 'backends/platform/android') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 7cf1e988fc..b1d0727d1f 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -28,6 +28,20 @@ // Allow use of stuff in #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 #include #include diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index 09466b4d2f..2f140f0c0b 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 +#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" diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index fae428d29f..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 +#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" diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp index f23d71b2a4..13aef11fa2 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -25,6 +25,23 @@ #if defined(__ANDROID__) +// Allow use of stuff in +#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" diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index 2d73783309..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 +#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" -- cgit v1.2.3 From bfecb37501b6fdc35f2802216db5fb2b0e54b8ee Mon Sep 17 00:00:00 2001 From: dhewg Date: Sat, 7 May 2011 19:42:37 +0200 Subject: ANDROID: Get rid of Fn->ALT metakey mapping Thanks to Ge0rG for the analysis --- backends/platform/android/events.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'backends/platform/android') diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index 2f140f0c0b..0d74e1c524 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -461,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; -- cgit v1.2.3