diff --git a/src/common/FrameBufferSDL2.cxx b/src/common/FrameBufferSDL2.cxx index de552ae00..9dcf1227d 100644 --- a/src/common/FrameBufferSDL2.cxx +++ b/src/common/FrameBufferSDL2.cxx @@ -42,7 +42,8 @@ FrameBufferSDL2::FrameBufferSDL2(OSystem* osystem) myRenderer(NULL), myWindowFlags(0), myTiaSurface(NULL), - myDirtyFlag(true) + myDirtyFlag(true), + myDblBufferedFlag(true) { // Initialize SDL2 context if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) @@ -211,7 +212,12 @@ bool FrameBufferSDL2::setVideoMode(const string& title, VideoMode& mode, bool fu } SDL_RendererInfo renderinfo; if(SDL_GetRendererInfo(myRenderer, &renderinfo) >= 0) + { myOSystem->settings().setValue("video", renderinfo.name); + // For now, accelerated renderers imply double buffering + // Eventually, SDL may be updated to query this from the render backend + myDblBufferedFlag = renderinfo.flags & SDL_RENDERER_ACCELERATED; + } // The framebuffer only takes responsibility for TIA surfaces // Other surfaces (such as the ones used for dialogs) are allocated diff --git a/src/common/FrameBufferSDL2.hxx b/src/common/FrameBufferSDL2.hxx index 41b1338d3..8ecfaa79d 100644 --- a/src/common/FrameBufferSDL2.hxx +++ b/src/common/FrameBufferSDL2.hxx @@ -113,9 +113,9 @@ class FrameBufferSDL2 : public FrameBuffer { return SDL_MapRGB(myPixelFormat, r, g, b); } /** - This method is called to query the type of the FrameBuffer. + This method is called to query the buffering type of the FrameBuffer. */ - BufferType type() const { return kDoubleBuffer; } + bool isDoubleBuffered() const { return myDblBufferedFlag; } /** This method is called to query the TV effects in use by the FrameBuffer. @@ -238,6 +238,9 @@ class FrameBufferSDL2 : public FrameBuffer // Indicates that the texture has been modified, and should be redrawn bool myDirtyFlag; + + // Indicates whether the backend is using double buffering + bool myDblBufferedFlag; }; #endif diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 53afdb223..d49d8d494 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -317,7 +317,7 @@ void FrameBuffer::update() { // When onscreen messages are enabled in double-buffer mode, // a full redraw is required - myOSystem->menu().draw(myMsg.enabled && type() == kDoubleBuffer); + myOSystem->menu().draw(myMsg.enabled && isDoubleBuffered()); break; // S_MENU } @@ -325,7 +325,7 @@ void FrameBuffer::update() { // When onscreen messages are enabled in double-buffer mode, // a full redraw is required - myOSystem->commandMenu().draw(myMsg.enabled && type() == kDoubleBuffer); + myOSystem->commandMenu().draw(myMsg.enabled && isDoubleBuffered()); break; // S_CMDMENU } @@ -333,7 +333,7 @@ void FrameBuffer::update() { // When onscreen messages are enabled in double-buffer mode, // a full redraw is required - myOSystem->launcher().draw(myMsg.enabled && type() == kDoubleBuffer); + myOSystem->launcher().draw(myMsg.enabled && isDoubleBuffered()); break; // S_LAUNCHER } @@ -342,7 +342,7 @@ void FrameBuffer::update() { // When onscreen messages are enabled in double-buffer mode, // a full redraw is required - myOSystem->debugger().draw(myMsg.enabled && type() == kDoubleBuffer); + myOSystem->debugger().draw(myMsg.enabled && isDoubleBuffered()); break; // S_DEBUGGER } #endif @@ -510,14 +510,13 @@ void FrameBuffer::refresh() // This method is in essence a FULL refresh, putting all rendering // buffers in a known, fully redrawn state - bool doubleBuffered = (type() == kDoubleBuffer); switch(myOSystem->eventHandler().state()) { case EventHandler::S_EMULATE: case EventHandler::S_PAUSE: invalidate(); drawTIA(true); - if(doubleBuffered) + if(isDoubleBuffered()) { postFrameUpdate(); invalidate(); @@ -529,7 +528,7 @@ void FrameBuffer::refresh() invalidate(); drawTIA(true); myOSystem->menu().draw(true); - if(doubleBuffered) + if(isDoubleBuffered()) { postFrameUpdate(); invalidate(); @@ -542,7 +541,7 @@ void FrameBuffer::refresh() invalidate(); drawTIA(true); myOSystem->commandMenu().draw(true); - if(doubleBuffered) + if(isDoubleBuffered()) { postFrameUpdate(); invalidate(); @@ -554,7 +553,7 @@ void FrameBuffer::refresh() case EventHandler::S_LAUNCHER: invalidate(); myOSystem->launcher().draw(true); - if(doubleBuffered) + if(isDoubleBuffered()) { postFrameUpdate(); invalidate(); @@ -566,7 +565,7 @@ void FrameBuffer::refresh() case EventHandler::S_DEBUGGER: invalidate(); myOSystem->debugger().draw(true); - if(doubleBuffered) + if(isDoubleBuffered()) { postFrameUpdate(); invalidate(); diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index df5557784..4d9107e31 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -39,12 +39,6 @@ namespace GUI { #include "Variant.hxx" #include "bspf.hxx" -// Different types of framebuffer derived objects -enum BufferType { - kSingleBuffer, - kDoubleBuffer -}; - // Return values for initialization of framebuffer window enum FBInitStatus { kSuccess, @@ -365,9 +359,9 @@ class FrameBuffer virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b) const = 0; /** - This method is called to query the type of the FrameBuffer. + This method is called to query the buffering type of the FrameBuffer. */ - virtual BufferType type() const = 0; + virtual bool isDoubleBuffered() const = 0; /** This method is called to get the specified scanline data from the diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index c85c5d26e..5ceebd6b9 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -37,10 +37,8 @@ Settings::Settings(OSystem* osystem) : myOSystem(osystem) { - // Add options that are common to all versions of Stella - setInternal("video", "soft"); - // Video-related options + setInternal("video", ""); setInternal("vsync", "true"); setInternal("fullscreen", "0"); setInternal("fullres", "auto"); @@ -275,21 +273,16 @@ void Settings::validate() string s; int i; - s = getString("video"); - if(s != "soft" && s != "gl") setInternal("video", "soft"); - s = getString("timing"); if(s != "sleep" && s != "busy") setInternal("timing", "sleep"); -//FIXSDL i = getInt("tia.aspectn"); - if(i < 80 || i > 120) setInternal("tia.aspectn", "100"); + if(i < 80 || i > 120) setInternal("tia.aspectn", "90"); i = getInt("tia.aspectp"); if(i < 80 || i > 120) setInternal("tia.aspectp", "100"); i = getInt("tv.filter"); if(i < 0 || i > 5) setInternal("tv.filter", "0"); -////////////////// #ifdef SOUND_SUPPORT i = getInt("volume");