mirror of https://github.com/stella-emu/stella.git
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:
parent
470de4f24a
commit
009884dad4
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// 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>
|
#include <assert.h>
|
||||||
|
@ -46,7 +46,8 @@
|
||||||
Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
||||||
const Event& event, PropertiesSet& propertiesSet, uInt32 sampleRate,
|
const Event& event, PropertiesSet& propertiesSet, uInt32 sampleRate,
|
||||||
const Properties* userDefinedProperties)
|
const Properties* userDefinedProperties)
|
||||||
: myEvent(event)
|
: myEvent(event),
|
||||||
|
myPropSet(propertiesSet)
|
||||||
{
|
{
|
||||||
myControllers[0] = 0;
|
myControllers[0] = 0;
|
||||||
myControllers[1] = 0;
|
myControllers[1] = 0;
|
||||||
|
@ -58,7 +59,7 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
||||||
string md5 = MD5(image, size);
|
string md5 = MD5(image, size);
|
||||||
|
|
||||||
// Search for the properties based on MD5
|
// Search for the properties based on MD5
|
||||||
propertiesSet.getMD5(md5, myProperties);
|
myPropSet.getMD5(md5, myProperties);
|
||||||
|
|
||||||
// Merge any user-defined properties
|
// Merge any user-defined properties
|
||||||
if(userDefinedProperties != 0)
|
if(userDefinedProperties != 0)
|
||||||
|
@ -149,7 +150,8 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Console::Console(const Console& console)
|
Console::Console(const Console& console)
|
||||||
: myEvent(console.myEvent)
|
: myEvent(console.myEvent),
|
||||||
|
myPropSet(console.myPropSet)
|
||||||
{
|
{
|
||||||
// TODO: Write this method
|
// TODO: Write this method
|
||||||
assert(false);
|
assert(false);
|
||||||
|
@ -214,8 +216,6 @@ const Properties& Console::defaultProperties()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Properties Console::ourDefaultProperties;
|
Properties Console::ourDefaultProperties;
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEVELOPER_SUPPORT
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Console::toggleFormat()
|
void Console::toggleFormat()
|
||||||
{
|
{
|
||||||
|
@ -399,25 +399,39 @@ void Console::changeHeight(const uInt32 direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Console::saveProperties(string& filename)
|
void Console::saveProperties(string& filename, bool merge)
|
||||||
{
|
{
|
||||||
string message;
|
string message;
|
||||||
|
|
||||||
// Replace all spaces in filename with underscores
|
// Merge the current properties into the PropertiesSet file
|
||||||
replace(filename.begin(), filename.end(), ' ', '_');
|
if(merge)
|
||||||
ofstream out(filename.c_str(), ios::out);
|
|
||||||
|
|
||||||
if(out && out.is_open())
|
|
||||||
{
|
{
|
||||||
myProperties.save(out);
|
if(myPropSet.merge(myProperties, filename))
|
||||||
out.close();
|
{
|
||||||
message = "Properties saved";
|
message = "Properties merged";
|
||||||
myMediaSource->showMessage(message, 120);
|
myMediaSource->showMessage(message, 120);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message = "Properties not merged";
|
||||||
|
myMediaSource->showMessage(message, 120);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else // Save to the specified file directly
|
||||||
{
|
{
|
||||||
message = "Properties not saved";
|
ofstream out(filename.c_str(), ios::out);
|
||||||
myMediaSource->showMessage(message, 120);
|
|
||||||
|
if(out && out.is_open())
|
||||||
|
{
|
||||||
|
myProperties.save(out);
|
||||||
|
out.close();
|
||||||
|
message = "Properties saved";
|
||||||
|
myMediaSource->showMessage(message, 120);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message = "Properties not saved";
|
||||||
|
myMediaSource->showMessage(message, 120);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// 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
|
#ifndef CONSOLE_HXX
|
||||||
|
@ -36,7 +36,7 @@ class System;
|
||||||
This class represents the entire game console.
|
This class represents the entire game console.
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@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
|
class Console
|
||||||
{
|
{
|
||||||
|
@ -134,7 +134,6 @@ class Console
|
||||||
*/
|
*/
|
||||||
static const Properties& defaultProperties();
|
static const Properties& defaultProperties();
|
||||||
|
|
||||||
#ifdef DEVELOPER_SUPPORT
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Toggle between NTSC and PAL mode. The GUI's may need to reload their palette.
|
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.
|
Save a copy of the current properties after any changes.
|
||||||
|
|
||||||
@param filename Filename to save the properties into.
|
@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);
|
void saveProperties(string& filename, bool merge = false);
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Pointers to the left and right controllers
|
// Pointers to the left and right controllers
|
||||||
|
@ -200,6 +200,9 @@ class Console
|
||||||
// Pointer to the 6502 based system being emulated
|
// Pointer to the 6502 based system being emulated
|
||||||
System* mySystem;
|
System* mySystem;
|
||||||
|
|
||||||
|
// Reference to the PropertiesSet object
|
||||||
|
PropertiesSet& myPropSet;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Default properties to use for properties objects
|
// Default properties to use for properties objects
|
||||||
static Properties ourDefaultProperties;
|
static Properties ourDefaultProperties;
|
||||||
|
|
Loading…
Reference in New Issue