mirror of https://github.com/stella-emu/stella.git
First pass at the new RomInfoWidget. This widget shows a snapshot
and some game properties for the currently selected ROM in the ROM launcher. There's still much work to do, but so far it's working quite well. Software mode support isn't completed yet. Beginnings of new filename semantics. For the next release, snapshot files (PNG) and state files (stx) will be named 'Cart_Name.Cart_MD5.ext'. However, for backward compatibility, the filenames 'Cart_Name.ext' and 'Cart_MD5.ext' will also be used, if present. Added 'romviewer' commandline argument, which activates the new ROM info viewer. Stella will have to be restarted for this to take effect. Still TODO is add ability to toggle this from the UI. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1363 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
3dbe104c3f
commit
352954e633
|
@ -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.88 2007-08-21 17:58:25 stephena Exp $
|
||||
// $Id: FrameBufferGL.cxx,v 1.89 2007-09-01 23:31:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef DISPLAY_OPENGL
|
||||
|
@ -577,6 +577,27 @@ void FrameBufferGL::drawBitmap(uInt32* bitmap, Int32 tx, Int32 ty,
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferGL::drawSurface(SDL_Surface* surface, Int32 x, Int32 y)
|
||||
{
|
||||
SDL_Rect clip;
|
||||
clip.x = x;
|
||||
clip.y = y;
|
||||
|
||||
SDL_BlitSurface(surface, 0, myTexture, &clip);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferGL::convertToSurface(SDL_Surface* surface, int row,
|
||||
uInt8* data, int rowsize) const
|
||||
{
|
||||
uInt16* pixels = (uInt16*) surface->pixels;
|
||||
pixels += (row * surface->pitch/2);
|
||||
|
||||
for(int c = 0; c < rowsize; c += 3)
|
||||
*pixels++ = SDL_MapRGB(surface->format, data[c], data[c+1], data[c+2]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferGL::translateCoords(Int32& x, Int32& y)
|
||||
{
|
||||
|
@ -700,6 +721,17 @@ bool FrameBufferGL::createTextures()
|
|||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SDL_Surface* FrameBufferGL::cloneSurface(int width, int height)
|
||||
{
|
||||
SDL_PixelFormat* fmt = myTexture->format;
|
||||
SDL_Surface* surface =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 16,
|
||||
fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool FrameBufferGL::myFuncsLoaded = false;
|
||||
|
||||
|
|
|
@ -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.45 2007-08-21 17:58:25 stephena Exp $
|
||||
// $Id: FrameBufferGL.hxx,v 1.46 2007-09-01 23:31:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_GL_HXX
|
||||
|
@ -36,7 +36,7 @@ class GUI::Font;
|
|||
This class implements an SDL OpenGL framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferGL.hxx,v 1.45 2007-08-21 17:58:25 stephena Exp $
|
||||
@version $Id: FrameBufferGL.hxx,v 1.46 2007-09-01 23:31:18 stephena Exp $
|
||||
*/
|
||||
class FrameBufferGL : public FrameBuffer
|
||||
{
|
||||
|
@ -126,6 +126,15 @@ class FrameBufferGL : public FrameBuffer
|
|||
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b)
|
||||
{ return SDL_MapRGB(myTexture->format, r, g, b); }
|
||||
|
||||
/**
|
||||
This method is called to create a surface compatible with the one
|
||||
currently in use, but having the given dimensions.
|
||||
|
||||
@param width The requested width of the new surface.
|
||||
@param height The requested height of the new surface.
|
||||
*/
|
||||
virtual SDL_Surface* cloneSurface(int width, int height);
|
||||
|
||||
/**
|
||||
This method is called to draw a horizontal line.
|
||||
|
||||
|
@ -182,6 +191,27 @@ class FrameBufferGL : public FrameBuffer
|
|||
virtual void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color,
|
||||
Int32 h = 8);
|
||||
|
||||
/**
|
||||
This method should be called to draw an SDL surface.
|
||||
|
||||
@param surface The data to draw
|
||||
@param x The x coordinate
|
||||
@param y The y coordinate
|
||||
*/
|
||||
virtual void drawSurface(SDL_Surface* surface, Int32 x, Int32 y);
|
||||
|
||||
/**
|
||||
This method should be called to convert and copy a given row of RGB
|
||||
data into an SDL surface.
|
||||
|
||||
@param surface The data to draw
|
||||
@param row The row of the surface the data should be placed in
|
||||
@param data The data in uInt8 R/G/B format
|
||||
@param rowsize The number of R/G/B triples in a data row
|
||||
*/
|
||||
virtual void convertToSurface(SDL_Surface* surface, int row,
|
||||
uInt8* data, int rowsize) const;
|
||||
|
||||
/**
|
||||
This method translates the given coordinates to their
|
||||
unzoomed/unscaled equivalents.
|
||||
|
|
|
@ -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.71 2007-06-20 16:33:22 stephena Exp $
|
||||
// $Id: FrameBufferSoft.cxx,v 1.72 2007-09-01 23:31:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -108,8 +108,8 @@ bool FrameBufferSoft::setVidMode(VideoMode mode)
|
|||
cerr << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl;
|
||||
return false;
|
||||
}
|
||||
myBytesPerPixel = myScreen->format->BytesPerPixel;
|
||||
myFormat = myScreen->format;
|
||||
myBytesPerPixel = myFormat->BytesPerPixel;
|
||||
|
||||
// Make sure drawMediaSource() knows which renderer to use
|
||||
stateChanged(myOSystem->eventHandler().state());
|
||||
|
@ -635,6 +635,22 @@ void FrameBufferSoft::drawBitmap(uInt32* bitmap, Int32 xorig, Int32 yorig,
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSoft::drawSurface(SDL_Surface* surface, Int32 x, Int32 y)
|
||||
{
|
||||
SDL_Rect clip;
|
||||
clip.x = x;
|
||||
clip.y = y;
|
||||
|
||||
SDL_BlitSurface(surface, 0, myScreen, &clip);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSoft::convertToSurface(SDL_Surface* surface, int row,
|
||||
uInt8* data, int rowsize) const
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSoft::translateCoords(Int32& x, Int32& y)
|
||||
{
|
||||
|
@ -709,3 +725,14 @@ void FrameBufferSoft::stateChanged(EventHandler::State state)
|
|||
// Have the changes take effect
|
||||
myOSystem->eventHandler().refreshDisplay();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SDL_Surface* FrameBufferSoft::cloneSurface(int width, int height)
|
||||
{
|
||||
SDL_Surface* surface =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, myBytesPerPixel << 3,
|
||||
myFormat->Rmask, myFormat->Gmask, myFormat->Bmask,
|
||||
myFormat->Amask);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
|
|
@ -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.46 2007-06-20 16:33:22 stephena Exp $
|
||||
// $Id: FrameBufferSoft.hxx,v 1.47 2007-09-01 23:31:18 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.46 2007-06-20 16:33:22 stephena Exp $
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.47 2007-09-01 23:31:18 stephena Exp $
|
||||
*/
|
||||
class FrameBufferSoft : public FrameBuffer
|
||||
{
|
||||
|
@ -114,6 +114,15 @@ class FrameBufferSoft : public FrameBuffer
|
|||
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b)
|
||||
{ return SDL_MapRGB(myScreen->format, r, g, b); }
|
||||
|
||||
/**
|
||||
This method is called to create a surface compatible with the one
|
||||
currently in use, but having the given dimensions.
|
||||
|
||||
@param width The requested width of the new surface.
|
||||
@param height The requested height of the new surface.
|
||||
*/
|
||||
virtual SDL_Surface* cloneSurface(int width, int height);
|
||||
|
||||
/**
|
||||
This method is called to draw a horizontal line.
|
||||
|
||||
|
@ -170,6 +179,27 @@ class FrameBufferSoft : public FrameBuffer
|
|||
virtual void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color,
|
||||
Int32 h = 8);
|
||||
|
||||
/**
|
||||
This method should be called to draw an SDL surface.
|
||||
|
||||
@param surface The data to draw
|
||||
@param x The x coordinate
|
||||
@param y The y coordinate
|
||||
*/
|
||||
virtual void drawSurface(SDL_Surface* surface, Int32 x, Int32 y);
|
||||
|
||||
/**
|
||||
This method should be called to convert and copy a given row of RGB
|
||||
data into an SDL surface.
|
||||
|
||||
@param surface The data to draw
|
||||
@param row The row of the surface the data should be placed in
|
||||
@param data The data in uInt8 R/G/B format
|
||||
@param rowsize The number of R/G/B triples in a data row
|
||||
*/
|
||||
virtual void convertToSurface(SDL_Surface* surface, int row,
|
||||
uInt8* data, int rowsize) const;
|
||||
|
||||
/**
|
||||
This method translates the given coordinates to their
|
||||
unzoomed/unscaled equivalents.
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Version.hxx,v 1.29 2007-08-27 13:58:41 stephena Exp $
|
||||
// $Id: Version.hxx,v 1.30 2007-09-01 23:31:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef VERSION_HXX
|
||||
#define VERSION_HXX
|
||||
|
||||
#define STELLA_BASE_VERSION "2.4.1"
|
||||
#define STELLA_BASE_VERSION "2.5_cvs"
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
#define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD
|
||||
|
|
|
@ -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.90 2007-08-15 17:43:51 stephena Exp $
|
||||
// $Id: FrameBuffer.hxx,v 1.91 2007-09-01 23:31:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_HXX
|
||||
|
@ -100,7 +100,7 @@ enum {
|
|||
All GUI elements (ala ScummVM) are drawn here as well.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBuffer.hxx,v 1.90 2007-08-15 17:43:51 stephena Exp $
|
||||
@version $Id: FrameBuffer.hxx,v 1.91 2007-09-01 23:31:18 stephena Exp $
|
||||
*/
|
||||
class FrameBuffer
|
||||
{
|
||||
|
@ -368,6 +368,27 @@ class FrameBuffer
|
|||
virtual void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color,
|
||||
Int32 h = 8) = 0;
|
||||
|
||||
/**
|
||||
This method should be called to draw an SDL surface.
|
||||
|
||||
@param surface The data to draw
|
||||
@param x The x coordinate
|
||||
@param y The y coordinate
|
||||
*/
|
||||
virtual void drawSurface(SDL_Surface* surface, Int32 x, Int32 y) = 0;
|
||||
|
||||
/**
|
||||
This method should be called to convert and copy a given row of RGB
|
||||
data into an SDL surface.
|
||||
|
||||
@param surface The data to draw
|
||||
@param row The row of the surface the data should be placed in
|
||||
@param data The data in uInt8 R/G/B format
|
||||
@param rowsize The number of R/G/B triples in a data row
|
||||
*/
|
||||
virtual void convertToSurface(SDL_Surface* surface, int row,
|
||||
uInt8* data, int rowsize) const = 0;
|
||||
|
||||
/**
|
||||
This method should be called to translate the given coordinates
|
||||
to their unzoomed/unscaled equivalents.
|
||||
|
@ -393,6 +414,24 @@ class FrameBuffer
|
|||
*/
|
||||
virtual void enablePhosphor(bool enable, int blend) = 0;
|
||||
|
||||
/**
|
||||
This method is called to map a given r,g,b triple to the screen palette.
|
||||
|
||||
@param r The red component of the color.
|
||||
@param g The green component of the color.
|
||||
@param b The blue component of the color.
|
||||
*/
|
||||
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b) = 0;
|
||||
|
||||
/**
|
||||
This method is called to create a surface compatible with the one
|
||||
currently in use, but having the given dimensions.
|
||||
|
||||
@param width The requested width of the new surface.
|
||||
@param height The requested height of the new surface.
|
||||
*/
|
||||
virtual SDL_Surface* cloneSurface(int width, int height) = 0;
|
||||
|
||||
/**
|
||||
This method is called to query the type of the FrameBuffer.
|
||||
*/
|
||||
|
@ -433,15 +472,6 @@ class FrameBuffer
|
|||
*/
|
||||
virtual void postFrameUpdate() = 0;
|
||||
|
||||
/**
|
||||
This method is called to map a given r,g,b triple to the screen palette.
|
||||
|
||||
@param r The red component of the color.
|
||||
@param g The green component of the color.
|
||||
@param b The blue component of the color.
|
||||
*/
|
||||
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b) = 0;
|
||||
|
||||
/**
|
||||
This method is called to provide information about the FrameBuffer.
|
||||
*/
|
||||
|
|
|
@ -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: OSystem.cxx,v 1.108 2007-08-17 16:12:50 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.109 2007-09-01 23:31:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -309,6 +309,28 @@ bool OSystem::createFrameBuffer(bool showmessage)
|
|||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string OSystem::getFilename(const string& path, const Properties& props,
|
||||
const string& ext) const
|
||||
{
|
||||
const string& full_name =
|
||||
path + BSPF_PATH_SEPARATOR + props.get(Cartridge_Name) + "." +
|
||||
props.get(Cartridge_MD5) + "." + ext;
|
||||
const string& rom_name =
|
||||
path + BSPF_PATH_SEPARATOR + props.get(Cartridge_Name) + "." + ext;
|
||||
const string& md5_name =
|
||||
path + BSPF_PATH_SEPARATOR + props.get(Cartridge_MD5) + "." + ext;
|
||||
|
||||
if(FilesystemNode::fileExists(full_name))
|
||||
return full_name;
|
||||
else if(FilesystemNode::fileExists(rom_name))
|
||||
return rom_name;
|
||||
else if(FilesystemNode::fileExists(md5_name))
|
||||
return md5_name;
|
||||
else
|
||||
return EmptyString;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::toggleFrameBuffer()
|
||||
{
|
||||
|
@ -344,7 +366,7 @@ void OSystem::createSound()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool OSystem::createConsole(const string& romfile)
|
||||
bool OSystem::createConsole(const string& romfile, const string& md5sum)
|
||||
{
|
||||
// Do a little error checking; it shouldn't be necessary
|
||||
if(myConsole) deleteConsole();
|
||||
|
@ -367,7 +389,7 @@ bool OSystem::createConsole(const string& romfile)
|
|||
// Open the cartridge image and read it in
|
||||
uInt8* image;
|
||||
int size = -1;
|
||||
string md5;
|
||||
string md5 = md5sum;
|
||||
if(openROM(myRomFile, md5, &image, &size))
|
||||
{
|
||||
// Get all required info for creating a valid console
|
||||
|
@ -528,7 +550,9 @@ bool OSystem::openROM(const string& rom, string& md5, uInt8** image, int* size)
|
|||
|
||||
// If we get to this point, we know we have a valid file to open
|
||||
// Now we make sure that the file has a valid properties entry
|
||||
md5 = MD5(*image, *size);
|
||||
// To save time, only generate an MD5 if we really need one
|
||||
if(md5 == "")
|
||||
md5 = MD5(*image, *size);
|
||||
|
||||
// Some games may not have a name, since there may not
|
||||
// be an entry in stella.pro. In that case, we use the rom name
|
||||
|
@ -596,7 +620,6 @@ bool OSystem::queryConsoleInfo(const uInt8* image, uInt32 size,
|
|||
string s;
|
||||
myPropSet->getMD5(md5, props);
|
||||
|
||||
|
||||
s = mySettings->getString("type");
|
||||
if(s != "") props.set(Cartridge_Type, s);
|
||||
s = mySettings->getString("channels");
|
||||
|
|
|
@ -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: OSystem.hxx,v 1.55 2007-08-12 23:05:12 stephena Exp $
|
||||
// $Id: OSystem.hxx,v 1.56 2007-09-01 23:31:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef OSYSTEM_HXX
|
||||
|
@ -35,6 +35,7 @@ class VideoDialog;
|
|||
#include "Settings.hxx"
|
||||
#include "Console.hxx"
|
||||
#include "Font.hxx"
|
||||
#include "StringList.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
|
@ -51,7 +52,7 @@ typedef Common::Array<Resolution> ResolutionList;
|
|||
other objects belong.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: OSystem.hxx,v 1.55 2007-08-12 23:05:12 stephena Exp $
|
||||
@version $Id: OSystem.hxx,v 1.56 2007-09-01 23:31:18 stephena Exp $
|
||||
*/
|
||||
class OSystem
|
||||
{
|
||||
|
@ -278,6 +279,23 @@ class OSystem
|
|||
*/
|
||||
const string& romFile() const { return myRomFile; }
|
||||
|
||||
/**
|
||||
Determines a valid filename for the given properties and extension.
|
||||
Currently, there are three possibilities, in order of precedence:
|
||||
|
||||
Cart_Name.Cart_MD5.ext
|
||||
Cart_Name.ext
|
||||
Cart_MD5.ext
|
||||
|
||||
@param path The full path to prepend to the filename
|
||||
@param props The ROM properties for the given ROM
|
||||
@param ext The extension to append to the filename
|
||||
|
||||
@return A valid file (which exists), or the empty string
|
||||
*/
|
||||
string getFilename(const string& path, const Properties& props,
|
||||
const string& ext) const;
|
||||
|
||||
/**
|
||||
Switches between software and OpenGL framebuffer modes.
|
||||
*/
|
||||
|
@ -287,9 +305,11 @@ class OSystem
|
|||
Creates a new game console from the specified romfile.
|
||||
|
||||
@param romfile The full pathname of the ROM to use
|
||||
@param md5 The MD5sum of the ROM
|
||||
|
||||
@return True on successful creation, otherwise false
|
||||
*/
|
||||
bool createConsole(const string& romfile = "");
|
||||
bool createConsole(const string& romfile = "", const string& md5 = "");
|
||||
|
||||
/**
|
||||
Deletes the currently defined console, if it exists.
|
||||
|
|
|
@ -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.125 2007-08-22 13:55:40 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.126 2007-09-01 23:31:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -84,6 +84,7 @@ Settings::Settings(OSystem* osystem)
|
|||
|
||||
setInternal("rombrowse", "true");
|
||||
setInternal("lastrom", "");
|
||||
setInternal("romviewer", "false");
|
||||
|
||||
setInternal("debuggerres", "1030x690");
|
||||
setInternal("launcherres", "400x300");
|
||||
|
@ -310,6 +311,7 @@ void Settings::usage()
|
|||
<< " -p3speed <number> Speed of emulated mouse movement for paddle 3 (0-100)\n"
|
||||
<< " -pthresh <number> Set threshold for eliminating paddle jitter\n"
|
||||
<< " -rombrowse <1|0> Use ROM browser mode (shows files and folders)\n"
|
||||
<< " -romviewer <1|0> Show ROM info viewer in ROM launcher\n"
|
||||
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
|
||||
<< " -ssdir <path> The directory to save snapshot files to\n"
|
||||
<< " -sssingle <1|0> Generate single snapshot instead of many\n"
|
||||
|
|
|
@ -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: GameList.cxx,v 1.12 2007-01-01 18:04:53 stephena Exp $
|
||||
// $Id: GameList.cxx,v 1.13 2007-09-01 23:31:18 stephena Exp $
|
||||
//
|
||||
// Based on code from KStella - Stella frontend
|
||||
// Copyright (C) 2003-2005 Stephen Anthony
|
||||
|
@ -38,12 +38,12 @@ GameList::~GameList()
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void GameList::appendGame(const string& name, const string& path,
|
||||
const string& note, bool isDir)
|
||||
const string& md5, bool isDir)
|
||||
{
|
||||
Entry g;
|
||||
g._name = name;
|
||||
g._path = path;
|
||||
g._note = note;
|
||||
g._md5 = md5;
|
||||
g._isdir = isDir;
|
||||
|
||||
myArray.push_back(g);
|
||||
|
|
|
@ -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: GameList.hxx,v 1.13 2007-01-01 18:04:53 stephena Exp $
|
||||
// $Id: GameList.hxx,v 1.14 2007-09-01 23:31:18 stephena Exp $
|
||||
//
|
||||
// Based on code from KStella - Stella frontend
|
||||
// Copyright (C) 2003-2005 Stephen Anthony
|
||||
|
@ -38,15 +38,18 @@ class GameList
|
|||
{ return i < (int)myArray.size() ? myArray[i]._name : EmptyString; }
|
||||
inline const string& path(int i)
|
||||
{ return i < (int)myArray.size() ? myArray[i]._path : EmptyString; }
|
||||
inline const string& note(int i)
|
||||
{ return i < (int)myArray.size() ? myArray[i]._note : EmptyString; }
|
||||
inline const string& md5(int i)
|
||||
{ return i < (int)myArray.size() ? myArray[i]._md5 : EmptyString; }
|
||||
inline const bool isDir(int i)
|
||||
{ return i < (int)myArray.size() ? myArray[i]._isdir: false; }
|
||||
|
||||
inline void setMd5(int i, const string& md5)
|
||||
{ myArray[i]._md5 = md5; }
|
||||
|
||||
inline int size() { return myArray.size(); }
|
||||
inline void clear() { myArray.clear(); }
|
||||
|
||||
void appendGame(const string& name, const string& path, const string& note,
|
||||
void appendGame(const string& name, const string& path, const string& md5,
|
||||
bool isDir = false);
|
||||
void sortByName();
|
||||
|
||||
|
@ -55,7 +58,7 @@ class GameList
|
|||
public:
|
||||
string _name;
|
||||
string _path;
|
||||
string _note;
|
||||
string _md5;
|
||||
bool _isdir;
|
||||
|
||||
bool operator < (const Entry& a) const;
|
||||
|
|
|
@ -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: LauncherDialog.cxx,v 1.69 2007-08-22 13:55:40 stephena Exp $
|
||||
// $Id: LauncherDialog.cxx,v 1.70 2007-09-01 23:31:18 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -30,6 +30,7 @@
|
|||
#include "MD5.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "StringListWidget.hxx"
|
||||
#include "RomInfoWidget.hxx"
|
||||
#include "Dialog.hxx"
|
||||
#include "DialogContainer.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
|
@ -51,8 +52,10 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
myList(NULL),
|
||||
myGameList(NULL),
|
||||
myProgressBar(NULL),
|
||||
myRomInfoWidget(NULL),
|
||||
mySelectedItem(0),
|
||||
myBrowseModeFlag(false)
|
||||
myBrowseModeFlag(true),
|
||||
myRomInfoFlag(false)
|
||||
{
|
||||
const GUI::Font& font = instance()->launcherFont();
|
||||
|
||||
|
@ -62,6 +65,15 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
int xpos = 0, ypos = 0, lwidth = 0;
|
||||
WidgetArray wid;
|
||||
|
||||
// Check if we want the ROM info viewer
|
||||
// Make sure it will fit within the current bounds
|
||||
myRomInfoFlag = instance()->settings().getBool("romviewer");
|
||||
if((w < 600 || h < 400) && myRomInfoFlag)
|
||||
{
|
||||
cerr << "Error: ROM launcher too small, deactivating ROM info viewer" << endl;
|
||||
myRomInfoFlag = false;
|
||||
}
|
||||
|
||||
// Show game name
|
||||
lwidth = font.getStringWidth("Select an item from the list ...");
|
||||
xpos += 10; ypos += 8;
|
||||
|
@ -76,13 +88,23 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
|
||||
// Add list with game titles
|
||||
xpos = 10; ypos += fontHeight + 5;
|
||||
int listWidth = myRomInfoFlag ? _w - 350 : _w - 20;
|
||||
myList = new StringListWidget(this, font, xpos, ypos,
|
||||
_w - 20, _h - 28 - bheight - 2*fontHeight);
|
||||
listWidth, _h - 28 - bheight - 2*fontHeight);
|
||||
myList->setNumberingMode(kListNumberingOff);
|
||||
myList->setEditable(false);
|
||||
wid.push_back(myList);
|
||||
|
||||
// Add ROM info area (if enabled)
|
||||
if(myRomInfoFlag)
|
||||
{
|
||||
xpos += myList->getWidth() + 15;
|
||||
myRomInfoWidget = new RomInfoWidget(this, font, xpos, ypos,
|
||||
326, myList->getHeight());
|
||||
}
|
||||
|
||||
// Add note textwidget to show any notes for the currently selected ROM
|
||||
xpos = 10;
|
||||
xpos += 5; ypos += myList->getHeight() + 4;
|
||||
lwidth = font.getStringWidth("Note:");
|
||||
myNoteLabel = new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
|
||||
|
@ -297,18 +319,16 @@ void LauncherDialog::loadListFromDisk()
|
|||
|
||||
// Create a entry for the GameList for each file
|
||||
Properties props;
|
||||
string md5, name, note;
|
||||
for(unsigned int idx = 0; idx < files.size(); idx++)
|
||||
{
|
||||
// Calculate the MD5 so we can get the rest of the info
|
||||
// from the PropertiesSet (stella.pro)
|
||||
md5 = MD5FromFile(files[idx].path());
|
||||
const string& md5 = MD5FromFile(files[idx].path());
|
||||
instance()->propSet().getMD5(md5, props);
|
||||
name = props.get(Cartridge_Name);
|
||||
note = props.get(Cartridge_Note);
|
||||
const string& name = props.get(Cartridge_Name);
|
||||
|
||||
// Indicate that this ROM doesn't have a properties entry
|
||||
myGameList->appendGame(name, files[idx].path(), note);
|
||||
myGameList->appendGame(name, files[idx].path(), md5);
|
||||
|
||||
// Update the progress bar, indicating one more ROM has been processed
|
||||
progress.setProgress(idx);
|
||||
|
@ -373,7 +393,7 @@ void LauncherDialog::createListCache()
|
|||
{
|
||||
out << myGameList->path(i) << "|"
|
||||
<< myGameList->name(i) << "|"
|
||||
<< myGameList->note(i)
|
||||
<< myGameList->md5(i)
|
||||
<< endl;
|
||||
}
|
||||
out.close();
|
||||
|
@ -407,7 +427,8 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
item = myList->getSelected();
|
||||
if(item >= 0)
|
||||
{
|
||||
string entry = myGameList->path(item);
|
||||
const string& rom = myGameList->path(item);
|
||||
const string& md5 = myGameList->md5(item);
|
||||
|
||||
// Directory's should be selected (ie, enter them and redisplay)
|
||||
if(myBrowseModeFlag && myGameList->isDir(item))
|
||||
|
@ -415,10 +436,10 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
if(myGameList->name(item) == " [..]")
|
||||
myCurrentNode = myCurrentNode.getParent();
|
||||
else
|
||||
myCurrentNode = entry;
|
||||
myCurrentNode = rom;
|
||||
updateListing();
|
||||
}
|
||||
else if(instance()->createConsole(entry))
|
||||
else if(instance()->createConsole(rom, md5))
|
||||
{
|
||||
#if !defined(GP2X) // Quick GP2X hack to spare flash-card saves
|
||||
// Make sure the console creation actually succeeded
|
||||
|
@ -441,13 +462,33 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
}
|
||||
|
||||
case kListSelectionChangedCmd:
|
||||
if(!myBrowseModeFlag)
|
||||
{
|
||||
item = myList->getSelected();
|
||||
if(item < 0) break;
|
||||
|
||||
if(myGameList->isDir(item))
|
||||
{
|
||||
item = myList->getSelected();
|
||||
if(item >= 0)
|
||||
myNote->setLabel(myGameList->note(item));
|
||||
if(myRomInfoFlag)
|
||||
myRomInfoWidget->clearInfo();
|
||||
break;
|
||||
}
|
||||
|
||||
// Make sure we have a valid md5 for this ROM
|
||||
if(myGameList->md5(item) == "")
|
||||
myGameList->setMd5(item, MD5FromFile(myGameList->path(item)));
|
||||
|
||||
// Get the properties for this entry
|
||||
Properties props;
|
||||
const string& md5 = myGameList->md5(item);
|
||||
instance()->propSet().getMD5(md5, props);
|
||||
|
||||
if(!myBrowseModeFlag)
|
||||
myNote->setLabel(props.get(Cartridge_Note));
|
||||
|
||||
if(myRomInfoFlag)
|
||||
myRomInfoWidget->showInfo(props);
|
||||
break;
|
||||
}
|
||||
|
||||
case kQuitCmd:
|
||||
close();
|
||||
|
|
|
@ -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: LauncherDialog.hxx,v 1.26 2007-08-22 13:55:40 stephena Exp $
|
||||
// $Id: LauncherDialog.hxx,v 1.27 2007-09-01 23:31:18 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -29,6 +29,7 @@ class CommandSender;
|
|||
class StaticTextWidget;
|
||||
class StringListWidget;
|
||||
class ButtonWidget;
|
||||
class RomInfoWidget;
|
||||
class OSystem;
|
||||
|
||||
#include "FSNode.hxx"
|
||||
|
@ -72,6 +73,8 @@ class LauncherDialog : public Dialog
|
|||
OptionsDialog* myOptions;
|
||||
ProgressDialog* myProgressBar;
|
||||
|
||||
RomInfoWidget* myRomInfoWidget;
|
||||
|
||||
private:
|
||||
void enableButtons(bool enable);
|
||||
void loadDirListing();
|
||||
|
@ -82,7 +85,8 @@ class LauncherDialog : public Dialog
|
|||
|
||||
private:
|
||||
int mySelectedItem;
|
||||
bool myBrowseModeFlag;
|
||||
bool myBrowseModeFlag;
|
||||
bool myRomInfoFlag;
|
||||
FilesystemNode myCurrentNode;
|
||||
|
||||
enum {
|
||||
|
|
|
@ -0,0 +1,251 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
|
||||
//
|
||||
// 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.1 2007-09-01 23:31:18 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include <zlib.h>
|
||||
#include <cstring>
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "Widget.hxx"
|
||||
|
||||
#include "RomInfoWidget.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h)
|
||||
: Widget(boss, font, x, y, w, h),
|
||||
mySurface(NULL)
|
||||
{
|
||||
_flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS;
|
||||
_bgcolor = _bgcolorhi = kWidColor;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RomInfoWidget::~RomInfoWidget()
|
||||
{
|
||||
clearInfo(false);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::showInfo(const Properties& props)
|
||||
{
|
||||
// The input stream for the PNG file
|
||||
ifstream in;
|
||||
|
||||
// Contents of each PNG chunk
|
||||
string type = "";
|
||||
uInt8* data = NULL;
|
||||
int size = 0;
|
||||
|
||||
// 'tEXt' chucks from the PNG image
|
||||
StringList textChucks;
|
||||
|
||||
// Get all possible names representing a snapshot file for this rom
|
||||
const string& path = instance()->settings().getString("ssdir");
|
||||
const string& filename = instance()->getFilename(path, props, "png");
|
||||
|
||||
// Open the PNG and check for a valid signature
|
||||
clearInfo(false);
|
||||
in.open(filename.c_str(), ios_base::binary);
|
||||
if(in)
|
||||
{
|
||||
try
|
||||
{
|
||||
uInt8 header[8];
|
||||
in.read((char*)header, 8);
|
||||
if(!isValidPNGHeader(header))
|
||||
throw "RomInfoWidget: Not a PNG image";
|
||||
|
||||
// Read all chunks until we reach the end
|
||||
int width = 0, height = 0;
|
||||
while(type != "IEND" && !in.eof())
|
||||
{
|
||||
readPNGChunk(in, type, &data, size);
|
||||
|
||||
if(type == "IHDR" && !parseIHDR(width, height, data, size))
|
||||
throw "RomInfoWidget: IHDR chunk not supported";
|
||||
else if(type == "IDAT")
|
||||
{
|
||||
// Restrict surface size to available space
|
||||
int s_width = BSPF_min(320, width);
|
||||
int s_height = BSPF_min(250, height);
|
||||
|
||||
FrameBuffer& fb = instance()->frameBuffer();
|
||||
mySurface = fb.cloneSurface(s_width, s_height);
|
||||
if(!parseIDATChunk(fb, mySurface, width, height, data, size))
|
||||
throw "RomInfoWidget: IDAT processing failed";
|
||||
}
|
||||
else if(type == "tEXt")
|
||||
textChucks.push_back(parseTextChunk(data, size));
|
||||
|
||||
delete[] data; data = NULL;
|
||||
}
|
||||
|
||||
in.close();
|
||||
}
|
||||
catch(const char *msg)
|
||||
{
|
||||
clearInfo(false);
|
||||
if(data) delete[] data;
|
||||
data = NULL;
|
||||
|
||||
cerr << msg << endl;
|
||||
}
|
||||
}
|
||||
// Now add some info for the message box below the image
|
||||
myRomInfo.push_back("Name: " + props.get(Cartridge_Name));
|
||||
myRomInfo.push_back("MD5: " + props.get(Cartridge_MD5));
|
||||
myRomInfo.push_back("Manufacturer: " + props.get(Cartridge_Manufacturer));
|
||||
myRomInfo.push_back("Model: " + props.get(Cartridge_ModelNo));
|
||||
myRomInfo.push_back("Rarity: " + props.get(Cartridge_Rarity));
|
||||
myRomInfo.push_back("Note: " + props.get(Cartridge_Note));
|
||||
|
||||
// TODO - add the PNG tEXt chunks
|
||||
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::clearInfo(bool redraw)
|
||||
{
|
||||
if(mySurface) SDL_FreeSurface(mySurface);
|
||||
mySurface = NULL;
|
||||
myRomInfo.clear();
|
||||
|
||||
if(redraw)
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::loadConfig()
|
||||
{
|
||||
setDirty(); draw();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::drawWidget(bool hilite)
|
||||
{
|
||||
// cerr << "RomInfoWidget::drawWidget\n";
|
||||
FrameBuffer& fb = instance()->frameBuffer();
|
||||
|
||||
fb.fillRect(_x+2, _y+2, _w-4, _h-4, kWidColor);
|
||||
fb.box(_x, _y, _w, _h, kColor, kShadowColor);
|
||||
fb.box(_x, _y+254, _w, _h-254, kColor, kShadowColor);
|
||||
|
||||
if(mySurface)
|
||||
{
|
||||
int x = (_w - mySurface->w) >> 1;
|
||||
int y = (256 - mySurface->h) >> 1;
|
||||
fb.drawSurface(mySurface, x + getAbsX(), y + getAbsY());
|
||||
}
|
||||
int xpos = _x + 5, ypos = _y + 256 + 5;
|
||||
for(unsigned int i = 0; i < myRomInfo.size(); ++i)
|
||||
{
|
||||
fb.drawString(_font, myRomInfo[i], xpos, ypos, _w - 10, _textcolor);
|
||||
ypos += _font->getLineHeight();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool RomInfoWidget::isValidPNGHeader(uInt8* header)
|
||||
{
|
||||
// Unique signature indicating a PNG image file
|
||||
uInt8 signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 };
|
||||
|
||||
return memcmp(header, signature, 8) == 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::readPNGChunk(ifstream& in, string& type,
|
||||
uInt8** data, int& size)
|
||||
{
|
||||
uInt8 temp[9];
|
||||
temp[8] = '\0';
|
||||
|
||||
// Get the size and type from the 8-byte header
|
||||
in.read((char*)temp, 8);
|
||||
size = temp[0] << 24 | temp[1] << 16 | temp[2] << 8 | temp[3];
|
||||
type = string((const char*)temp+4);
|
||||
|
||||
// Now read the payload
|
||||
if(size > 0)
|
||||
{
|
||||
*data = new uInt8[size];
|
||||
in.read((char*) *data, size);
|
||||
}
|
||||
|
||||
// Read (and discard) the 4-byte CRC
|
||||
in.read((char*)temp, 4);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool RomInfoWidget::parseIHDR(int& width, int& height, uInt8* data, int size)
|
||||
{
|
||||
// We only support the PNG functionality defined in Snapshot.cxx
|
||||
// Specifically, 24 bpp RGB data; any other formats are ignored
|
||||
|
||||
if(size != 13)
|
||||
return false;
|
||||
|
||||
width = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
|
||||
height = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7];
|
||||
|
||||
uInt8 trailer[5] = { 8, 2, 0, 0, 0 }; // 24-bit RGB
|
||||
return memcmp(trailer, data + 8, 5) == 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool RomInfoWidget::parseIDATChunk(const FrameBuffer& fb, SDL_Surface* surface,
|
||||
int width, int height, uInt8* data, int size)
|
||||
{
|
||||
// The entire decompressed image data
|
||||
uLongf bufsize = (width * 3 + 1) * height;
|
||||
uInt8* buffer = new uInt8[bufsize];
|
||||
|
||||
// Only get as many scanlines as necessary to fill the surface
|
||||
height = BSPF_min(250, height);
|
||||
|
||||
if(uncompress(buffer, &bufsize, data, size) == Z_OK)
|
||||
{
|
||||
uInt8* buf_ptr = buffer;
|
||||
int i_pitch = width * 3; // bytes per line of the image
|
||||
int rowbytes = surface->w * 3; // bytes per line of the surface
|
||||
for(int row = 0; row < height; row++, buf_ptr += i_pitch)
|
||||
{
|
||||
buf_ptr++; // skip past first byte (PNG filter type)
|
||||
fb.convertToSurface(surface, row, buf_ptr, rowbytes);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "error decompressing data\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
delete[] buffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string RomInfoWidget::parseTextChunk(uInt8* data, int size)
|
||||
{
|
||||
return "";
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: RomInfoWidget.hxx,v 1.1 2007-09-01 23:31:18 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef ROM_INFO_WIDGET_HXX
|
||||
#define ROM_INFO_WIDGET_HXX
|
||||
|
||||
#include <SDL.h>
|
||||
#include <fstream>
|
||||
|
||||
#include "Props.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "Command.hxx"
|
||||
#include "StringList.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
|
||||
class RomInfoWidget : public Widget
|
||||
{
|
||||
public:
|
||||
RomInfoWidget(GuiObject *boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h);
|
||||
virtual ~RomInfoWidget();
|
||||
|
||||
void showInfo(const Properties& props);
|
||||
void clearInfo(bool redraw = true);
|
||||
|
||||
protected:
|
||||
void loadConfig();
|
||||
void drawWidget(bool hilite);
|
||||
|
||||
private:
|
||||
static bool isValidPNGHeader(uInt8* header);
|
||||
static void readPNGChunk(ifstream& in, string& type, uInt8** data, int& size);
|
||||
static bool parseIHDR(int& width, int& height, uInt8* data, int size);
|
||||
static bool parseIDATChunk(const FrameBuffer& fb, SDL_Surface* surface,
|
||||
int width, int height, uInt8* data, int size);
|
||||
static string parseTextChunk(uInt8* data, int size);
|
||||
|
||||
private:
|
||||
// Surface holding the scaled PNG image, ready for drawing by SDL_BlitSurface
|
||||
SDL_Surface* mySurface;
|
||||
|
||||
// Some ROM properties info, as well as 'tEXt' chunks from the PNG image
|
||||
StringList myRomInfo;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -25,6 +25,7 @@ MODULE_OBJS := \
|
|||
src/gui/OptionsDialog.o \
|
||||
src/gui/PopUpWidget.o \
|
||||
src/gui/ProgressDialog.o \
|
||||
src/gui/RomInfoWidget.o \
|
||||
src/gui/ScrollBarWidget.o \
|
||||
src/gui/CheckListWidget.o \
|
||||
src/gui/StringListWidget.o \
|
||||
|
|
Loading…
Reference in New Issue