From 281672e1718d5f960061b714f79924125922e1e5 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 24 Oct 2013 00:03:09 +0200 Subject: SDL: Let SdlGraphicsManager inherit from GraphicsManager. --- backends/graphics/opengl/opengl-graphics.h | 2 +- backends/graphics/sdl/sdl-graphics.h | 7 +++---- backends/graphics/surfacesdl/surfacesdl-graphics.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'backends') diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index d2d0358407..93c0c5bc83 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -47,7 +47,7 @@ enum { GFX_NEAREST = 1 }; -class OpenGLGraphicsManager : public GraphicsManager { +class OpenGLGraphicsManager : virtual public GraphicsManager { public: OpenGLGraphicsManager(); virtual ~OpenGLGraphicsManager(); diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h index 4d4338af16..ebf8078f23 100644 --- a/backends/graphics/sdl/sdl-graphics.h +++ b/backends/graphics/sdl/sdl-graphics.h @@ -23,6 +23,8 @@ #ifndef BACKENDS_GRAPHICS_SDL_SDLGRAPHICS_H #define BACKENDS_GRAPHICS_SDL_SDLGRAPHICS_H +#include "backends/graphics/graphics.h" + #include "common/rect.h" class SdlEventSource; @@ -31,11 +33,8 @@ class SdlEventSource; * Base class for a SDL based graphics manager. * * It features a few extra a few extra features required by SdlEventSource. - * FIXME/HACK: - * Note it does not inherit from GraphicsManager to avoid a diamond inheritance - * in the current OpenGLSdlGraphicsManager. */ -class SdlGraphicsManager { +class SdlGraphicsManager : virtual public GraphicsManager { public: SdlGraphicsManager(SdlEventSource *source); virtual ~SdlGraphicsManager(); diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index 00c05ff2bf..22b7780675 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -75,7 +75,7 @@ public: /** * SDL graphics manager */ -class SurfaceSdlGraphicsManager : public GraphicsManager, public SdlGraphicsManager, public Common::EventObserver { +class SurfaceSdlGraphicsManager : public SdlGraphicsManager, public Common::EventObserver { public: SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource); virtual ~SurfaceSdlGraphicsManager(); -- cgit v1.2.3 From ea6d38d5f3b123b765e5bf8e2dc4f957e4b43eb6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 24 Oct 2013 00:06:32 +0200 Subject: SDL: Make activateManager/deactivateManager SdlGraphicsManager specific. We can do this now that we can use virtual inheritance and dynamic_cast because we enabled RTTI. --- backends/graphics/graphics.h | 21 --------------------- backends/graphics/openglsdl/openglsdl-graphics.cpp | 4 ++-- backends/graphics/sdl/sdl-graphics.h | 13 +++++++++++++ .../graphics/surfacesdl/surfacesdl-graphics.cpp | 4 ++-- backends/platform/sdl/sdl.cpp | 10 +++++----- 5 files changed, 22 insertions(+), 30 deletions(-) (limited to 'backends') diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h index 74258b8910..24397228e6 100644 --- a/backends/graphics/graphics.h +++ b/backends/graphics/graphics.h @@ -37,27 +37,6 @@ class GraphicsManager : public PaletteManager { public: virtual ~GraphicsManager() {} - /** - * Makes this graphics manager active. That means it should be ready to - * process inputs now. However, even without being active it should be - * able to query the supported modes and other bits. - * - * HACK: Actually this is specific to SdlGraphicsManager subclasses. - * But sadly we cannot cast from GraphicsManager to SdlGraphicsManager - * because there is no relation between these two. - */ - virtual void activateManager() {} - - /** - * Makes this graphics manager inactive. This should allow another - * graphics manager to become active again. - * - * HACK: Actually this is specific to SdlGraphicsManager subclasses. - * But sadly we cannot cast from GraphicsManager to SdlGraphicsManager - * because there is no relation between these two. - */ - virtual void deactivateManager() {} - virtual bool hasFeature(OSystem::Feature f) = 0; virtual void setFeatureState(OSystem::Feature f, bool enable) = 0; virtual bool getFeatureState(OSystem::Feature f) = 0; diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index e39cd35870..f76d7b2ec0 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -73,7 +73,7 @@ OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() { } void OpenGLSdlGraphicsManager::activateManager() { - OpenGLGraphicsManager::activateManager(); + SdlGraphicsManager::activateManager(); initEventSource(); // Register the graphics manager as a event observer @@ -87,7 +87,7 @@ void OpenGLSdlGraphicsManager::deactivateManager() { } deinitEventSource(); - OpenGLGraphicsManager::deactivateManager(); + SdlGraphicsManager::deactivateManager(); } bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) { diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h index ebf8078f23..fea743b3ca 100644 --- a/backends/graphics/sdl/sdl-graphics.h +++ b/backends/graphics/sdl/sdl-graphics.h @@ -39,6 +39,19 @@ public: SdlGraphicsManager(SdlEventSource *source); virtual ~SdlGraphicsManager(); + /** + * Makes this graphics manager active. That means it should be ready to + * process inputs now. However, even without being active it should be + * able to query the supported modes and other bits. + */ + virtual void activateManager() {} + + /** + * Makes this graphics manager inactive. This should allow another + * graphics manager to become active again. + */ + virtual void deactivateManager() {} + /** * Notify the graphics manager that the graphics needs to be redrawn, since * the application window was modified. diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index c946b8e747..15193e2da4 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -198,7 +198,7 @@ SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() { } void SurfaceSdlGraphicsManager::activateManager() { - GraphicsManager::activateManager(); + SdlGraphicsManager::activateManager(); initEventSource(); // Register the graphics manager as a event observer @@ -212,7 +212,7 @@ void SurfaceSdlGraphicsManager::deactivateManager() { } deinitEventSource(); - GraphicsManager::deactivateManager(); + SdlGraphicsManager::deactivateManager(); } bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) { diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index c240727069..6175f07a53 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -91,7 +91,7 @@ OSystem_SDL::~OSystem_SDL() { delete _savefileManager; _savefileManager = 0; if (_graphicsManager) { - _graphicsManager->deactivateManager(); + dynamic_cast(_graphicsManager)->deactivateManager(); } delete _graphicsManager; _graphicsManager = 0; @@ -240,7 +240,7 @@ void OSystem_SDL::initBackend() { // so the virtual keyboard can be initialized, but we have to add the // graphics manager as an event observer after initializing the event // manager. - _graphicsManager->activateManager(); + dynamic_cast(_graphicsManager)->activateManager(); } #if defined(USE_TASKBAR) @@ -585,14 +585,14 @@ bool OSystem_SDL::setGraphicsMode(int mode) { // manager, delete and create the new mode graphics manager if (_graphicsMode >= _firstGLMode && mode < _firstGLMode) { debug(1, "switching to plain SDL graphics"); - _graphicsManager->deactivateManager(); + dynamic_cast(_graphicsManager)->deactivateManager(); delete _graphicsManager; _graphicsManager = new SurfaceSdlGraphicsManager(_eventSource); switchedManager = true; } else if (_graphicsMode < _firstGLMode && mode >= _firstGLMode) { debug(1, "switching to OpenGL graphics"); - _graphicsManager->deactivateManager(); + dynamic_cast(_graphicsManager)->deactivateManager(); delete _graphicsManager; _graphicsManager = new OpenGLSdlGraphicsManager(_desktopWidth, _desktopHeight, _eventSource); @@ -602,7 +602,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) { _graphicsMode = mode; if (switchedManager) { - _graphicsManager->activateManager(); + dynamic_cast(_graphicsManager)->activateManager(); _graphicsManager->beginGFXTransaction(); #ifdef USE_RGB_COLOR -- cgit v1.2.3 From cfa6b1b4ae690a6712ef9b2fa6a5f21ff3c2173b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 24 Oct 2013 00:09:17 +0200 Subject: SDL: Further small cleanup related to manager switching. --- backends/graphics/openglsdl/openglsdl-graphics.cpp | 2 -- backends/graphics/sdl/sdl-graphics.cpp | 4 ++-- backends/graphics/sdl/sdl-graphics.h | 7 ++----- backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 2 -- 4 files changed, 4 insertions(+), 11 deletions(-) (limited to 'backends') diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index f76d7b2ec0..3f9fc1fbd5 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -74,7 +74,6 @@ OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() { void OpenGLSdlGraphicsManager::activateManager() { SdlGraphicsManager::activateManager(); - initEventSource(); // Register the graphics manager as a event observer g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false); @@ -86,7 +85,6 @@ void OpenGLSdlGraphicsManager::deactivateManager() { g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this); } - deinitEventSource(); SdlGraphicsManager::deactivateManager(); } diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp index 417f4faf54..40b97b267b 100644 --- a/backends/graphics/sdl/sdl-graphics.cpp +++ b/backends/graphics/sdl/sdl-graphics.cpp @@ -31,10 +31,10 @@ SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *source) SdlGraphicsManager::~SdlGraphicsManager() { } -void SdlGraphicsManager::initEventSource() { +void SdlGraphicsManager::activateManager() { _eventSource->setGraphicsManager(this); } -void SdlGraphicsManager::deinitEventSource() { +void SdlGraphicsManager::deactivateManager() { _eventSource->setGraphicsManager(0); } diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h index fea743b3ca..3791961cfa 100644 --- a/backends/graphics/sdl/sdl-graphics.h +++ b/backends/graphics/sdl/sdl-graphics.h @@ -44,13 +44,13 @@ public: * process inputs now. However, even without being active it should be * able to query the supported modes and other bits. */ - virtual void activateManager() {} + virtual void activateManager(); /** * Makes this graphics manager inactive. This should allow another * graphics manager to become active again. */ - virtual void deactivateManager() {} + virtual void deactivateManager(); /** * Notify the graphics manager that the graphics needs to be redrawn, since @@ -92,9 +92,6 @@ public: virtual void notifyMousePos(Common::Point mouse) = 0; protected: - void initEventSource(); - void deinitEventSource(); - SdlEventSource *_eventSource; }; diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 15193e2da4..d15fd6d8ef 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -199,7 +199,6 @@ SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() { void SurfaceSdlGraphicsManager::activateManager() { SdlGraphicsManager::activateManager(); - initEventSource(); // Register the graphics manager as a event observer g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false); @@ -211,7 +210,6 @@ void SurfaceSdlGraphicsManager::deactivateManager() { g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this); } - deinitEventSource(); SdlGraphicsManager::deactivateManager(); } -- cgit v1.2.3 From 6677a973c2b9b742897441d3b8571b81b41fd297 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 11 Jan 2014 16:36:04 +0100 Subject: SDL: Avoid having SDL_SRCALPHA set even if we have alpha in the pixelformat. --- backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backends') diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 0a4dcf3ea3..89802ac8ab 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -746,6 +746,8 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() { if (_screen == NULL) error("allocating _screen failed"); + // Avoid having SDL_SRCALPHA set even if we supplied an alpha-channel in the format. + SDL_SetAlpha(_screen, 0, 255); #else _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight, 8, 0, 0, 0, 0); if (_screen == NULL) -- cgit v1.2.3 From eff22cb43d22b0f47ac2bf5063916639a632705d Mon Sep 17 00:00:00 2001 From: AReim1982 Date: Fri, 22 Nov 2013 15:13:56 +0100 Subject: WII: Implement changes needed by DevKitPPC R26 and later This changes makes ScummVM compilable with newer versions of DevKitPPC. ScummVM can be linked against the original libogc and libfat. That makes some newer WiiMotes work, improves audio-/video-playback and contains various improvements. --- backends/fs/wii/wii-fs-factory.cpp | 6 +++-- backends/fs/wii/wii-fs.cpp | 44 ++++++++++++++++++++------------ backends/fs/wii/wii-fs.h | 2 +- backends/platform/wii/main.cpp | 3 ++- backends/platform/wii/osystem_events.cpp | 2 +- backends/platform/wii/wii.mk | 4 +-- 6 files changed, 38 insertions(+), 23 deletions(-) (limited to 'backends') diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 760e5316e7..987e7f56bf 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -125,6 +125,8 @@ bool WiiFilesystemFactory::failedToMount(FileSystemType type) { return false; } +const DISC_INTERFACE* dvd = &__io_wiidvd; + void WiiFilesystemFactory::mount(FileSystemType type) { switch (type) { case kDVD: @@ -133,7 +135,7 @@ void WiiFilesystemFactory::mount(FileSystemType type) { break; printf("mount dvd\n"); - if (ISO9660_Mount()) { + if (ISO9660_Mount("dvd", dvd)) { _dvdMounted = true; _dvdError = false; printf("ISO9660 mounted\n"); @@ -179,7 +181,7 @@ void WiiFilesystemFactory::umount(FileSystemType type) { printf("umount dvd\n"); - ISO9660_Unmount(); + ISO9660_Unmount("dvd:"); _dvdMounted = false; _dvdError = false; diff --git a/backends/fs/wii/wii-fs.cpp b/backends/fs/wii/wii-fs.cpp index 4a19e18240..43f4f592b7 100644 --- a/backends/fs/wii/wii-fs.cpp +++ b/backends/fs/wii/wii-fs.cpp @@ -80,9 +80,9 @@ void WiiFilesystemNode::clearFlags() { void WiiFilesystemNode::setFlags(const struct stat *st) { _exists = true; - _isDirectory = S_ISDIR(st->st_mode); - _isReadable = (st->st_mode & S_IRUSR) > 0; - _isWritable = (st->st_mode & S_IWUSR) > 0; + _isDirectory = ( (st->st_mode & S_IFDIR) != 0 ); + _isReadable = ( (st->st_mode & S_IRUSR) != 0 ); + _isWritable = ( (st->st_mode & S_IWUSR) != 0 ); } WiiFilesystemNode::WiiFilesystemNode() { @@ -106,7 +106,7 @@ WiiFilesystemNode::WiiFilesystemNode(const Common::String &p) { _displayName = lastPathComponent(_path, '/'); struct stat st; - if (!stat(_path.c_str(), &st)) + if(stat(_path.c_str(), &st) != -1) setFlags(&st); else clearFlags(); @@ -152,33 +152,45 @@ bool WiiFilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi if (_path.empty()) return getDevopChildren(list, mode, hidden); - DIR_ITER* dp = diropen (_path.c_str()); + DIR* dp = opendir (_path.c_str()); + DIR* tmpdir; if (dp == NULL) return false; - char filename[MAXPATHLEN]; - struct stat st; + struct dirent *pent; - while (dirnext(dp, filename, &st) == 0) { - if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0) + while ((pent = readdir(dp)) != NULL) { + if (strcmp(pent->d_name, ".") == 0 || strcmp(pent->d_name, "..") == 0) continue; Common::String newPath(_path); if (newPath.lastChar() != '/') - newPath += '/'; - newPath += filename; - - bool isDir = S_ISDIR(st.st_mode); - + newPath += '/'; + newPath += pent->d_name; + + bool isDir = false; + tmpdir = opendir(newPath.c_str()); + if(tmpdir) + { + isDir = true; + closedir(tmpdir); + } + if ((mode == Common::FSNode::kListFilesOnly && isDir) || (mode == Common::FSNode::kListDirectoriesOnly && !isDir)) continue; - + + struct stat st; + st.st_mode = 0; + st.st_mode |= ( isDir ? S_IFDIR : 0 ); + st.st_mode |= S_IRUSR; + st.st_mode |= S_IWUSR; + list.push_back(new WiiFilesystemNode(newPath, &st)); } - dirclose(dp); + closedir(dp); return true; } diff --git a/backends/fs/wii/wii-fs.h b/backends/fs/wii/wii-fs.h index 11679d0c36..f785101099 100644 --- a/backends/fs/wii/wii-fs.h +++ b/backends/fs/wii/wii-fs.h @@ -51,7 +51,7 @@ public: * * @param path Common::String with the path the new node should point to. */ - WiiFilesystemNode(const Common::String &path); + WiiFilesystemNode(const Common::String &p); WiiFilesystemNode(const Common::String &p, const struct stat *st); virtual bool exists() const; diff --git a/backends/platform/wii/main.cpp b/backends/platform/wii/main.cpp index affe053b6a..ec6231522e 100644 --- a/backends/platform/wii/main.cpp +++ b/backends/platform/wii/main.cpp @@ -225,7 +225,8 @@ int main(int argc, char *argv[]) { printf("shutdown\n"); SYS_UnregisterResetFunc(&resetinfo); - fatUnmountDefault(); + fatUnmount("usb:/"); + fatUnmount("sd:/"); if (res) show_console(res); diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp index 3ba66aed89..aa63c8aa22 100644 --- a/backends/platform/wii/osystem_events.cpp +++ b/backends/platform/wii/osystem_events.cpp @@ -188,7 +188,7 @@ void OSystem_Wii::initEvents() { _padAcceleration = 9 - ConfMan.getInt("wii_pad_acceleration"); #ifdef USE_WII_KBD - _kbd_active = KEYBOARD_Init() >= 0; + _kbd_active = KEYBOARD_Init(NULL) >= 0; #endif } diff --git a/backends/platform/wii/wii.mk b/backends/platform/wii/wii.mk index 7d2db68b4e..99ef46338c 100644 --- a/backends/platform/wii/wii.mk +++ b/backends/platform/wii/wii.mk @@ -17,10 +17,10 @@ geckoupload: $(WII_EXE_STRIPPED) $(DEVKITPPC)/bin/geckoupload $< wiigdb: - $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(EXECUTABLE) + $(DEVKITPPC)/bin/powerpc-eabi-gdb -n $(EXECUTABLE) wiidebug: - $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(EXECUTABLE) -x $(srcdir)/backends/platform/wii/gdb.txt + $(DEVKITPPC)/bin/powerpc-eabi-gdb -n $(EXECUTABLE) -x $(srcdir)/backends/platform/wii/gdb.txt # target to create a Wii snapshot wiidist: all -- cgit v1.2.3 From 4412e12debd77a5cef60054d2ad437a180d00817 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 21 Jan 2014 19:01:28 +0100 Subject: BUILD: Rename libunity support variable to "USE_UNITY" instead of "USE_TASKBAR_UNITY". This makes it consistent with other library support variables. --- backends/platform/sdl/posix/posix.cpp | 4 ++-- backends/taskbar/unity/unity-taskbar.cpp | 2 +- backends/taskbar/unity/unity-taskbar.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp index 954f404ac6..1752153f29 100644 --- a/backends/platform/sdl/posix/posix.cpp +++ b/backends/platform/sdl/posix/posix.cpp @@ -50,7 +50,7 @@ void OSystem_POSIX::init() { // Initialze File System Factory _fsFactory = new POSIXFilesystemFactory(); -#if defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY) +#if defined(USE_TASKBAR) && defined(USE_UNITY) // Initialize taskbar manager _taskbarManager = new UnityTaskbarManager(); #endif @@ -67,7 +67,7 @@ void OSystem_POSIX::initBackend() { // Invoke parent implementation of this method OSystem_SDL::initBackend(); -#if defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY) +#if defined(USE_TASKBAR) && defined(USE_UNITY) // Register the taskbar manager as an event source (this is necessary for the glib event loop to be run) _eventManager->getEventDispatcher()->registerSource((UnityTaskbarManager *)_taskbarManager, false); #endif diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp index f36e2bf628..1b82e58c8a 100644 --- a/backends/taskbar/unity/unity-taskbar.cpp +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -24,7 +24,7 @@ #define FORBIDDEN_SYMBOL_EXCEPTION_time_h #include "common/scummsys.h" -#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY) +#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_UNITY) #include "backends/taskbar/unity/unity-taskbar.h" diff --git a/backends/taskbar/unity/unity-taskbar.h b/backends/taskbar/unity/unity-taskbar.h index d1d9430bcd..d818ed9ff1 100644 --- a/backends/taskbar/unity/unity-taskbar.h +++ b/backends/taskbar/unity/unity-taskbar.h @@ -23,7 +23,7 @@ #ifndef BACKEND_UNITY_TASKBAR_H #define BACKEND_UNITY_TASKBAR_H -#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY) +#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_UNITY) #include "common/events.h" #include "common/str.h" -- cgit v1.2.3 From 0f36a56b813c4270033804de8dd4f3412bedca55 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 21 Jan 2014 23:52:20 +0100 Subject: OPENGL: Properly query for OpenGL errors. There might be various error flags and we need to clear all of them to get precise error results. Thus, we need to call glGetError in a loop to achieve that. --- backends/graphics/opengl/debug.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/graphics/opengl/debug.cpp b/backends/graphics/opengl/debug.cpp index 69006bb975..d5d73fb5ec 100644 --- a/backends/graphics/opengl/debug.cpp +++ b/backends/graphics/opengl/debug.cpp @@ -52,9 +52,9 @@ Common::String getGLErrStr(GLenum error) { } // End of anonymous namespace void checkGLError(const char *expr, const char *file, int line) { - GLenum error = glGetError(); + GLenum error; - if (error != GL_NO_ERROR) { + while ((error = glGetError()) != GL_NO_ERROR) { // We cannot use error here because we do not know whether we have a // working screen or not. warning("GL ERROR: %s on %s (%s:%d)", getGLErrStr(error).c_str(), expr, file, line); -- cgit v1.2.3 From 58aaef33c11e4f140c962f96e54a326baa724c0e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 22 Jan 2014 22:51:44 +0100 Subject: AMIGAOS4: Make isReadable return false for non-existent files This also properly initializes _bIsValid for non-existent files. For consistency, isWritable() is changed analogously to isReadable(), even though it should not lead to changes in behaviour. --- backends/fs/amigaos4/amigaos4-fs.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'backends') diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 6d713f10be..d0578307f4 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -81,6 +81,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const Common::String &p) { _sDisplayName = ::lastPathComponent(_sPath); _pFileLock = 0; _bIsDirectory = false; + _bIsValid = false; // Check whether the node exists and if it is a directory struct ExamineData * pExd = IDOS->ExamineObjectTags(EX_StringNameInput,_sPath.c_str(),TAG_END); @@ -332,6 +333,9 @@ AbstractFSNode *AmigaOSFilesystemNode::getParent() const { } bool AmigaOSFilesystemNode::isReadable() const { + if (!_bIsValid) + return false; + // Regular RWED protection flags are low-active or inverted, thus the negation. // moreover pseudo root filesystem (null _pFileLock) is readable whatever the // protection says @@ -341,6 +345,9 @@ bool AmigaOSFilesystemNode::isReadable() const { } bool AmigaOSFilesystemNode::isWritable() const { + if (!_bIsValid) + return false; + // Regular RWED protection flags are low-active or inverted, thus the negation. // moreover pseudo root filesystem (null _pFileLock) is never writable whatever // the protection says (because of the pseudo nature) -- cgit v1.2.3 From d32816c0279ebf064542dafd1f1b257f0661bd2a Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 22 Jan 2014 22:53:14 +0100 Subject: AMIGAOS4: Allow getParent() to work for non-directories --- backends/fs/amigaos4/amigaos4-fs.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'backends') diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index d0578307f4..bd8bf1978a 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -306,12 +306,6 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b AbstractFSNode *AmigaOSFilesystemNode::getParent() const { ENTER(); - if (!_bIsDirectory) { - debug(6, "Not a directory"); - LEAVE(); - return 0; - } - if (_pFileLock == 0) { debug(6, "Root node"); LEAVE(); -- cgit v1.2.3 From 219a68eeda2c0e14a29f1cfb969dabe3a70e1544 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 22 Jan 2014 22:00:49 +0100 Subject: AMIGAOS4: Clarify virtual fs root node --- backends/fs/amigaos4/amigaos4-fs.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'backends') diff --git a/backends/fs/amigaos4/amigaos4-fs.h b/backends/fs/amigaos4/amigaos4-fs.h index c5ca61476f..7ce9981479 100644 --- a/backends/fs/amigaos4/amigaos4-fs.h +++ b/backends/fs/amigaos4/amigaos4-fs.h @@ -43,7 +43,13 @@ */ class AmigaOSFilesystemNode : public AbstractFSNode { protected: + /** + * The main file lock. + * If this is NULL but _bIsValid is true, then this Node references + * the virtual filesystem root. + */ BPTR _pFileLock; + Common::String _sDisplayName; Common::String _sPath; bool _bIsDirectory; -- cgit v1.2.3 From 6927e570bbbd69886b5fe2c2ce484ae236af61db Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Thu, 23 Jan 2014 22:46:34 +0100 Subject: ANDROID: Add 32bpp support. We still prefer 16bpp for performance reasons. --- backends/platform/android/gfx.cpp | 3 +++ backends/platform/android/texture.cpp | 17 ++++++++++++++--- backends/platform/android/texture.h | 12 ++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 0ce95a3cfb..9f6c759c75 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -94,6 +94,7 @@ Common::List OSystem_Android::getSupportedFormats() const Common::List 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 { diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index cc41c0d8a6..87fd2d976c 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -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..67f7343c98 100644 --- a/backends/platform/android/texture.h +++ b/backends/platform/android/texture.h @@ -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, -- cgit v1.2.3 From 495fa910d3161829125a5fe9953aeecf300c9857 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 24 Jan 2014 03:28:45 +0100 Subject: WINCE: Attempt to fix WinCE compilation. --- backends/platform/wince/CEActionsPocket.cpp | 2 +- backends/platform/wince/CEActionsSmartphone.cpp | 2 +- backends/platform/wince/CELauncherDialog.cpp | 4 ++-- backends/platform/wince/wince-sdl.cpp | 9 +++++---- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'backends') diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp index 5980a41caa..493a5e688c 100644 --- a/backends/platform/wince/CEActionsPocket.cpp +++ b/backends/platform/wince/CEActionsPocket.cpp @@ -236,7 +236,7 @@ CEActionsPocket::~CEActionsPocket() { bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) { static bool keydialogrunning = false, quitdialog = false; - _graphicsMan = ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager()); + _graphicsMan = dynamic_cast(((OSystem_SDL *)g_system)->getGraphicsManager()); if (!pushed) { switch (action) { diff --git a/backends/platform/wince/CEActionsSmartphone.cpp b/backends/platform/wince/CEActionsSmartphone.cpp index 2cce288323..d2bc449dfc 100644 --- a/backends/platform/wince/CEActionsSmartphone.cpp +++ b/backends/platform/wince/CEActionsSmartphone.cpp @@ -202,7 +202,7 @@ CEActionsSmartphone::~CEActionsSmartphone() { bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) { static bool keydialogrunning = false, quitdialog = false; - _graphicsMan = ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager()); + _graphicsMan = dynamic_cast(((OSystem_SDL *)g_system)->getGraphicsManager()); if (!pushed) { switch (action) { diff --git a/backends/platform/wince/CELauncherDialog.cpp b/backends/platform/wince/CELauncherDialog.cpp index dd6076e0af..3908294682 100644 --- a/backends/platform/wince/CELauncherDialog.cpp +++ b/backends/platform/wince/CELauncherDialog.cpp @@ -65,12 +65,12 @@ public: }; CELauncherDialog::CELauncherDialog() : GUI::LauncherDialog() { - ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->reset_panel(); + dynamic_cast(((OSystem_SDL *)g_system)->getGraphicsManager())->reset_panel(); } void CELauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { if ((cmd == 'STRT') || (cmd == kListItemActivatedCmd) || (cmd == kListItemDoubleClickedCmd)) { - ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->init_panel(); + dynamic_cast(((OSystem_SDL *)g_system)->getGraphicsManager())->init_panel(); } LauncherDialog::handleCommand(sender, cmd, data); if (cmd == 'ABOU') { diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 1c5cd5565b..1c9c178460 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -422,7 +422,7 @@ void OSystem_WINCE3::initBackend() { if (_graphicsManager == 0) _graphicsManager = new WINCESdlGraphicsManager(_eventSource); - ((WINCESdlEventSource *)_eventSource)->init((WINCESdlGraphicsManager *)_graphicsManager); + ((WINCESdlEventSource *)_eventSource)->init(dynamic_cast(_graphicsManager)); // Call parent implementation of this method OSystem_SDL::initBackend(); @@ -486,15 +486,16 @@ void OSystem_WINCE3::swap_sound_master() { //WINCESdlGraphicsManager _graphicsManager - if (((WINCESdlGraphicsManager *)_graphicsManager)->_toolbarHandler.activeName() == NAME_MAIN_PANEL) - ((WINCESdlGraphicsManager *)_graphicsManager)->_toolbarHandler.forceRedraw(); // redraw sound icon + WINCESdlGraphicsManager *graphicsManager = dynamic_cast(_graphicsManager); + if (graphicsManager->_toolbarHandler.activeName() == NAME_MAIN_PANEL) + graphicsManager->_toolbarHandler.forceRedraw(); // redraw sound icon } void OSystem_WINCE3::engineInit() { check_mappings(); // called here to initialize virtual keys handling - ((WINCESdlGraphicsManager *)_graphicsManager)->update_game_settings(); + dynamic_cast(_graphicsManager)->update_game_settings(); // finalize mixer init _mixerManager->init(); } -- cgit v1.2.3 From ce383aca1ee1f7f27c284169a2757ea3870e1bb1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 24 Jan 2014 03:28:45 +0100 Subject: MAEMO: Get rid of superfluous cast. --- backends/events/maemosdl/maemosdl-events.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/events/maemosdl/maemosdl-events.cpp b/backends/events/maemosdl/maemosdl-events.cpp index dcdf0384e3..eaf2f48b60 100644 --- a/backends/events/maemosdl/maemosdl-events.cpp +++ b/backends/events/maemosdl/maemosdl-events.cpp @@ -188,7 +188,7 @@ bool MaemoSdlEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &even bool MaemoSdlEventSource::toggleClickMode() { _clickEnabled = !_clickEnabled; - ((SurfaceSdlGraphicsManager *) _graphicsManager)->displayMessageOnOSD( + _graphicsManager->displayMessageOnOSD( _clickEnabled ? _("Clicking Enabled") : _("Clicking Disabled")); return _clickEnabled; -- cgit v1.2.3 From 417f755b90d3505994dc5c01e93699335966093e Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 25 Jan 2014 18:50:20 +0000 Subject: WII: Fix Gamecube build. Missing ifdef guard for Wii DVD interface. --- backends/fs/wii/wii-fs-factory.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backends') diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 987e7f56bf..3bebc2bed3 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -125,7 +125,9 @@ bool WiiFilesystemFactory::failedToMount(FileSystemType type) { return false; } +#ifdef USE_WII_DI const DISC_INTERFACE* dvd = &__io_wiidvd; +#endif void WiiFilesystemFactory::mount(FileSystemType type) { switch (type) { -- cgit v1.2.3 From 08d3b5754af625f0385aa28b225e82704659eab9 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 25 Jan 2014 21:32:07 +0000 Subject: WII: Another fix for Gamecube build. Corrected Disc Interface object. --- backends/fs/wii/wii-fs-factory.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 3bebc2bed3..1c67ae4823 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -126,7 +126,11 @@ bool WiiFilesystemFactory::failedToMount(FileSystemType type) { } #ifdef USE_WII_DI -const DISC_INTERFACE* dvd = &__io_wiidvd; +#ifndef GAMECUBE + const DISC_INTERFACE* dvd = &__io_wiidvd; +#else + const DISC_INTERFACE* dvd = &__io_gcdvd; +#endif #endif void WiiFilesystemFactory::mount(FileSystemType type) { -- cgit v1.2.3 From b6e5865fcebfbacaa401fe3ecb1e1951613263ab Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 26 Jan 2014 11:19:53 +0000 Subject: WII: Add missing dvd interface header for Gamecube build. --- backends/fs/wii/wii-fs-factory.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'backends') diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 1c67ae4823..f234c1e300 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -33,6 +33,9 @@ #ifdef USE_WII_DI #include #include +#ifdef GAMECUBE +#include +#endif #endif #ifdef USE_WII_SMB -- cgit v1.2.3