diff options
Diffstat (limited to 'backends/platform/android')
-rw-r--r-- | backends/platform/android/android.cpp | 6 | ||||
-rw-r--r-- | backends/platform/android/android.h | 6 | ||||
-rw-r--r-- | backends/platform/android/android.mk | 1 | ||||
-rw-r--r-- | backends/platform/android/asset-archive.cpp | 4 | ||||
-rw-r--r-- | backends/platform/android/asset-archive.h | 4 | ||||
-rw-r--r-- | backends/platform/android/events.cpp | 6 | ||||
-rw-r--r-- | backends/platform/android/gfx.cpp | 23 | ||||
-rw-r--r-- | backends/platform/android/jni.cpp | 6 | ||||
-rw-r--r-- | backends/platform/android/jni.h | 6 | ||||
-rw-r--r-- | backends/platform/android/org/scummvm/scummvm/ScummVM.java | 8 | ||||
-rw-r--r-- | backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java | 10 | ||||
-rw-r--r-- | backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java | 10 | ||||
-rw-r--r-- | backends/platform/android/org/scummvm/scummvm/ScummVMEventsHoneycomb.java | 25 | ||||
-rw-r--r-- | backends/platform/android/texture.cpp | 23 | ||||
-rw-r--r-- | backends/platform/android/texture.h | 16 |
15 files changed, 104 insertions, 50 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 5e3d1d0db6..3ff1b939ef 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -8,12 +8,12 @@ * 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 + * 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. diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 704ce12f60..28016f5e3e 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -8,12 +8,12 @@ * 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 + * 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. diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk index 915bf8ac60..7c4fe01d54 100644 --- a/backends/platform/android/android.mk +++ b/backends/platform/android/android.mk @@ -7,6 +7,7 @@ ANDROID_PLUGIN_VERSIONCODE = 6 JAVA_FILES = \ ScummVM.java \ ScummVMEvents.java \ + ScummVMEventsHoneycomb.java \ ScummVMApplication.java \ ScummVMActivity.java \ EditableSurfaceView.java \ diff --git a/backends/platform/android/asset-archive.cpp b/backends/platform/android/asset-archive.cpp index da378fb082..52c2c084bd 100644 --- a/backends/platform/android/asset-archive.cpp +++ b/backends/platform/android/asset-archive.cpp @@ -8,12 +8,12 @@ * 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. diff --git a/backends/platform/android/asset-archive.h b/backends/platform/android/asset-archive.h index c5e43555e0..6a0033d24e 100644 --- a/backends/platform/android/asset-archive.h +++ b/backends/platform/android/asset-archive.h @@ -8,12 +8,12 @@ * 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. diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index 5c42db9347..c60626ec36 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -8,12 +8,12 @@ * 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 + * 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. diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 882dcff9a4..d7713f99d8 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -8,12 +8,12 @@ * 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 + * 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. @@ -94,6 +94,7 @@ Common::List<Graphics::PixelFormat> OSystem_Android::getSupportedFormats() const Common::List<Graphics::PixelFormat> res; res.push_back(GLES565Texture::pixelFormat()); res.push_back(GLES5551Texture::pixelFormat()); + res.push_back(GLES8888Texture::pixelFormat()); res.push_back(GLES4444Texture::pixelFormat()); res.push_back(Graphics::PixelFormat::createFormatCLUT8()); @@ -147,6 +148,8 @@ void OSystem_Android::initTexture(GLESBaseTexture **texture, *texture = new GLES565Texture(); else if (format_new == GLES5551Texture::pixelFormat()) *texture = new GLES5551Texture(); + else if (format_new == GLES8888Texture::pixelFormat()) + *texture = new GLES8888Texture(); else if (format_new == GLES4444Texture::pixelFormat()) *texture = new GLES4444Texture(); else { @@ -233,7 +236,7 @@ void OSystem_Android::initViewport() { GLCALL(glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)); GLCALL(glEnable(GL_BLEND)); - GLCALL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); + GLCALL(glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); GLCALL(glEnableClientState(GL_VERTEX_ARRAY)); GLCALL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); @@ -726,7 +729,7 @@ void OSystem_Android::setMouseCursor(const void *buf, uint w, uint h, _mouse_keycolor = keycolor; p = _mouse_texture_palette->palette() + _mouse_keycolor * 2; - WRITE_UINT16(p, READ_UINT16(p) & ~1); + WRITE_UINT16(p, 0); } if (w == 0 || h == 0) @@ -752,12 +755,12 @@ void OSystem_Android::setMouseCursor(const void *buf, uint w, uint h, return; } - uint16 *s = (uint16 *)buf; + const uint16 *s = (const uint16 *)buf; uint16 *d = (uint16 *)tmp; for (uint16 y = 0; y < h; ++y, d += pitch / 2 - w) for (uint16 x = 0; x < w; ++x, d++) - if (*s++ != (keycolor & 0xffff)) - *d |= 1; + if (*s++ == (keycolor & 0xffff)) + *d = 0; _mouse_texture->updateBuffer(0, 0, w, h, tmp, pitch); @@ -779,7 +782,7 @@ void OSystem_Android::setCursorPaletteInternal(const byte *colors, WRITE_UINT16(p, pf.RGBToColor(colors[0], colors[1], colors[2])); p = _mouse_texture_palette->palette() + _mouse_keycolor * 2; - WRITE_UINT16(p, READ_UINT16(p) & ~1); + WRITE_UINT16(p, 0); } void OSystem_Android::setCursorPalette(const byte *colors, @@ -821,7 +824,7 @@ void OSystem_Android::disableCursorPalette() { } byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2; - WRITE_UINT16(p, READ_UINT16(p) & ~1); + WRITE_UINT16(p, 0); } } diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp index 2b738dd63f..764c84ce1c 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -8,12 +8,12 @@ * 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 + * 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. diff --git a/backends/platform/android/jni.h b/backends/platform/android/jni.h index 52698e0f35..326869b1ee 100644 --- a/backends/platform/android/jni.h +++ b/backends/platform/android/jni.h @@ -8,12 +8,12 @@ * 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 + * 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. diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVM.java b/backends/platform/android/org/scummvm/scummvm/ScummVM.java index 3a25b54eeb..5047502e61 100644 --- a/backends/platform/android/org/scummvm/scummvm/ScummVM.java +++ b/backends/platform/android/org/scummvm/scummvm/ScummVM.java @@ -86,13 +86,15 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable { Log.d(LOG_TAG, String.format("surfaceChanged: %dx%d (%d)", width, height, format)); + // store values for the native code + // make sure to do it before notifying the lock + // as it leads to a race condition otherwise + setSurface(width, height); + synchronized(_sem_surface) { _surface_holder = holder; _sem_surface.notifyAll(); } - - // store values for the native code - setSurface(width, height); } // SurfaceHolder callback diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java index 5d041dafd2..5964d5bfde 100644 --- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java +++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java @@ -4,6 +4,7 @@ import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.media.AudioManager; +import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.util.DisplayMetrics; @@ -169,7 +170,14 @@ public class ScummVMActivity extends Activity { _mouseHelper.attach(main_surface); } - _events = new ScummVMEvents(this, _scummvm, _mouseHelper); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) + { + _events = new ScummVMEvents(this, _scummvm, _mouseHelper); + } + else + { + _events = new ScummVMEventsHoneycomb(this, _scummvm, _mouseHelper); + } main_surface.setOnKeyListener(_events); main_surface.setOnTouchListener(_events); diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java index 702215341b..32c65d3395 100644 --- a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java +++ b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java @@ -68,15 +68,7 @@ public class ScummVMEvents implements return true; } - public boolean onGenericMotionEvent(final MotionEvent e) { - if((e.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { - _scummvm.pushEvent(JE_JOYSTICK, e.getAction(), - (int)(e.getAxisValue(MotionEvent.AXIS_X)*100), - (int)(e.getAxisValue(MotionEvent.AXIS_Y)*100), - 0, 0); - return true; - } - + public boolean onGenericMotionEvent(MotionEvent e) { return false; } diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMEventsHoneycomb.java b/backends/platform/android/org/scummvm/scummvm/ScummVMEventsHoneycomb.java new file mode 100644 index 0000000000..ab85429040 --- /dev/null +++ b/backends/platform/android/org/scummvm/scummvm/ScummVMEventsHoneycomb.java @@ -0,0 +1,25 @@ +package org.scummvm.scummvm; + +import android.content.Context; +import android.view.MotionEvent; +import android.view.InputDevice; + +public class ScummVMEventsHoneycomb extends ScummVMEvents { + + public ScummVMEventsHoneycomb(Context context, ScummVM scummvm, MouseHelper mouseHelper) { + super(context, scummvm, mouseHelper); + } + + @Override + public boolean onGenericMotionEvent(MotionEvent e) { + if((e.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { + _scummvm.pushEvent(JE_JOYSTICK, e.getAction(), + (int)(e.getAxisValue(MotionEvent.AXIS_X)*100), + (int)(e.getAxisValue(MotionEvent.AXIS_Y)*100), + 0, 0); + return true; + } + + return false; + } +} diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index cc41c0d8a6..165396b82b 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -8,12 +8,12 @@ * 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 + * 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. @@ -259,11 +259,15 @@ void GLESTexture::fillBuffer(uint32 color) { assert(_surface.getPixels()); if (_pixelFormat.bytesPerPixel == 1 || - ((color & 0xff) == ((color >> 8) & 0xff))) + (_pixelFormat.bytesPerPixel == 2 && + ((color & 0xff) == ((color >> 8) & 0xff)))) memset(_pixels, color & 0xff, _surface.pitch * _surface.h); - else - Common::fill(_pixels, _pixels + _surface.pitch * _surface.h, + else if (_pixelFormat.bytesPerPixel == 2) + Common::fill((uint16 *)_pixels, (uint16 *)(_pixels + _surface.pitch * _surface.h), (uint16)color); + else + Common::fill((uint32 *)_pixels, (uint32 *)(_pixels + _surface.pitch * _surface.h), + color); setDirty(); } @@ -334,6 +338,13 @@ GLES565Texture::GLES565Texture() : GLES565Texture::~GLES565Texture() { } +GLES8888Texture::GLES8888Texture() : + GLESTexture(GL_RGBA, GL_UNSIGNED_BYTE, pixelFormat()) { +} + +GLES8888Texture::~GLES8888Texture() { +} + GLESFakePaletteTexture::GLESFakePaletteTexture(GLenum glFormat, GLenum glType, Graphics::PixelFormat pixelFormat) : GLESBaseTexture(glFormat, glType, pixelFormat), diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h index 4307b5a1bc..4b05dfd5d4 100644 --- a/backends/platform/android/texture.h +++ b/backends/platform/android/texture.h @@ -8,12 +8,12 @@ * 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. @@ -224,6 +224,18 @@ public: } }; +// RGBA8888 texture +class GLES8888Texture : public GLESTexture { +public: + GLES8888Texture(); + virtual ~GLES8888Texture(); + + static inline Graphics::PixelFormat pixelFormat() { + // We assume LE since all Android platforms are LE. + return Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24); + } +}; + class GLESFakePaletteTexture : public GLESBaseTexture { protected: GLESFakePaletteTexture(GLenum glFormat, GLenum glType, |