Added code to actually perform bounds checking on the TIA display

properties, and changed the lower bound on Display.Height (210).

Cleaned up some redundant TIA code.

Fixed crashes in RomInfoWidget caused by viewing images larger than the
allocated surface (now the remainder is simply not displayed).

Updated properties database for several ROMs (related to maximum height).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1613 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-01-12 01:07:29 +00:00
parent 8dc2f03ac3
commit 7800ae585d
6 changed files with 49 additions and 49 deletions

View File

@ -1024,7 +1024,7 @@
<tr>
<td><pre>-height &lt;number&gt;</pre></td>
<td>Set "Display.Height" property (100 - 256).</td>
<td>Set "Display.Height" property (210 - 256).</td>
</tr>
<tr>
@ -2522,7 +2522,7 @@ Ms Pac-Man (Stella extended codes):
<tr>
<td VALIGN="TOP"><i>Display.Height:</i></td>
<td>Indicates the number of scan-lines to display.
The value must be <i>n</i> such that 100 &lt;= <i>n</i> &lt;= 256.</td>
The value must be <i>n</i> such that 210 &lt;= <i>n</i> &lt;= 256.</td>
</tr>
<tr>

View File

@ -288,7 +288,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "152e55f88af3ff647e75a3070b7b6842", "", "", "Turmoil (1983) (Unknown) (Hack)", "", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "153f40e335e5cb90f5ce02e54934ab62", "Absolute Entertainment, Alex DeMeo", "EAZ-041-04I", "Title Match Pro Wrestling (1987) (Absolute) (PAL) [a]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "1542662f665d2ffaa77b4b897dd2e2af", "", "", "Starfield (V1.0) (2002) (MP)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "155fa7f479dcba3b10b1494e236d6010", "", "", "Tomcat - The F-14 Flight Simulator (2002) (Skyworks)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "155fa7f479dcba3b10b1494e236d6010", "Skyworks", "", "Tomcat (2002) (Skyworks) (PAL)", "AKA The F-14 Flight Simulator", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "157356f80c709ab675961d8b8b207e20", "", "", "Multi-Sprite Game V2.5 (Piero Cavina) (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "157bddb7192754a45372be196797f284", "Atari, Warren Robinett - Sears", "CX2613, 49-75154", "Adventure (1980) (Atari)", "", "Common", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "159e5cd6ccb968015f49aed5adbc91eb", "Justin J. Scott", "", "Yar's Defeat (2002) (Justin J. Scott) (Hack)", "Hack of Yars' Revenge", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" },
@ -392,7 +392,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "1e587ca91518a47753a28217cd4fd586", "Telesys, Jim Rupp, Jack Woodman", "1001", "Coco Nuts (1982) (Telesys)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "1e750000af77cc76232f4d040f4ab060", "Jone Yuan Telephonic Enterprise Co", "", "Raft Rider (Jone Yuan)", "2600 Screen Search Console", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "1e85f8bccb4b866d4daa9fcf89306474", "Atari, Tod Frye", "CX26122", "Sinistar (02-13-1984) (Atari) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "1e89f722494608d6ea15a00d99f81337", "", "", "River Raid (Unknown) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "1e89f722494608d6ea15a00d99f81337", "", "", "River Raid (Unknown) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "NTSC50", "", "", "", "", "" },
{ "1ea1abcd2d3d3d628f59a99a9d41b13b", "Jone Yuan Telephonic Enterprise Co", "", "Stampede (Jone Yuan) (Hack)", "2600 Screen Search Console", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "1ec57bbd27bdbd08b60c391c4895c1cf", "Atari, Jerome Domurat, Howard Scott Warshaw", "CX26119", "Saboteur (09-02-1983) (Atari) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "1ec5bef77b91e59313cba205f15b06d7", "", "", "Overhead Adventure Demo 1 (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "64", "", "", "", "" },
@ -1784,7 +1784,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "8a8e401369e2b63a13e18a4d685387c6", "Activision, David Crane - Ariola", "EAG-008, PAG-008, EAG-008-04I - 711 008-720", "Laser Blast (1981) (Activision) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "8a9d874a38608964f33ec0c35cab618d", "Chris Cracknell", "", "Rescue Bira Bira (Chris Cracknell)", "Hack of Jungle Fever", "Hack", "", "", "", "", "", "", "", "", "", "", "20", "230", "YES", "", "" },
{ "8a9d953ac3db52a313a90d6a9b139c76", "", "", "Hangman Invader Biglist3 (Hack)", "Hack of Hangman", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "8aad33da907bed78b76b87fceaa838c1", "Atari, Larry Kaplan", "CX26163P", "Air-Sea Battle (32 in 1) (1988) (Atari) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "260", "", "", "" },
{ "8aad33da907bed78b76b87fceaa838c1", "Atari, Larry Kaplan", "CX26163P", "Air-Sea Battle (32 in 1) (1988) (Atari) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "40", "256", "", "", "" },
{ "8ac18076d01a6b63acf6e2cab4968940", "Atari, Dan Hitchens", "CX2685", "Gravitar (04-08-1983) (Atari) (Prototype)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "8ae7809702b7d618e45daa2ddb0ece26", "", "", "Greeting Cart Blue-Ribbon Award(PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "8af58a9b90b25907da0251ec0facf3b8", "Jone Yuan Telephonic Enterprise Co", "", "Cosmic Swarm (Jone Yuan)", "2600 Screen Search Console", "", "", "", "", "", "", "", "", "", "", "", "30", "", "", "", "" },
@ -2623,7 +2623,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "d1a1841b7f2007a24439ac248374630a", "Starpath Corporation, Dennis Caswell", "AR-4200", "Escape from the Mindmaster (1 of 4) (1982) (Starpath)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "d1a9478b99d6a55e13a9fd4262da7cd4", "U.S. Games Corporation, Garry Kitchen - Vidtec", "VC1001", "Space Jockey (1982) (U.S. Games) (4K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "d1b4075925e8d3031a7616d2f02fdd1f", "", "", "Demo Image Series #7 - Two Marios (27-02-2003) (AD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "d1c3520b57c348bc21d543699bc88e7e", "Gameworld", "133-002", "Warplock (1983) (Gameworld) (PAL)", "Uses the Paddle Controllers", "", "", "", "", "", "", "", "PADDLES", "PADDLES", "", "", "", "", "", "", "" },
{ "d1c3520b57c348bc21d543699bc88e7e", "Gameworld", "133-002", "Warplock (1983) (Gameworld) (PAL)", "Uses the Paddle Controllers", "", "", "", "", "", "", "", "PADDLES", "PADDLES", "", "", "", "", "YES", "", "" },
{ "d1d704a7146e95709b57b6d4cac3f788", "Atari, Warren Robinett", "CX26163P", "Slot Racers (32 in 1) (1988) (Atari) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "d20e61c86ed729780feca162166912ca", "Supergame", "32", "Pitfall (1984) (Supergame)", "AKA Pitfall!", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "d223bc6f13358642f02ddacfaf4a90c9", "Rainbow Vision - Suntek", "SS-003", "Pac-Kong (Rainbow Vision) (PAL)", "AKA Spider Kong", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },

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.97 2009-01-11 15:01:36 stephena Exp $
// $Id: TIA.cxx,v 1.98 2009-01-12 01:07:29 stephena Exp $
//============================================================================
//#define DEBUG_HMOVE
@ -225,12 +225,19 @@ void TIA::frameReset()
// Reset pixel pointer and drawing flag
myFramePointer = myCurrentFrameBuffer;
myYStart = atoi(myConsole.properties().get(Display_YStart).c_str());
myHeight = atoi(myConsole.properties().get(Display_Height).c_str());
// Make sure all these are within bounds
myFrameXStart = 0; // Hardcoded in preparation for new TIA class
myFrameWidth = 160; // Hardcoded in preparation for new TIA class
myFrameYStart = atoi(myConsole.properties().get(Display_YStart).c_str());
if(myFrameYStart < 0) myFrameYStart = 0;
if(myFrameYStart > 64) myFrameYStart = 64;
myFrameHeight = atoi(myConsole.properties().get(Display_Height).c_str());
if(myFrameHeight < 210) myFrameHeight = 210;
if(myFrameHeight > 256) myFrameHeight = 256;
// Calculate color clock offsets for starting and stoping frame drawing
myStartDisplayOffset = 228 * myYStart;
myStopDisplayOffset = myStartDisplayOffset + 228 * myHeight;
myStartDisplayOffset = 228 * myFrameYStart;
myStopDisplayOffset = myStartDisplayOffset + 228 * myFrameHeight;
// Reasonable values to start and stop the current frame drawing
myClockWhenFrameStarted = mySystem->cycles() * 3;
@ -241,19 +248,6 @@ void TIA::frameReset()
myVSYNCFinishClock = 0x7FFFFFFF;
myScanlineCountForLastFrame = 0;
myCurrentScanline = 0;
myFrameXStart = 0; // Hardcoded in preparation for new TIA class
myFrameWidth = 160; // Hardcoded in preparation for new TIA class
myFrameYStart = atoi(myConsole.properties().get(Display_YStart).c_str());
myFrameHeight = atoi(myConsole.properties().get(Display_Height).c_str());
// Make sure the height value is reasonable, because we need a certain
// minimum amount of space for the onscreen GUI
if(myFrameHeight < 210)
{
// Values are illegal so reset to default values
myFrameHeight = 210;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1962,16 +1956,18 @@ inline void TIA::waitHorizontalSync()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::greyOutFrame()
{
unsigned int c = scanlines();
if(c < myYStart) c = myYStart;
for(unsigned int s = c; s < (myHeight + myYStart); s++)
for(unsigned int i = 0; i < 160; i++) {
uInt8 tmp = myCurrentFrameBuffer[ (s - myYStart) * 160 + i] & 0x0f;
tmp >>= 1;
myCurrentFrameBuffer[ (s - myYStart) * 160 + i] = tmp;
}
uInt32 c = scanlines();
if(c < myFrameYStart) c = myFrameYStart;
for(uInt32 s = c; s < (myFrameHeight + myFrameYStart); ++s)
{
for(uInt32 i = 0; i < 160; ++i)
{
uInt8 tmp = myCurrentFrameBuffer[ (s - myFrameYStart) * 160 + i] & 0x0f;
tmp >>= 1;
myCurrentFrameBuffer[ (s - myFrameYStart) * 160 + i] = tmp;
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.hxx,v 1.48 2009-01-01 18:13:37 stephena Exp $
// $Id: TIA.hxx,v 1.49 2009-01-12 01:07:29 stephena Exp $
//============================================================================
#ifndef TIA_HXX
@ -40,7 +40,7 @@ class Settings;
be displayed on screen.
@author Bradford W. Mott
@version $Id: TIA.hxx,v 1.48 2009-01-01 18:13:37 stephena Exp $
@version $Id: TIA.hxx,v 1.49 2009-01-12 01:07:29 stephena Exp $
*/
class TIA : public Device , public MediaSource
{
@ -339,14 +339,6 @@ class TIA : public Device , public MediaSource
// Indicates the height of the frame in scanlines
uInt32 myFrameHeight;
private:
// Indicates offset in scanlines when display should begin
// (aka the Display.YStart property)
uInt32 myYStart;
// Height of display (aka Display.Height)
uInt32 myHeight;
// Indicates offset in color clocks when display should begin
uInt32 myStartDisplayOffset;

View File

@ -1557,7 +1557,9 @@
""
"Cartridge.MD5" "155fa7f479dcba3b10b1494e236d6010"
"Cartridge.Name" "Tomcat - The F-14 Flight Simulator (2002) (Skyworks)"
"Cartridge.Manufacturer" "Skyworks"
"Cartridge.Name" "Tomcat (2002) (Skyworks) (PAL)"
"Cartridge.Note" "AKA The F-14 Flight Simulator"
""
"Cartridge.MD5" "171cd6b55267573e6a9c2921fb720794"
@ -2146,6 +2148,7 @@
"Cartridge.MD5" "1e89f722494608d6ea15a00d99f81337"
"Cartridge.Name" "River Raid (Unknown) (PAL)"
"Display.Format" "NTSC50"
""
"Cartridge.MD5" "1e85f8bccb4b866d4daa9fcf89306474"
@ -9085,7 +9088,8 @@
"Cartridge.Manufacturer" "Atari, Larry Kaplan"
"Cartridge.ModelNo" "CX26163P"
"Cartridge.Name" "Air-Sea Battle (32 in 1) (1988) (Atari) (PAL)"
"Display.Height" "260"
"Display.YStart" "40"
"Display.Height" "256"
""
"Cartridge.MD5" "89a68746eff7f266bbf08de2483abe55"
@ -14427,6 +14431,7 @@
"Cartridge.Note" "Uses the Paddle Controllers"
"Controller.Left" "PADDLES"
"Controller.Right" "PADDLES"
"Display.Phosphor" "YES"
""
"Cartridge.MD5" "d28afe0517a046265c418181fa9dd9a1"

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: RomInfoWidget.cxx,v 1.15 2009-01-04 22:27:44 stephena Exp $
// $Id: RomInfoWidget.cxx,v 1.16 2009-01-12 01:07:29 stephena Exp $
//============================================================================
#include <cstring>
@ -96,8 +96,10 @@ void RomInfoWidget::parseProperties()
mySurface = instance().frameBuffer().surface(mySurfaceID);
if(mySurface == NULL)
{
// For some reason, we need to allocate a buffer slightly higher than
// the maximum that Stella can generate
mySurfaceID = instance().frameBuffer().allocateSurface(
320*myZoomLevel, 260*myZoomLevel, false);
320*myZoomLevel, 257*myZoomLevel, false);
mySurface = instance().frameBuffer().surface(mySurfaceID);
}
@ -277,11 +279,13 @@ bool RomInfoWidget::parseIDATChunk(FBSurface* surface, int width, int height,
// The following calculation will work up to approx. 16x zoom level,
// but since Stella only generates snapshots at up to 10x, we should
// be fine for a while ...
uInt32 izoom = int(ceil(width/320.0));
uInt32 izoom = uInt32(ceil(width/320.0));
// Set the surface size
uInt32 sw = width / izoom * myZoomLevel,
sh = height / izoom * myZoomLevel;
sw = BSPF_min(sw, myZoomLevel * 320u);
sh = BSPF_min(sh, myZoomLevel * 256u);
mySurface->setWidth(sw);
mySurface->setHeight(sh);
@ -290,7 +294,7 @@ bool RomInfoWidget::parseIDATChunk(FBSurface* surface, int width, int height,
spitch = sw * 3; // bytes per line of the surface/line
uLongf bufsize = ipitch * height;
uInt8* buffer = new uInt8[bufsize];
uInt32* line = new uInt32[spitch + 3]; // few extra bytes for rounding issues
uInt32* line = new uInt32[ipitch];
if(uncompress(buffer, &bufsize, data, size) == Z_OK)
{
@ -299,6 +303,9 @@ bool RomInfoWidget::parseIDATChunk(FBSurface* surface, int width, int height,
uInt32 i_offset = 3 * izoom;
uInt32 srow = 0;
// We can only scan at most izoom*256 lines
height = BSPF_min(uInt32(height), izoom*256u);
// Grab each non-duplicate row of data from the image
for(int irow = 0; irow < height; irow += izoom, buf_ptr += buf_offset)
{