diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h index a5a7c66af60..471a9898514 100644 --- a/backends/graphics/graphics.h +++ b/backends/graphics/graphics.h @@ -47,7 +47,7 @@ public: return noGraphicsModes; }; virtual int getDefaultGraphicsMode() const { return 0; } - virtual bool setGraphicsMode(int mode) { return (mode == 0); } + virtual bool setGraphicsMode(int mode, uint flags = OSystem::kGfxModeNoFlags) { return (mode == 0); } // ResidualVM virtual void resetGraphicsScale() {} virtual int getGraphicsMode() const { return 0; } virtual const OSystem::GraphicsMode *getSupportedShaders() const { @@ -113,7 +113,6 @@ public: //virtual void grabPalette(byte *colors, uint start, uint num) const = 0; // ResidualVM specific methods: - virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) {} virtual Graphics::PixelBuffer getScreenPixelBuffer() { return Graphics::PixelBuffer(); } virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) {} virtual void saveScreenshot() {} diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 8af87abcc26..34836ce5b74 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -169,7 +169,7 @@ int OpenGLGraphicsManager::getDefaultGraphicsMode() const { return GFX_OPENGL; } -bool OpenGLGraphicsManager::setGraphicsMode(int mode) { +bool OpenGLGraphicsManager::setGraphicsMode(int mode, uint flags) { // ResidualVM assert(_transactionMode != kTransactionNone); switch (mode) { diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 0204db257ea..6dd99979249 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -66,7 +66,7 @@ public: virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override; virtual int getDefaultGraphicsMode() const override; - virtual bool setGraphicsMode(int mode) override; + virtual bool setGraphicsMode(int mode, uint flags = OSystem::kGfxModeNoFlags) override; // ResidualVM virtual int getGraphicsMode() const override; #ifdef USE_RGB_COLOR diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h index f32c5fc2e1d..be9bf05c5a4 100644 --- a/backends/graphics/sdl/sdl-graphics.h +++ b/backends/graphics/sdl/sdl-graphics.h @@ -97,7 +97,7 @@ public: virtual bool showMouse(bool visible) override; virtual bool saveScreenshot(const Common::String &filename) const { return false; } - void saveScreenshot() override; + void saveScreenshot() override; // ResidualVM // Override from Common::EventObserver virtual bool notifyEvent(const Common::Event &event) override; diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 32a1407e523..a2be54a8878 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -617,7 +617,7 @@ int SurfaceSdlGraphicsManager::getGraphicsModeScale(int mode) const { return scale; } -bool SurfaceSdlGraphicsManager::setGraphicsMode(int mode) { +bool SurfaceSdlGraphicsManager::setGraphicsMode(int mode, uint flags) { // ResidualVM Common::StackLock lock(_graphicsMutex); assert(_transactionMode == kTransactionActive); diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index 138186fdb53..7d6bc3d8419 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -81,7 +81,7 @@ public: virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override; virtual int getDefaultGraphicsMode() const override; - virtual bool setGraphicsMode(int mode) override; + virtual bool setGraphicsMode(int mode, uint flags = OSystem::kGfxModeNoFlags) override; // ResidualVM virtual int getGraphicsMode() const override; virtual void resetGraphicsScale() override; #ifdef USE_RGB_COLOR diff --git a/backends/graphics3d/graphics3d.h b/backends/graphics3d/graphics3d.h index b9791c98313..3c7506df8ff 100644 --- a/backends/graphics3d/graphics3d.h +++ b/backends/graphics3d/graphics3d.h @@ -39,16 +39,13 @@ */ class Graphics3dManager : public GraphicsManager { public: - // Methods not used by ResidualVM + // Following methods are not used by 3D graphics managers #ifdef USE_RGB_COLOR virtual Common::List getSupportedFormats() const { Common::List supportedFormats; return supportedFormats; } #endif - virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) {} - virtual void beginGFXTransaction() {} - virtual OSystem::TransactionError endGFXTransaction() { return OSystem::kTransactionSuccess; } virtual void setPalette(const byte *colors, uint start, uint num) {} virtual void grabPalette(byte *colors, uint start, uint num) const {} virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {} @@ -60,8 +57,11 @@ public: virtual void clearFocusRectangle() {} virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) {} virtual void setCursorPalette(const byte *colors, uint start, uint num) {} + + // Stubs for windowed gfx manager calls int getWindowWidth() const { return 0; } int getWindowHeight() const { return 0; } + virtual void unlockWindowSize() {} }; #endif diff --git a/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp b/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp index 8af3fe18e04..0aab595e26e 100644 --- a/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp +++ b/backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp @@ -59,7 +59,8 @@ OpenGLSdlGraphics3dManager::OpenGLSdlGraphics3dManager(SdlEventSource *eventSour _frameBuffer(nullptr), _surfaceRenderer(nullptr), _engineRequestedWidth(0), - _engineRequestedHeight(0) { + _engineRequestedHeight(0), + _transactionMode(kTransactionNone) { ConfMan.registerDefault("antialiasing", 0); ConfMan.registerDefault("aspect_ratio", true); @@ -106,7 +107,8 @@ void OpenGLSdlGraphics3dManager::setFeatureState(OSystem::Feature f, bool enable case OSystem::kFeatureFullscreenMode: if (_fullscreen != enable) { _fullscreen = enable; - createOrUpdateScreen(); + if (_transactionMode == kTransactionNone) + createOrUpdateScreen(); } break; case OSystem::kFeatureAspectRatioCorrection: @@ -117,14 +119,59 @@ void OpenGLSdlGraphics3dManager::setFeatureState(OSystem::Feature f, bool enable } } -void OpenGLSdlGraphics3dManager::setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) { - assert(accel3d); +void OpenGLSdlGraphics3dManager::beginGFXTransaction() { + assert(_transactionMode == kTransactionNone); + + _transactionMode = kTransactionActive; +} + +OSystem::TransactionError OpenGLSdlGraphics3dManager::endGFXTransaction() { + assert(_transactionMode != kTransactionNone); + + setupScreen(); + + _transactionMode = kTransactionNone; + return OSystem::kTransactionSuccess; +} + +const OSystem::GraphicsMode glGraphicsModes[] = { + { "opengl3d", "OpenGL 3D", 0 }, + { nullptr, nullptr, 0 } +}; + +const OSystem::GraphicsMode *OpenGLSdlGraphics3dManager::getSupportedGraphicsModes() const { + return glGraphicsModes; +} + +int OpenGLSdlGraphics3dManager::getDefaultGraphicsMode() const { + return 0; +} + +bool OpenGLSdlGraphics3dManager::setGraphicsMode(int mode, uint flags) { + assert(_transactionMode != kTransactionNone); + assert(flags & OSystem::kGfxModeRender3d); + assert(flags & OSystem::kGfxModeAcceleration3d); + + return true; +} + +int OpenGLSdlGraphics3dManager::getGraphicsMode() const { + return 0; +} + +void OpenGLSdlGraphics3dManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) { + _engineRequestedWidth = w; + _engineRequestedHeight = h; + if (_transactionMode == kTransactionNone) + setupScreen(); +} + +void OpenGLSdlGraphics3dManager::setupScreen() { + assert(_transactionMode == kTransactionActive); + closeOverlay(); - _engineRequestedWidth = gameWidth; - _engineRequestedHeight = gameHeight; _antialiasing = ConfMan.getInt("antialiasing"); - _fullscreen = fullscreen; _lockAspectRatio = ConfMan.getBool("aspect_ratio"); _vsync = ConfMan.getBool("vsync"); diff --git a/backends/graphics3d/openglsdl/openglsdl-graphics3d.h b/backends/graphics3d/openglsdl/openglsdl-graphics3d.h index d82ea82464d..497539ac669 100644 --- a/backends/graphics3d/openglsdl/openglsdl-graphics3d.h +++ b/backends/graphics3d/openglsdl/openglsdl-graphics3d.h @@ -62,12 +62,20 @@ public: virtual bool getFeatureState(OSystem::Feature f) const override; virtual void setFeatureState(OSystem::Feature f, bool enable) override; + virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override; + virtual int getDefaultGraphicsMode() const override; + virtual bool setGraphicsMode(int mode, uint flags = OSystem::kGfxModeNoFlags) override; + virtual int getGraphicsMode() const override; + + virtual void beginGFXTransaction() override; + virtual OSystem::TransactionError endGFXTransaction() override; + // GraphicsManager API - Graphics mode #ifdef USE_RGB_COLOR virtual Graphics::PixelFormat getScreenFormat() const override { return _screenFormat; } #endif virtual int getScreenChangeID() const override { return _screenChangeCount; } - virtual void setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) override; + virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format) override; virtual Graphics::PixelBuffer getScreenPixelBuffer() override; virtual int16 getHeight() const override; virtual int16 getWidth() const override; @@ -131,6 +139,7 @@ protected: bool renderToFramebuffer, bool engineSupportsArbitraryResolutions); void createOrUpdateScreen(); + void setupScreen(); /** Compute the size and position of the game rectangle in the screen */ Math::Rect2d computeGameRect(bool renderToFrameBuffer, uint gameWidth, uint gameHeight, @@ -167,6 +176,19 @@ protected: bool shouldRenderToFramebuffer() const; bool isVSyncEnabled() const; + +protected: + + enum TransactionMode { + kTransactionNone = 0, + kTransactionActive = 1, + kTransactionRollback = 2 + }; + + /** + * The current transaction mode. + */ + TransactionMode _transactionMode; }; #endif diff --git a/backends/graphics3d/sdl/sdl-graphics3d.cpp b/backends/graphics3d/sdl/sdl-graphics3d.cpp index d390b0074c8..2b2a072b29d 100644 --- a/backends/graphics3d/sdl/sdl-graphics3d.cpp +++ b/backends/graphics3d/sdl/sdl-graphics3d.cpp @@ -54,6 +54,11 @@ void SdlGraphics3dManager::deactivateManager() { _eventSource->setGraphicsManager(0); } +void SdlGraphics3dManager::setDefaultFeatureState() { + setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); + setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio")); +} + void SdlGraphics3dManager::saveScreenshot() { Common::String filename; diff --git a/backends/graphics3d/sdl/sdl-graphics3d.h b/backends/graphics3d/sdl/sdl-graphics3d.h index d4f03cd8a41..fbea8ac91a4 100644 --- a/backends/graphics3d/sdl/sdl-graphics3d.h +++ b/backends/graphics3d/sdl/sdl-graphics3d.h @@ -116,6 +116,20 @@ public: // Override from Common::EventObserver virtual bool notifyEvent(const Common::Event &event) override; + /** + * A (subset) of the graphic manager's state. This is used when switching + * between different SDL graphic managers at runtime. + */ + struct State { + bool aspectRatio; + bool fullscreen; + }; + + /** + * Gets the default feature state of the graphics manager. + */ + virtual void setDefaultFeatureState(); + /** Obtain the user configured fullscreen resolution, or default to the desktop resolution */ virtual Common::Rect getPreferredFullscreenResolution(); @@ -129,13 +143,9 @@ public: protected: enum CustomEventAction { kActionToggleFullscreen = 100, - kActionSaveScreenshot, + kActionSaveScreenshot }; -#if SDL_VERSION_ATLEAST(2, 0, 0) -public: - void unlockWindowSize() {} -#endif protected: SdlEventSource *_eventSource; diff --git a/backends/graphics3d/surfacesdl/surfacesdl-graphics3d.cpp b/backends/graphics3d/surfacesdl/surfacesdl-graphics3d.cpp index 95e47bd80c0..3f0c71dac17 100644 --- a/backends/graphics3d/surfacesdl/surfacesdl-graphics3d.cpp +++ b/backends/graphics3d/surfacesdl/surfacesdl-graphics3d.cpp @@ -56,7 +56,8 @@ SurfaceSdlGraphics3dManager::SurfaceSdlGraphics3dManager(SdlEventSource *sdlEven _screenChangeCount(1 << (sizeof(int) * 6 - 2)), _gameRect(), _engineRequestedWidth(0), - _engineRequestedHeight(0) { + _engineRequestedHeight(0), + _transactionMode(kTransactionNone) { ConfMan.registerDefault("aspect_ratio", true); _sideSurfaces[0] = _sideSurfaces[1] = nullptr; @@ -100,7 +101,8 @@ void SurfaceSdlGraphics3dManager::setFeatureState(OSystem::Feature f, bool enabl case OSystem::kFeatureFullscreenMode: if (_fullscreen != enable) { _fullscreen = enable; - createOrUpdateScreen(); + if (_transactionMode == kTransactionNone) + createOrUpdateScreen(); } break; case OSystem::kFeatureAspectRatioCorrection: @@ -111,8 +113,56 @@ void SurfaceSdlGraphics3dManager::setFeatureState(OSystem::Feature f, bool enabl } } -void SurfaceSdlGraphics3dManager::setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) { - assert(!accel3d); +void SurfaceSdlGraphics3dManager::beginGFXTransaction() { + assert(_transactionMode == kTransactionNone); + + _transactionMode = kTransactionActive; +} + +OSystem::TransactionError SurfaceSdlGraphics3dManager::endGFXTransaction() { + assert(_transactionMode != kTransactionNone); + + setupScreen(); + + _transactionMode = kTransactionNone; + return OSystem::kTransactionSuccess; +} + +const OSystem::GraphicsMode glGraphicsModes[] = { + { "tinygl", "TinyGL", 0 }, + { nullptr, nullptr, 0 } +}; + +const OSystem::GraphicsMode *SurfaceSdlGraphics3dManager::getSupportedGraphicsModes() const { + return glGraphicsModes; +} + +int SurfaceSdlGraphics3dManager::getDefaultGraphicsMode() const { + return 0; +} + +bool SurfaceSdlGraphics3dManager::setGraphicsMode(int mode, uint flags) { + assert(_transactionMode != kTransactionNone); + assert(flags & OSystem::kGfxModeRender3d); + assert(!(flags & OSystem::kGfxModeAcceleration3d)); + + return true; +} + +int SurfaceSdlGraphics3dManager::getGraphicsMode() const { + return 0; +} + +void SurfaceSdlGraphics3dManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) { + _engineRequestedWidth = w; + _engineRequestedHeight = h; + + if (_transactionMode == kTransactionNone) + setupScreen(); +} + +void SurfaceSdlGraphics3dManager::setupScreen() { + assert(_transactionMode == kTransactionActive); if (_subScreen) { SDL_FreeSurface(_subScreen); @@ -123,15 +173,11 @@ void SurfaceSdlGraphics3dManager::setupScreen(uint gameWidth, uint gameHeight, b deinitializeRenderer(); #endif - _engineRequestedWidth = gameWidth; - _engineRequestedHeight = gameHeight; - _fullscreen = fullscreen; _lockAspectRatio = ConfMan.getBool("aspect_ratio"); - createOrUpdateScreen(); SDL_PixelFormat *f = _screen->format; - _subScreen = SDL_CreateRGBSurface(SDL_SWSURFACE, gameWidth, gameHeight, f->BitsPerPixel, f->Rmask, f->Gmask, f->Bmask, f->Amask); + _subScreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _engineRequestedWidth, _engineRequestedHeight, f->BitsPerPixel, f->Rmask, f->Gmask, f->Bmask, f->Amask); #if SDL_VERSION_ATLEAST(2, 0, 0) SDL_SetSurfaceBlendMode(_subScreen, SDL_BLENDMODE_NONE); diff --git a/backends/graphics3d/surfacesdl/surfacesdl-graphics3d.h b/backends/graphics3d/surfacesdl/surfacesdl-graphics3d.h index ea0aa7b89f7..b7e9fa5509e 100644 --- a/backends/graphics3d/surfacesdl/surfacesdl-graphics3d.h +++ b/backends/graphics3d/surfacesdl/surfacesdl-graphics3d.h @@ -40,12 +40,20 @@ public: virtual void setFeatureState(OSystem::Feature f, bool enable) override; virtual bool getFeatureState(OSystem::Feature f) const override; + virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override; + virtual int getDefaultGraphicsMode() const override; + virtual bool setGraphicsMode(int mode, uint flags = OSystem::kGfxModeNoFlags) override; + virtual int getGraphicsMode() const override; + + virtual void beginGFXTransaction() override; + virtual OSystem::TransactionError endGFXTransaction() override; + // GraphicsManager API - Graphics mode #ifdef USE_RGB_COLOR virtual Graphics::PixelFormat getScreenFormat() const override { return _screenFormat; } #endif virtual int getScreenChangeID() const override { return _screenChangeCount; } - virtual void setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) override; + virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format) override; virtual Graphics::PixelBuffer getScreenPixelBuffer() override; virtual int16 getHeight() const override; virtual int16 getWidth() const override; @@ -87,6 +95,7 @@ protected: SDL_Surface *_screen; SDL_Surface *_subScreen; void createOrUpdateScreen(); + void setupScreen(); SDL_Surface *_overlayscreen; bool _overlayDirty; @@ -111,6 +120,19 @@ protected: void closeOverlay(); virtual bool saveScreenshot(const Common::String &filename) const override; + +protected: + + enum TransactionMode { + kTransactionNone = 0, + kTransactionActive = 1, + kTransactionRollback = 2 + }; + + /** + * The current transaction mode. + */ + TransactionMode _transactionMode; }; #endif diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index 2c7405ad311..eb799c20ea0 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -69,8 +69,8 @@ int ModularGraphicsBackend::getDefaultGraphicsMode() const { return _graphicsManager->getDefaultGraphicsMode(); } -bool ModularGraphicsBackend::setGraphicsMode(int mode) { - return _graphicsManager->setGraphicsMode(mode); +bool ModularGraphicsBackend::setGraphicsMode(int mode, uint flags) { // ResidualVM + return _graphicsManager->setGraphicsMode(mode, flags); // ResidualVM } int ModularGraphicsBackend::getGraphicsMode() const { @@ -125,11 +125,6 @@ Common::List ModularGraphicsBackend::getSupportedFormats( #endif -// ResidualVM specific method -void ModularGraphicsBackend::setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) { - _graphicsManager->setupScreen(screenW, screenH, fullscreen, accel3d); -} - // ResidualVM specific method Graphics::PixelBuffer ModularGraphicsBackend::getScreenPixelBuffer() { return _graphicsManager->getScreenPixelBuffer(); diff --git a/backends/modular-backend.h b/backends/modular-backend.h index 500f6cf5176..eac26a7c345 100644 --- a/backends/modular-backend.h +++ b/backends/modular-backend.h @@ -66,7 +66,7 @@ public: GraphicsManager *getGraphicsManager(); virtual const GraphicsMode *getSupportedGraphicsModes() const override; virtual int getDefaultGraphicsMode() const override; - virtual bool setGraphicsMode(int mode) override; + virtual bool setGraphicsMode(int mode, uint flags = kGfxModeNoFlags) override; // ResidualVM virtual int getGraphicsMode() const override; virtual const GraphicsMode *getSupportedShaders() const override final; virtual int getDefaultShader() const override final; @@ -82,7 +82,6 @@ public: virtual Common::List getSupportedFormats() const override final; #endif virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) override final; - virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) override; // ResidualVM specific method virtual Graphics::PixelBuffer getScreenPixelBuffer() override; // ResidualVM specific method virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) override; // ResidualVM specific method virtual void initSizeHint(const Graphics::ModeList &modes) override final; diff --git a/backends/platform/android/graphics.cpp b/backends/platform/android/graphics.cpp index 636edcb5f65..8305642bee4 100644 --- a/backends/platform/android/graphics.cpp +++ b/backends/platform/android/graphics.cpp @@ -238,7 +238,6 @@ bool AndroidGraphicsManager::notifyMousePosition(Common::Point &mouse) { const OSystem::GraphicsMode *AndroidGraphicsManager::getSupportedGraphicsModes() const { static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { { "default", "Default", 0 }, - { "filter", "Linear filtering", 1 }, { 0, 0, 0 }, }; @@ -249,20 +248,7 @@ int AndroidGraphicsManager::getDefaultGraphicsMode() const { return 0; } -bool AndroidGraphicsManager::setGraphicsMode(int mode) { - ENTER("%d", mode); - - if (_game_texture) - _game_texture->setLinearFilter(mode == 1); - - if (_overlay_texture) - _overlay_texture->setLinearFilter(mode == 1); - - if (_mouse_texture) - _mouse_texture->setLinearFilter(mode == 1); - - _graphicsMode = mode; - +bool AndroidGraphicsManager::setGraphicsMode(int mode, uint flags) { return true; } @@ -472,6 +458,11 @@ void AndroidGraphicsManager::copyRectToScreen(const void *buf, int pitch, void AndroidGraphicsManager::initSize(uint width, uint height, const Graphics::PixelFormat *format) { + setupScreen(width, height, true, true); +} + +void AndroidGraphicsManager::initSizeIntern(uint width, uint height, + const Graphics::PixelFormat *format) { ENTER("%d, %d, %p", width, height, format); GLTHREADCHECK; @@ -682,7 +673,7 @@ void AndroidGraphicsManager::setupScreen(uint screenW, uint screenH, bool fullsc if (_opengl) { // resize game texture - initSize(screenW, screenH, 0); + initSizeIntern(screenW, screenH, 0); if (isGame) _game_texture->setGameTexture(); // format is not used by the gfx_opengl driver, use fake format @@ -690,7 +681,7 @@ void AndroidGraphicsManager::setupScreen(uint screenW, uint screenH, bool fullsc } else { Graphics::PixelFormat format = GLES565Texture::pixelFormat(); - initSize(screenW, screenH, &format); + initSizeIntern(screenW, screenH, &format); // as there is no support for the texture surface's lock/unlock mechanism in gfx_tinygl/... // do not use _game_texture->surface()->pixels directly _game_pbuf.create(_game_texture->getPixelFormat(), diff --git a/backends/platform/android/graphics.h b/backends/platform/android/graphics.h index c3464d74074..55a8bd1a92b 100644 --- a/backends/platform/android/graphics.h +++ b/backends/platform/android/graphics.h @@ -42,9 +42,12 @@ public: Common::Point getMousePosition() { return Common::Point(_cursorX, _cursorY); } void setMousePosition(int x, int y) { _cursorX = x; _cursorY = y; } + virtual void beginGFXTransaction() {} + virtual OSystem::TransactionError endGFXTransaction() { return OSystem::kTransactionSuccess; } + virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override; virtual int getDefaultGraphicsMode() const override; - virtual bool setGraphicsMode(int mode) override; + virtual bool setGraphicsMode(int mode, uint flags = OSystem::kGfxModeNoFlags) override; virtual void resetGraphicsScale() override; virtual int getGraphicsMode() const override; @@ -89,7 +92,7 @@ public: virtual void setCursorPalette(const byte *colors, uint start, uint num) override; - void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) override; + void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d); // ResidualVM specific method void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d, bool isGame); @@ -120,6 +123,7 @@ private: void initOverlay(); void initViewport(); void updateEventScale(); + void initSizeIntern(uint width, uint height, const Graphics::PixelFormat *format); enum FixupType { kClear = 0, // glClear diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index ef70eb0962c..a07e617b782 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -263,14 +263,7 @@ void OSystem_SDL::initBackend() { #endif if (_graphicsManager == 0) { -// ResidualVM start: -#ifdef USE_OPENGL - _graphicsManager = new OpenGLSdlGraphicsManager(_eventSource, _window); - _graphicsMode = _firstGLMode; -#else _graphicsManager = new SurfaceSdlGraphicsManager(_eventSource, _window); -#endif -// ResidualVM end } } @@ -401,9 +394,7 @@ void OSystem_SDL::detectAntiAliasingSupport() { void OSystem_SDL::engineInit() { #if SDL_VERSION_ATLEAST(2, 0, 0) // ResidualVM start: - if (dynamic_cast(_graphicsManager)) { - dynamic_cast(_graphicsManager)->unlockWindowSize(); - } else { + if (dynamic_cast(_graphicsManager)) { dynamic_cast(_graphicsManager)->unlockWindowSize(); } // ResidualVM end @@ -429,9 +420,7 @@ void OSystem_SDL::engineInit() { void OSystem_SDL::engineDone() { #if SDL_VERSION_ATLEAST(2, 0, 0) // ResidualVM start: - if (dynamic_cast(_graphicsManager)) { - dynamic_cast(_graphicsManager)->unlockWindowSize(); - } else { + if (dynamic_cast(_graphicsManager)) { dynamic_cast(_graphicsManager)->unlockWindowSize(); } // ResidualVM end @@ -511,39 +500,8 @@ void OSystem_SDL::setWindowCaption(const char *caption) { } // ResidualVM specific code + #ifdef USE_OPENGL -void OSystem_SDL::setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) { - bool switchedManager = false; - if (accel3d && !dynamic_cast(_graphicsManager)) { - switchedManager = true; - } else if (!accel3d && !dynamic_cast(_graphicsManager)) { - switchedManager = true; - } - - if (dynamic_cast(_graphicsManager)) { - _gfxManagerState = dynamic_cast(_graphicsManager)->getState(); - } - - if (switchedManager) { - SdlGraphics3dManager *sdlGraphicsManager; - if (dynamic_cast(_graphicsManager)) { - dynamic_cast(_graphicsManager)->deactivateManager(); - } else { - dynamic_cast(_graphicsManager)->deactivateManager(); - } - delete _graphicsManager; - - if (accel3d) { - _graphicsManager = sdlGraphicsManager = new OpenGLSdlGraphics3dManager(_eventSource, _window, _capabilities); - } else { - _graphicsManager = sdlGraphicsManager = new SurfaceSdlGraphics3dManager(_eventSource, _window); - } - sdlGraphicsManager->activateManager(); - } - - ModularGraphicsBackend::setupScreen(screenW, screenH, fullscreen, accel3d); -} - Common::Array OSystem_SDL::getSupportedAntiAliasingLevels() const { return _capabilities.openGLAntiAliasLevels; } @@ -780,54 +738,13 @@ int OSystem_SDL::getDefaultGraphicsMode() const { } } -bool OSystem_SDL::setGraphicsMode(int mode) { - // ResidualVM start: - if (dynamic_cast(_graphicsManager) || - dynamic_cast(_graphicsManager)) { - if (dynamic_cast(_graphicsManager)) { - dynamic_cast(_graphicsManager)->deactivateManager(); - } - if (dynamic_cast(_graphicsManager)) { - dynamic_cast(_graphicsManager)->deactivateManager(); - } - delete _graphicsManager; +// ResidualVM start: +bool OSystem_SDL::setGraphicsMode(int mode, uint flags) { + bool render3d = flags & OSystem::kGfxModeRender3d; + bool accel3d = flags & OSystem::kGfxModeAcceleration3d; - SdlGraphicsManager *sdlGraphicsManager = nullptr; - if (mode < _firstGLMode) { - debug(1, "switching to plain SDL graphics"); - _graphicsManager = sdlGraphicsManager = new SurfaceSdlGraphicsManager(_eventSource, _window); - } else if (mode >= _firstGLMode) { - debug(1, "switching to OpenGL graphics"); - _graphicsManager = sdlGraphicsManager = new OpenGLSdlGraphicsManager(_eventSource, _window); - } - - _graphicsMode = mode; - - assert(sdlGraphicsManager); - sdlGraphicsManager->activateManager(); - - // This failing will probably have bad consequences... - if (!sdlGraphicsManager->setState(_gfxManagerState)) { - return false; - } - - // Next setup the cursor again - CursorMan.pushCursor(0, 0, 0, 0, 0, 0); - CursorMan.popCursor(); - - // Next setup cursor palette if needed - if (_graphicsManager->getFeatureState(kFeatureCursorPalette)) { - CursorMan.pushCursorPalette(0, 0, 0); - CursorMan.popCursorPalette(); - } - - _graphicsManager->beginGFXTransaction(); - // Oh my god if this failed the client code might just explode. - return _graphicsManager->setGraphicsMode(_graphicsModeIds[mode]); - } - // ResidualVM end - - if (_graphicsModes.empty()) { + // In 3d render mode gfx mode param is ignored. + if (_graphicsModes.empty() && !render3d) { return _graphicsManager->setGraphicsMode(mode); } @@ -836,42 +753,95 @@ bool OSystem_SDL::setGraphicsMode(int mode) { return false; } - // Very hacky way to set up the old graphics manager state, in case we - // switch from SDL->OpenGL or OpenGL->SDL. - // - // This is a probably temporary workaround to fix bugs like #3368143 - // "SDL/OpenGL: Crash when switching renderer backend". - SdlGraphicsManager *sdlGraphicsManager = dynamic_cast(_graphicsManager); - SdlGraphicsManager::State state = sdlGraphicsManager->getState(); - bool switchedManager = false; + SdlGraphicsManager *sdlGraphicsManager = dynamic_cast(_graphicsManager); + SdlGraphics3dManager *sdlGraphics3dManager = dynamic_cast(_graphicsManager); + assert(sdlGraphicsManager || sdlGraphics3dManager); + + if (sdlGraphicsManager) { + // Very hacky way to set up the old graphics manager state, in case we + // switch from SDL->OpenGL or OpenGL->SDL. + // + // This is a probably temporary workaround to fix bugs like #3368143 + // "SDL/OpenGL: Crash when switching renderer backend". + // + // It's also used to restore state from 3D to 2D GFX manager + _gfxManagerState = sdlGraphicsManager->getState(); + } // If the new mode and the current mode are not from the same graphics // manager, delete and create the new mode graphics manager - if (_graphicsMode >= _firstGLMode && mode < _firstGLMode) { - debug(1, "switching to plain SDL graphics"); - sdlGraphicsManager->deactivateManager(); - delete _graphicsManager; - _graphicsManager = sdlGraphicsManager = new SurfaceSdlGraphicsManager(_eventSource, _window); + if (!render3d) { + if (sdlGraphics3dManager) { + sdlGraphics3dManager->deactivateManager(); + delete sdlGraphics3dManager; + } - switchedManager = true; - } else if (_graphicsMode < _firstGLMode && mode >= _firstGLMode) { - debug(1, "switching to OpenGL graphics"); - sdlGraphicsManager->deactivateManager(); - delete _graphicsManager; - _graphicsManager = sdlGraphicsManager = new OpenGLSdlGraphicsManager(_eventSource, _window); + if ((sdlGraphics3dManager || _graphicsMode >= _firstGLMode) && mode < _firstGLMode) { + debug(1, "switching to plain SDL graphics"); + if (sdlGraphicsManager) { + sdlGraphicsManager->deactivateManager(); + delete sdlGraphicsManager; + } + _graphicsManager = sdlGraphicsManager = new SurfaceSdlGraphicsManager(_eventSource, _window); + switchedManager = true; + } else if ((sdlGraphics3dManager || _graphicsMode < _firstGLMode) && mode >= _firstGLMode) { + debug(1, "switching to OpenGL graphics"); + if (sdlGraphicsManager) { + sdlGraphicsManager->deactivateManager(); + delete sdlGraphicsManager; + } + _graphicsManager = sdlGraphicsManager = new OpenGLSdlGraphicsManager(_eventSource, _window); + switchedManager = true; + } - switchedManager = true; + if (sdlGraphics3dManager) { + sdlGraphics3dManager = nullptr; + } + } else { + if (sdlGraphicsManager) { + sdlGraphicsManager->deactivateManager(); + delete sdlGraphicsManager; + } + + if (accel3d && !dynamic_cast(_graphicsManager)) { + if (sdlGraphics3dManager) { + sdlGraphics3dManager->deactivateManager(); + delete sdlGraphics3dManager; + } + _graphicsManager = sdlGraphics3dManager = new OpenGLSdlGraphics3dManager(_eventSource, _window, _capabilities); + // Setup feature defaults for 3D gfx while switching from 2D + if (sdlGraphicsManager) + sdlGraphics3dManager->setDefaultFeatureState(); + switchedManager = true; + } else if (!accel3d && !dynamic_cast(_graphicsManager)) { + if (sdlGraphics3dManager) { + sdlGraphics3dManager->deactivateManager(); + delete _graphicsManager; + } + _graphicsManager = sdlGraphics3dManager = new SurfaceSdlGraphics3dManager(_eventSource, _window); + // Setup feature defaults for 3D gfx while switching from 2D + if (sdlGraphicsManager) + sdlGraphics3dManager->setDefaultFeatureState(); + switchedManager = true; + } + + if (sdlGraphicsManager) { + sdlGraphicsManager = nullptr; + } } _graphicsMode = mode; if (switchedManager) { - sdlGraphicsManager->activateManager(); - - // This failing will probably have bad consequences... - if (!sdlGraphicsManager->setState(state)) { - return false; + if (sdlGraphicsManager) { + sdlGraphicsManager->activateManager(); + // This failing will probably have bad consequences... + if (!sdlGraphicsManager->setState(_gfxManagerState)) { + return false; + } + } else if (sdlGraphics3dManager) { + sdlGraphics3dManager->activateManager(); } // Next setup the cursor again @@ -886,11 +856,12 @@ bool OSystem_SDL::setGraphicsMode(int mode) { _graphicsManager->beginGFXTransaction(); // Oh my god if this failed the client code might just explode. - return _graphicsManager->setGraphicsMode(_graphicsModeIds[mode]); + return _graphicsManager->setGraphicsMode(_graphicsModeIds[mode], flags); } else { - return _graphicsManager->setGraphicsMode(_graphicsModeIds[mode]); + return _graphicsManager->setGraphicsMode(_graphicsModeIds[mode], flags); } } +// ResidualVM end int OSystem_SDL::getGraphicsMode() const { if (_graphicsModes.empty()) { diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 2d58733087b..47cbb0155d6 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -94,7 +94,6 @@ public: // ResidualVM - Start #ifdef USE_OPENGL - virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) override; Common::Array getSupportedAntiAliasingLevels() const override; #endif // ResidualVM - End @@ -131,9 +130,9 @@ protected: */ SdlWindow *_window; - SdlGraphicsManager::State _gfxManagerState; // ResidualVM - // ResidualVM specific code - start + SdlGraphicsManager::State _gfxManagerState; + #ifdef USE_OPENGL // Graphics capabilities void detectFramebufferSupport(); @@ -174,7 +173,7 @@ protected: virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override; virtual int getDefaultGraphicsMode() const override; - virtual bool setGraphicsMode(int mode) override; + virtual bool setGraphicsMode(int mode, uint flags) override; // ResidualVM virtual int getGraphicsMode() const override; #endif protected: diff --git a/base/main.cpp b/base/main.cpp index c64a2fa9e32..01154e60229 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -452,6 +452,13 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { ConfMan.registerDefault("dump_midi", true); } +// ResidualVM start: +#if defined(USE_OPENGL) + ConfMan.set("gfx_mode", "opengl"); +#else + ConfMan.set("gfx_mode", "normal"); +#endif +// ResidualVM end // Init the backend. Must take place after all config data (including // the command line params) was read. diff --git a/common/system.h b/common/system.h index 3d512a14dad..8776389ab7a 100644 --- a/common/system.h +++ b/common/system.h @@ -562,8 +562,6 @@ public: //@{ /** - * !!! Not used in ResidualVM !!! - * * Description of a graphics mode. */ struct GraphicsMode { @@ -587,8 +585,6 @@ public: }; /** - * !!! Not used in ResidualVM !!! - * * Retrieve a list of all graphics modes supported by this backend. * This can be both video modes as well as graphic filters/scalers; * it is completely up to the backend maintainer to decide what is @@ -602,8 +598,6 @@ public: } /** - * !!! Not used in ResidualVM !!! - * * Return the ID of the 'default' graphics mode. What exactly this means * is up to the backend. This mode is set by the client code when no user * overrides are present (i.e. if no custom graphics mode is selected via @@ -613,20 +607,32 @@ public: */ virtual int getDefaultGraphicsMode() const { return 0; } + // ResidualVM start: + enum GfxModeFlags { + kGfxModeNoFlags = 0, /**< No Flags */ + kGfxModeRender3d = (1 << 0), /**< Indicate 3d drawing mode */ + kGfxModeAcceleration3d = (1 << 1) /**< Indicate 3d hardware support */ + }; + // ResidualVM end + /** - * !!! Not used in ResidualVM !!! - * * Switch to the specified graphics mode. If switching to the new mode * failed, this method returns false. * + * The flag 'kGfxModeRender3d' is optional. It allow to switch to 3D only rendering mode. + * The argument 'mode' will be ignored. Game engine is allowed to use OpenGL(ES) or TinyGL API direclty. + * Which one depends on 'kGfxModeAcceleration3d' flag. + * + * The flag 'kGfxModeAcceleration3d' is optional and work only with kGfxModeRender3d. + * OpenGL(ES) is only allowed to use by game engine to draw graphics. + * * @param mode the ID of the new graphics mode + * @param flags the flags for new graphics mode * @return true if the switch was successful, false otherwise */ - virtual bool setGraphicsMode(int mode) { return (mode == 0); } + virtual bool setGraphicsMode(int mode, uint flags = kGfxModeNoFlags) { return (mode == 0); } // ResidualVM /** - * !!! Not used in ResidualVM !!! - * * Switch to the graphics mode with the given name. If 'name' is unknown, * or if switching to the new mode failed, this method returns false. * @@ -639,8 +645,6 @@ public: bool setGraphicsMode(const char *name); /** - * !!! Not used in ResidualVM !!! - * * Determine which graphics mode is currently active. * @return the ID of the active graphics mode */ @@ -818,7 +822,6 @@ public: */ virtual int getStretchMode() const { return 0; } - /** * Set the size and color format of the virtual screen. Typical sizes include: * - 320x200 (e.g. for most SCUMM games, and Simon) @@ -858,7 +861,7 @@ public: * @param modes the list of graphics modes the engine will probably use. */ virtual void initSizeHint(const Graphics::ModeList &modes) {} - + /** * !!! Not used in ResidualVM !!! * @@ -877,8 +880,6 @@ public: virtual int getScreenChangeID() const { return 0; } /** - * !!! Not used in ResidualVM !!! - * * Begin a new GFX transaction, which is a sequence of GFX mode changes. * The idea behind GFX transactions is to make it possible to activate * several different GFX changes at once as a "batch" operation. For @@ -897,8 +898,6 @@ public: virtual void beginGFXTransaction() {} /** - * !!! Not used in ResidualVM !!! - * * This type is able to save the different errors which can happen while * changing GFX config values inside GFX transactions. * @@ -928,17 +927,6 @@ public: */ virtual TransactionError endGFXTransaction() { return kTransactionSuccess; } - /** - * Set the size of the screen. - * !!! ResidualVM specific method: !!! - * - * @param width the new screen width - * @param height the new screen height - * @param fullscreen the new screen will be displayed in fullscreeen mode - */ - - virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) {}; - /** * Return a Graphics::PixelBuffer representing the framebuffer. * The caller can then perform arbitrary graphics transformations diff --git a/engines/engine.cpp b/engines/engine.cpp index af5f02634fb..2c11f83fe7e 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -395,6 +395,16 @@ void initGraphics(int width, int height) { initGraphics(width, height, &format); } +// ResidualVM start: +void initGraphics3d(int width, int height, bool fullscreen, bool accel3d) { + g_system->beginGFXTransaction(); + g_system->setGraphicsMode(0, OSystem::kGfxModeRender3d | (accel3d ? OSystem::kGfxModeAcceleration3d : 0)); + g_system->initSize(width, height); + g_system->setFeatureState(OSystem::kFeatureFullscreenMode, fullscreen); + g_system->endGFXTransaction(); +} +// ResidualVM end + void GUIErrorMessageWithURL(const Common::U32String &msg, const char *url) { GUIErrorMessage(msg, url); } diff --git a/engines/grim/grim.cpp b/engines/grim/grim.cpp index 456d456633e..87dc4176c39 100644 --- a/engines/grim/grim.cpp +++ b/engines/grim/grim.cpp @@ -47,6 +47,7 @@ #include "image/png.h" #include "engines/engine.h" +#include "engines/util.h" #include "engines/grim/md5check.h" #include "engines/grim/md5checkdialog.h" @@ -237,7 +238,7 @@ GfxBase *GrimEngine::createRenderer(int screenW, int screenH, bool fullscreen) { Graphics::RendererType matchingRendererType = Graphics::getBestMatchingAvailableRendererType(desiredRendererType); _softRenderer = matchingRendererType == Graphics::kRendererTypeTinyGL; - _system->setupScreen(screenW, screenH, fullscreen, !_softRenderer); + initGraphics3d(screenW, screenH, fullscreen, !_softRenderer); #if defined(USE_OPENGL) // Check the OpenGL context actually supports shaders diff --git a/engines/icb/surface_manager.cpp b/engines/icb/surface_manager.cpp index 87793900dc7..c94460d2a55 100644 --- a/engines/icb/surface_manager.cpp +++ b/engines/icb/surface_manager.cpp @@ -34,6 +34,9 @@ #include "common/rect.h" #include "common/textconsole.h" #include "common/system.h" + +#include "engines/util.h" + #include "graphics/tinygl/zgl.h" #include "graphics/tinygl/zblit.h" @@ -190,7 +193,7 @@ unsigned int _surface_manager::Init_direct_draw() { Zdebug("*SURFACE_MANAGER* Initalizing the SDL video interface"); g_system->setWindowCaption("In Cold Blood (C)2000 Revolution Software Ltd"); - g_system->setupScreen(640, 480, ConfMan.getBool("fullscreen"), false); + initGraphics3d(640, 480, ConfMan.getBool("fullscreen"), false); Graphics::PixelBuffer pixBuff = g_system->getScreenPixelBuffer(); _zb = new TinyGL::FrameBuffer(640, 480, pixBuff); // TODO: delete diff --git a/engines/myst3/gfx.cpp b/engines/myst3/gfx.cpp index c7957da8950..da80bdb4946 100644 --- a/engines/myst3/gfx.cpp +++ b/engines/myst3/gfx.cpp @@ -28,6 +28,8 @@ #include "engines/myst3/gfx.h" +#include "engines/util.h" + #include "common/config-manager.h" #include "graphics/renderer.h" @@ -208,7 +210,7 @@ Renderer *createRenderer(OSystem *system) { width = Renderer::kOriginalWidth; } - system->setupScreen(width, height, fullscreen, isAccelerated); + initGraphics3d(width, height, fullscreen, isAccelerated); #if defined(USE_OPENGL) // Check the OpenGL context actually supports shaders diff --git a/engines/stark/gfx/driver.cpp b/engines/stark/gfx/driver.cpp index 350db108f8b..6cb2173aff5 100644 --- a/engines/stark/gfx/driver.cpp +++ b/engines/stark/gfx/driver.cpp @@ -30,13 +30,15 @@ #include "graphics/opengl/context.h" #endif +#include "engines/util.h" + namespace Stark { namespace Gfx { Driver *Driver::create() { #if defined(USE_GLES2) || defined(USE_OPENGL_SHADERS) bool fullscreen = ConfMan.getBool("fullscreen"); - g_system->setupScreen(kOriginalWidth, kOriginalHeight, fullscreen, true); + initGraphics3d(kOriginalWidth, kOriginalHeight, fullscreen, true); if (OpenGLContext.shadersSupported) { return new OpenGLSDriver(); diff --git a/engines/util.h b/engines/util.h index ccf28f2e220..1453b834a5d 100644 --- a/engines/util.h +++ b/engines/util.h @@ -60,5 +60,6 @@ void initGraphicsModes(const Graphics::ModeList &modes); void initGraphics(int width, int height); void initGraphics(int width, int height, const Graphics::PixelFormat *format); void initGraphics(int width, int height, const Common::List &formatList); +void initGraphics3d(int width, int height, bool fullscreen, bool accel3d); // ResidualVM #endif diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index e0cdc18a9ae..7af9d13dc05 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -83,6 +83,7 @@ #ifdef ENABLE_WME3D #include "graphics/renderer.h" +#include "engines/util.h" #endif namespace Wintermute { @@ -499,7 +500,7 @@ bool BaseGame::initialize1() { bool BaseGame::initialize2() { // we know whether we are going to be accelerated #ifdef ENABLE_WME3D bool fullscreen = ConfMan.getBool("fullscreen"); - g_system->setupScreen(_settings->getResWidth(), _settings->getResHeight(), fullscreen, true); + initGraphics3d(_settings->getResWidth(), _settings->getResHeight(), fullscreen, true); Common::String rendererConfig = ConfMan.get("renderer"); Graphics::RendererType desiredRendererType = Graphics::parseRendererTypeCode(rendererConfig); diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 7716121766e..7c335b2daf1 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -129,7 +129,7 @@ Common::Error WintermuteEngine::run() { return Common::kUnsupportedColorMode; } #else - g_system->setupScreen(800, 600, ConfMan.getBool("fullscreen"), true); + initGraphics3d(800, 600, ConfMan.getBool("fullscreen"), true); #endif // Create debugger console. It requires GFX to be initialized diff --git a/graphics/yuv_to_rgb.cpp b/graphics/yuv_to_rgb.cpp index 7f37ba0578e..c40aa19c43d 100644 --- a/graphics/yuv_to_rgb.cpp +++ b/graphics/yuv_to_rgb.cpp @@ -197,7 +197,7 @@ const YUVToRGBLookup *YUVToRGBManager::getLookup(Graphics::PixelFormat format, Y if (_lookup && _lookup->getFormat() == format && _lookup->getScale() == scale && _alphaMode == alphaMode) return _lookup; - _alphaMode = alphaMode; + _alphaMode = alphaMode; // ResidualVM delete _lookup; _lookup = new YUVToRGBLookup(format, scale, alphaMode); return _lookup;