diff options
author | athrxx | 2011-03-22 15:55:17 +0100 |
---|---|---|
committer | athrxx | 2011-03-22 15:55:17 +0100 |
commit | ea79336ac90e12fe53242cfd9153db9d7087ca0f (patch) | |
tree | 50c74ceb394cf23d845c408659459f3b07192b92 /backends | |
parent | 92f922aabe5811fcf595697bc1316aa57b4c9b66 (diff) | |
parent | 273ba73d5fae0dd0d3b3f7c5f15f03d02c0af1b4 (diff) | |
download | scummvm-rg350-ea79336ac90e12fe53242cfd9153db9d7087ca0f.tar.gz scummvm-rg350-ea79336ac90e12fe53242cfd9153db9d7087ca0f.tar.bz2 scummvm-rg350-ea79336ac90e12fe53242cfd9153db9d7087ca0f.zip |
Merge branch 'master' of https://github.com/scummvm/scummvm
Diffstat (limited to 'backends')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 47 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 13 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 39 | ||||
-rw-r--r-- | backends/platform/android/android.cpp | 20 | ||||
-rw-r--r-- | backends/platform/android/android.h | 3 | ||||
-rw-r--r-- | backends/platform/android/android.mk | 4 | ||||
-rw-r--r-- | backends/platform/android/events.cpp | 12 |
7 files changed, 63 insertions, 75 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index fd8c2ccffe..4ac2747d25 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -103,14 +103,8 @@ void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { break; case OSystem::kFeatureAspectRatioCorrection: - // TODO: If we enable aspect ratio correction, we automatically set - // the video mode to 4/3. That is quity messy, but since we have that - // messy OpenGL mode use there's not much to do about it right now... - // Of course in case we disasble the aspect ratio correction, we - // might want to setup a different mode, but which one? - // Think of a way to get rid of this mess. - if (enable) - _videoMode.mode = OpenGL::GFX_4_3; + _videoMode.aspectRatioCorrection = enable; + _transactionDetails.needRefresh = true; break; default: @@ -124,7 +118,7 @@ bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) { return _videoMode.fullscreen; case OSystem::kFeatureAspectRatioCorrection: - return _videoMode.mode == OpenGL::GFX_4_3; + return _videoMode.aspectRatioCorrection; default: return false; @@ -138,7 +132,6 @@ bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) { static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { {"gl1", _s("OpenGL Normal"), OpenGL::GFX_NORMAL}, {"gl2", _s("OpenGL Conserve"), OpenGL::GFX_CONSERVE}, - {"gl3", _s("OpenGL 4/3"), OpenGL::GFX_4_3}, {"gl4", _s("OpenGL Original"), OpenGL::GFX_ORIGINAL}, {0, 0, 0} }; @@ -166,11 +159,10 @@ bool OpenGLGraphicsManager::setGraphicsMode(int mode) { switch (mode) { case OpenGL::GFX_NORMAL: case OpenGL::GFX_CONSERVE: - case OpenGL::GFX_4_3: case OpenGL::GFX_ORIGINAL: break; default: - warning("unknown gfx mode %d", mode); + warning("Unknown gfx mode %d", mode); return false; } @@ -1262,10 +1254,14 @@ void OpenGLGraphicsManager::toggleAntialiasing() { } uint OpenGLGraphicsManager::getAspectRatio() { - if (_videoMode.mode == OpenGL::GFX_NORMAL) - return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight; - else if (_videoMode.mode == OpenGL::GFX_4_3) + // In case we enable aspect ratio correction we force a 4/3 ratio. + // TODO: This makes OpenGL Normal behave like OpenGL Conserve, when aspect + // ratio correction is enabled, but it's better than the previous 4/3 mode + // mess at least... + if (_videoMode.aspectRatioCorrection) return 13333; + else if (_videoMode.mode == OpenGL::GFX_NORMAL) + return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight; else return _videoMode.screenWidth * 10000 / _videoMode.screenHeight; } @@ -1274,10 +1270,7 @@ void OpenGLGraphicsManager::adjustMousePosition(int16 &x, int16 &y) { if (_overlayVisible) return; - if (_videoMode.mode == OpenGL::GFX_NORMAL) { - x /= _videoMode.scaleFactor; - y /= _videoMode.scaleFactor; - } else if (!_overlayVisible) { + if (!_overlayVisible) { x -= _displayX; y -= _displayY; @@ -1388,22 +1381,6 @@ const char *OpenGLGraphicsManager::getCurrentModeName() { return modeName; } -void OpenGLGraphicsManager::switchDisplayMode(int mode) { - assert(_transactionMode == kTransactionActive); - - if (_videoMode.mode == mode) - return; - - if (mode == -1) // If -1, switch to next mode - _videoMode.mode = (_videoMode.mode + 1) % 4; - else if (mode == -2) // If -2, switch to previous mode - _videoMode.mode = (_videoMode.mode + 3) % 4; - else - _videoMode.mode = mode; - - _transactionDetails.needRefresh = true; -} - #ifdef USE_OSD void OpenGLGraphicsManager::updateOSD() { // The font we are going to use: diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index f674015b4a..374f1c196e 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -39,8 +39,7 @@ namespace OpenGL { enum { GFX_NORMAL = 0, GFX_CONSERVE = 1, - GFX_4_3 = 2, - GFX_ORIGINAL = 3 + GFX_ORIGINAL = 2 }; } @@ -156,6 +155,7 @@ protected: int mode; int scaleFactor; bool antialiasing; + bool aspectRatioCorrection; int screenWidth, screenHeight; int overlayWidth, overlayHeight; @@ -217,15 +217,6 @@ protected: int _displayWidth; int _displayHeight; - /** - * Sets the dispaly mode. - * - * This can only be used in a GFX transaction. - * - * @param mode the dispaly mode, if -1 it will switch to next mode. If -2 to previous mode. - */ - virtual void switchDisplayMode(int mode); - virtual const char *getCurrentModeName(); virtual void calculateDisplaySize(int &width, int &height); diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index de9dba1ab1..b9022af120 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -295,10 +295,6 @@ bool OpenGLSdlGraphicsManager::setupFullscreenMode() { } bool OpenGLSdlGraphicsManager::loadGFXMode() { - // Force 4/3 if feature enabled - if (getFeatureState(OSystem::kFeatureAspectRatioCorrection)) - _videoMode.mode = OpenGL::GFX_4_3; - // If the screen was resized, do not change its size if (!_screenResized) { const int scaleFactor = getScale(); @@ -509,10 +505,19 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { // Ctrl-Alt-a switch between display modes if (event.kbd.keycode == 'a') { beginGFXTransaction(); - switchDisplayMode(-1); + setFeatureState(OSystem::kFeatureAspectRatioCorrection, !getFeatureState(OSystem::kFeatureAspectRatioCorrection)); endGFXTransaction(); #ifdef USE_OSD - displayModeChangedMsg(); + char buffer[128]; + if (getFeatureState(OSystem::kFeatureAspectRatioCorrection)) + sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d", + _videoMode.screenWidth, _videoMode.screenHeight, + _hwscreen->w, _hwscreen->h); + else + sprintf(buffer, "Disabled aspect ratio correction\n%d x %d -> %d x %d", + _videoMode.screenWidth, _videoMode.screenHeight, + _hwscreen->w, _hwscreen->h); + displayMessageOnOSD(buffer); #endif internUpdateScreen(); return true; @@ -561,12 +566,12 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { } } - const bool isNormalNumber = (SDLK_1 <= sdlKey && sdlKey <= SDLK_4); - const bool isKeypadNumber = (SDLK_KP1 <= sdlKey && sdlKey <= SDLK_KP4); + const bool isNormalNumber = (SDLK_1 <= sdlKey && sdlKey <= SDLK_3); + const bool isKeypadNumber = (SDLK_KP1 <= sdlKey && sdlKey <= SDLK_KP3); // Ctrl-Alt-<number key> will change the GFX mode if (isNormalNumber || isKeypadNumber) { - if (sdlKey - (isNormalNumber ? SDLK_1 : SDLK_KP1) <= 4) { + if (sdlKey - (isNormalNumber ? SDLK_1 : SDLK_KP1) <= 3) { #ifdef USE_OSD int lastMode = _videoMode.mode; #endif @@ -576,10 +581,6 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { beginGFXTransaction(); setGraphicsMode(sdlKey - (isNormalNumber ? SDLK_1 : SDLK_KP1)); setScale(oldScale); - // TODO: We disable the aspect ratio correction here, - // we might switch to mode which ignores it... - // We should really fix this mess up. - setFeatureState(OSystem::kFeatureAspectRatioCorrection, false); endGFXTransaction(); #ifdef USE_OSD if (lastMode != _videoMode.mode) @@ -597,18 +598,6 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { toggleFullScreen(-1); return true; } - - // Ctrl-Shift-a switch backwards between display modes - if (event.kbd.keycode == 'a') { - beginGFXTransaction(); - switchDisplayMode(-2); - endGFXTransaction(); -#ifdef USE_OSD - displayModeChangedMsg(); -#endif - internUpdateScreen(); - return true; - } } break; case Common::EVENT_KEYUP: diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 6bb6de7289..69b3f1e084 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -27,6 +27,7 @@ #include <sys/time.h> #include <sys/resource.h> +#include <sys/system_properties.h> #include <time.h> #include <unistd.h> @@ -131,6 +132,11 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) : _touchpad_scale(66), _dpad_scale(4), _trackball_scale(2) { + LOGI("Running on: [%s] [%s] SDK:%s ABI:%s", + getSystemProperty("ro.build.fingerprint").c_str(), + getSystemProperty("ro.build.display.id").c_str(), + getSystemProperty("ro.build.version.sdk").c_str(), + getSystemProperty("ro.product.cpu.abi").c_str()); } OSystem_Android::~OSystem_Android() { @@ -548,6 +554,20 @@ void OSystem_Android::logMessage(LogMessageType::Type type, } } +Common::String OSystem_Android::getSystemLanguage() const { + return Common::String::format("%s_%s", + getSystemProperty("persist.sys.language").c_str(), + getSystemProperty("persist.sys.country").c_str()); +} + +Common::String OSystem_Android::getSystemProperty(const char *name) const { + char value[PROP_VALUE_MAX]; + + int len = __system_property_get(name, value); + + return Common::String(value, len); +} + #ifdef DYNAMIC_MODULES void AndroidPluginProvider::addCustomDirectories(Common::FSList &dirs) const { ((OSystem_Android *)g_system)->addPluginDirectories(dirs); diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 839b3f01c1..eb05dbd390 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -144,6 +144,8 @@ private: FilesystemFactory *_fsFactory; timeval _startTime; + Common::String getSystemProperty(const char *name) const; + void initSurface(); void deinitSurface(); void initViewport(); @@ -280,6 +282,7 @@ public: virtual void logMessage(LogMessageType::Type type, const char *message); virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); + virtual Common::String getSystemLanguage() const; }; #endif diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk index cb39f8acfe..01ebf73a81 100644 --- a/backends/platform/android/android.mk +++ b/backends/platform/android/android.mk @@ -22,6 +22,8 @@ JAVA_FILES_GEN = \ PATH_DIST = $(srcdir)/dists/android PATH_RESOURCES = $(PATH_DIST)/res +PORT_DISTFILES = $(PATH_DIST)/README.Android + RESOURCES = \ $(PATH_RESOURCES)/values/strings.xml \ $(PATH_RESOURCES)/layout/main.xml \ @@ -178,7 +180,7 @@ androidtest: $(APK_MAIN) $(APK_PLUGINS) androiddistdebug: all $(MKDIR) debug $(CP) $(APK_MAIN) $(APK_PLUGINS) debug/ - for i in $(DIST_FILES_DOCS); do \ + for i in $(DIST_FILES_DOCS) $(PORT_DISTFILES); do \ sed 's/$$/\r/' < $$i > debug/`basename $$i`.txt; \ done diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index 5fc10b2161..c969068d70 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -352,14 +352,20 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, } if (arg2 < 1 || arg2 > ARRAYSIZE(jkeymap)) { - LOGE("received invalid keycode: %d (%d)", arg2, arg3); - return; + if (arg3 < 1) { + LOGE("received invalid keycode: %d (%d)", arg2, arg3); + return; + } else { + // lets bet on the ascii code + e.kbd.keycode = Common::KEYCODE_INVALID; + } + } else { + e.kbd.keycode = jkeymap[arg2]; } if (arg5 > 0) e.synthetic = true; - e.kbd.keycode = jkeymap[arg2]; e.kbd.ascii = arg3; if (arg4 & JMETA_SHIFT) |