When in 'small' window mode and attempting to open PAL ROMs larger than the

screen size (vertically), the window will open in partially truncated mode,
where the top of the PAL image is cut off.  This normally won't be a problem,
as it's mostly blank space anyway.

App window centering is now honoured when changing video zoom levels, not
just when changing eventhandler states.

Bumped version # for another test release.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2135 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-09-21 19:39:30 +00:00
parent cb6d2cf602
commit f3483ca8b1
8 changed files with 89 additions and 46 deletions

View File

@ -12,6 +12,14 @@
Release History
===========================================================================
3.2.1 to 3.2.2: (September 17, 2010)
* Fixed bug with window centering; if enabled and the the window was
larger than the desktop, the window would be moved offscreen.
-Have fun!
3.2 to 3.2.1: (August 25, 2010)
* Improved behaviour of joystick 'hat' movement. This should fix bugs
@ -24,8 +32,6 @@
* Added game properties info and snapshot for the newly released
'Halo 2600' ROM.
-Have fun!
3.1.2 to 3.2: (August 20, 2010)

View File

@ -22,7 +22,7 @@
#include <cstdlib>
#define STELLA_VERSION "3.3_test4"
#define STELLA_VERSION "3.3_test5"
#define STELLA_BUILD atoi("$Rev$" + 6)
#endif

View File

