Merge pull request #409 from lordhoto/rtti
Enable RTTI and clean up the code by exploiting the availability of dynamic_cast.
This commit is contained in:
commit
2fe303ce3f
11 changed files with 38 additions and 48 deletions
5
Makefile
5
Makefile
|
@ -33,8 +33,9 @@ ifeq "$(HAVE_GCC)" "1"
|
|||
#CXXFLAGS+= -Wmissing-format-attribute
|
||||
|
||||
ifneq "$(BACKEND)" "tizen"
|
||||
# Disable RTTI and exceptions. These settings cause tizen apps to crash
|
||||
CXXFLAGS+= -fno-rtti -fno-exceptions
|
||||
# Disable exceptions. This setting causes tizen apps to crash
|
||||
# TODO: Does this still apply after enabling RTTI again?
|
||||
CXXFLAGS+= -fno-exceptions
|
||||
endif
|
||||
|
||||
ifneq "$(HAVE_CLANG)" "1"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -47,7 +47,7 @@ enum {
|
|||
GFX_NEAREST = 1
|
||||
};
|
||||
|
||||
class OpenGLGraphicsManager : public GraphicsManager {
|
||||
class OpenGLGraphicsManager : virtual public GraphicsManager {
|
||||
public:
|
||||
OpenGLGraphicsManager();
|
||||
virtual ~OpenGLGraphicsManager();
|
||||
|
|
|
@ -73,8 +73,7 @@ OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
|
|||
}
|
||||
|
||||
void OpenGLSdlGraphicsManager::activateManager() {
|
||||
OpenGLGraphicsManager::activateManager();
|
||||
initEventSource();
|
||||
SdlGraphicsManager::activateManager();
|
||||
|
||||
// Register the graphics manager as a event observer
|
||||
g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false);
|
||||
|
@ -86,8 +85,7 @@ void OpenGLSdlGraphicsManager::deactivateManager() {
|
|||
g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
|
||||
}
|
||||
|
||||
deinitEventSource();
|
||||
OpenGLGraphicsManager::deactivateManager();
|
||||
SdlGraphicsManager::deactivateManager();
|
||||
}
|
||||
|
||||
bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,15 +33,25 @@ 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();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
@ -80,9 +92,6 @@ public:
|
|||
virtual void notifyMousePos(Common::Point mouse) = 0;
|
||||
|
||||
protected:
|
||||
void initEventSource();
|
||||
void deinitEventSource();
|
||||
|
||||
SdlEventSource *_eventSource;
|
||||
};
|
||||
|
||||
|
|
|
@ -198,8 +198,7 @@ SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() {
|
|||
}
|
||||
|
||||
void SurfaceSdlGraphicsManager::activateManager() {
|
||||
GraphicsManager::activateManager();
|
||||
initEventSource();
|
||||
SdlGraphicsManager::activateManager();
|
||||
|
||||
// Register the graphics manager as a event observer
|
||||
g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false);
|
||||
|
@ -211,8 +210,7 @@ void SurfaceSdlGraphicsManager::deactivateManager() {
|
|||
g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
|
||||
}
|
||||
|
||||
deinitEventSource();
|
||||
GraphicsManager::deactivateManager();
|
||||
SdlGraphicsManager::deactivateManager();
|
||||
}
|
||||
|
||||
bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -91,7 +91,7 @@ OSystem_SDL::~OSystem_SDL() {
|
|||
delete _savefileManager;
|
||||
_savefileManager = 0;
|
||||
if (_graphicsManager) {
|
||||
_graphicsManager->deactivateManager();
|
||||
dynamic_cast<SdlGraphicsManager *>(_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<SdlGraphicsManager *>(_graphicsManager)->activateManager();
|
||||
}
|
||||
|
||||
#if defined(USE_TASKBAR)
|
||||
|
@ -579,14 +579,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<SdlGraphicsManager *>(_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<SdlGraphicsManager *>(_graphicsManager)->deactivateManager();
|
||||
delete _graphicsManager;
|
||||
_graphicsManager = new OpenGLSdlGraphicsManager(_desktopWidth, _desktopHeight, _eventSource);
|
||||
|
||||
|
@ -596,7 +596,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
|
|||
_graphicsMode = mode;
|
||||
|
||||
if (switchedManager) {
|
||||
_graphicsManager->activateManager();
|
||||
dynamic_cast<SdlGraphicsManager *>(_graphicsManager)->activateManager();
|
||||
|
||||
_graphicsManager->beginGFXTransaction();
|
||||
#ifdef USE_RGB_COLOR
|
||||
|
|
5
configure
vendored
5
configure
vendored
|
@ -2046,18 +2046,21 @@ case $_host_os in
|
|||
CXXFLAGS="$CXXFLAGS -march=armv5te"
|
||||
CXXFLAGS="$CXXFLAGS -mtune=xscale"
|
||||
CXXFLAGS="$CXXFLAGS -msoft-float"
|
||||
ABI="armeabi"
|
||||
;;
|
||||
android-v7a)
|
||||
CXXFLAGS="$CXXFLAGS -march=armv7-a"
|
||||
CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp"
|
||||
CXXFLAGS="$CXXFLAGS -mfpu=vfp"
|
||||
LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
|
||||
ABI="armeabi-v7a"
|
||||
;;
|
||||
ouya)
|
||||
CXXFLAGS="$CXXFLAGS -march=armv7-a"
|
||||
CXXFLAGS="$CXXFLAGS -mtune=cortex-a9"
|
||||
CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp"
|
||||
CXXFLAGS="$CXXFLAGS -mfpu=neon"
|
||||
ABI="armeabi-v7a"
|
||||
;;
|
||||
esac
|
||||
CXXFLAGS="$CXXFLAGS --sysroot=$ANDROID_NDK/platforms/android-4/arch-arm"
|
||||
|
@ -2083,6 +2086,8 @@ case $_host_os in
|
|||
CXXFLAGS="$CXXFLAGS -Wno-psabi"
|
||||
LDFLAGS="$LDFLAGS --sysroot=$ANDROID_NDK/platforms/android-4/arch-arm"
|
||||
LDFLAGS="$LDFLAGS -mthumb-interwork"
|
||||
LDFLAGS="$LDFLAGS -L$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/`$CXX -dumpversion`/libs/$ABI/"
|
||||
LIBS="$LIBS -lsupc++"
|
||||
add_line_to_config_mk "ANDROID_SDK = $ANDROID_SDK"
|
||||
_seq_midi=no
|
||||
;;
|
||||
|
|
|
@ -33,6 +33,6 @@
|
|||
#define DISABLE_EDIT_AND_CONTINUE "tinsel,tony,scummvm" // Comma separated list of projects that need Edit&Continue to be disabled for co-routine support (the main project is automatically added)
|
||||
|
||||
//#define ADDITIONAL_LIBRARY "" // Add a single library to the list of externally linked libraries
|
||||
#define NEEDS_RTTI 0 // Enable RTTI globally
|
||||
#define NEEDS_RTTI 1 // Enable RTTI globally
|
||||
|
||||
#endif // TOOLS_CREATE_PROJECT_CONFIG_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue