Removed all DEVELOPER_SUPPORT #ifdef's from the code. The methods will now

be compiled into the core.  It's up to the GUI's to call (or not call) the
DEVELOPER methods.

Changed the behaviour of Console::saveProperties() in that it now accepts a
boolean variable 'merge', which if true, will make a call to
PropertiesSet::merge() and indicate that these properties are to be saved
into a stella.pro file.

If merge is false, it simply saves the properties to the specified file
(as before).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@129 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2002-11-11 02:46:34 +00:00
parent 470de4f24a
commit 009884dad4
2 changed files with 42 additions and 25 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: Console.cxx,v 1.6 2002-11-10 19:05:57 stephena Exp $
// $Id: Console.cxx,v 1.7 2002-11-11 02:46:34 stephena Exp $
//============================================================================
#include <assert.h>
@ -46,7 +46,8 @@
Console::Console(const uInt8* image, uInt32 size, const char* filename,
const Event& event, PropertiesSet& propertiesSet, uInt32 sampleRate,
const Properties* userDefinedProperties)
: myEvent(event)
: myEvent(event),
myPropSet(propertiesSet)
{
myControllers[0] = 0;
myControllers[1] = 0;
@ -58,7 +59,7 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
string md5 = MD5(image, size);
// Search for the properties based on MD5
propertiesSet.getMD5(md5, myProperties);
myPropSet.getMD5(md5, myProperties);
// Merge any user-defined properties
if(userDefinedProperties != 0)
@ -149,7 +150,8 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Console::Console(const Console& console)
: myEvent(console.myEvent)
: myEvent(console.myEvent),
myPropSet(console.myPropSet)
{
// TODO: Write this method
assert(false);
@ -214,8 +216,6 @@ const Properties& Console::defaultProperties()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Properties Console::ourDefaultProperties;
#ifdef DEVELOPER_SUPPORT
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleFormat()
{
@ -399,12 +399,26 @@ void Console::changeHeight(const uInt32 direction)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::saveProperties(string& filename)
void Console::saveProperties(string& filename, bool merge)
{
string message;
// Replace all spaces in filename with underscores
replace(filename.begin(), filename.end(), ' ', '_');
// Merge the current properties into the PropertiesSet file
if(merge)
{
if(myPropSet.merge(myProperties, filename))
{
message = "Properties merged";
myMediaSource->showMessage(message, 120);
}
else
{
message = "Properties not merged";
myMediaSource->showMessage(message, 120);
}
}
else // Save to the specified file directly
{
ofstream out(filename.c_str(), ios::out);
if(out && out.is_open())
@ -419,5 +433,5 @@ void Console::saveProperties(string& filename)
message = "Properties not saved";
myMediaSource->showMessage(message, 120);
}
}
}
#endif

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: Console.hxx,v 1.5 2002-11-10 19:05:57 stephena Exp $
// $Id: Console.hxx,v 1.6 2002-11-11 02:46:34 stephena Exp $
//============================================================================
#ifndef CONSOLE_HXX
@ -36,7 +36,7 @@ class System;
This class represents the entire game console.
@author Bradford W. Mott
@version $Id: Console.hxx,v 1.5 2002-11-10 19:05:57 stephena Exp $
@version $Id: Console.hxx,v 1.6 2002-11-11 02:46:34 stephena Exp $
*/
class Console
{
@ -134,7 +134,6 @@ class Console
*/
static const Properties& defaultProperties();
#ifdef DEVELOPER_SUPPORT
public:
/**
Toggle between NTSC and PAL mode. The GUI's may need to reload their palette.
@ -177,9 +176,10 @@ class Console
Save a copy of the current properties after any changes.
@param filename Filename to save the properties into.
@param merge Whether or not to merge the changes into the
main properties file.
*/
void saveProperties(string& filename);
#endif
void saveProperties(string& filename, bool merge = false);
private:
// Pointers to the left and right controllers
@ -200,6 +200,9 @@ class Console
// Pointer to the 6502 based system being emulated
System* mySystem;
// Reference to the PropertiesSet object
PropertiesSet& myPropSet;
private:
// Default properties to use for properties objects
static Properties ourDefaultProperties;