mirror of https://github.com/stella-emu/stella.git
Reactivated rom viewer in ROM lauuncher. For now, it only works with
1x snapshots (which the core code can no longer generate) and doesn't resize properly into 2x mode. Reworked '-romviewer' commandline argument (and associated UI) to indicate the zoom level for snapshots in the viewer ('0' means to not turn it on at all, otherwise '1' or '2'). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1584 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
c839ddaab1
commit
c5de58f13c
|
@ -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.128 2008-12-28 23:47:09 stephena Exp $
|
||||
// $Id: FrameBufferGL.cxx,v 1.129 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef DISPLAY_OPENGL
|
||||
|
@ -649,15 +649,15 @@ void FBSurfaceGL::drawChar(const GUI::Font* font, uInt8 chr,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceGL::drawBitmap(uInt32* bitmap, Int32 tx, Int32 ty,
|
||||
int color, Int32 h)
|
||||
void FBSurfaceGL::drawBitmap(uInt32* bitmap, uInt32 tx, uInt32 ty,
|
||||
int color, uInt32 h)
|
||||
{
|
||||
uInt16* buffer = (uInt16*) myTexture->pixels + ty * myPitch + tx;
|
||||
|
||||
for(int y = 0; y < h; ++y)
|
||||
for(uInt32 y = 0; y < h; ++y)
|
||||
{
|
||||
uInt32 mask = 0xF0000000;
|
||||
for(int x = 0; x < 8; ++x, mask >>= 4)
|
||||
for(uInt32 x = 0; x < 8; ++x, mask >>= 4)
|
||||
if(bitmap[y] & mask)
|
||||
buffer[x] = (uInt16) myFB.myDefPalette[color];
|
||||
|
||||
|
@ -665,6 +665,32 @@ void FBSurfaceGL::drawBitmap(uInt32* bitmap, Int32 tx, Int32 ty,
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceGL::drawBytes(uInt8* data, uInt32 tx, uInt32 ty, uInt32 rowbytes)
|
||||
{
|
||||
uInt16* buffer = (uInt16*) myTexture->pixels + ty * myPitch + tx;
|
||||
|
||||
for(uInt32 c = 0; c < rowbytes; c += 3)
|
||||
*buffer++ = SDL_MapRGB(&myFB.myPixelFormat, data[c], data[c+1], data[c+2]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceGL::drawSurface(const FBSurface* surface, uInt32 tx, uInt32 ty)
|
||||
{
|
||||
const FBSurfaceGL* s = (const FBSurfaceGL*) surface;
|
||||
|
||||
SDL_Rect dstrect;
|
||||
dstrect.x = tx;
|
||||
dstrect.y = ty;
|
||||
SDL_Rect srcrect;
|
||||
srcrect.x = 0;
|
||||
srcrect.y = 0;
|
||||
srcrect.w = s->myWidth;
|
||||
srcrect.h = s->myHeight;
|
||||
|
||||
SDL_BlitSurface(s->myTexture, &srcrect, myTexture, &dstrect);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceGL::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
||||
{
|
||||
|
@ -807,47 +833,3 @@ void FBSurfaceGL::setFilter(const string& name)
|
|||
bool FrameBufferGL::myLibraryLoaded = false;
|
||||
|
||||
#endif // DISPLAY_OPENGL
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
GUI::Surface* FrameBufferGL::createSurface(int width, int height) const
|
||||
{
|
||||
SDL_PixelFormat* fmt = myTexture->format;
|
||||
SDL_Surface* data =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 16,
|
||||
fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask);
|
||||
|
||||
return data ? new GUI::Surface(width, height, data) : NULL;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferGL::drawSurface(const GUI::Surface* surface, Int32 x, Int32 y)
|
||||
{
|
||||
SDL_Rect dstrect;
|
||||
dstrect.x = x;
|
||||
dstrect.y = y;
|
||||
SDL_Rect srcrect;
|
||||
srcrect.x = 0;
|
||||
srcrect.y = 0;
|
||||
srcrect.w = surface->myClipWidth;
|
||||
srcrect.h = surface->myClipHeight;
|
||||
|
||||
SDL_BlitSurface(surface->myData, &srcrect, myTexture, &dstrect);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferGL::bytesToSurface(GUI::Surface* surface, int row,
|
||||
uInt8* data, int rowbytes) const
|
||||
{
|
||||
SDL_Surface* s = surface->myData;
|
||||
uInt16* pixels = (uInt16*) s->pixels;
|
||||
pixels += (row * s->pitch/2);
|
||||
|
||||
for(int c = 0; c < rowbytes; c += 3)
|
||||
*pixels++ = SDL_MapRGB(s->format, data[c], data[c+1], data[c+2]);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -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.66 2008-12-28 21:01:55 stephena Exp $
|
||||
// $Id: FrameBufferGL.hxx,v 1.67 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_GL_HXX
|
||||
|
@ -35,7 +35,7 @@ class FBSurfaceGL;
|
|||
This class implements an SDL OpenGL framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferGL.hxx,v 1.66 2008-12-28 21:01:55 stephena Exp $
|
||||
@version $Id: FrameBufferGL.hxx,v 1.67 2008-12-29 20:42:15 stephena Exp $
|
||||
*/
|
||||
class FrameBufferGL : public FrameBuffer
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ class FrameBufferGL : public FrameBuffer
|
|||
A surface suitable for OpenGL rendering mode.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferGL.hxx,v 1.66 2008-12-28 21:01:55 stephena Exp $
|
||||
@version $Id: FrameBufferGL.hxx,v 1.67 2008-12-29 20:42:15 stephena Exp $
|
||||
*/
|
||||
class FBSurfaceGL : public FBSurface
|
||||
{
|
||||
|
@ -192,7 +192,9 @@ class FBSurfaceGL : public FBSurface
|
|||
void vLine(uInt32 x, uInt32 y, uInt32 y2, int color);
|
||||
void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, int color);
|
||||
void drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y, int color);
|
||||
void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color, Int32 h = 8);
|
||||
void drawBitmap(uInt32* bitmap, uInt32 x, uInt32 y, int color, uInt32 h = 8);
|
||||
void drawBytes(uInt8* data, uInt32 x, uInt32 y, uInt32 rowbytes);
|
||||
void drawSurface(const FBSurface* surface, uInt32 x, uInt32 y);
|
||||
void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
|
||||
void getPos(uInt32& x, uInt32& y) const;
|
||||
void setPos(uInt32 x, uInt32 y);
|
||||
|
|
|
@ -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.87 2008-12-28 22:54:04 stephena Exp $
|
||||
// $Id: FrameBufferSoft.cxx,v 1.88 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -689,27 +689,60 @@ void FBSurfaceSoft::drawChar(const GUI::Font* font, uInt8 chr,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceSoft::drawBitmap(uInt32* bitmap, Int32 tx, Int32 ty,
|
||||
int color, Int32 h)
|
||||
void FBSurfaceSoft::drawBitmap(uInt32* bitmap, uInt32 tx, uInt32 ty,
|
||||
int color, uInt32 h)
|
||||
{
|
||||
SDL_Rect rect;
|
||||
for(int y = 0; y < h; y++)
|
||||
rect.y = ty + myYOffset;
|
||||
rect.w = rect.h = 1;
|
||||
for(uInt32 y = 0; y < h; y++)
|
||||
{
|
||||
rect.x = tx + myXOffset;
|
||||
uInt32 mask = 0xF0000000;
|
||||
|
||||
for(int x = 0; x < 8; x++, mask >>= 4)
|
||||
for(uInt32 x = 0; x < 8; x++, mask >>= 4)
|
||||
{
|
||||
if(bitmap[y] & mask)
|
||||
{
|
||||
rect.x = x + tx + myXOffset;
|
||||
rect.y = y + ty + myYOffset;
|
||||
rect.w = rect.h = 1;
|
||||
SDL_FillRect(mySurface, &rect, myFB.myDefPalette[color]);
|
||||
|
||||
rect.x++;
|
||||
}
|
||||
rect.y++;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceSoft::drawBytes(uInt8* data, uInt32 tx, uInt32 ty, uInt32 rowbytes)
|
||||
{
|
||||
SDL_Rect rect;
|
||||
rect.x = tx + myXOffset;
|
||||
rect.y = ty + myYOffset;
|
||||
rect.w = rect.h = 1;
|
||||
for(uInt32 x = 0; x < rowbytes; x += 3)
|
||||
{
|
||||
SDL_FillRect(mySurface, &rect,
|
||||
SDL_MapRGB(myFB.myFormat, data[x], data[x+1], data[x+2]));
|
||||
|
||||
rect.x++;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceSoft::drawSurface(const FBSurface* surface, uInt32 tx, uInt32 ty)
|
||||
{
|
||||
const FBSurfaceSoft* s = (const FBSurfaceSoft*) surface;
|
||||
|
||||
SDL_Rect dstrect;
|
||||
dstrect.x = tx + myXOffset;
|
||||
dstrect.y = ty + myYOffset;
|
||||
SDL_Rect srcrect;
|
||||
srcrect.x = 0;
|
||||
srcrect.y = 0;
|
||||
srcrect.w = s->myWidth;
|
||||
srcrect.h = s->myHeight;
|
||||
|
||||
SDL_BlitSurface(s->mySurface, &srcrect, mySurface, &dstrect);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurfaceSoft::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
||||
{
|
||||
|
@ -835,42 +868,3 @@ void FBSurfaceSoft::recalc()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSoft::drawSurface(const GUI::Surface* surface, Int32 x, Int32 y)
|
||||
{
|
||||
SDL_Rect dstrect;
|
||||
dstrect.x = x * myZoomLevel + myImageDim.x;
|
||||
dstrect.y = y * myZoomLevel + myImageDim.y;
|
||||
SDL_Rect srcrect;
|
||||
srcrect.x = 0;
|
||||
srcrect.y = 0;
|
||||
srcrect.w = surface->myClipWidth * myZoomLevel;
|
||||
srcrect.h = surface->myClipHeight * myZoomLevel;
|
||||
|
||||
SDL_BlitSurface(surface->myData, &srcrect, myScreen, &dstrect);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSoft::bytesToSurface(GUI::Surface* surface, int row,
|
||||
uInt8* data, int rowbytes) const
|
||||
{
|
||||
// Calculate a scanline of zoomed surface data
|
||||
SDL_Surface* s = surface->myData;
|
||||
SDL_Rect rect;
|
||||
rect.x = 0;
|
||||
rect.y = row * myZoomLevel;
|
||||
for(int c = 0; c < rowbytes; c += 3)
|
||||
{
|
||||
uInt32 pixel = SDL_MapRGB(s->format, data[c], data[c+1], data[c+2]);
|
||||
rect.x += myZoomLevel;
|
||||
rect.w = rect.h = myZoomLevel;
|
||||
SDL_FillRect(surface->myData, &rect, pixel);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -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.59 2008-12-28 21:01:55 stephena Exp $
|
||||
// $Id: FrameBufferSoft.hxx,v 1.60 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_SOFT_HXX
|
||||
|
@ -32,7 +32,7 @@ class RectList;
|
|||
This class implements an SDL software framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.59 2008-12-28 21:01:55 stephena Exp $
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.60 2008-12-29 20:42:15 stephena Exp $
|
||||
*/
|
||||
class FrameBufferSoft : public FrameBuffer
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ class FrameBufferSoft : public FrameBuffer
|
|||
A surface suitable for software rendering mode.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.59 2008-12-28 21:01:55 stephena Exp $
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.60 2008-12-29 20:42:15 stephena Exp $
|
||||
*/
|
||||
class FBSurfaceSoft : public FBSurface
|
||||
{
|
||||
|
@ -179,7 +179,9 @@ class FBSurfaceSoft : public FBSurface
|
|||
void vLine(uInt32 x, uInt32 y, uInt32 y2, int color);
|
||||
void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, int color);
|
||||
void drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y, int color);
|
||||
void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color, Int32 h = 8);
|
||||
void drawBitmap(uInt32* bitmap, uInt32 x, uInt32 y, int color, uInt32 h = 8);
|
||||
void drawBytes(uInt8* data, uInt32 x, uInt32 y, uInt32 rowbytes);
|
||||
void drawSurface(const FBSurface* surface, uInt32 x, uInt32 y);
|
||||
void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
|
||||
void getPos(uInt32& x, uInt32& y) const;
|
||||
void setPos(uInt32 x, uInt32 y);
|
||||
|
|
|
@ -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: EventHandler.cxx,v 1.232 2008-12-28 23:47:09 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.233 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -869,16 +869,6 @@ void EventHandler::handleJoyHatEvent(int stick, int hat, int value)
|
|||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::handleResizeEvent()
|
||||
{
|
||||
// For now, only the overlay cares about resize events
|
||||
// We don't know which one wants it, so we send it to all of them
|
||||
// These events need to be sent even if the overlay isn't active
|
||||
if(&myOSystem->launcher())
|
||||
myOSystem->launcher().handleResizeEvent();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::handleEvent(Event::Type event, int state)
|
||||
{
|
||||
|
|
|
@ -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: EventHandler.hxx,v 1.112 2008-12-27 23:27:32 stephena Exp $
|
||||
// $Id: EventHandler.hxx,v 1.113 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENTHANDLER_HXX
|
||||
|
@ -61,7 +61,7 @@ enum EventMode {
|
|||
mapping can take place.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: EventHandler.hxx,v 1.112 2008-12-27 23:27:32 stephena Exp $
|
||||
@version $Id: EventHandler.hxx,v 1.113 2008-12-29 20:42:15 stephena Exp $
|
||||
*/
|
||||
class EventHandler
|
||||
{
|
||||
|
@ -213,11 +213,6 @@ class EventHandler
|
|||
void leaveDebugMode();
|
||||
void takeSnapshot();
|
||||
|
||||
/**
|
||||
Send a resize event to the handler.
|
||||
*/
|
||||
void handleResizeEvent();
|
||||
|
||||
/**
|
||||
Send an event directly to the event handler.
|
||||
These events cannot be remapped.
|
||||
|
|
|
@ -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.cxx,v 1.149 2008-12-28 21:01:55 stephena Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.150 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -587,7 +587,6 @@ bool FrameBuffer::changeVidMode(int direction)
|
|||
if(saveModeChange)
|
||||
myOSystem->settings().setString("tia_filter", vidmode.gfxmode.name);
|
||||
|
||||
myOSystem->eventHandler().handleResizeEvent(); // FIXME - this may no longer be required
|
||||
refresh();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -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.109 2008-12-28 21:01:55 stephena Exp $
|
||||
// $Id: FrameBuffer.hxx,v 1.110 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_HXX
|
||||
|
@ -91,7 +91,7 @@ enum {
|
|||
turn drawn here as well.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBuffer.hxx,v 1.109 2008-12-28 21:01:55 stephena Exp $
|
||||
@version $Id: FrameBuffer.hxx,v 1.110 2008-12-29 20:42:15 stephena Exp $
|
||||
*/
|
||||
class FrameBuffer
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ class FrameBuffer
|
|||
FrameBuffer type.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBuffer.hxx,v 1.109 2008-12-28 21:01:55 stephena Exp $
|
||||
@version $Id: FrameBuffer.hxx,v 1.110 2008-12-29 20:42:15 stephena Exp $
|
||||
*/
|
||||
// Text alignment modes for drawString()
|
||||
enum TextAlignment {
|
||||
|
@ -624,8 +624,28 @@ class FBSurface
|
|||
@param color The color of the character
|
||||
@param h The height of the data image
|
||||
*/
|
||||
virtual void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color,
|
||||
Int32 h = 8) = 0;
|
||||
virtual void drawBitmap(uInt32* bitmap, uInt32 x, uInt32 y, int color,
|
||||
uInt32 h = 8) = 0;
|
||||
|
||||
/**
|
||||
This method should be called to convert and copy a given row of RGB
|
||||
data into a FrameBuffer surface.
|
||||
|
||||
@param data The data in uInt8 R/G/B format
|
||||
@param row The row of the surface the data should be placed in
|
||||
@param rowbytes The number of bytes in row of 'data'
|
||||
*/
|
||||
virtual void drawBytes(uInt8* data, uInt32 x, uInt32 y, uInt32 rowbytes) = 0;
|
||||
|
||||
/**
|
||||
This method should be called copy the contents of the given
|
||||
surface into the FrameBuffer surface.
|
||||
|
||||
@param surface The data to draw
|
||||
@param x The x coordinate
|
||||
@param y The y coordinate
|
||||
*/
|
||||
virtual void drawSurface(const FBSurface* surface, uInt32 x, uInt32 y) = 0;
|
||||
|
||||
/**
|
||||
This method should be called to add a dirty rectangle
|
||||
|
@ -737,29 +757,3 @@ class FBSurface
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if 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(const GUI::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 rowbytes The number of bytes in row of 'data'
|
||||
*/
|
||||
virtual void bytesToSurface(GUI::Surface* surface, int row,
|
||||
uInt8* data, int rowbytes) const = 0;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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.135 2008-12-27 23:27:32 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.136 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -341,10 +341,6 @@ bool OSystem::createFrameBuffer()
|
|||
// Setup the SDL joysticks (must be done after FrameBuffer is created)
|
||||
myEventHandler->setupJoysticks();
|
||||
|
||||
// FIXME - this next line can probably be removed
|
||||
// Let the system know that we've possibly resized the display
|
||||
myEventHandler->handleResizeEvent();
|
||||
|
||||
// Update the UI palette
|
||||
setUIPalette();
|
||||
}
|
||||
|
|
|
@ -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.150 2008-12-28 21:01:55 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.151 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -88,7 +88,7 @@ Settings::Settings(OSystem* osystem)
|
|||
// ROM browser options
|
||||
setInternal("launcherres", "640x480");
|
||||
setInternal("launcherfont", "small");
|
||||
setInternal("romviewer", "false");
|
||||
setInternal("romviewer", "0");
|
||||
setInternal("lastrom", "");
|
||||
|
||||
// UI-related options
|
||||
|
@ -259,6 +259,12 @@ void Settings::validate()
|
|||
s = getString("launcherfont");
|
||||
if(s != "small" && s != "large")
|
||||
setInternal("launcherfont", "small");
|
||||
|
||||
i = getInt("romviewer");
|
||||
if(i < 0)
|
||||
setInternal("romviewer", "0");
|
||||
else if(i > 2)
|
||||
setInternal("romviewer", "2");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -315,7 +321,7 @@ void Settings::usage()
|
|||
<< " -pspeed <number> Speed of digital emulated paddle movement (1-15)\n"
|
||||
<< " -sa1 <left|right> Stelladaptor 1 emulates specified joystick port\n"
|
||||
<< " -sa2 <left|right> Stelladaptor 2 emulates specified joystick port\n"
|
||||
<< " -romviewer <1|0> Show ROM info viewer in ROM launcher\n"
|
||||
<< " -romviewer <0|1|2> Show ROM info viewer at given zoom level in ROM launcher (0 for off)\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: DialogContainer.cxx,v 1.51 2008-12-28 21:01:55 stephena Exp $
|
||||
// $Id: DialogContainer.cxx,v 1.52 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "OSystem.hxx"
|
||||
|
@ -323,13 +323,6 @@ void DialogContainer::handleJoyHatEvent(int stick, int hat, int value)
|
|||
activeDialog->handleJoyHat(stick, hat, value);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DialogContainer::handleResizeEvent()
|
||||
{
|
||||
// Send resize event to base dialog; it's up to the dialog to actually listen
|
||||
myBaseDialog->handleCommand(NULL, kResizeCmd, 0, 0);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DialogContainer::reset()
|
||||
{
|
||||
|
|
|
@ -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: DialogContainer.hxx,v 1.26 2008-12-28 21:01:55 stephena Exp $
|
||||
// $Id: DialogContainer.hxx,v 1.27 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DIALOG_CONTAINER_HXX
|
||||
|
@ -36,7 +36,7 @@ class OSystem;
|
|||
a stack, and handles their events.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: DialogContainer.hxx,v 1.26 2008-12-28 21:01:55 stephena Exp $
|
||||
@version $Id: DialogContainer.hxx,v 1.27 2008-12-29 20:42:15 stephena Exp $
|
||||
*/
|
||||
class DialogContainer
|
||||
{
|
||||
|
@ -118,11 +118,6 @@ class DialogContainer
|
|||
*/
|
||||
void handleJoyHatEvent(int stick, int hat, int value);
|
||||
|
||||
/**
|
||||
Handle a resize event.
|
||||
*/
|
||||
void handleResizeEvent();
|
||||
|
||||
/**
|
||||
Draw the stack of menus (full indicates to redraw all items).
|
||||
*/
|
||||
|
|
|
@ -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: GuiObject.hxx,v 1.25 2008-06-13 13:14:51 stephena Exp $
|
||||
// $Id: GuiObject.hxx,v 1.26 2008-12-29 20:42:15 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -43,8 +43,7 @@ enum {
|
|||
kSetPositionCmd = 'SETP',
|
||||
kTabChangedCmd = 'TBCH',
|
||||
kCheckActionCmd = 'CBAC',
|
||||
kRefreshAllCmd = 'REFA',
|
||||
kResizeCmd = 'RESZ'
|
||||
kRefreshAllCmd = 'REFA'
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -55,7 +54,7 @@ enum {
|
|||
This is the base class for all GUI objects/widgets.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: GuiObject.hxx,v 1.25 2008-06-13 13:14:51 stephena Exp $
|
||||
@version $Id: GuiObject.hxx,v 1.26 2008-12-29 20:42:15 stephena Exp $
|
||||
*/
|
||||
class GuiObject : public CommandReceiver
|
||||
{
|
||||
|
|
|
@ -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.89 2008-11-30 17:28:03 stephena Exp $
|
||||
// $Id: LauncherDialog.cxx,v 1.90 2008-12-29 20:42:15 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -53,8 +53,7 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
myGameList(NULL),
|
||||
myProgressBar(NULL),
|
||||
myRomInfoWidget(NULL),
|
||||
mySelectedItem(0),
|
||||
myRomInfoFlag(false)
|
||||
mySelectedItem(0)
|
||||
{
|
||||
const GUI::Font& font = instance().launcherFont();
|
||||
|
||||
|
@ -64,15 +63,6 @@ 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 < 640 || h < 480) && 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;
|
||||
|
@ -87,7 +77,16 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
|
||||
// Add list with game titles
|
||||
xpos = 10; ypos += fontHeight + 5;
|
||||
int listWidth = myRomInfoFlag ? _w - 350 : _w - 20;
|
||||
|
||||
// Before we add the list, we need to know the size of the RomInfoWidget
|
||||
int romWidth = 0;
|
||||
int romSize = instance().settings().getInt("romviewer");
|
||||
if(romSize > 1 && w >= 1000 && h >= 800)
|
||||
romWidth = 375*2;
|
||||
else if(romSize > 0 && w >= 640 && h >= 480)
|
||||
romWidth = 375;
|
||||
|
||||
int listWidth = _w - (romWidth > 0 ? romWidth+25 : 20);
|
||||
myList = new StringListWidget(this, font, xpos, ypos,
|
||||
listWidth, _h - 28 - bheight - 2*fontHeight);
|
||||
myList->setNumberingMode(kListNumberingOff);
|
||||
|
@ -95,12 +94,11 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
wid.push_back(myList);
|
||||
|
||||
// Add ROM info area (if enabled)
|
||||
if(myRomInfoFlag)
|
||||
if(romWidth > 0)
|
||||
{
|
||||
xpos += myList->getWidth() + 15;
|
||||
myRomInfoWidget = new RomInfoWidget(this, instance().font(), xpos, ypos,
|
||||
326, myList->getHeight());
|
||||
wid.push_back(myRomInfoWidget);
|
||||
myRomInfoWidget = new RomInfoWidget(this, instance().consoleFont(), xpos, ypos,
|
||||
romWidth, myList->getHeight());
|
||||
}
|
||||
|
||||
// Add note textwidget to show any notes for the currently selected ROM
|
||||
|
@ -202,7 +200,7 @@ void LauncherDialog::loadConfig()
|
|||
}
|
||||
Dialog::setFocus(getFocusList()[mySelectedItem]);
|
||||
|
||||
if(myRomInfoFlag)
|
||||
if(myRomInfoWidget)
|
||||
myRomInfoWidget->loadConfig();
|
||||
}
|
||||
|
||||
|
@ -300,7 +298,7 @@ void LauncherDialog::loadDirListing()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::loadRomInfo()
|
||||
{
|
||||
if(!(myRomInfoFlag && myRomInfoWidget)) return;
|
||||
if(!myRomInfoWidget) return;
|
||||
int item = myList->getSelected();
|
||||
if(item < 0) return;
|
||||
|
||||
|
@ -314,8 +312,7 @@ void LauncherDialog::loadRomInfo()
|
|||
|
||||
// Get the properties for this entry
|
||||
Properties props;
|
||||
const string& md5 = myGameList->md5(item);
|
||||
instance().propSet().getMD5(md5, props);
|
||||
instance().propSet().getMD5(myGameList->md5(item), props);
|
||||
|
||||
myRomInfoWidget->setProperties(props);
|
||||
}
|
||||
|
@ -406,16 +403,6 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
updateListing();
|
||||
break;
|
||||
|
||||
case kResizeCmd:
|
||||
// Instead of figuring out how to resize the snapshot image,
|
||||
// we just reload it
|
||||
if(myRomInfoFlag)
|
||||
{
|
||||
myRomInfoWidget->initialize();
|
||||
loadRomInfo();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
}
|
||||
|
|
|
@ -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.35 2008-11-30 17:28:03 stephena Exp $
|
||||
// $Id: LauncherDialog.hxx,v 1.36 2008-12-29 20:42:15 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -92,7 +92,7 @@ class LauncherDialog : public Dialog
|
|||
|
||||
private:
|
||||
int mySelectedItem;
|
||||
bool myRomInfoFlag;
|
||||
int myRomInfoSize;
|
||||
FilesystemNode myCurrentNode;
|
||||
|
||||
enum {
|
||||
|
|
|
@ -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.10 2008-12-28 21:01:55 stephena Exp $
|
||||
// $Id: RomInfoWidget.cxx,v 1.11 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cstring>
|
||||
|
@ -31,24 +31,18 @@
|
|||
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),
|
||||
myDrawSurface(false),
|
||||
mySurface(NULL),
|
||||
mySurfaceID(-1),
|
||||
mySurfaceIsValid(false),
|
||||
myHaveProperties(false)
|
||||
{
|
||||
_flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS;
|
||||
_flags = WIDGET_ENABLED;
|
||||
_bgcolor = _bgcolorhi = kWidColor;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RomInfoWidget::~RomInfoWidget()
|
||||
{
|
||||
/*
|
||||
if(mySurface)
|
||||
{
|
||||
delete mySurface;
|
||||
mySurface = NULL;
|
||||
}
|
||||
*/
|
||||
myRomInfo.clear();
|
||||
}
|
||||
|
||||
|
@ -68,7 +62,6 @@ void RomInfoWidget::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::setProperties(const Properties& props)
|
||||
{
|
||||
return;
|
||||
myHaveProperties = true;
|
||||
myProperties = props;
|
||||
|
||||
|
@ -83,8 +76,7 @@ return;
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::clearProperties()
|
||||
{
|
||||
return;
|
||||
myHaveProperties = myDrawSurface = false;
|
||||
myHaveProperties = mySurfaceIsValid = false;
|
||||
|
||||
// Decide whether the information should be shown immediately
|
||||
if(instance().eventHandler().state() == EventHandler::S_LAUNCHER)
|
||||
|
@ -93,29 +85,23 @@ return;
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::initialize()
|
||||
{
|
||||
// Delete surface; a new one will be created by parseProperties
|
||||
// delete mySurface;
|
||||
// mySurface = NULL;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::parseProperties()
|
||||
{
|
||||
// FIXME
|
||||
#if 0
|
||||
// Initialize to empty properties entry
|
||||
mySurfaceErrorMsg = "";
|
||||
myDrawSurface = false;
|
||||
myRomInfo.clear();
|
||||
|
||||
// Check if a surface has ever been created; if so, we use it
|
||||
// The surface will always be the maximum size, but sometimes we'll
|
||||
// only draw certain parts of it
|
||||
mySurface = instance().frameBuffer().surface(mySurfaceID);
|
||||
if(mySurface == NULL)
|
||||
mySurface = instance().frameBuffer().createSurface(320, 260);
|
||||
{
|
||||
mySurfaceID = instance().frameBuffer().allocateSurface(320, 260, false);
|
||||
mySurface = instance().frameBuffer().surface(mySurfaceID);
|
||||
}
|
||||
|
||||
// Initialize to empty properties entry
|
||||
mySurfaceErrorMsg = "";
|
||||
mySurfaceIsValid = false;
|
||||
myRomInfo.clear();
|
||||
|
||||
// The input stream for the PNG file
|
||||
ifstream in;
|
||||
|
@ -155,13 +141,12 @@ void RomInfoWidget::parseProperties()
|
|||
if(!parseIHDR(width, height, data, size))
|
||||
throw "Invalid PNG image (IHDR)";
|
||||
|
||||
mySurface->setClipWidth(width);
|
||||
mySurface->setClipHeight(height);
|
||||
mySurface->setWidth(width);
|
||||
mySurface->setHeight(height);
|
||||
}
|
||||
else if(type == "IDAT")
|
||||
{
|
||||
if(!parseIDATChunk(instance().frameBuffer(), mySurface,
|
||||
width, height, data, size))
|
||||
if(!parseIDATChunk(mySurface, width, height, data, size))
|
||||
throw "PNG image too large";
|
||||
}
|
||||
else if(type == "tEXt")
|
||||
|
@ -171,11 +156,11 @@ void RomInfoWidget::parseProperties()
|
|||
}
|
||||
|
||||
in.close();
|
||||
myDrawSurface = true;
|
||||
mySurfaceIsValid = true;
|
||||
}
|
||||
catch(const char* msg)
|
||||
{
|
||||
myDrawSurface = false;
|
||||
mySurfaceIsValid = false;
|
||||
myRomInfo.clear();
|
||||
if(data) delete[] data;
|
||||
data = NULL;
|
||||
|
@ -196,40 +181,36 @@ void RomInfoWidget::parseProperties()
|
|||
myRomInfo.push_back("Controllers: " + myProperties.get(Controller_Left) +
|
||||
" (left), " + myProperties.get(Controller_Right) + " (right)");
|
||||
// TODO - add the PNG tEXt chunks
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RomInfoWidget::drawWidget(bool hilite)
|
||||
{
|
||||
// FIXME
|
||||
#if 0
|
||||
FrameBuffer& fb = instance().frameBuffer();
|
||||
FBSurface& s = dialog().surface();
|
||||
|
||||
fb.fillRect(_x+2, _y+2, _w-4, _h-4, kWidColor);
|
||||
fb.box(_x, _y, _w, _h, kColor, kShadowColor);
|
||||
fb.box(_x, _y+264, _w, _h-264, kColor, kShadowColor);
|
||||
s.fillRect(_x+2, _y+2, _w-4, _h-4, kWidColor);
|
||||
s.box(_x, _y, _w, _h, kColor, kShadowColor);
|
||||
s.box(_x, _y+275, _w, _h-275, kColor, kShadowColor);
|
||||
|
||||
if(!myHaveProperties) return;
|
||||
|
||||
if(myDrawSurface && mySurface)
|
||||
if(mySurfaceIsValid)
|
||||
{
|
||||
int x = (_w - mySurface->getClipWidth()) >> 1;
|
||||
int y = (266 - mySurface->getClipHeight()) >> 1;
|
||||
fb.drawSurface(mySurface, x + getAbsX(), y + getAbsY());
|
||||
uInt32 x = ((_w - mySurface->getWidth()) >> 1) + getAbsX();
|
||||
uInt32 y = ((275 - mySurface->getHeight()) >> 1) + getAbsY();
|
||||
s.drawSurface(mySurface, x, y);
|
||||
}
|
||||
else if(mySurfaceErrorMsg != "")
|
||||
{
|
||||
int x = _x + ((_w - _font->getStringWidth(mySurfaceErrorMsg)) >> 1);
|
||||
fb.drawString(_font, mySurfaceErrorMsg, x, 120, _w - 10, _textcolor);
|
||||
s.drawString(_font, mySurfaceErrorMsg, x, 120, _w - 10, _textcolor);
|
||||
}
|
||||
int xpos = _x + 5, ypos = _y + 266 + 5;
|
||||
int xpos = _x + 5, ypos = _y + 280 + 5;
|
||||
for(unsigned int i = 0; i < myRomInfo.size(); ++i)
|
||||
{
|
||||
fb.drawString(_font, myRomInfo[i], xpos, ypos, _w - 10, _textcolor);
|
||||
s.drawString(_font, myRomInfo[i], xpos, ypos, _w - 10, _textcolor);
|
||||
ypos += _font->getLineHeight();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -284,11 +265,9 @@ bool RomInfoWidget::parseIHDR(int& width, int& height, uInt8* data, int size)
|
|||
return memcmp(trailer, data + 8, 5) == 0;
|
||||
}
|
||||
|
||||
// FIXME
|
||||
#if 0
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool RomInfoWidget::parseIDATChunk(const FrameBuffer& fb, GUI::Surface* surface,
|
||||
int width, int height, uInt8* data, int size)
|
||||
bool RomInfoWidget::parseIDATChunk(FBSurface* surface, int width, int height,
|
||||
uInt8* data, int size)
|
||||
{
|
||||
// The entire decompressed image data
|
||||
uLongf bufsize = (width * 3 + 1) * height;
|
||||
|
@ -301,7 +280,7 @@ bool RomInfoWidget::parseIDATChunk(const FrameBuffer& fb, GUI::Surface* surface,
|
|||
for(int row = 0; row < height; row++, buf_ptr += pitch)
|
||||
{
|
||||
buf_ptr++; // skip past first byte (PNG filter type)
|
||||
fb.bytesToSurface(surface, row, buf_ptr, pitch);
|
||||
surface->drawBytes(buf_ptr, 0, row, pitch);
|
||||
}
|
||||
delete[] buffer;
|
||||
return true;
|
||||
|
@ -309,7 +288,6 @@ bool RomInfoWidget::parseIDATChunk(const FrameBuffer& fb, GUI::Surface* surface,
|
|||
delete[] buffer;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string RomInfoWidget::parseTextChunk(uInt8* data, int size)
|
||||
|
|
|
@ -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.hxx,v 1.5 2008-06-19 12:01:31 stephena Exp $
|
||||
// $Id: RomInfoWidget.hxx,v 1.6 2008-12-29 20:42:15 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef ROM_INFO_WIDGET_HXX
|
||||
|
@ -37,7 +37,6 @@ class RomInfoWidget : public Widget
|
|||
|
||||
void setProperties(const Properties& props);
|
||||
void clearProperties();
|
||||
void initialize();
|
||||
void loadConfig();
|
||||
|
||||
protected:
|
||||
|
@ -48,16 +47,17 @@ class RomInfoWidget : public Widget
|
|||
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, GUI::Surface* surface,
|
||||
// int width, int height, uInt8* data, int size);
|
||||
static bool parseIDATChunk(FBSurface* surface, int width, int height,
|
||||
uInt8* data, int size);
|
||||
static string parseTextChunk(uInt8* data, int size);
|
||||
|
||||
private:
|
||||
// Surface holding the scaled PNG image
|
||||
// GUI::Surface* mySurface;
|
||||
// Surface id and pointer holding the scaled PNG image
|
||||
FBSurface* mySurface;
|
||||
int mySurfaceID;
|
||||
|
||||
// Whether the surface should be redrawn by drawWidget()
|
||||
bool myDrawSurface;
|
||||
bool mySurfaceIsValid;
|
||||
|
||||
// Some ROM properties info, as well as 'tEXt' chunks from the PNG image
|
||||
StringList myRomInfo;
|
||||
|
|
|
@ -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: UIDialog.cxx,v 1.15 2008-07-25 12:41:41 stephena Exp $
|
||||
// $Id: UIDialog.cxx,v 1.16 2008-12-29 20:42:15 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -96,6 +96,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
|
|||
ypos += lineHeight + 4;
|
||||
|
||||
// Launcher font
|
||||
pwidth = font.getStringWidth("2x (1000x800)");
|
||||
items.clear();
|
||||
items.push_back("Small", "small");
|
||||
items.push_back("Large", "large");
|
||||
|
@ -106,10 +107,14 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
|
|||
ypos += lineHeight + 4;
|
||||
|
||||
// ROM launcher info/snapshot viewer
|
||||
xpos += ((_w - 40 - font.getStringWidth("ROM Info viewer")) >> 1);
|
||||
myRomViewerCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"ROM Info viewer", 0);
|
||||
wid.push_back(myRomViewerCheckbox);
|
||||
items.clear();
|
||||
items.push_back("Off", "0");
|
||||
items.push_back("1x (640x480) ", "1");
|
||||
items.push_back("2x (1000x800)", "2");
|
||||
myRomViewerPopup =
|
||||
new PopUpWidget(myTab, font, xpos, ypos+1, pwidth, lineHeight, items,
|
||||
"ROM Info viewer: ", lwidth);
|
||||
wid.push_back(myRomViewerPopup);
|
||||
|
||||
// Add message concerning usage
|
||||
xpos = vBorder; ypos += 2*(lineHeight + 4);
|
||||
|
@ -126,6 +131,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
|
|||
wid.clear();
|
||||
tabID = myTab->addTab(" Debugger ");
|
||||
lwidth = font.getStringWidth("Debugger Height: ");
|
||||
pwidth = font.getStringWidth("Standard");
|
||||
xpos = ypos = vBorder;
|
||||
|
||||
// Debugger width and height
|
||||
|
@ -248,11 +254,12 @@ void UIDialog::loadConfig()
|
|||
myLauncherHeightLabel->setValue(h);
|
||||
|
||||
// Launcher font
|
||||
const string& s = instance().settings().getString("launcherfont");
|
||||
myLauncherFontPopup->setSelected(s, "small");
|
||||
const string& font = instance().settings().getString("launcherfont");
|
||||
myLauncherFontPopup->setSelected(font, "small");
|
||||
|
||||
// ROM launcher info viewer
|
||||
myRomViewerCheckbox->setState(instance().settings().getBool("romviewer"));
|
||||
const string& viewer = instance().settings().getString("romviewer");
|
||||
myRomViewerPopup->setSelected(viewer, "0");
|
||||
|
||||
// Debugger size
|
||||
instance().settings().getSize("debuggerres", w, h);
|
||||
|
@ -291,7 +298,8 @@ void UIDialog::saveConfig()
|
|||
myLauncherFontPopup->getSelectedTag());
|
||||
|
||||
// ROM launcher info viewer
|
||||
instance().settings().setBool("romviewer", myRomViewerCheckbox->getState());
|
||||
instance().settings().setString("romviewer",
|
||||
myRomViewerPopup->getSelectedTag());
|
||||
|
||||
// Debugger size
|
||||
instance().settings().setSize("debuggerres",
|
||||
|
@ -320,7 +328,8 @@ void UIDialog::setDefaults()
|
|||
myLauncherWidthLabel->setValue(w);
|
||||
myLauncherHeightSlider->setValue(h);
|
||||
myLauncherHeightLabel->setValue(h);
|
||||
myRomViewerCheckbox->setState(false);
|
||||
myLauncherFontPopup->setSelected("small", "");
|
||||
myRomViewerPopup->setSelected("0", "");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -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: UIDialog.hxx,v 1.8 2008-03-23 16:22:46 stephena Exp $
|
||||
// $Id: UIDialog.hxx,v 1.9 2008-12-29 20:42:15 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -50,7 +50,7 @@ class UIDialog : public Dialog
|
|||
SliderWidget* myLauncherHeightSlider;
|
||||
StaticTextWidget* myLauncherHeightLabel;
|
||||
PopUpWidget* myLauncherFontPopup;
|
||||
CheckboxWidget* myRomViewerCheckbox;
|
||||
PopUpWidget* myRomViewerPopup;
|
||||
|
||||
// Debugger options
|
||||
SliderWidget* myDebuggerWidthSlider;
|
||||
|
|
Loading…
Reference in New Issue