From 9d2e1cfcc0fb7d8ad931e7e59f154dc1f5fb2569 Mon Sep 17 00:00:00 2001 From: stephena Date: Wed, 12 Nov 2003 19:36:25 +0000 Subject: [PATCH] Changed the behaviour of pause() wrt the FrameBuffer. Now the base FrameBuffer class is paused, and *it* notifies the child class of this event. Previously, the code for pausing the parent class had to be provided by the child, meaning that if the derived classes of FrameBuffer didn't provide it, then the emulation core would not pause. This is exactly what happened to me in the Windows version, and I spent 10 minutes trying to figure out why pause wasn't working :) git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@204 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/FrameBuffer.cxx | 14 ++++++++++++-- stella/src/emucore/FrameBuffer.hxx | 25 +++++++++++++++++-------- stella/src/ui/sdl/FrameBufferSDL.cxx | 8 +++----- stella/src/ui/sdl/FrameBufferSDL.hxx | 6 +++--- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index 56628a936..ed6f0899c 100644 --- a/stella/src/emucore/FrameBuffer.cxx +++ b/stella/src/emucore/FrameBuffer.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBuffer.cxx,v 1.4 2003-11-09 23:53:19 stephena Exp $ +// $Id: FrameBuffer.cxx,v 1.5 2003-11-12 19:36:25 stephena Exp $ //============================================================================ #include @@ -50,10 +50,10 @@ FrameBuffer::FrameBuffer() myWidth(160), myHeight(300), theRedrawEntireFrameIndicator(true), - myPauseStatus(false), myFGColor(10), myBGColor(0), myFrameRate(0), + myPauseStatus(false), myCurrentWidget(W_NONE), myRemapEventSelectedFlag(false), mySelectedEvent(Event::NoType), @@ -449,6 +449,16 @@ MediaSource* FrameBuffer::mediaSource() const return (MediaSource*) NULL; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void FrameBuffer::pause(bool status) +{ + myPauseStatus = status; + + // Now notify the child object, in case it wants to do something + // special when pause is received + pauseEvent(myPauseStatus); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameBuffer::Widget FrameBuffer::currentSelectedWidget() { diff --git a/stella/src/emucore/FrameBuffer.hxx b/stella/src/emucore/FrameBuffer.hxx index 97eab8425..bf89762ee 100644 --- a/stella/src/emucore/FrameBuffer.hxx +++ b/stella/src/emucore/FrameBuffer.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBuffer.hxx,v 1.4 2003-11-09 23:53:19 stephena Exp $ +// $Id: FrameBuffer.hxx,v 1.5 2003-11-12 19:36:25 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_HXX @@ -35,7 +35,7 @@ class Console; can be changed. @author Stephen Anthony - @version $Id: FrameBuffer.hxx,v 1.4 2003-11-09 23:53:19 stephena Exp $ + @version $Id: FrameBuffer.hxx,v 1.5 2003-11-12 19:36:25 stephena Exp $ */ class FrameBuffer { @@ -120,6 +120,14 @@ class FrameBuffer */ MediaSource* mediaSource() const; + /** + Sets the pause status. While pause is selected, the + MediaSource will not be updated. + + @param status Toggle pause based on status + */ + void pause(bool status); + public: ////////////////////////////////////////////////////////////////////// // The following methods are system-specific and must be implemented @@ -179,11 +187,12 @@ class FrameBuffer virtual void postFrameUpdate() = 0; /** - This routine is called when the emulation has been paused. + This routine is called when the emulation has received + a pause event. - @param status Toggle pause based on status + @param status The received pause status */ - virtual void pause(bool status) = 0; + virtual void pauseEvent(bool status) = 0; protected: // The Console for the system @@ -198,9 +207,6 @@ class FrameBuffer // Indicates if the entire frame should be redrawn bool theRedrawEntireFrameIndicator; - // Indicates the current pause status - bool myPauseStatus; - // Table of bitmapped fonts. static const uInt8 ourFontData[2048]; @@ -246,6 +252,9 @@ class FrameBuffer // Indicates the current framerate of the system uInt32 myFrameRate; + // Indicates the current pause status + bool myPauseStatus; + // Structure used for main menu items struct MainMenuItem { diff --git a/stella/src/ui/sdl/FrameBufferSDL.cxx b/stella/src/ui/sdl/FrameBufferSDL.cxx index b884e4e29..30fbd15d4 100644 --- a/stella/src/ui/sdl/FrameBufferSDL.cxx +++ b/stella/src/ui/sdl/FrameBufferSDL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBufferSDL.cxx,v 1.3 2003-11-09 23:53:20 stephena Exp $ +// $Id: FrameBufferSDL.cxx,v 1.4 2003-11-12 19:36:25 stephena Exp $ //============================================================================ #include @@ -43,12 +43,10 @@ FrameBufferSDL::~FrameBufferSDL() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FrameBufferSDL::pause(bool status) +void FrameBufferSDL::pauseEvent(bool status) { - myPauseStatus = status; - // Shade the palette to 75% normal value in pause mode - if(myPauseStatus) + if(status) setupPalette(0.75); else setupPalette(1.0); diff --git a/stella/src/ui/sdl/FrameBufferSDL.hxx b/stella/src/ui/sdl/FrameBufferSDL.hxx index 4f95abfe3..745226755 100644 --- a/stella/src/ui/sdl/FrameBufferSDL.hxx +++ b/stella/src/ui/sdl/FrameBufferSDL.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBufferSDL.hxx,v 1.3 2003-11-09 23:53:20 stephena Exp $ +// $Id: FrameBufferSDL.hxx,v 1.4 2003-11-12 19:36:25 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_SDL_HXX @@ -34,7 +34,7 @@ the core FrameBuffer. @author Stephen Anthony - @version $Id: FrameBufferSDL.hxx,v 1.3 2003-11-09 23:53:20 stephena Exp $ + @version $Id: FrameBufferSDL.hxx,v 1.4 2003-11-12 19:36:25 stephena Exp $ */ class FrameBufferSDL : public FrameBuffer { @@ -100,7 +100,7 @@ class FrameBufferSDL : public FrameBuffer @param status Toggle pause based on status */ - void pause(bool status); + void pauseEvent(bool status); ////////////////////////////////////////////////////////////////////// // The following methods must be defined in child classes