More bugfixes as indicated by Coverity.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3235 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-12-06 18:12:17 +00:00
parent 9e23bc3580
commit 8b7043d74a
16 changed files with 157 additions and 142 deletions

View File

@ -189,8 +189,8 @@ void FBSurfaceSDL2::reload()
void FBSurfaceSDL2::resize(uInt32 width, uInt32 height)
{
// We will only resize when necessary, and not using static textures
if((myTexAccess == SDL_TEXTUREACCESS_STATIC) ||
(int(width) <= mySurface->w && int(height) <= mySurface->h))
if((myTexAccess == SDL_TEXTUREACCESS_STATIC) || (mySurface &&
int(width) <= mySurface->w && int(height) <= mySurface->h))
return; // don't need to resize at all
if(mySurface)

View File

@ -276,58 +276,10 @@ void FrameBufferSDL2::postFrameUpdate()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL2::setWindowIcon()
{
#ifndef BSPF_MAC_OSX // Currently not needed for OSX
#include "stella.xpm" // The Stella icon
#ifndef BSPF_MAC_OSX // Currently not needed for OSX
#include "stella_icon.hxx" // The Stella icon
// Set the window icon
uInt32 w, h, ncols, nbytes;
uInt32 rgba[256], icon[32 * 32];
uInt8 mask[32][4];
sscanf(stella_icon[0], "%2u %2u %2u %2u", &w, &h, &ncols, &nbytes);
if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1))
{
myOSystem.logMessage("ERROR: Couldn't load the application icon.", 0);
return;
}
for(uInt32 i = 0; i < ncols; i++)
{
uInt8 code;
char color[32];
uInt32 col;
sscanf(stella_icon[1 + i], "%c c %s", &code, color);
if(!strcmp(color, "None"))
col = 0x00000000;
else if(!strcmp(color, "black"))
col = 0xFF000000;
else if (color[0] == '#')
{
sscanf(color + 1, "%06x", &col);
col |= 0xFF000000;
}
else
{
myOSystem.logMessage("ERROR: Couldn't load the application icon.", 0);
return;
}
rgba[code] = col;
}
memset(mask, 0, sizeof(mask));
for(h = 0; h < 32; h++)
{
const char* line = stella_icon[1 + ncols + h];
for(w = 0; w < 32; w++)
{
icon[w + 32 * h] = rgba[int(line[w])];
if(rgba[int(line[w])] & 0xFF000000)
mask[h][w >> 3] |= 1 << (7 - (w & 0x07));
}
}
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(icon, 32, 32, 32,
SDL_Surface* surface = SDL_CreateRGBSurfaceFrom(stella_icon, 32, 32, 32,
32 * 4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000);
SDL_SetWindowIcon(myWindow, surface);
SDL_FreeSurface(surface);

View File

@ -145,7 +145,8 @@ class FrameBufferSDL2 : public FrameBuffer
@param h The requested height of the new surface.
@param data If non-null, use the given data values as a static surface
*/
unique_ptr<FBSurface> createSurface(uInt32 w, uInt32 h, const uInt32* data) const override;
unique_ptr<FBSurface> createSurface(uInt32 w, uInt32 h, const uInt32* data)
const override;
/**
Grabs or ungrabs the mouse based on the given boolean value.

View File

@ -22,7 +22,7 @@
#include <cstdlib>
#define STELLA_VERSION "4.6.7"
#define STELLA_VERSION "4.7_pre"
#define STELLA_BUILD atoi("$Rev$" + 6)
#endif

View File

@ -0,0 +1,66 @@
static uInt32 stella_icon[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000,
0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000,
0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000,
0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000,
0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000,
0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000,
0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000,
0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF,
0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x00000000,
0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000,
0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000,
0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000,
0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
};

View File

@ -831,7 +831,7 @@ string CartDebug::loadConfigFile()
{
// Skip leading space
int c = in.peek();
while(c == ' ' && c == '\t')
while(c == ' ' || c == '\t')
{
in.get();
c = in.peek();

View File

@ -203,8 +203,8 @@ int DebuggerParser::decipher_arg(const string& str)
}
if(arg.substr(0, 1) == "\\") {
bin = true;
dec = false;
bin = true;
arg.erase(0, 1);
} else if(arg.substr(0, 1) == "#") {
dec = true;
@ -216,11 +216,6 @@ int DebuggerParser::decipher_arg(const string& str)
arg.erase(0, 1);
}
// sanity check mutually exclusive options:
if(derefByte && derefWord) return -1;
if(lobyte && hibyte) return -1;
if(bin && dec) return -1;
// Special cases (registers):
const CpuState& state = static_cast<const CpuState&>(debugger.cpuDebug().getState());
if(arg == "a") result = state.A;
@ -1015,7 +1010,7 @@ void DebuggerParser::executeJump()
// The specific address we want may not exist (it may be part of a data section)
// If so, scroll backward a little until we find it
while(((line = debugger.cartDebug().addressToLine(address)) == -1) &&
((address & 0xFFF) >= 0))
(address >= 0))
address--;
if(line >= 0 && address >= 0)

View File

@ -634,9 +634,9 @@ void PromptWidget::killLastWord()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::addToHistory(const char *str)
void PromptWidget::addToHistory(const char* str)
{
strcpy(_history[_historyIndex], str);
strncpy(_history[_historyIndex], str, kLineBufferSize-1);
_historyIndex = (_historyIndex + 1) % kHistorySize;
_historyLine = 0;

View File

@ -36,8 +36,8 @@ class PromptWidget : public Widget, public CommandSender
virtual ~PromptWidget();
public:
int printf(const char *format, ...);
int vprintf(const char *format, va_list argptr);
int printf(const char* format, ...);
int vprintf(const char* format, va_list argptr);
void print(const string& str);
void printPrompt();
bool saveBuffer(string& filename);

View File

@ -196,7 +196,7 @@ cerr << "opened file: " << kvNameTable[i] << endl;
else
{
cerr << "opened file: " << "kvshared.wav" << endl;
fseek(mySampleFile, 45, SEEK_SET);
// fseek(mySampleFile, 45, SEEK_SET);
myFileOpened = true;
}
}
@ -232,9 +232,9 @@ void KidVid::setNextSong()
mySongCounter = ourSongStart[temp+1] - ourSongStart[temp];
if(mySharedData)
fseek(mySharedSampleFile, ourSongStart[temp], SEEK_SET);
; // fseek(mySharedSampleFile, ourSongStart[temp], SEEK_SET);
else
fseek(mySampleFile, ourSongStart[temp], SEEK_SET);
; // fseek(mySampleFile, ourSongStart[temp], SEEK_SET);
myFilePointer++;
myTapeBusy = true;
@ -250,10 +250,10 @@ void KidVid::setNextSong()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KidVid::getNextSampleByte()
{
#if 1
static int oddeven = 0;
// static int oddeven = 0;
if(mySongCounter == 0)
mySampleByte = 0x80;
#if 0
else
{
oddeven = oddeven^1;

View File

@ -90,7 +90,7 @@ class NullDevice : public Device
@return The byte at the specified address
*/
uInt8 peek(uInt16 address) override {
cerr << hex << "NullDevice: peek(" << address << ")\n";
cerr << "NullDevice: peek(" << address << ")\n";
return 0;
}
@ -103,7 +103,7 @@ class NullDevice : public Device
@return True if the poke changed the device address space, else false
*/
bool poke(uInt16 address, uInt8 value) override {
cerr << hex << "NullDevice: poke(" << address << "," << value << ")\n";
cerr << "NullDevice: poke(" << address << "," << value << ")\n";
return false;
}

View File

@ -42,13 +42,13 @@ void Properties::set(PropertyType key, const string& value)
if(key != LastPropType)
{
myProperties[key] = value;
if(BSPF_equalsIgnoreCase(myProperties[key], "AUTO-DETECT"))
myProperties[key] = "AUTO";
switch(key)
{
case Cartridge_Type:
case Display_Format:
if(BSPF_equalsIgnoreCase(myProperties[key], "AUTO-DETECT"))
myProperties[key] = "AUTO";
case Cartridge_Sound:
case Console_LeftDifficulty:
case Console_RightDifficulty:

View File

@ -50,40 +50,17 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
myFrameYStart(34),
myFrameHeight(210),
myMaximumNumberOfScanlines(262),
myStartScanline(0),
myColorLossEnabled(false),
myPartialFrameFlag(false),
myAutoFrameEnabled(false),
myFrameCounter(0),
myPALFrameCounter(0),
myBitsEnabled(true),
myCollisionsEnabled(true),
myJitterEnabled(false),
myNextFrameJitter(0),
myCurrentFrameJitter(0)
myStartScanline(0)
{
// Allocate buffers for two frame buffers
myCurrentFrameBuffer = new uInt8[160 * 320];
myPreviousFrameBuffer = new uInt8[160 * 320];
// Make sure all TIA bits are enabled
enableBits(true);
// Turn off debug colours (this also sets up the PriorityEncoder)
toggleFixedColors(0);
// Compute all of the mask tables
TIATables::computeAllTables();
// Zero audio registers
myAUDV0 = myAUDV1 = myAUDF0 = myAUDF1 = myAUDC0 = myAUDC1 = 0;
// Should undriven pins be randomly pulled high or low?
myTIAPinsDriven = mySettings.getBool("tiadriven");
// Enable scanline jittering
myJitterEnabled = mySettings.getBool("tv.jitter");
// Set initial state
initialize();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -94,61 +71,41 @@ TIA::~TIA()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::reset()
void TIA::initialize()
{
// Reset the sound device
mySound.reset();
myFramePointer = nullptr;
myFramePointerOffset = myFramePointerClocks = myStopDisplayOffset = 0;
// Currently no objects are enabled or selectively disabled
myEnabledObjects = 0;
myDisabledObjects = 0xFF;
myAllowHMOVEBlanks = true;
myClockWhenFrameStarted = myClockStartDisplay = myClockStopDisplay =
myClockAtLastUpdate = myClocksToEndOfScanLine = myVSYNCFinishClock = 0;
// Some default values for the registers
myVSYNC = myVBLANK = 0;
myNUSIZ0 = myNUSIZ1 = 0;
myScanlineCountForLastFrame = myStartScanline = 0;
myVSYNC = myVBLANK = myNUSIZ0 = myNUSIZ1 = 0;
myPlayfieldPriorityAndScore = myCTRLPF = 0;
myColor[P0Color] = myColor[P1Color] = myColor[PFColor] = myColor[BKColor] = 0;
myColor[M0Color] = myColor[M1Color] = myColor[BLColor] = myColor[HBLANKColor] = 0;
myColorPtr = nullptr;
myPlayfieldPriorityAndScore = 0;
myCTRLPF = 0;
myREFP0 = myREFP1 = false;
myPF = 0;
myGRP0 = myGRP1 = myDGRP0 = myDGRP1 = 0;
myGRP0 = myGRP1 = myDGRP0 = myDGRP1 = myCurrentGRP0 = myCurrentGRP1 = 0;
myENAM0 = myENAM1 = myENABL = myDENABL = false;
myHMP0 = myHMP1 = myHMM0 = myHMM1 = myHMBL = 0;
myVDELP0 = myVDELP1 = myVDELBL = myRESMP0 = myRESMP1 = false;
myCollision = 0;
myCollisionEnabledMask = 0xFFFFFFFF;
myPOSP0 = myPOSP1 = myPOSM0 = myPOSM1 = myPOSBL = 0;
// Some default values for the "current" variables
myCurrentGRP0 = 0;
myCurrentGRP1 = 0;
myMotionClockP0 = 0;
myMotionClockP1 = 0;
myMotionClockM0 = 0;
myMotionClockM1 = 0;
myMotionClockBL = 0;
myMotionClockP0 = myMotionClockP1 = myMotionClockM0 =
myMotionClockM1 = myMotionClockBL = 0;
myStartP0 = myStartP1 = myStartM0 = myStartM1 = 0;
mySuppressP0 = mySuppressP1 = 0;
myHMP0mmr = myHMP1mmr = myHMM0mmr = myHMM1mmr = myHMBLmmr = false;
myCurrentHMOVEPos = myPreviousHMOVEPos = 0x7FFFFFFF;
myHMOVEBlankEnabled = false;
enableBits(true);
myDumpEnabled = false;
myDumpDisabledCycle = 0;
myINPT4 = myINPT5 = 0x80;
myFrameCounter = myPALFrameCounter = 0;
myScanlineCountForLastFrame = 0;
myNextFrameJitter = myCurrentFrameJitter = 0;
myP0Mask = &TIATables::PxMask[0][0][0];
myP1Mask = &TIATables::PxMask[0][0][0];
myM0Mask = &TIATables::MxMask[0][0][0];
@ -156,9 +113,43 @@ void TIA::reset()
myBLMask = &TIATables::BLMask[0][0];
myPFMask = TIATables::PFMask[0];
// Recalculate the size of the display
myAUDV0 = myAUDV1 = myAUDF0 = myAUDF1 = myAUDC0 = myAUDC1 = 0;
myDumpEnabled = false;
myDumpDisabledCycle = 0;
myINPT4 = myINPT5 = 0x80;
myCurrentHMOVEPos = myPreviousHMOVEPos = 0x7FFFFFFF;
myHMOVEBlankEnabled = false;
myAllowHMOVEBlanks = true;
myTIAPinsDriven = mySettings.getBool("tiadriven");
myEnabledObjects = 0;
myDisabledObjects = 0xFF;
myColorLossEnabled = myPartialFrameFlag = myAutoFrameEnabled = false;
myFrameCounter = myPALFrameCounter = 0;
myFramerate = 60.0;
myBitsEnabled = myCollisionsEnabled = true;
myJitterEnabled = mySettings.getBool("tv.jitter");
myNextFrameJitter = myCurrentFrameJitter = 0;
// Make sure all TIA bits are enabled
enableBits(true);
// Turn off debug colours (this also sets up the PriorityEncoder)
toggleFixedColors(0);
frameReset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::reset()
{
initialize(); // Set initial state
mySound.reset(); // Reset the sound device
frameReset(); // Recalculate the size of the display
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -362,6 +362,9 @@ class TIA : public Device
*/
void enableCollisions(bool mode);
// Reset all instance variables to the initial state
void initialize();
// Update the current frame buffer to the specified color clock
void updateFrame(Int32 clock);

View File

@ -58,7 +58,14 @@ using namespace Common;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thumbulator::Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, bool traponfatal)
: rom(rom_ptr),
ram(ram_ptr)
ram(ram_ptr),
halfadd(0),
cpsr(0),
mamcr(0),
instructions(0),
fetches(0),
reads(0),
writes(0)
{
trapFatalErrors(traponfatal);
}

View File

@ -617,7 +617,7 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
case kTVModeChanged:
handleTVModeChange(NTSCFilter::Preset(myTVMode->getSelectedTag().toInt()));
break;
case kTVSharpChanged: myTVSharpLabel->setValue(myTVSharp->getValue());
break;
case kTVHueChanged: myTVHueLabel->setValue(myTVHue->getValue());