mirror of https://github.com/stella-emu/stella.git
Fixed bug/crash with attempting to create a Console if the ROM image
dimensions are larger than the current screen. In the process, this restructuring will allow messages to be shown in states other than emulation mode. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1047 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
fcc001964e
commit
7606af4b3a
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Console.cxx,v 1.84 2006-03-05 01:18:41 stephena Exp $
|
// $Id: Console.cxx,v 1.85 2006-03-15 23:14:01 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -87,6 +87,17 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5,
|
||||||
if(myProperties.get(Display_Height) == "210")
|
if(myProperties.get(Display_Height) == "210")
|
||||||
myProperties.set(Display_Height, "250");
|
myProperties.set(Display_Height, "250");
|
||||||
|
|
||||||
|
// Make sure this ROM can fit in the screen dimensions
|
||||||
|
int sWidth, sHeight, iWidth, iHeight;
|
||||||
|
myOSystem->getScreenDimensions(sWidth, sHeight);
|
||||||
|
iWidth = atoi(myProperties.get(Display_Width).c_str()) << 1;
|
||||||
|
iHeight = atoi(myProperties.get(Display_Height).c_str());
|
||||||
|
if(iWidth > sWidth || iHeight > sHeight)
|
||||||
|
{
|
||||||
|
myOSystem->frameBuffer().showMessage("ROM image dimensions larger than screen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup the controllers based on properties
|
// Setup the controllers based on properties
|
||||||
string left = myProperties.get(Controller_Left);
|
string left = myProperties.get(Controller_Left);
|
||||||
string right = myProperties.get(Controller_Right);
|
string right = myProperties.get(Controller_Right);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: EventHandler.cxx,v 1.152 2006-03-05 01:18:42 stephena Exp $
|
// $Id: EventHandler.cxx,v 1.153 2006-03-15 23:14:01 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -194,7 +194,7 @@ void EventHandler::refreshDisplay()
|
||||||
switch(myState)
|
switch(myState)
|
||||||
{
|
{
|
||||||
case S_EMULATE:
|
case S_EMULATE:
|
||||||
myOSystem->frameBuffer().refresh();
|
myOSystem->frameBuffer().refresh(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_MENU:
|
case S_MENU:
|
||||||
|
@ -208,6 +208,8 @@ void EventHandler::refreshDisplay()
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cerr << " ==> State change = " << myState << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBuffer.cxx,v 1.79 2006-03-06 15:42:26 stephena Exp $
|
// $Id: FrameBuffer.cxx,v 1.80 2006-03-15 23:14:01 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -176,6 +176,7 @@ void FrameBuffer::update()
|
||||||
// Draw any pending messages
|
// Draw any pending messages
|
||||||
if(myMessageTime > 0 && !myPauseStatus)
|
if(myMessageTime > 0 && !myPauseStatus)
|
||||||
drawMessage();
|
drawMessage();
|
||||||
|
|
||||||
break; // S_EMULATE
|
break; // S_EMULATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,6 +207,11 @@ void FrameBuffer::update()
|
||||||
case EventHandler::S_LAUNCHER:
|
case EventHandler::S_LAUNCHER:
|
||||||
{
|
{
|
||||||
myOSystem->launcher().draw();
|
myOSystem->launcher().draw();
|
||||||
|
|
||||||
|
// Draw any pending messages
|
||||||
|
if(myMessageTime > 0)
|
||||||
|
drawMessage();
|
||||||
|
|
||||||
break; // S_LAUNCHER
|
break; // S_LAUNCHER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +238,6 @@ void FrameBuffer::update()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBuffer::refresh(bool now)
|
void FrameBuffer::refresh(bool now)
|
||||||
{
|
{
|
||||||
// cerr << "refreshTIA() " << myNumRedraws++ << endl;
|
|
||||||
theRedrawTIAIndicator = true;
|
theRedrawTIAIndicator = true;
|
||||||
if(now)
|
if(now)
|
||||||
{
|
{
|
||||||
|
@ -248,7 +253,7 @@ void FrameBuffer::showMessage(const string& message)
|
||||||
if(myMessageTime > 0)
|
if(myMessageTime > 0)
|
||||||
{
|
{
|
||||||
theRedrawTIAIndicator = true;
|
theRedrawTIAIndicator = true;
|
||||||
drawMediaSource();
|
myOSystem->eventHandler().refreshDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
myMessageText = message;
|
myMessageText = message;
|
||||||
|
@ -260,7 +265,7 @@ void FrameBuffer::hideMessage()
|
||||||
{
|
{
|
||||||
// Erase old messages on the screen
|
// Erase old messages on the screen
|
||||||
if(myMessageTime > 0)
|
if(myMessageTime > 0)
|
||||||
refresh(true);
|
myOSystem->eventHandler().refreshDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -533,10 +538,7 @@ inline void FrameBuffer::drawMessage()
|
||||||
// Either erase the entire message (when time is reached),
|
// Either erase the entire message (when time is reached),
|
||||||
// or show again this frame
|
// or show again this frame
|
||||||
if(myMessageTime == 0)
|
if(myMessageTime == 0)
|
||||||
{
|
myOSystem->eventHandler().refreshDisplay();
|
||||||
theRedrawTIAIndicator = true;
|
|
||||||
drawMediaSource();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
addDirtyRect(x, y, w, h);
|
addDirtyRect(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue