Fixed bug with paddle games that didn't default to paddle 0. They actually

didn't work at all with the GP2X or the Stelladaptor, because of a related
bug in swapping virtual console ports.

Added about() method to FrameBufferXXX classes, which all FrameBuffer
derived objects are required to implement.  This is so framebuffer info
is only printed as necessary.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1200 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-12-11 00:15:34 +00:00
parent a4c4a1348b
commit 992b641a6b
12 changed files with 97 additions and 79 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.72 2006-12-08 16:48:55 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.73 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -235,26 +235,25 @@ bool FrameBufferGL::initSubsystem()
SDL_GL_GetAttribute( SDL_GL_BLUE_SIZE, (int*)&myRGB[2] );
SDL_GL_GetAttribute( SDL_GL_ALPHA_SIZE, (int*)&myRGB[3] );
// Show some OpenGL info
if(myOSystem->settings().getBool("showinfo"))
{
cout << "Video rendering: OpenGL mode" << endl;
ostringstream colormode;
colormode << " Color : " << myDepth << " bit, " << myRGB[0] << "-"
<< myRGB[1] << "-" << myRGB[2] << "-" << myRGB[3];
cout << " Vendor : " << p_glGetString(GL_VENDOR) << endl
<< " Renderer: " << p_glGetString(GL_RENDERER) << endl
<< " Version : " << p_glGetString(GL_VERSION) << endl
<< colormode.str() << endl
<< " Filter : " << myFilterParamName << endl
<< endl;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrameBufferGL::about()
{
ostringstream out;
out << "Video rendering: OpenGL mode" << endl
<< " Vendor : " << p_glGetString(GL_VENDOR) << endl
<< " Renderer: " << p_glGetString(GL_RENDERER) << endl
<< " Version : " << p_glGetString(GL_VERSION) << endl
<< " Color : " << myDepth << " bit, " << myRGB[0] << "-"
<< myRGB[1] << "-" << myRGB[2] << "-" << myRGB[3] << endl
<< " Filter : " << myFilterParamName << endl;
return out.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::setAspectRatio()
{
@ -587,11 +586,9 @@ void FrameBufferGL::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::drawChar(const GUI::Font* FONT, uInt8 chr,
void FrameBufferGL::drawChar(const GUI::Font* font, uInt8 chr,
uInt32 tx, uInt32 ty, int color)
{
GUI::Font* font = (GUI::Font*) FONT;
// If this character is not included in the font, use the default char.
if(chr < font->desc().firstchar ||
chr >= font->desc().firstchar + font->desc().size)
@ -664,14 +661,12 @@ void FrameBufferGL::enablePhosphor(bool enable, int blend)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::cls()
{
/* FIXME - commented out until I figure out why it crashes in OSX
if(myFuncsLoaded)
if(myFuncsLoaded && myCurrentTexture)
{
p_glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapBuffers();
p_glClear(GL_COLOR_BUFFER_BIT);
}
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.hxx,v 1.37 2006-12-08 16:48:55 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.38 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_GL_HXX
@ -40,7 +40,7 @@ class GUI::Font;
This class implements an SDL OpenGL framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.37 2006-12-08 16:48:55 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.38 2006-12-11 00:15:33 stephena Exp $
*/
class FrameBufferGL : public FrameBuffer
{
@ -78,6 +78,11 @@ class FrameBufferGL : public FrameBuffer
*/
virtual BufferType type() { return kGLBuffer; }
/**
This method is called to provide information about the FrameBuffer.
*/
virtual string about();
/**
This method is called to set the aspect ratio of the screen.
*/

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: FrameBufferSoft.cxx,v 1.63 2006-12-10 18:07:34 stephena Exp $
// $Id: FrameBufferSoft.cxx,v 1.64 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#include <SDL.h>
@ -61,14 +61,13 @@ bool FrameBufferSoft::initSubsystem()
}
// Create the screen
if(!createScreen())
return false;
return createScreen();
}
// Show some info
if(myOSystem->settings().getBool("showinfo"))
cout << "Video rendering: Software mode" << endl << endl;
return true;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrameBufferSoft::about()
{
return "Video rendering: Software mode\n";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -542,13 +541,8 @@ void FrameBufferSoft::preFrameUpdate()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::postFrameUpdate()
{
// This is a performance hack until I have more time to work
// on the Win32 code. It seems that SDL_UpdateRects() is very
// expensive in Windows, so we force a full screen update instead.
if(myUseDirtyRects)
{
SDL_UpdateRects(myScreen, myRectList->numRects(), myRectList->rects());
}
else if(myRectList->numRects() > 0)
{
SDL_Flip(myScreen);
@ -653,13 +647,11 @@ void FrameBufferSoft::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::drawChar(const GUI::Font* FONT, uInt8 chr,
void FrameBufferSoft::drawChar(const GUI::Font* font, uInt8 chr,
uInt32 xorig, uInt32 yorig, int color)
{
GUI::Font* font = (GUI::Font*)FONT;
const FontDesc& desc = font->desc();
// If this character is not included in the font, use the default char.
const FontDesc& desc = font->desc();
if(chr < desc.firstchar || chr >= desc.firstchar + desc.size)
{
if (chr == ' ')

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: FrameBufferSoft.hxx,v 1.40 2006-12-10 17:04:34 stephena Exp $
// $Id: FrameBufferSoft.hxx,v 1.41 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX
@ -33,7 +33,7 @@ class RectList;
This class implements an SDL software framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferSoft.hxx,v 1.40 2006-12-10 17:04:34 stephena Exp $
@version $Id: FrameBufferSoft.hxx,v 1.41 2006-12-11 00:15:33 stephena Exp $
*/
class FrameBufferSoft : public FrameBuffer
{
@ -62,6 +62,11 @@ class FrameBufferSoft : public FrameBuffer
*/
virtual BufferType type() { return kSoftBuffer; }
/**
This method is called to provide information about the FrameBuffer.
*/
virtual string about();
/**
This method is called to set the aspect ratio of the screen.
*/

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.105 2006-12-09 00:25:19 stephena Exp $
// $Id: Console.cxx,v 1.106 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#include <assert.h>
@ -111,18 +111,14 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5,
string right = myProperties.get(Controller_Right);
// Swap the ports if necessary
// Note that this doesn't swap the actual controllers,
// just the ports that they're attached to
Controller::Jack leftjack, rightjack;
int leftPort, rightPort;
if(myProperties.get(Console_SwapPorts) == "NO")
{
leftjack = Controller::Left;
rightjack = Controller::Right;
leftPort = 0; rightPort = 1;
}
else
{
leftjack = Controller::Right;
rightjack = Controller::Left;
leftPort = 1; rightPort = 0;
}
// Also check if we should swap the paddles plugged into a jack
@ -131,23 +127,23 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5,
// Construct left controller
if(left == "BOOSTER-GRIP")
{
myControllers[0] = new BoosterGrip(leftjack, *myEvent);
myControllers[leftPort] = new BoosterGrip(Controller::Left, *myEvent);
}
else if(left == "DRIVING")
{
myControllers[0] = new Driving(leftjack, *myEvent);
myControllers[leftPort] = new Driving(Controller::Left, *myEvent);
}
else if((left == "KEYBOARD") || (left == "KEYPAD"))
{
myControllers[0] = new Keyboard(leftjack, *myEvent);
myControllers[leftPort] = new Keyboard(Controller::Left, *myEvent);
}
else if(left == "PADDLES")
{
myControllers[0] = new Paddles(leftjack, *myEvent, swapPaddles);
myControllers[leftPort] = new Paddles(Controller::Left, *myEvent, swapPaddles);
}
else
{
myControllers[0] = new Joystick(leftjack, *myEvent);
myControllers[leftPort] = new Joystick(Controller::Left, *myEvent);
}
#ifdef ATARIVOX_SUPPORT
@ -157,29 +153,29 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5,
// Construct right controller
if(right == "BOOSTER-GRIP")
{
myControllers[1] = new BoosterGrip(rightjack, *myEvent);
myControllers[rightPort] = new BoosterGrip(Controller::Right, *myEvent);
}
else if(right == "DRIVING")
{
myControllers[1] = new Driving(rightjack, *myEvent);
myControllers[rightPort] = new Driving(Controller::Right, *myEvent);
}
else if((right == "KEYBOARD") || (right == "KEYPAD"))
{
myControllers[1] = new Keyboard(rightjack, *myEvent);
myControllers[rightPort] = new Keyboard(Controller::Right, *myEvent);
}
else if(right == "PADDLES")
{
myControllers[1] = new Paddles(rightjack, *myEvent, swapPaddles);
myControllers[rightPort] = new Paddles(Controller::Right, *myEvent, swapPaddles);
}
#ifdef ATARIVOX_SUPPORT
else if(right == "ATARIVOX")
{
myControllers[1] = vox = new AtariVox(rightjack, *myEvent);
myControllers[rightPort] = vox = new AtariVox(Controller::Right, *myEvent);
}
#endif
else
{
myControllers[1] = new Joystick(rightjack, *myEvent);
myControllers[rightPort] = new Joystick(Controller::Right, *myEvent);
}
// Create switches for the console

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: FrameBuffer.cxx,v 1.106 2006-12-10 17:04:34 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.107 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#include <sstream>
@ -44,7 +44,8 @@ FrameBuffer::FrameBuffer(OSystem* osystem)
theRedrawTIAIndicator(true),
myUsePhosphor(false),
myPhosphorBlend(77),
myFrameRate(0)
myFrameRate(0),
myInitializedCount(0)
{
}
@ -72,6 +73,7 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
if(SDL_Init(initflags) < 0)
return;
}
myInitializedCount++;
// Erase old contents
cls();
@ -116,6 +118,11 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
// Erase any messages from a previous run
myMessage.counter = 0;
// Finally, show some information about the framebuffer,
// but only on the first initialization
if(myInitializedCount == 1 && myOSystem->settings().getBool("showinfo"))
cout << about() << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: FrameBuffer.hxx,v 1.78 2006-12-10 17:04:34 stephena Exp $
// $Id: FrameBuffer.hxx,v 1.79 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_HXX
@ -97,7 +97,7 @@ struct Scaler {
All GUI elements (ala ScummVM) are drawn here as well.
@author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.78 2006-12-10 17:04:34 stephena Exp $
@version $Id: FrameBuffer.hxx,v 1.79 2006-12-11 00:15:33 stephena Exp $
*/
class FrameBuffer
{
@ -314,6 +314,11 @@ class FrameBuffer
*/
virtual BufferType type() = 0;
/**
This method is called to provide information about the FrameBuffer.
*/
virtual string about() = 0;
/**
This method is called to set the aspect ratio of the screen.
*/
@ -555,6 +560,9 @@ class FrameBuffer
// Indicates the current framerate of the system
uInt32 myFrameRate;
// Indicates the number of times the framebuffer was initialized
uInt32 myInitializedCount;
// Used for onscreen messages
struct Message {
string text;

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.96 2006-12-10 17:04:34 stephena Exp $
// $Id: Settings.cxx,v 1.97 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#include <cassert>
@ -80,7 +80,7 @@ Settings::Settings(OSystem* osystem)
setInternal("lastrom", "");
setInternal("modtime", ""); // romdir last modification time
setInternal("tiadefaults", "false");
setInternal("tiadefaults", "true");
setInternal("autoslot", "false");
setInternal("fastscbios", "true");
}

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: FrameBufferGP2X.cxx,v 1.11 2006-12-10 17:04:34 stephena Exp $
// $Id: FrameBufferGP2X.cxx,v 1.12 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#include <SDL.h>
@ -45,6 +45,13 @@ bool FrameBufferGP2X::initSubsystem()
return createScreen();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrameBufferGP2X::about()
{
// TODO - add SDL info to this string
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGP2X::setAspectRatio()
{
@ -236,10 +243,9 @@ void FrameBufferGP2X::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGP2X::drawChar(const GUI::Font* FONT, uInt8 chr,
void FrameBufferGP2X::drawChar(const GUI::Font* font, uInt8 chr,
uInt32 xorig, uInt32 yorig, int color)
{
GUI::Font* font = (GUI::Font*)FONT;
const FontDesc& desc = font->desc();
// If this character is not included in the font, use the default char.

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: FrameBufferGP2X.hxx,v 1.6 2006-12-08 16:49:31 stephena Exp $
// $Id: FrameBufferGP2X.hxx,v 1.7 2006-12-11 00:15:33 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_GP2X_HXX
@ -32,7 +32,7 @@ class GUI::Font;
This class implements an SDL hardware framebuffer for the GP2X device.
@author Stephen Anthony
@version $Id: FrameBufferGP2X.hxx,v 1.6 2006-12-08 16:49:31 stephena Exp $
@version $Id: FrameBufferGP2X.hxx,v 1.7 2006-12-11 00:15:33 stephena Exp $
*/
class FrameBufferGP2X : public FrameBuffer
{
@ -61,6 +61,11 @@ class FrameBufferGP2X : public FrameBuffer
*/
virtual BufferType type() { return kSoftBuffer; }
/**
This method is called to provide information about the FrameBuffer.
*/
virtual string about();
/**
This method is called to set the aspect ratio of the screen.
*/

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: Font.hxx,v 1.5 2006-12-08 16:49:34 stephena Exp $
// $Id: Font.hxx,v 1.6 2006-12-11 00:15:34 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -49,7 +49,7 @@ class Font
public:
Font(FontDesc desc);
const FontDesc& desc() { return myFontDesc; }
const FontDesc& desc() const { return myFontDesc; }
int getFontHeight() const { return myFontDesc.height; }
int getLineHeight() const { return myFontDesc.height + 2; }

View File

@ -625,9 +625,8 @@ void FrameBufferWinCE::postFrameUpdate()
if (legacygapi) GXEndDraw();
}
void FrameBufferWinCE::drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y, int color)
void FrameBufferWinCE::drawChar(const GUI::Font* myfont, uInt8 c, uInt32 x, uInt32 y, int color)
{
GUI::Font* myfont = (GUI::Font*)font;
const FontDesc& desc = myfont->desc();
if (!myDstScreen) return;