From 0bac94e94f95954fe514b305372d33f4dd257bb1 Mon Sep 17 00:00:00 2001 From: stephena Date: Wed, 13 Dec 2006 22:46:28 +0000 Subject: [PATCH] Cleaned up some debugging code from the last commit, and removed remaining scaler stuff. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1211 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/configure | 36 ++---------- stella/src/common/FrameBufferGL.cxx | 63 +++++++-------------- stella/src/common/FrameBufferGL.hxx | 13 ++--- stella/src/emucore/FrameBuffer.cxx | 86 ++++------------------------- stella/src/emucore/FrameBuffer.hxx | 23 +++----- 5 files changed, 50 insertions(+), 171 deletions(-) diff --git a/stella/configure b/stella/configure index 798cdb199..8a41fc06a 100755 --- a/stella/configure +++ b/stella/configure @@ -27,7 +27,6 @@ _build_cheats=yes _build_static=no _build_profile=no _build_atarivox=no -_build_scalers=no # more defaults _ranlib=ranlib @@ -268,8 +267,6 @@ Optional Features: --disable-cheats --enable-atarivox enable/disable AtariVox support [disabled] --disable-atarivox - --enable-scalers enable/disable video scalers support [disabled] - --disable-scalers --enable-shared build shared binary [enabled] --enable-static build static binary (if possible) [disabled] --disable-static @@ -278,7 +275,6 @@ Optional Features: Optional Libraries: --with-zlib-prefix=DIR Prefix where zlib is installed (optional) - --disable-zlib disable zlib (compression) support [autodetect] --with-sdl-prefix=DIR Prefix where the sdl-config script is installed (optional) @@ -316,10 +312,6 @@ for ac_option in $@; do --disable-cheats) _build_cheats=no ;; --enable-atarivox) _build_atarivox=yes ;; --disable-atarivox) _build_atarivox=no ;; - --enable-scalers) _build_scalers=yes ;; - --disable-scalers) _build_scalers=no ;; - --enable-zlib) _zlib=yes ;; - --disable-zlib) _zlib=no ;; --enable-nasm) _nasm=yes ;; --disable-nasm) _nasm=no ;; --enable-shared) _build_static=no ;; @@ -637,7 +629,12 @@ int main(void) { return strcmp(ZLIB_VERSION, zlibVersion()); } EOF cc_check $LDFLAGS $CXXFLAGS $ZLIB_CFLAGS $ZLIB_LIBS -lz && _zlib=yes fi -echo "$_zlib" +if test "$_zlib" = yes ; then + echo "$_zlib" +else + echo "none found!" + exit 1 +fi # # Check for GL @@ -744,20 +741,6 @@ else echo fi -if test "$_build_scalers" = "yes" ; then - if test "$_build_gl" = "yes" ; then - echo_n " Scaler support enabled in OpenGL mode" - echo - else - echo_n " Scaler support disabled (OpenGL not available)" - echo - _build_scalers=no - fi -else - echo_n " Scaler support disabled" - echo -fi - if test "$_nasm" = yes ; then echo_n " NASM support enabled for x86 assembly code" echo @@ -798,7 +781,6 @@ DBGGUI="$SRC/debugger/gui" YACC="$SRC/yacc" CHEAT="$SRC/cheat" ATARIVOX="$SRC/emucore/rsynth" -SCALER="$SRC/common/scaler" INCLUDES="-I$CORE -I$CORE/m6502/src -I$CORE/m6502/src/bspf/src -I$COMMON -I$GUI" @@ -904,12 +886,6 @@ if test "$_build_atarivox" = yes ; then INCLUDES="$INCLUDES -I$ATARIVOX" fi -if test "$_build_scalers" = yes ; then - DEFINES="$DEFINES -DSCALER_SUPPORT" - MODULES="$MODULES $SCALER" - INCLUDES="$INCLUDES -I$SCALER" -fi - if test "$_build_profile" = no ; then _build_profile= fi diff --git a/stella/src/common/FrameBufferGL.cxx b/stella/src/common/FrameBufferGL.cxx index 9e67a5e5b..35c3dc7ca 100644 --- a/stella/src/common/FrameBufferGL.cxx +++ b/stella/src/common/FrameBufferGL.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: FrameBufferGL.cxx,v 1.75 2006-12-13 19:13:32 stephena Exp $ +// $Id: FrameBufferGL.cxx,v 1.76 2006-12-13 22:46:28 stephena Exp $ //============================================================================ #ifdef DISPLAY_OPENGL @@ -90,15 +90,15 @@ static void (APIENTRY* p_glTexParameteri)( GLenum, GLenum, GLint ); FrameBufferGL::FrameBufferGL(OSystem* osystem) : FrameBuffer(osystem), myTexture(NULL), + myHaveTexRectEXT(false), + myHaveAppleCStorageEXT(false), + myHaveAppleTexRangeEXT(false), myScreenmode(0), myScreenmodeCount(0), myFilterParamName("GL_NEAREST"), myZoomLevel(1), myFSScaleFactor(1.0), - myDirtyFlag(true), - myHaveTexRectEXT(false), - myHaveAppleCStorageEXT(false), - myHaveAppleTexRangeEXT(false) + myDirtyFlag(true) { } @@ -291,7 +291,6 @@ bool FrameBufferGL::createScreen() cerr << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl; return false; } - myUse16Bit = (myDepth == 15 || myDepth == 16); // Check for some extensions that can potentially speed up operation const char* extensions = (const char *) p_glGetString(GL_EXTENSIONS); @@ -526,10 +525,9 @@ void FrameBufferGL::drawChar(const GUI::Font* font, uInt8 chr, uInt16 mask = 0x8000; for(int x = 0; x < w; ++x, mask >>= 1) - { if(ptr & mask) buffer[x] = (uInt16) myDefPalette[color]; - } + buffer += myBuffer.pitch; } } @@ -544,10 +542,9 @@ void FrameBufferGL::drawBitmap(uInt32* bitmap, Int32 tx, Int32 ty, { uInt32 mask = 0xF0000000; for(int x = 0; x < 8; ++x, mask >>= 4) - { if(bitmap[y] & mask) buffer[x] = (uInt16) myDefPalette[color]; - } + buffer += myBuffer.pitch; } } @@ -618,26 +615,15 @@ bool FrameBufferGL::createTextures() // Create a texture that best suits the current display depth and system // This code needs to be Apple-specific, otherwise performance is // terrible on a Mac Mini -// if(myUse16Bit) - { #if defined(MAC_OSX) - myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE, - myBuffer.texture_width, myBuffer.texture_height, 16, - 0x00007c00, 0x000003e0, 0x0000001f, 0x00000000); + myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE, + myBuffer.texture_width, myBuffer.texture_height, 16, + 0x00007c00, 0x000003e0, 0x0000001f, 0x00000000); #else - myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE, - myBuffer.texture_width, myBuffer.texture_height, 16, - 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000); + myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE, + myBuffer.texture_width, myBuffer.texture_height, 16, + 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000); #endif - } -/* - else - { - myTexture = SDL_CreateRGBSurface(SDL_SWSURFACE, - myBuffer.texture_width, myBuffer.texture_height, 32, - 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000); - } -*/ if(myTexture == NULL) return false; @@ -683,26 +669,15 @@ bool FrameBufferGL::createTextures() // Finally, create the texture in the most optimal format GLenum tex_intformat; -// if(myUse16Bit) - { #if defined (MAC_OSX) - tex_intformat = GL_RGB5; - myBuffer.format = GL_BGRA; - myBuffer.type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + tex_intformat = GL_RGB5; + myBuffer.format = GL_BGRA; + myBuffer.type = GL_UNSIGNED_SHORT_1_5_5_5_REV; #else - tex_intformat = GL_RGB; - myBuffer.format = GL_RGB; - myBuffer.type = GL_UNSIGNED_SHORT_5_6_5; + tex_intformat = GL_RGB; + myBuffer.format = GL_RGB; + myBuffer.type = GL_UNSIGNED_SHORT_5_6_5; #endif - } -/* - else - { - tex_intformat = GL_RGBA8; - myBuffer.format = GL_BGRA; - myBuffer.type = GL_UNSIGNED_INT_8_8_8_8_REV; - } -*/ p_glTexImage2D(myBuffer.target, 0, tex_intformat, myBuffer.texture_width, myBuffer.texture_height, 0, myBuffer.format, myBuffer.type, myBuffer.pixels); diff --git a/stella/src/common/FrameBufferGL.hxx b/stella/src/common/FrameBufferGL.hxx index eeaf57806..3f77aef76 100644 --- a/stella/src/common/FrameBufferGL.hxx +++ b/stella/src/common/FrameBufferGL.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: FrameBufferGL.hxx,v 1.39 2006-12-13 17:09:09 stephena Exp $ +// $Id: FrameBufferGL.hxx,v 1.40 2006-12-13 22:46:28 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_GL_HXX @@ -36,7 +36,7 @@ class GUI::Font; This class implements an SDL OpenGL framebuffer. @author Stephen Anthony - @version $Id: FrameBufferGL.hxx,v 1.39 2006-12-13 17:09:09 stephena Exp $ + @version $Id: FrameBufferGL.hxx,v 1.40 2006-12-13 22:46:28 stephena Exp $ */ class FrameBufferGL : public FrameBuffer { @@ -240,6 +240,7 @@ class FrameBufferGL : public FrameBuffer // Points to the current texture data SDL_Surface* myTexture; + // Holds all items specifically needed by GL commands struct glBufferType { GLuint texture; @@ -250,7 +251,7 @@ class FrameBufferGL : public FrameBuffer GLenum target; GLenum format; GLenum type; - GLint filter; // The texture filtering to use + GLint filter; void* pixels; int width, height; @@ -258,7 +259,8 @@ class FrameBufferGL : public FrameBuffer }; glBufferType myBuffer; - bool myUse16Bit; + // Optional GL extensions that may increase performance + bool myHaveTexRectEXT, myHaveAppleCStorageEXT, myHaveAppleTexRangeEXT; // The possible OpenGL screenmodes to use SDL_Rect** myScreenmode; @@ -285,9 +287,6 @@ class FrameBufferGL : public FrameBuffer // TODO - will be removed when textured dirty rect support is added bool myDirtyFlag; - // Optional extensions that may increase performance - bool myHaveTexRectEXT, myHaveAppleCStorageEXT, myHaveAppleTexRangeEXT; - // Indicates if the OpenGL functions have been properly loaded static bool myFuncsLoaded; }; diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index c06cb4513..1232628a9 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.108 2006-12-13 00:05:46 stephena Exp $ +// $Id: FrameBuffer.cxx,v 1.109 2006-12-13 22:46:28 stephena Exp $ //============================================================================ #include @@ -698,58 +698,13 @@ void FrameBuffer::setAvailableScalers() { /** Different emulation modes support different scalers, and the size of the current desktop also determines how much a window can be - zoomed. For now, there are two separate scaler lists; one for - normal emulation mode (and modes that have the TIA in the background), - and one for standard GUI modes (modes that bypass drawMediaSource). - For reasons of efficiency, only zooming is supported in GUI mode. Also, - it doesn't really make sense to use high quality scalers on text-only - windows. */ - - EventHandler::State state = myOSystem->eventHandler().state(); + zoomed. */ int maxsize = maxWindowSizeForScreen(); myScalerList.clear(); - bool inTIAMode = (state == EventHandler::S_EMULATE || - state == EventHandler::S_MENU || - state == EventHandler::S_CMDMENU); - - // Next, determine which mode we're in and update the appropriate scaler list - if(type() == kSoftBuffer) - { - if(inTIAMode) - { - for(int i = 0; i < kTIAScalerListSize; ++i) - if(ourTIAScalers[i].scale == 1 && ourTIAScalers[i].zoom <= maxsize) - myScalerList.push_back(&ourTIAScalers[i]); - } - else // UI mode - { - for(int i = 0; i < kUIScalerListSize; ++i) - if(ourUIScalers[i].scale == 1 && ourUIScalers[i].zoom <= maxsize) - myScalerList.push_back(&ourTIAScalers[i]); - } - } - else if(type() == kGLBuffer) - { - if(inTIAMode) - { -#ifdef SCALER_SUPPORT - for(int i = 0; i < kTIAScalerListSize; ++i) - if(ourTIAScalers[i].scale <= maxsize && ourTIAScalers[i].zoom <= maxsize) - myScalerList.push_back(&ourTIAScalers[i]); -#else - for(int i = 0; i < kTIAScalerListSize; ++i) - if(ourTIAScalers[i].scale == 1 && ourTIAScalers[i].zoom <= maxsize) - myScalerList.push_back(&ourTIAScalers[i]); -#endif - } - else // UI mode - { - for(int i = 0; i < kUIScalerListSize; ++i) - if(ourUIScalers[i].scale == 1 && ourUIScalers[i].zoom <= maxsize) - myScalerList.push_back(&ourTIAScalers[i]); - } - } + for(int i = 0; i < kScalerListSize; ++i) + if(ourScalers[i].zoom <= maxsize) + myScalerList.push_back(&ourScalers[i]); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -787,7 +742,6 @@ void FrameBuffer::getScaler(Scaler& scaler, int direction, const string& name) else { // Otherwise, get the largest scaler that's available - // FIXME - this needs to be fixed for high-quality scalers scaler = *(myScalerList[myScalerList.size()-1]); } } @@ -821,27 +775,11 @@ const uInt8 FrameBuffer::ourGUIColors[kNumColors-256][3] = { }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Scaler FrameBuffer::ourUIScalers[kUIScalerListSize] = { - { kZOOM1X, "Zoom1x", "zoom1x", 1, 1 }, - { kZOOM2X, "Zoom2x", "zoom2x", 2, 1 }, - { kZOOM3X, "Zoom3x", "zoom3x", 3, 1 }, - { kZOOM4X, "Zoom4x", "zoom4x", 4, 1 }, - { kZOOM5X, "Zoom5x", "zoom5x", 5, 1 }, - { kZOOM6X, "Zoom6x", "zoom6x", 6, 1 } -}; - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Scaler FrameBuffer::ourTIAScalers[kTIAScalerListSize] = { - { kZOOM1X, "Zoom1x", "zoom1x", 1, 1 }, - { kZOOM2X, "Zoom2x", "zoom2x", 2, 1 }, - { kZOOM3X, "Zoom3x", "zoom3x", 3, 1 }, - { kZOOM4X, "Zoom4x", "zoom4x", 4, 1 }, - { kZOOM5X, "Zoom5x", "zoom5x", 5, 1 }, - { kZOOM6X, "Zoom6x", "zoom6x", 6, 1 }, - - { kSCALE2X, "Scale2x", "scale2x", 1, 2 }, - { kSCALE3X, "Scale3x", "scale3x", 1, 3 }, - - { kHQ2X, "HQ2x", "hq2x", 1, 2 }, - { kHQ3X, "HQ3x", "hq3x", 1, 3 }, +Scaler FrameBuffer::ourScalers[kScalerListSize] = { + { kZOOM1X, "Zoom1x", "zoom1x", 1 }, + { kZOOM2X, "Zoom2x", "zoom2x", 2 }, + { kZOOM3X, "Zoom3x", "zoom3x", 3 }, + { kZOOM4X, "Zoom4x", "zoom4x", 4 }, + { kZOOM5X, "Zoom5x", "zoom5x", 5 }, + { kZOOM6X, "Zoom6x", "zoom6x", 6 } }; diff --git a/stella/src/emucore/FrameBuffer.hxx b/stella/src/emucore/FrameBuffer.hxx index 7801d2531..7ea4984d9 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.80 2006-12-13 00:05:46 stephena Exp $ +// $Id: FrameBuffer.hxx,v 1.81 2006-12-13 22:46:28 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_HXX @@ -77,17 +77,12 @@ enum { }; // Different types of scalers available -enum ScalerType { - kZOOM1X, kZOOM2X, kZOOM3X, kZOOM4X, kZOOM5X, kZOOM6X, - kSCALE2X, kSCALE3X, kSCALE4X, - kHQ2X, kHQ3X, kHQ4X -}; +enum ScalerType { kZOOM1X, kZOOM2X, kZOOM3X, kZOOM4X, kZOOM5X, kZOOM6X }; struct Scaler { ScalerType type; const char* name; const char* comparitor; int zoom; - int scale; }; /** @@ -98,7 +93,7 @@ struct Scaler { All GUI elements (ala ScummVM) are drawn here as well. @author Stephen Anthony - @version $Id: FrameBuffer.hxx,v 1.80 2006-12-13 00:05:46 stephena Exp $ + @version $Id: FrameBuffer.hxx,v 1.81 2006-12-13 22:46:28 stephena Exp $ */ class FrameBuffer { @@ -214,7 +209,7 @@ class FrameBuffer @param direction Described above @param type The scaler to use if direction is set to 0 */ - bool scale(int direction, const string& type = "Zoom1x"); + bool scale(int direction, const string& type = "zoom1x"); /** Sets the state of the cursor (hidden or grabbed) based on the @@ -541,7 +536,7 @@ class FrameBuffer /** Returns a scaler based on the current eventhandler mode and the value of direction. - If there's any error, default to 'Zoom1x'. + If there's any error, default to 'zoom1x'. direction = -1 means previous scaler based on value in 'name' direction = 0 means actual scaler based on value in 'name' direction = +1 means next scaler based on value in 'name' @@ -576,12 +571,8 @@ class FrameBuffer // The various scalers available in TIA vs. non-TIA mode // For the foreseeable future, the UI scalers will be restricted // from using the more advanced scalers - enum { - kUIScalerListSize = 6, - kTIAScalerListSize = 10 - }; - static Scaler ourUIScalers[kUIScalerListSize]; - static Scaler ourTIAScalers[kTIAScalerListSize]; + enum { kScalerListSize = 6 }; + static Scaler ourScalers[kScalerListSize]; // The list of scalers available in the current mode Common::Array myScalerList;