diff --git a/stella/src/emucore/Cart.cxx b/stella/src/emucore/Cart.cxx index 4abe7ebc7..11e22e979 100644 --- a/stella/src/emucore/Cart.cxx +++ b/stella/src/emucore/Cart.cxx @@ -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.44 2008-11-24 18:02:19 stephena Exp $ +// $Id: Cart.cxx,v 1.45 2009-01-01 00:08:59 stephena Exp $ //============================================================================ #include @@ -73,21 +73,19 @@ Cartridge* Cartridge::create(const uInt8* image, uInt32 size, // Collect some info about the ROM ostringstream buf; - buf << " ROM Size: " << size << endl - << " Bankswitch Type: " << type; // See if we should try to auto-detect the cartridge type // If we ask for extended info, always do an autodetect if(type == "AUTO-DETECT" || settings.getBool("rominfo")) { string detected = autodetectType(image, size); - buf << " ==> " << detected; + buf << "AUTO => "; if(type != "AUTO-DETECT" && type != detected) - buf << " (auto-detection not consistent)"; + cerr << "Auto-detection not consistent: " << type << ", " << detected << endl; type = detected; } - buf << endl; + buf << type << " (" << (size/1024) << "K) "; myAboutString = buf.str(); // We should know the cart's type by now so let's create it diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index a19b133bd..eb1af4a17 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.cxx @@ -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: Console.cxx,v 1.149 2008-06-20 12:19:42 stephena Exp $ +// $Id: Console.cxx,v 1.150 2009-01-01 00:08:59 stephena Exp $ //============================================================================ #include @@ -126,7 +126,6 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props) // Auto-detect NTSC/PAL mode if it's requested myDisplayFormat = myProperties.get(Display_Format); - vidinfo << " Display Format: " << myDisplayFormat; if(myDisplayFormat == "AUTO-DETECT" || myOSystem->settings().getBool("rominfo")) { @@ -145,8 +144,9 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props) } myDisplayFormat = (palCount >= 15) ? "PAL" : "NTSC"; if(myProperties.get(Display_Format) == "AUTO-DETECT") - vidinfo << " ==> " << myDisplayFormat; + myConsoleInfo.DisplayFormat = "AUTO => "; } + myConsoleInfo.DisplayFormat += myDisplayFormat; // Set up the correct properties used when toggling format // Note that this can be overridden if a format is forced @@ -178,18 +178,14 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props) myOSystem->eventHandler().allowAllDirections(allow); // Reset the system to its power-on state - // TODO - a reset still isn't completely working with Boulderdash mySystem->reset(); - // Finally, show some info about the console - about << " Cart Name: " << myProperties.get(Cartridge_Name) << endl - << " Cart MD5: " << myProperties.get(Cartridge_MD5) << endl - << " Controller 0: " << myControllers[0]->about() << endl - << " Controller 1: " << myControllers[1]->about() << endl - << vidinfo.str() << endl - << cart->about(); - - myAboutString = about.str(); + // Finally, add remaining info about the console + myConsoleInfo.CartName = myProperties.get(Cartridge_Name); + myConsoleInfo.CartMD5 = myProperties.get(Cartridge_MD5); + myConsoleInfo.Control0 = myControllers[0]->about(); + myConsoleInfo.Control1 = myControllers[1]->about(); + myConsoleInfo.BankSwitch = cart->about(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/Console.hxx b/stella/src/emucore/Console.hxx index bdf291acb..4da442fdd 100644 --- a/stella/src/emucore/Console.hxx +++ b/stella/src/emucore/Console.hxx @@ -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: Console.hxx,v 1.69 2008-05-30 19:07:55 stephena Exp $ +// $Id: Console.hxx,v 1.70 2009-01-01 00:08:59 stephena Exp $ //============================================================================ #ifndef CONSOLE_HXX @@ -35,11 +35,24 @@ class System; #include "AtariVox.hxx" #include "Serializable.hxx" +/** + Contains detailed info about a console. +*/ +struct ConsoleInfo +{ + string BankSwitch; + string CartName; + string CartMD5; + string Control0; + string Control1; + string DisplayFormat; +}; + /** This class represents the entire game console. @author Bradford W. Mott - @version $Id: Console.hxx,v 1.69 2008-05-30 19:07:55 stephena Exp $ + @version $Id: Console.hxx,v 1.70 2009-01-01 00:08:59 stephena Exp $ */ class Console : public Serializable { @@ -150,9 +163,9 @@ class Console : public Serializable void setProperties(const Properties& props); /** - Query some information about this console. + Query detailed information about this console. */ - const string& about() const { return myAboutString; } + inline const ConsoleInfo& about() const { return myConsoleInfo; } public: /** @@ -320,8 +333,8 @@ class Console : public Serializable // successfully loaded bool myUserPaletteDefined; - // Contains info about this console in string format - string myAboutString; + // Contains detailed info about this console + ConsoleInfo myConsoleInfo; // Table of RGB values for NTSC, PAL and SECAM static uInt32 ourNTSCPalette[256]; diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index 0ba91f4cc..fd91bdcc4 100644 --- a/stella/src/emucore/FrameBuffer.cxx +++ b/stella/src/emucore/FrameBuffer.cxx @@ -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.150 2008-12-29 20:42:15 stephena Exp $ +// $Id: FrameBuffer.cxx,v 1.151 2009-01-01 00:08:59 stephena Exp $ //============================================================================ #include @@ -125,8 +125,8 @@ bool FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height) // Create surfaces for TIA statistics and general messages myStatsMsg.color = kBtnTextColor; - myStatsMsg.w = myOSystem->consoleFont().getStringWidth("000 LINES %00.00 FPS"); - myStatsMsg.h = myOSystem->consoleFont().getFontHeight(); + myStatsMsg.w = myOSystem->consoleFont().getMaxCharWidth() * 21; + myStatsMsg.h = (myOSystem->consoleFont().getFontHeight() + 2) * 3; if(myStatsMsg.surface == NULL) { @@ -169,13 +169,18 @@ void FrameBuffer::update() if(myStatsMsg.enabled) { // FIXME - sizes hardcoded for now; fix during UI refactoring + const ConsoleInfo& info = myOSystem->console().about(); char msg[30]; sprintf(msg, "%u LINES %2.2f FPS", myOSystem->console().mediaSource().scanlines(), myOSystem->console().getFramerate()); myStatsMsg.surface->fillRect(0, 0, myStatsMsg.w, myStatsMsg.h, kBGColor); - myStatsMsg.surface->drawString(&myOSystem->consoleFont(), msg, 1, 1, - myStatsMsg.w, myStatsMsg.color, kTextAlignLeft); + myStatsMsg.surface->drawString(&myOSystem->consoleFont(), + msg, 1, 1, myStatsMsg.w, myStatsMsg.color, kTextAlignLeft); + myStatsMsg.surface->drawString(&myOSystem->consoleFont(), + info.DisplayFormat, 1, 15, myStatsMsg.w, myStatsMsg.color, kTextAlignLeft); + myStatsMsg.surface->drawString(&myOSystem->consoleFont(), + info.BankSwitch, 1, 30, myStatsMsg.w, myStatsMsg.color, kTextAlignLeft); myStatsMsg.surface->addDirtyRect(0, 0, 0, 0); // force a full draw myStatsMsg.surface->setPos(myImageRect.x() + 3, myImageRect.y() + 3); myStatsMsg.surface->update(); diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index 74b9bfdb7..0f552913e 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -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.136 2008-12-29 20:42:15 stephena Exp $ +// $Id: OSystem.cxx,v 1.137 2009-01-01 00:08:59 stephena Exp $ //============================================================================ #include @@ -412,7 +412,7 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum) if(mySettings->getBool("showinfo")) cout << "Game console created:" << endl << " ROM file: " << myRomFile << endl << endl - << myConsole->about() << endl; + << " FIXME : myConsole->about()" << endl; // Update the timing info for a new console run resetLoopTiming(); @@ -613,6 +613,21 @@ string OSystem::MD5FromFile(const string& filename) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string OSystem::getROMInfo(const string& romfile) { +// FIXME - convert this into a string +// also, combine this method with ::createConsole(), as there's +// quite a bit of redundant code +/* + about << " Cart Name: " << myProperties.get(Cartridge_Name) << endl + << " Cart MD5: " << myProperties.get(Cartridge_MD5) << endl + << " Controller 0: " << myControllers[0]->about() << endl + << " Controller 1: " << myControllers[1]->about() << endl + << vidinfo.str() << endl + << cart->about(); + + myAboutString = about.str(); +*/ + + ostringstream buf; // Open the cartridge image and read it in @@ -628,7 +643,7 @@ string OSystem::getROMInfo(const string& romfile) { Console* console = new Console(this, cart, props); if(console) - buf << console->about(); + buf << "FIXME : console->about()\n"; else buf << "ERROR: Couldn't get ROM info for " << romfile << " ..." << endl;