OpenGL dialog boxes are now centered.

Partial fixes to F8 bankswitching code, also adding hardcoded support
for HES Challenge/Surfers Paradise double cart (the lower bank was
never accessible).  More work is required in this area.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1552 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-11-24 18:02:19 +00:00
parent a1e91c365d
commit 6d0333800e
6 changed files with 44 additions and 28 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.cxx,v 1.106 2008-08-05 12:54:47 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.107 2008-11-24 18:02:19 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -333,6 +333,7 @@ bool FrameBufferGL::setVidMode(VideoMode& mode)
p_glLoadIdentity();
p_glOrtho(0.0, mode.image_w, mode.image_h, 0.0, 0.0, 1.0);
p_glMatrixMode(GL_MODELVIEW);
p_glPushMatrix();
p_glLoadIdentity();
// Allocate GL textures
@ -432,6 +433,7 @@ void FrameBufferGL::postFrameUpdate()
{
if(myDirtyFlag)
{
cerr << " SWAP buffers\n";
// Now show all changes made to the texture
SDL_GL_SwapBuffers();
myDirtyFlag = false;
@ -513,6 +515,8 @@ FBSurfaceGL::FBSurfaceGL(FrameBufferGL& buffer,
uInt32 baseWidth, uInt32 baseHeight,
uInt32 scaleWidth, uInt32 scaleHeight)
: myFB(buffer),
myXOrig(0),
myYOrig(0),
myWidth(scaleWidth),
myHeight(scaleHeight)
{
@ -706,15 +710,15 @@ void FBSurfaceGL::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceGL::getPos(uInt32& x, uInt32& y) const
{
#if 0
x = myXOrig;
y = myYOrig;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceGL::setPos(uInt32 x, uInt32 y)
{
myXOrig = x;
myYOrig = y;
#if 0
// Only non-base surfaces can be arbitrarily 'moved'
if(!myIsBaseSurface)
@ -742,6 +746,10 @@ void FBSurfaceGL::setHeight(uInt32 h)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceGL::translateCoords(Int32& x, Int32& y) const
{
// TODO - this doesn't work if aspect ratio is used
x -= myXOrig;
y -= myYOrig;
/*
// Wow, what a mess :)
x = (Int32) ((x - myImageDim.x) / myWidthScaleFactor);
@ -754,15 +762,23 @@ void FBSurfaceGL::update()
{
if(mySurfaceIsDirty)
{
cerr << " FBSurfaceGL::update(): x = " << myXOrig << ", y = " << myYOrig << ", w = " << myWidth << ", h = " << myHeight << endl;
// Texturemap complete texture to surface so we have free scaling
// and antialiasing
p_glTexSubImage2D(myTexTarget, 0, 0, 0, myTexWidth, myTexHeight,
myTexFormat, myTexType, myTexture->pixels);
p_glBegin(GL_QUADS);
p_glTexCoord2f(myTexCoord[0], myTexCoord[1]); p_glVertex2i(0, 0);
p_glTexCoord2f(myTexCoord[2], myTexCoord[1]); p_glVertex2i(myWidth, 0);
p_glTexCoord2f(myTexCoord[2], myTexCoord[3]); p_glVertex2i(myWidth, myHeight);
p_glTexCoord2f(myTexCoord[0], myTexCoord[3]); p_glVertex2i(0, myHeight);
p_glTexCoord2f(myTexCoord[0], myTexCoord[1]);
p_glVertex2i(myXOrig, myYOrig);
p_glTexCoord2f(myTexCoord[2], myTexCoord[1]);
p_glVertex2i(myXOrig + myWidth, myYOrig);
p_glTexCoord2f(myTexCoord[2], myTexCoord[3]);
p_glVertex2i(myXOrig + myWidth, myYOrig + myHeight);
p_glTexCoord2f(myTexCoord[0], myTexCoord[3]);
p_glVertex2i(myXOrig, myYOrig + myHeight);
p_glEnd();
mySurfaceIsDirty = false;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.hxx,v 1.57 2008-11-02 16:46:05 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.58 2008-11-24 18:02:19 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.57 2008-11-02 16:46:05 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.58 2008-11-24 18:02:19 stephena Exp $
*/
class FrameBufferGL : public FrameBuffer
{
@ -201,7 +201,7 @@ class FrameBufferGL : public FrameBuffer
A surface suitable for OpenGL rendering mode.
@author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.57 2008-11-02 16:46:05 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.58 2008-11-24 18:02:19 stephena Exp $
*/
class FBSurfaceGL : public FBSurface
{
@ -257,12 +257,12 @@ class FBSurfaceGL : public FBSurface
GLenum myTexType;
GLint myTexFilter;
uInt32 myXOrig, myYOrig;
uInt32 myWidth, myHeight;
bool mySurfaceIsDirty;
// int myBaseOffset;
uInt32 myPitch;
uInt32 myXOrig, myYOrig;
uInt32 myXOffset, myYOffset;
};

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Cart.cxx,v 1.43 2008-11-02 16:46:05 stephena Exp $
// $Id: Cart.cxx,v 1.44 2008-11-24 18:02:19 stephena Exp $
//============================================================================
#include <cassert>
@ -63,7 +63,8 @@ Cartridge* Cartridge::create(const uInt8* image, uInt32 size,
// First consider the ROMs that are special and don't have a properties entry
// Hopefully this list will be very small
if(md5 == "bc24440b59092559a1ec26055fd1270e" ||
md5 == "75ee371ccfc4f43e7d9b8f24e1266b55")
md5 == "75ee371ccfc4f43e7d9b8f24e1266b55" ||
md5 == "9905f9f4706223dadee84f6867ede8e3")
{
// These two ROMs are normal 8K images, except they must be initialized
// from the opposite bank compared to normal ones
@ -117,7 +118,7 @@ Cartridge* Cartridge::create(const uInt8* image, uInt32 size,
else if(type == "F6SC")
cartridge = new CartridgeF6SC(image);
else if(type == "F8")
cartridge = new CartridgeF8(image, false);
cartridge = new CartridgeF8(image);
else if(type == "F8 swapped")
cartridge = new CartridgeF8(image, true);
else if(type == "F8SC")

View File

@ -13,26 +13,24 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartF8.cxx,v 1.18 2008-03-28 23:29:13 stephena Exp $
// $Id: CartF8.cxx,v 1.19 2008-11-24 18:02:19 stephena Exp $
//============================================================================
#include <cassert>
#include <cstring>
#include "System.hxx"
#include "CartF8.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8::CartridgeF8(const uInt8* image, bool swapbanks)
CartridgeF8::CartridgeF8(const uInt8* image, bool startlow)
{
// Copy the ROM image into my buffer
for(uInt32 addr = 0; addr < 8192; ++addr)
{
myImage[addr] = image[addr];
}
memcpy(myImage, image, 8192);
// Normally bank 1 is the reset bank, unless we're dealing with ROMs
// that have been incorrectly created with banks in the opposite order
myResetBank = swapbanks ? 0 : 1;
myResetBank = startlow ? 0 : 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartF8.hxx,v 1.12 2008-02-06 13:45:21 stephena Exp $
// $Id: CartF8.hxx,v 1.13 2008-11-24 18:02:19 stephena Exp $
//============================================================================
#ifndef CARTRIDGEF8_HXX
@ -29,7 +29,7 @@ class System;
are two 4K banks.
@author Bradford W. Mott
@version $Id: CartF8.hxx,v 1.12 2008-02-06 13:45:21 stephena Exp $
@version $Id: CartF8.hxx,v 1.13 2008-11-24 18:02:19 stephena Exp $
*/
class CartridgeF8 : public Cartridge
{
@ -38,9 +38,9 @@ class CartridgeF8 : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param swapbanks Whether to swap the startup bank
@param startlow Whether to use the lower or upper bank for startup
*/
CartridgeF8(const uInt8* image, bool swapbanks);
CartridgeF8(const uInt8* image, bool startlow = false);
/**
Destructor

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.cxx,v 1.139 2008-08-04 11:56:12 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.140 2008-11-24 18:02:19 stephena Exp $
//============================================================================
#include <algorithm>
@ -194,7 +194,8 @@ void FrameBuffer::update()
{
// Only update the screen if it's been invalidated
if(myRedrawEntireFrame)
drawMediaSource();
{cerr << " ==> redraw TIA before menu\n";
drawMediaSource();}
myOSystem->menu().draw();
break; // S_MENU
@ -341,7 +342,7 @@ void FrameBuffer::enableMessages(bool enable)
myMsg.counter = 0;
myOSystem->eventHandler().refreshDisplay(true); // Do this twice for
myOSystem->eventHandler().refreshDisplay(true); // double-buffered modes
// myOSystem->eventHandler().refreshDisplay(true); // double-buffered modes
}
}