Added 'gl_texrect' commandline argument, which toggles use of the

GL_TEXTURE_RECTANGLE OpenGL extension.  For now, this will default to
off, since some people are having OpenGL issues that I can't seem to
track down.

Added NTSC50 and SECAM60 modes.  Switching between formats will now
use the current scanline count.  So, if we're on a 60Hz/262 scanline
cart, the switchable formats are NTSC, PAL60, SECAM60.  Otherwise,
the formats are NTSC50, PAL, SECAM.  This makes the switching of cart
format act more like z26, where only the palette is changed.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1369 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-09-10 15:47:00 +00:00
parent ae200c9cb7
commit f2c377c1ae
8 changed files with 125 additions and 116 deletions

View File

@ -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.90 2007-09-03 18:37:22 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.91 2007-09-10 15:46:58 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -33,18 +33,6 @@
#include "FrameBufferGL.hxx"
// There's probably a cleaner way of doing this
// These values come from SDL_video.c
// If they change, this code will break horribly
#ifndef SDL_GL_ACCELERATED_VISUAL
#define SDL_GL_ACCELERATED_VISUAL SDL_GLattr(15)
#endif
#ifndef SDL_GL_SWAP_CONTROL
#define SDL_GL_SWAP_CONTROL SDL_GLattr(16)
#endif
// These are not defined in the current version of SDL_opengl.h
// Hopefully speed up OpenGL rendering in OSX
#ifndef GL_TEXTURE_RECTANGLE_ARB
#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
#endif
@ -223,9 +211,8 @@ bool FrameBufferGL::initSubsystem(VideoMode mode)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrameBufferGL::about() const
{
string extensions;
if(myHaveTexRectEXT) extensions += "GL_TEXTURE_RECTANGLE_ARB ";
if(extensions == "") extensions = "None";
const string& extensions =
myHaveTexRectEXT ? "GL_TEXTURE_RECTANGLE_ARB" : "None";
ostringstream out;
out << "Video rendering: OpenGL mode" << endl
@ -326,8 +313,14 @@ bool FrameBufferGL::setVidMode(VideoMode mode)
}
// Check for some extensions that can potentially speed up operation
const char* extensions = (const char *) p_glGetString(GL_EXTENSIONS);
myHaveTexRectEXT = strstr(extensions, "ARB_texture_rectangle") != NULL;
// Don't use it if we've been instructed not to
if(myOSystem->settings().getBool("gl_texrect"))
{
const char* extensions = (const char *) p_glGetString(GL_EXTENSIONS);
myHaveTexRectEXT = strstr(extensions, "ARB_texture_rectangle") != NULL;
}
else
myHaveTexRectEXT = false;
// Initialize GL display
p_glViewport(myImageDim.x, myImageDim.y, myImageDim.w, myImageDim.h);
@ -340,7 +333,7 @@ bool FrameBufferGL::setVidMode(VideoMode mode)
p_glMatrixMode(GL_PROJECTION);
p_glLoadIdentity();
p_glOrtho(0.0, orthoWidth, orthoHeight, 0, -1.0, 1.0);
p_glOrtho(0.0, orthoWidth, orthoHeight, 0.0, 0.0, 1.0);
p_glMatrixMode(GL_MODELVIEW);
p_glLoadIdentity();
@ -495,25 +488,20 @@ void FrameBufferGL::toggleFilter()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::hLine(uInt32 x, uInt32 y, uInt32 x2, int color)
{
// Horizontal line
SDL_Rect tmp;
tmp.x = x;
tmp.y = y;
tmp.w = x2 - x + 1;
tmp.h = 1;
SDL_FillRect(myTexture, &tmp, myDefPalette[color]);
uInt16* buffer = (uInt16*) myTexture->pixels + y * myBuffer.pitch + x;
while(x++ <= x2)
*buffer++ = (uInt16) myDefPalette[color];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::vLine(uInt32 x, uInt32 y, uInt32 y2, int color)
{
// Vertical line
SDL_Rect tmp;
tmp.x = x;
tmp.y = y;
tmp.w = 1;
tmp.h = y2 - y + 1;
SDL_FillRect(myTexture, &tmp, myDefPalette[color]);
uInt16* buffer = (uInt16*) myTexture->pixels + y * myBuffer.pitch + x;
while(y++ <= y2)
{
*buffer = (uInt16) myDefPalette[color];
buffer += myTexture->w;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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: Version.hxx,v 1.30 2007-09-01 23:31:18 stephena Exp $
// $Id: Version.hxx,v 1.31 2007-09-10 15:46:58 stephena Exp $
//============================================================================
#ifndef VERSION_HXX
@ -22,9 +22,9 @@
#define STELLA_BASE_VERSION "2.5_cvs"
#ifdef NIGHTLY_BUILD
#define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD
#define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD
#else
#define STELLA_VERSION STELLA_BASE_VERSION
#define STELLA_VERSION STELLA_BASE_VERSION
#endif
#endif

View File

@ -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: Console.cxx,v 1.128 2007-07-27 13:49:16 stephena Exp $
// $Id: Console.cxx,v 1.129 2007-09-10 15:46:58 stephena Exp $
//============================================================================
#include <cassert>
@ -61,6 +61,8 @@
Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
: myOSystem(osystem),
myProperties(props),
myDisplayFormat("NTSC"),
myFramerate(60),
myUserPaletteDefined(false)
{
myControllers[0] = 0;
@ -208,10 +210,24 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
}
buf << endl << cart->about();
// Make sure height is set properly for PAL ROM
if((myDisplayFormat == "PAL" || myDisplayFormat == "SECAM") &&
myProperties.get(Display_Height) == "210")
myProperties.set(Display_Height, "250");
// Set up the correct properties used when toggling format
// Note that this can be overridden if a format is forced
// For example, if a PAL ROM is forced to be NTSC, it will use NTSC-like
// properties (60Hz, 262 scanlines, etc) and cycle between NTSC-like modes
if(myDisplayFormat == "NTSC" || myDisplayFormat == "PAL60" ||
myDisplayFormat == "SECAM60")
{
// Assume we've got ~262 scanlines (NTSC-like format)
myFramerate = 60;
}
else
{
// Assume we've got ~312 scanlines (PAL-like format)
myFramerate = 50;
if(myProperties.get(Display_Height) == "210")
myProperties.set(Display_Height, "250");
}
// Reset, the system to its power-on state
mySystem->reset();
@ -237,43 +253,52 @@ Console::~Console()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleFormat()
{
int framerate = 60;
if(myDisplayFormat == "NTSC")
string format, message;
if(myDisplayFormat.compare(0, 4, "NTSC") == 0)
{
myDisplayFormat = "PAL";
myProperties.set(Display_Format, myDisplayFormat);
mySystem->reset();
myOSystem->frameBuffer().showMessage("PAL Mode");
framerate = 50;
if(myFramerate == 60)
{
format = "PAL60";
message = "PAL palette (PAL60)";
}
else
{
format = "PAL";
message = "PAL palette (PAL)";
}
}
else if(myDisplayFormat == "PAL")
else if(myDisplayFormat.compare(0, 3, "PAL") == 0)
{
myDisplayFormat = "PAL60";
myProperties.set(Display_Format, myDisplayFormat);
mySystem->reset();
myOSystem->frameBuffer().showMessage("PAL60 Mode");
framerate = 60;
if(myFramerate == 60)
{
format = "SECAM";
message = "SECAM palette (SECAM60)";
}
else
{
format = "SECAM";
message = "SECAM palette (SECAM)";
}
}
else if(myDisplayFormat == "PAL60")
else if(myDisplayFormat.compare(0, 5, "SECAM") == 0)
{
myDisplayFormat = "SECAM";
myProperties.set(Display_Format, myDisplayFormat);
mySystem->reset();
myOSystem->frameBuffer().showMessage("SECAM Mode");
framerate = 50;
}
else if(myDisplayFormat == "SECAM")
{
myDisplayFormat = "NTSC";
myProperties.set(Display_Format, myDisplayFormat);
mySystem->reset();
myOSystem->frameBuffer().showMessage("NTSC Mode");
framerate = 60;
if(myFramerate == 60)
{
format = "NTSC";
message = "NTSC palette (NTSC)";
}
else
{
format = "NTSC50";
message = "NTSC palette (NTSC50)";
}
}
myDisplayFormat = format;
myProperties.set(Display_Format, myDisplayFormat);
myOSystem->frameBuffer().showMessage(message);
setPalette(myOSystem->settings().getString("palette"));
myOSystem->setFramerate(framerate);
myOSystem->sound().setFrameRate(framerate);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -413,7 +438,7 @@ void Console::initializeVideo(bool full)
setColorLossPalette(myOSystem->settings().getBool("colorloss"));
setPalette(myOSystem->settings().getString("palette"));
myOSystem->setFramerate(getFrameRate());
myOSystem->setFramerate(getFramerate());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -427,7 +452,7 @@ void Console::initializeAudio()
myOSystem->sound().close();
myOSystem->sound().setChannels(channels);
myOSystem->sound().setFrameRate(getFrameRate());
myOSystem->sound().setFrameRate(getFramerate());
myOSystem->sound().initialize();
}
@ -650,24 +675,14 @@ void Console::setColorLossPalette(bool loss)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Console::getFrameRate() const
uInt32 Console::getFramerate() const
{
// Set the correct framerate based on the format of the ROM
// This can be overridden by changing the framerate in the
// VideoDialog box or on the commandline, but it can't be saved
// (ie, framerate is now solely determined based on ROM format).
int framerate = myOSystem->settings().getInt("framerate");
if(framerate == -1)
{
if(myDisplayFormat == "NTSC" || myDisplayFormat == "PAL60")
framerate = 60;
else if(myDisplayFormat == "PAL" || myDisplayFormat == "SECAM")
framerate = 50;
else
framerate = 60;
}
return framerate;
return framerate == -1 ? myFramerate : framerate;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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: Console.hxx,v 1.61 2007-07-27 13:49:16 stephena Exp $
// $Id: Console.hxx,v 1.62 2007-09-10 15:46:58 stephena Exp $
//============================================================================
#ifndef CONSOLE_HXX
@ -38,7 +38,7 @@ class System;
This class represents the entire game console.
@author Bradford W. Mott
@version $Id: Console.hxx,v 1.61 2007-07-27 13:49:16 stephena Exp $
@version $Id: Console.hxx,v 1.62 2007-09-10 15:46:58 stephena Exp $
*/
class Console
{
@ -145,11 +145,6 @@ class Console
*/
void toggleFormat();
/**
Query the currently selected display format (NTSC/PAL/PAL60).
*/
string getFormat() const { return myDisplayFormat; }
/**
Toggle between the available palettes.
*/
@ -206,6 +201,12 @@ class Console
*/
void changeHeight(int direction);
/**
Returns the framerate based on a number of factors
(whether 'framerate' is set, what display format is in use, etc)
*/
uInt32 getFramerate() const;
/**
Toggles the TIA bit specified in the method name.
*/
@ -242,12 +243,6 @@ class Console
*/
const uInt32* getPalette(int direction) const;
/**
Returns the framerate based on a number of factors
(whether 'framerate' is set, what display format is in use, etc)
*/
uInt32 getFrameRate() const;
private:
// Pointer to the osystem object
OSystem* myOSystem;
@ -281,9 +276,12 @@ class Console
AtariVox *vox;
#endif
// The currently defined display format (NTSC/PAL/PAL60)
// The currently defined display format (NTSC/PAL/SECAM)
string myDisplayFormat;
// The currently defined display framerate
uInt32 myFramerate;
// Indicates whether an external palette was found and
// successfully loaded
bool myUserPaletteDefined;

View File

@ -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: Settings.cxx,v 1.127 2007-09-03 18:37:22 stephena Exp $
// $Id: Settings.cxx,v 1.128 2007-09-10 15:46:58 stephena Exp $
//============================================================================
#include <cassert>
@ -43,6 +43,7 @@ Settings::Settings(OSystem* osystem)
setInternal("gl_fsmax", "never");
setInternal("gl_lib", "libGL.so");
setInternal("gl_vsync", "false");
setInternal("gl_texrect", "false");
setInternal("zoom_ui", "2");
setInternal("zoom_tia", "2");
@ -279,6 +280,7 @@ void Settings::usage()
<< " -gl_fsmax <never|always| Stretch GL image in fullscreen mode\n"
<< " ui|tia\n"
<< " -gl_vsync <1|0> Enable synchronize to vertical blank interrupt\n"
<< " -gl_texrect <1|0> Enable GL_TEXTURE_RECTANGLE extension\n"
<< endl
#endif
<< " -zoom_tia <zoom> Use the specified zoom level in emulation mode\n"

View File

@ -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: TIA.cxx,v 1.80 2007-09-03 18:37:22 stephena Exp $
// $Id: TIA.cxx,v 1.81 2007-09-10 15:46:59 stephena Exp $
//============================================================================
#include <cassert>
@ -197,16 +197,16 @@ void TIA::reset()
myAllowHMOVEBlanks =
(myConsole.properties().get(Emulation_HmoveBlanks) == "YES");
if(myConsole.getFormat().compare(0, 3, "PAL") == 0)
{
myColorLossEnabled = true;
myMaximumNumberOfScanlines = 342;
}
else // NTSC
if(myConsole.getFramerate() > 55) // NTSC
{
myColorLossEnabled = false;
myMaximumNumberOfScanlines = 290;
}
else
{
myColorLossEnabled = true;
myMaximumNumberOfScanlines = 342;
}
// Recalculate the size of the display
frameReset();

View File

@ -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: GameInfoDialog.cxx,v 1.42 2007-09-06 21:00:57 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.43 2007-09-10 15:46:59 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -226,8 +226,11 @@ GameInfoDialog::GameInfoDialog(
myFormat->appendEntry("Auto-detect", 1);
myFormat->appendEntry("NTSC", 2);
myFormat->appendEntry("PAL", 3);
myFormat->appendEntry("PAL60", 4);
myFormat->appendEntry("SECAM", 5);
myFormat->appendEntry("SECAM", 4);
myFormat->appendEntry("NTSC50", 5);
myFormat->appendEntry("PAL60", 6);
myFormat->appendEntry("SECAM60", 7);
wid.push_back(myFormat);
ypos += lineHeight + 5;
@ -460,10 +463,14 @@ void GameInfoDialog::loadView()
myFormat->setSelectedTag(2);
else if(s == "PAL")
myFormat->setSelectedTag(3);
else if(s == "PAL60")
myFormat->setSelectedTag(4);
else if(s == "SECAM")
myFormat->setSelectedTag(4);
else if(s == "NTSC50")
myFormat->setSelectedTag(5);
else if(s == "PAL60")
myFormat->setSelectedTag(6);
else if(s == "SECAM60")
myFormat->setSelectedTag(7);
else
myFormat->setSelectedTag(0);
@ -585,8 +592,9 @@ void GameInfoDialog::saveConfig()
// Display properties
tag = myFormat->getSelectedTag();
s = (tag == 5) ? "SECAM" : (tag == 4) ? "PAL60" : (tag == 3) ? "PAL" :
(tag == 2) ? "NTSC" : "AUTO-DETECT";
s = (tag == 7) ? "SECAM60" : (tag == 6) ? "PAL60" : (tag == 5) ? "NTSC50" :
(tag == 4) ? "SECAM" : (tag == 3) ? "PAL" : (tag == 2) ? "NTSC" :
"AUTO-DETECT";
myGameProperties.set(Display_Format, s);
s = myYStart->getEditString();

View File

@ -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: LauncherDialog.cxx,v 1.73 2007-09-06 21:00:58 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.74 2007-09-10 15:47:00 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -449,8 +449,6 @@ void LauncherDialog::loadRomInfo()
if(myRomInfoFlag)
myRomInfoWidget->showInfo(props);
cerr << "\n ==> " << myGameList->path(item) << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -