Added autodetection for X07 bankswitching scheme.

Added OpenGL info to the TV effect tab of the VideoDialog, so users
can see why the effects aren't available if OpenGL is not sufficient.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1772 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-06-12 21:47:03 +00:00
parent 3f7a38e910
commit 3ef83843b5
4 changed files with 47 additions and 0 deletions

View File

@ -321,6 +321,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
if(isProbablySC(image, size))
type = "EFSC";
}
else if(isProbablyX07(image, size))
type = "X07";
else
type = "MB";
}
@ -583,6 +585,23 @@ bool Cartridge::isProbablyFE(const uInt8* image, uInt32 size)
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbablyX07(const uInt8* image, uInt32 size)
{
// X07 bankswitching switches to bank 0, 1, 2, etc by accessing address 0x08xd
uInt8 signature[3][3] = {
{ 0xAD, 0x0D, 0x08 }, // LDA $080D
{ 0xAD, 0x1D, 0x08 }, // LDA $081D
{ 0xAD, 0x2D, 0x08 } // LDA $082D
};
for(uInt32 i = 0; i < 3; ++i)
{
if(searchForBytes(image, size, signature[i], 3, 1))
return true;
}
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge::Cartridge(const Cartridge&)
{

View File

@ -254,6 +254,11 @@ class Cartridge : public Device
*/
static bool isProbablyFE(const uInt8* image, uInt32 size);
/**
Returns true if the image is probably an X07 bankswitching cartridge
*/
static bool isProbablyX07(const uInt8* image, uInt32 size);
protected:
// If myBankLocked is true, ignore attempts at bankswitching. This is used
// by the debugger, when disassembling/dumping ROM.

View File

@ -275,6 +275,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myPhosphorCheckbox);
ypos += lineHeight + 4;
// OpenGL information
// Add message concerning GLSL requirement
ypos += lineHeight + 4;
lwidth = font.getStringWidth("(*) TV effects require OpenGL 2.0+ & GLSL");
@ -285,6 +286,15 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
new StaticTextWidget(myTab, font, 10+font.getStringWidth("(*) "), ypos,
lwidth, fontHeight, "\'gl_texrect\' must be disabled",
kTextAlignLeft);
ypos += lineHeight + 10;
myGLVersionInfo =
new StaticTextWidget(myTab, font, 10+font.getStringWidth("(*) "), ypos,
lwidth, fontHeight, "", kTextAlignLeft);
ypos += lineHeight + 4;
myGLTexRectInfo =
new StaticTextWidget(myTab, font, 10+font.getStringWidth("(*) "), ypos,
lwidth, fontHeight, "", kTextAlignLeft);
// Add items for tab 2
addToFocusList(wid, tabID);
@ -427,6 +437,16 @@ void VideoDialog::loadConfig()
// TV phosphor burn-off effect
myPhosphorCheckbox->setState(instance().settings().getBool("tv_phos"));
myPhosphorCheckbox->setEnabled(tv);
char buf[30];
if(gl) sprintf(buf, "OpenGL version detected: %3.1f", FrameBufferGL::glVersion());
else sprintf(buf, "OpenGL version detected: None");
myGLVersionInfo->setLabel(buf);
sprintf(buf, "OpenGL texrect enabled: %s",
instance().settings().getBool("gl_texrect") ? "Yes" : "No");
myGLTexRectInfo->setLabel(buf);
#else
myGLVersionInfo->setLabel("OpenGL mode not supported");
#endif
myTab->loadConfig();

View File

@ -81,6 +81,9 @@ class VideoDialog : public Dialog
PopUpWidget* myNoisePopup;
CheckboxWidget* myPhosphorCheckbox;
StaticTextWidget* myGLVersionInfo;
StaticTextWidget* myGLTexRectInfo;
enum {
kNAspectRatioChanged = 'VDan',
kPAspectRatioChanged = 'VDap',