@ -152,6 +152,15 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
// 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
// The TIA will self-adjust the framerate if necessary
// TODO - query these values directly from the TIA if value is 'AUTO'
uInt32 ystart = atoi(myProperties.get(Display_YStart).c_str());
if(ystart < 0) ystart = 0;
else if(ystart > 64) ystart = 64;
uInt32 height = atoi(myProperties.get(Display_Height).c_str());
if(height < 210) height = 210;
else if(height > 256) height = 256;
if(myDisplayFormat == "NTSC" || myDisplayFormat == "PAL60" ||
myDisplayFormat == "SECAM60")
{
@ -165,8 +174,24 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
myFramerate = 50.0;
myConsoleInfo.InitialFrameRate = "50";
if(myProperties.get(Display_Height) == "210")
myProperties.set(Display_Height, "250");
// PAL ROMs normally need at least 250 lines
height = BSPF_max(height, 250u);
}
// Make sure these values fit within the bounds of the desktop
// If not, attempt to center vertically
if(height <= myOSystem->desktopHeight())
{
myTIA->setYStart(ystart);
myTIA->setHeight(height);
}
else
{
ystart += height - myOSystem->desktopHeight();
ystart = BSPF_min(ystart, 64u);
height = myOSystem->desktopHeight();
myTIA->setYStart(ystart);
myTIA->setHeight(height);
}
const string& md5 = myProperties.get(Cartridge_MD5);
@ -421,7 +446,7 @@ FBInitStatus Console::initializeVideo(bool full)
if(full)
{
string title = string("Stella ") + STELLA_VERSION +
const string& title = string("Stella ") + STELLA_VERSION +
": \"" + myProperties.get(Cartridge_Name) + "\"";
fbstatus = myOSystem->frameBuffer().initialize(title,
myTIA->width() << 1, myTIA->height());
@ -500,11 +525,9 @@ void Console::fry() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeYStart(int direction)
{
Int32 ystart = atoi(myProperties.get(Display_YStart).c_str());
ostringstream strval;
string message;
uInt32 ystart = myTIA->ystart();
if(direction == +1) // increase YStart
if(direction == +1) // increase YStart
{
ystart++;
if(ystart > 64)
@ -525,27 +548,25 @@ void Console::changeYStart(int direction)
else
return;
strval << ystart;
myProperties.set(Display_YStart, strval.str());
myTIA->setYStart(ystart);
myTIA->frameReset();
myOSystem->frameBuffer().refresh();
message = "YStart ";
message += strval.str();
myOSystem->frameBuffer().showMessage(message);
ostringstream val;
val << ystart;
myOSystem->frameBuffer().showMessage("YStart " + val.str());
myProperties.set(Display_YStart, val.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeHeight(int direction)
{
Int32 height = atoi(myProperties.get(Display_Height).c_str());
ostringstream strval;
string message;
uInt32 height = myTIA->height();
if(direction == +1) // increase Height
if(direction == +1) // increase Height
{
height++;
if(height > 256)
if(height > 256 || height > myOSystem->desktopHeight())
{
myOSystem->frameBuffer().showMessage("Height at maximum");
return;
@ -554,7 +575,7 @@ void Console::changeHeight(int direction)
else if(direction == -1) // decrease Height
{
height--;
if(height < 200)
if(height < 210)
{
myOSystem->frameBuffer().showMessage("Height at minimum");
return;
@ -563,14 +584,14 @@ void Console::changeHeight(int direction)
else
return;
strval << height;
myProperties.set(Display_Height, strval.str());
myTIA->setHeight(height);
myTIA->frameReset();
initializeVideo(); // takes care of refreshing the screen
message = "Height ";
message += strval.str();
myOSystem->frameBuffer().showMessage(message);
ostringstream val;
val << height;
myOSystem->frameBuffer().showMessage("Height " + val.str());
myProperties.set(Display_Height, val.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -129,15 +129,7 @@ FBInitStatus FrameBuffer::initialize(const string& title, uInt32 width, uInt32 h
if(initSubsystem(mode))
{
// Attempt to center the application window in non-fullscreen mode
if(!fullScreen() && myOSystem->settings().getBool("center"))
{
int x = mode.screen_w >= myOSystem->desktopWidth() ? 0 :
((myOSystem->desktopWidth() - mode.screen_w) >> 1);
int y = mode.screen_h >= myOSystem->desktopHeight() ? 0 :
((myOSystem->desktopHeight() - mode.screen_h) >> 1);
myOSystem->setAppWindowPos(x, y, mode.screen_w, mode.screen_h);
}
centerAppWindow(mode);
myImageRect.setWidth(mode.image_w);
myImageRect.setHeight(mode.image_h);
@ -696,6 +688,8 @@ bool FrameBuffer::changeVidMode(int direction)
VideoMode vidmode = myCurrentModeList->current(myOSystem->settings(), fullScreen());
if(setVidMode(vidmode))
{
centerAppWindow(vidmode);
myImageRect.setWidth(vidmode.image_w);
myImageRect.setHeight(vidmode.image_h);
myImageRect.moveTo(vidmode.image_x, vidmode.image_y);
@ -1015,6 +1009,20 @@ FrameBuffer::VideoMode FrameBuffer::getSavedVidMode()
return myCurrentModeList->current(myOSystem->settings(), fullScreen());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::centerAppWindow(const VideoMode& mode)
{
// Attempt to center the application window in non-fullscreen mode
if(!fullScreen() && myOSystem->settings().getBool("center"))
{
int x = mode.screen_w >= myOSystem->desktopWidth() ? 0 :
((myOSystem->desktopWidth() - mode.screen_w) >> 1);
int y = mode.screen_h >= myOSystem->desktopHeight() ? 0 :
((myOSystem->desktopHeight() - mode.screen_h) >> 1);
myOSystem->setAppWindowPos(x, y, mode.screen_w, mode.screen_h);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::VideoModeList::VideoModeList()
: myIdx(-1)

View File

@ -516,6 +516,11 @@ class FrameBuffer
*/
VideoMode getSavedVidMode();
/**
Attempt to center the application window in windowed mode.
*/
void centerAppWindow(const VideoMode& mode);
private:
/**
This class implements an iterator around an array of VideoMode objects.

View File

@ -42,6 +42,9 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
: myConsole(console),
mySound(sound),
mySettings(settings),
myFrameWidth(160),
myFrameYStart(34),
myFrameHeight(210),
myMaximumNumberOfScanlines(262),
myColorLossEnabled(false),
myPartialFrameFlag(false),
@ -226,15 +229,6 @@ void TIA::frameReset()
// Reset pixel pointer and drawing flag
myFramePointer = myCurrentFrameBuffer;
// Make sure all these are within bounds
myFrameWidth = 160;
myFrameYStart = atoi(myConsole.properties().get(Display_YStart).c_str());
if(myFrameYStart < 0) myFrameYStart = 0;
else if(myFrameYStart > 64) myFrameYStart = 64;
myFrameHeight = atoi(myConsole.properties().get(Display_Height).c_str());
if(myFrameHeight < 210) myFrameHeight = 210;
else if(myFrameHeight > 256) myFrameHeight = 256;
// Calculate color clock offsets for starting and stopping frame drawing
// Note that although we always start drawing at scanline zero, the
// framebuffer that is exposed outside the class actually starts at 'ystart'

View File

@ -69,7 +69,7 @@ class TIA : public Device
void reset();
/**
Reset frame to change XStart/YStart/Width/Height properties
Reset frame to current YStart/Height properties
*/
void frameReset();
@ -189,6 +189,15 @@ class TIA : public Device
*/
inline uInt32 width() const { return myFrameWidth; }
inline uInt32 height() const { return myFrameHeight; }
inline uInt32 ystart() const { return myFrameYStart; }
/**
Changes the current Height/YStart properties.
Note that calls to these method(s) must be eventually followed by
::frameReset() for the changes to take effect.
*/
void setHeight(uInt32 height) { myFrameHeight = height; }
void setYStart(uInt32 ystart) { myFrameYStart = ystart; }
/**
Enables/disables auto-frame calculation. If enabled, the TIA

View File

@ -48,7 +48,7 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
WidgetArray wid;
// Set real dimensions
_w = BSPF_min(49 * fontWidth + 10, max_w);
_w = BSPF_min(50 * fontWidth + 10, max_w);
_h = BSPF_min(12 * (lineHeight + 4) + 10, max_h);
// The tab widget