Some fairly major changes to the Properties handling. Added a 'Default'

button to GameInfoDialog, which basically resets ROM properties to
built-in (compiled) defaults, and removes the entry from an external
stella.pro file (if it exists).  A ROM reload is still necessary
for these settings to take effect.

Removed 'Alt-s' properties merging shortcut, since it does the same
as clicking OK in GameInfoDialog, and there should be only one way of
doing that.

Fixed bug in UI where pressing state-change keys (Ctrl, Shift, etc)
would be interpreted as characters.

Added ROM properties for "Strat-O-Gems Deluxe".


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1165 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-12-01 18:30:21 +00:00
parent e3c0ee39ff
commit 4c8743b04e
17 changed files with 256 additions and 219 deletions

View File

@ -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.102 2006-11-27 02:18:47 stephena Exp $ // $Id: Console.cxx,v 1.103 2006-12-01 18:30:16 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -382,31 +382,9 @@ void Console::togglePhosphor()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::saveProperties(string filename, bool merge) void Console::setProperties(const Properties& props)
{ {
// Merge the current properties into the PropertiesSet file myProperties = props;
if(merge)
{
if(myOSystem->propSet().merge(myProperties, filename))
myOSystem->frameBuffer().showMessage("Properties merged");
else
myOSystem->frameBuffer().showMessage("Error merging properties");
}
else // Save to the specified file directly
{
ofstream out(filename.c_str(), ios::out);
if(out && out.is_open())
{
myProperties.save(out);
out.close();
myOSystem->frameBuffer().showMessage("Properties saved");
}
else
{
myOSystem->frameBuffer().showMessage("Error saving properties");
}
}
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -448,7 +426,6 @@ void Console::initialize()
// Initialize the options menu system with updated values from the framebuffer // Initialize the options menu system with updated values from the framebuffer
myOSystem->menu().initialize(); myOSystem->menu().initialize();
myOSystem->menu().setGameProfile(myProperties);
// Initialize the command menu system with updated values from the framebuffer // Initialize the command menu system with updated values from the framebuffer
myOSystem->commandMenu().initialize(); myOSystem->commandMenu().initialize();
@ -794,7 +771,7 @@ void Console::loadUserPalette()
return; return;
} }
// Now that we have valid data, create the user-defined buffers // Now that we have valid data, create the user-defined palettes
ourUserNTSCPalette = new uInt32[256]; ourUserNTSCPalette = new uInt32[256];
ourUserPALPalette = new uInt32[256]; ourUserPALPalette = new uInt32[256];
uInt8 pixbuf[3]; // Temporary buffer for one 24-bit pixel uInt8 pixbuf[3]; // Temporary buffer for one 24-bit pixel

View File

@ -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.48 2006-11-25 01:34:35 stephena Exp $ // $Id: Console.hxx,v 1.49 2006-12-01 18:30:16 stephena Exp $
//============================================================================ //============================================================================
#ifndef CONSOLE_HXX #ifndef CONSOLE_HXX
@ -38,7 +38,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.48 2006-11-25 01:34:35 stephena Exp $ @version $Id: Console.hxx,v 1.49 2006-12-01 18:30:16 stephena Exp $
*/ */
class Console class Console
{ {
@ -120,6 +120,13 @@ class Console
*/ */
M6532& riot() const { return *myRiot; } M6532& riot() const { return *myRiot; }
/**
Set the properties to those given
@param The properties to use for the current game
*/
void setProperties(const Properties& props);
public: public:
/** /**
Overloaded assignment operator Overloaded assignment operator
@ -152,15 +159,6 @@ class Console
*/ */
void togglePhosphor(); void togglePhosphor();
/**
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, bool merge = false);
/** /**
Initialize the basic properties of the console. Initialize the basic properties of the console.
TODO - This is a workaround for a bug in the TIA rendering, whereby TODO - This is a workaround for a bug in the TIA rendering, whereby

View File

@ -3094,7 +3094,7 @@ static const char* DefProps[][23] = {
{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "807a8ff6216b00d52aba2dfea5d8d860", "John Payson", "", "Strat-O-Gems Deluxe", "", "Homebrew", "", "", "", "", "", "", "", "", "", "PAL", "", "", "", "250", "", "", "" },
{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "80e1410ec98089e0733cc09e584dba4b", "Dynamics", "", "Jumping Jack (Dynamics) (PAL) [!]", "", "", "", "", "", "", "", "", "", "", "", "PAL", "", "", "42", "256", "", "", "" }, { "80e1410ec98089e0733cc09e584dba4b", "Dynamics", "", "Jumping Jack (Dynamics) (PAL) [!]", "", "", "", "", "", "", "", "", "", "", "", "PAL", "", "", "42", "256", "", "", "" },
{ "8101efafcf0af32fedda4579c941e6f4", "", "", "Okie Dokie (4K) (PD)", "", "New Release", "", "", "", "", "", "", "", "", "", "PAL", "16", "128", "64", "220", "", "", "" }, { "8101efafcf0af32fedda4579c941e6f4", "", "", "Okie Dokie (4K) (PD)", "", "New Release", "", "", "", "", "", "", "", "", "", "PAL", "16", "128", "64", "220", "", "", "" },

View File

@ -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: EventHandler.cxx,v 1.175 2006-11-29 18:22:55 stephena Exp $ // $Id: EventHandler.cxx,v 1.176 2006-12-01 18:30:18 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -35,6 +35,7 @@
#include "GuiUtils.hxx" #include "GuiUtils.hxx"
#include "Deserializer.hxx" #include "Deserializer.hxx"
#include "Serializer.hxx" #include "Serializer.hxx"
#include "PropsSet.hxx"
#include "bspf.hxx" #include "bspf.hxx"
#ifdef DEVELOPER_SUPPORT #ifdef DEVELOPER_SUPPORT
@ -474,10 +475,6 @@ void EventHandler::poll(uInt32 time)
myOSystem->console().enableBits(true); myOSystem->console().enableBits(true);
break; break;
case SDLK_s: // Alt-s merges properties into user properties (user.pro)
saveProperties();
break;
case SDLK_p: // Alt-p toggles phosphor effect case SDLK_p: // Alt-p toggles phosphor effect
myOSystem->console().togglePhosphor(); myOSystem->console().togglePhosphor();
break; break;
@ -603,10 +600,20 @@ void EventHandler::poll(uInt32 time)
break; break;
case SDLK_s: // Ctrl-s saves properties to a file case SDLK_s: // Ctrl-s saves properties to a file
string newPropertiesFile = myOSystem->baseDir() + BSPF_PATH_SEPARATOR + {
string filename = myOSystem->baseDir() + BSPF_PATH_SEPARATOR +
myOSystem->console().properties().get(Cartridge_Name) + ".pro"; myOSystem->console().properties().get(Cartridge_Name) + ".pro";
myOSystem->console().saveProperties(newPropertiesFile); ofstream out(filename.c_str(), ios::out);
if(out)
{
myOSystem->console().properties().save(out);
out.close();
myOSystem->frameBuffer().showMessage("Properties saved");
}
else
myOSystem->frameBuffer().showMessage("Error saving properties");
break; break;
}
} }
} }
} }
@ -622,9 +629,11 @@ void EventHandler::poll(uInt32 time)
handleEvent(myKeyTable[key][kEmulationMode], state); handleEvent(myKeyTable[key][kEmulationMode], state);
else if(myOverlay != NULL) else if(myOverlay != NULL)
{ {
// Make sure the unicode field is valid // Assign unicode field if it doesn't exist
// Make sure 'state change' keys (Shift, Ctrl, etc) are excluded
if(!unicode) unicode = key; if(!unicode) unicode = key;
if(key > SDLK_F15 && key < SDLK_HELP)
unicode = 0;
myOverlay->handleKeyEvent(unicode, key, mod, state); myOverlay->handleKeyEvent(unicode, key, mod, state);
} }
@ -2318,12 +2327,6 @@ void EventHandler::setEventState(State state)
myOSystem->stateChanged(myState); myOSystem->stateChanged(myState);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::saveProperties()
{
myOSystem->console().saveProperties(myOSystem->propertiesFile(), true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setSDLMappings() void EventHandler::setSDLMappings()
{ {

View File

@ -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: EventHandler.hxx,v 1.91 2006-11-28 21:48:56 stephena Exp $ // $Id: EventHandler.hxx,v 1.92 2006-12-01 18:30:18 stephena Exp $
//============================================================================ //============================================================================
#ifndef EVENTHANDLER_HXX #ifndef EVENTHANDLER_HXX
@ -114,7 +114,7 @@ struct JoyMouse {
mapping can take place. mapping can take place.
@author Stephen Anthony @author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.91 2006-11-28 21:48:56 stephena Exp $ @version $Id: EventHandler.hxx,v 1.92 2006-12-01 18:30:18 stephena Exp $
*/ */
class EventHandler class EventHandler
{ {
@ -312,7 +312,6 @@ class EventHandler
void leaveMenuMode(); void leaveMenuMode();
bool enterDebugMode(); bool enterDebugMode();
void leaveDebugMode(); void leaveDebugMode();
void saveProperties();
/** /**
Send an event directly to the event handler. Send an event directly to the event handler.

View File

@ -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: Props.cxx,v 1.14 2006-11-19 00:48:55 stephena Exp $ // $Id: Props.cxx,v 1.15 2006-12-01 18:30:18 stephena Exp $
//============================================================================ //============================================================================
#include <cctype> #include <cctype>
@ -135,9 +135,10 @@ void Properties::load(istream& in)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Properties::save(ostream& out) void Properties::save(ostream& out) const
{ {
// Write out each of the key and value pairs // Write out each of the key and value pairs
bool changed = false;
for(int i = 0; i < LastPropType; ++i) for(int i = 0; i < LastPropType; ++i)
{ {
// Try to save some space by only saving the items that differ from default // Try to save some space by only saving the items that differ from default
@ -147,13 +148,17 @@ void Properties::save(ostream& out)
out.put(' '); out.put(' ');
writeQuotedString(out, myProperties[i]); writeQuotedString(out, myProperties[i]);
out.put('\n'); out.put('\n');
changed = true;
} }
} }
// Put a trailing null string so we know when to stop reading if(changed)
writeQuotedString(out, ""); {
out.put('\n'); // Put a trailing null string so we know when to stop reading
out.put('\n'); writeQuotedString(out, "");
out.put('\n');
out.put('\n');
}
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -243,7 +248,7 @@ void Properties::copy(const Properties& properties)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Properties::print() void Properties::print() const
{ {
cout << get(Cartridge_MD5) << "|" cout << get(Cartridge_MD5) << "|"
<< get(Cartridge_Name) << "|" << get(Cartridge_Name) << "|"

View File

@ -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: Props.hxx,v 1.10 2006-11-19 00:48:55 stephena Exp $ // $Id: Props.hxx,v 1.11 2006-12-01 18:30:18 stephena Exp $
//============================================================================ //============================================================================
#ifndef PROPERTIES_HXX #ifndef PROPERTIES_HXX
@ -57,7 +57,7 @@ enum PropertyType {
if the property key is not found in the original property list. if the property key is not found in the original property list.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: Props.hxx,v 1.10 2006-11-19 00:48:55 stephena Exp $ @version $Id: Props.hxx,v 1.11 2006-12-01 18:30:18 stephena Exp $
*/ */
class Properties class Properties
{ {
@ -112,12 +112,12 @@ class Properties
@param out The output stream to use @param out The output stream to use
*/ */
void save(ostream& out); void save(ostream& out) const;
/** /**
Print the attributes of this properties object Print the attributes of this properties object
*/ */
void print(); void print() const;
/** /**
Resets all properties to their defaults Resets all properties to their defaults

View File

@ -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: PropsSet.cxx,v 1.23 2006-10-22 18:58:46 stephena Exp $ // $Id: PropsSet.cxx,v 1.24 2006-12-01 18:30:18 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -62,32 +62,33 @@ PropertiesSet::~PropertiesSet()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PropertiesSet::getMD5(const string& md5, Properties &properties) void PropertiesSet::getMD5(const string& md5, Properties& properties,
bool useDefaults) const
{ {
properties.setDefaults(); properties.setDefaults();
bool found = false; bool found = false;
// First check our dynamic BST for the object // First check our dynamic BST for the object
if(myRoot != 0) if(!useDefaults && myRoot != 0)
{ {
TreeNode* current = myRoot; TreeNode* current = myRoot;
while(current) while(current)
{ {
string currentMd5 = current->props->get(Cartridge_MD5); const string& currentMd5 = current->props->get(Cartridge_MD5);
if(currentMd5 == md5) if(currentMd5 == md5)
{ {
found = true; // We only report a node as found if it's to be saved.
// Nodes in the BST that are marked as 'do not save' are
// essentially treated as if they're not present.
// What really should happen is the node should be removed,
// and the tree rebalanced ...
found = current->save;
break; break;
} }
else else if(md5 < currentMd5)
{ current = current->left;
if(md5 < currentMd5) else
current = current->left; current = current->right;
else
current = current->right;
}
} }
if(found) if(found)
@ -133,6 +134,29 @@ void PropertiesSet::insert(const Properties& properties, bool save)
insertNode(myRoot, properties, save); insertNode(myRoot, properties, save);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PropertiesSet::removeMD5(const string& md5)
{
// We only remove from the dynamic BST
if(myRoot != 0)
{
TreeNode* current = myRoot;
while(current)
{
const string& currentMd5 = current->props->get(Cartridge_MD5);
if(currentMd5 == md5)
{
current->save = false; // make sure this node isn't saved
break;
}
else if(md5 < currentMd5)
current = current->left;
else
current = current->right;
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PropertiesSet::insertNode(TreeNode* &t, const Properties& properties, void PropertiesSet::insertNode(TreeNode* &t, const Properties& properties,
bool save) bool save)
@ -202,20 +226,26 @@ void PropertiesSet::load(const string& filename, bool save)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PropertiesSet::save(ostream& out) bool PropertiesSet::save(const string& filename) const
{ {
ofstream out(filename.c_str(), ios::out);
if(!out)
return false;
saveNode(out, myRoot); saveNode(out, myRoot);
out.close();
return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PropertiesSet::print() void PropertiesSet::print() const
{ {
cout << size() << endl; cout << size() << endl;
printNode(myRoot); // FIXME - print out internal properties as well printNode(myRoot); // FIXME - print out internal properties as well
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PropertiesSet::saveNode(ostream& out, TreeNode *node) void PropertiesSet::saveNode(ostream& out, TreeNode *node) const
{ {
if(node) if(node)
{ {
@ -227,11 +257,12 @@ void PropertiesSet::saveNode(ostream& out, TreeNode *node)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PropertiesSet::printNode(TreeNode *node) void PropertiesSet::printNode(TreeNode *node) const
{ {
if(node) if(node)
{ {
node->props->print(); if(node->save)
node->props->print();
printNode(node->left); printNode(node->left);
printNode(node->right); printNode(node->right);
} }
@ -242,18 +273,3 @@ uInt32 PropertiesSet::size() const
{ {
return mySize; return mySize;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PropertiesSet::merge(const Properties& properties, const string& filename)
{
ofstream out(filename.c_str());
if(out.is_open())
{
insert(properties, true); // always save merged properties
save(out);
out.close();
return true;
}
else
return false;
}

View File

@ -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: PropsSet.hxx,v 1.14 2006-03-19 00:46:04 stephena Exp $ // $Id: PropsSet.hxx,v 1.15 2006-12-01 18:30:18 stephena Exp $
//============================================================================ //============================================================================
#ifndef PROPERTIES_SET_HXX #ifndef PROPERTIES_SET_HXX
@ -57,8 +57,10 @@ class PropertiesSet
@param md5 The md5 of the property to get @param md5 The md5 of the property to get
@param properties The property with the given MD5, or the default @param properties The property with the given MD5, or the default
properties if not found properties if not found
@param defaults Use the built-in defaults, ignoring any external properties
*/ */
void getMD5(const string& md5, Properties& properties); void getMD5(const string& md5, Properties& properties,
bool useDefaults = false) const;
/** /**
Load properties from the specified file. Use the given Load properties from the specified file. Use the given
@ -71,11 +73,31 @@ class PropertiesSet
void load(const string& filename, bool save); void load(const string& filename, bool save);
/** /**
Save properties to the specified output stream Save properties to the specified file.
@param out The output stream to use @param filename Full pathname of output file to use
@return True on success, false on failure
Failure occurs if file couldn't be opened for writing
*/ */
void save(ostream& out); bool save(const string& filename) const;
/**
Insert the properties into the set. If a duplicate is inserted
the old properties are overwritten with the new ones.
@param properties The collection of properties
@param save Indicates whether to set the 'save' tag for
this property
*/
void insert(const Properties& properties, bool save = true);
/**
Marks the property with the given MD5 as being removed.
@param md5 The md5 of the property to remove
*/
void removeMD5(const string& md5);
/** /**
Get the number of properties in the collection. Get the number of properties in the collection.
@ -87,28 +109,7 @@ class PropertiesSet
/** /**
Prints the contents of the PropertiesSet as a flat file. Prints the contents of the PropertiesSet as a flat file.
*/ */
void print(); void print() const;
/**
Merge the given properties into the collection.
@param properties The properties to merge
@param filename Full pathname of properties file to save
@return True on success, false on failure
Failure occurs if file couldn't be opened for writing
*/
bool merge(const Properties& properties, const string& filename);
/**
Insert the properties into the set. If a duplicate is inserted
the old properties are overwritten with the new ones.
@param properties The collection of properties
@param save Indicates whether to set the 'save' tag for
this property
*/
void insert(const Properties& properties, bool save = true);
private: private:
struct TreeNode { struct TreeNode {
@ -141,14 +142,14 @@ class PropertiesSet
@param out The output stream to use @param out The output stream to use
@param node The current subroot of the tree @param node The current subroot of the tree
*/ */
void saveNode(ostream& out, TreeNode *node); void saveNode(ostream& out, TreeNode* node) const;
/** /**
Prints the current node properties Prints the current node properties
@param node The current subroot of the tree @param node The current subroot of the tree
*/ */
void printNode(TreeNode *node); void printNode(TreeNode* node) const;
private: private:
// The parent system for this object // The parent system for this object

View File

@ -20949,3 +20949,11 @@
"Cartridge.Rarity" "Homebrew" "Cartridge.Rarity" "Homebrew"
"Display.Format" "PAL" "Display.Format" "PAL"
"" ""
"Cartridge.MD5" "807a8ff6216b00d52aba2dfea5d8d860"
"Cartridge.Manufacturer" "John Payson"
"Cartridge.Name" "Strat-O-Gems Deluxe"
"Cartridge.Rarity" "Homebrew"
"Display.Format" "PAL"
"Display.Height" "250"
""

View File

@ -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: Dialog.cxx,v 1.48 2006-11-28 21:48:56 stephena Exp $ // $Id: Dialog.cxx,v 1.49 2006-12-01 18:30:19 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -485,7 +485,7 @@ bool Dialog::handleNavEvent(Event::Type e)
break; break;
case Event::UIOK: case Event::UIOK:
if(_okWidget) if(_okWidget && _okWidget->isEnabled())
{ {
// Receiving 'OK' is the same as getting the 'Select' event // Receiving 'OK' is the same as getting the 'Select' event
_okWidget->handleEvent(Event::UISelect); _okWidget->handleEvent(Event::UISelect);
@ -494,7 +494,7 @@ bool Dialog::handleNavEvent(Event::Type e)
break; break;
case Event::UICancel: case Event::UICancel:
if(_cancelWidget) if(_cancelWidget && _cancelWidget->isEnabled())
{ {
// Receiving 'Cancel' is the same as getting the 'Select' event // Receiving 'Cancel' is the same as getting the 'Select' event
_cancelWidget->handleEvent(Event::UISelect); _cancelWidget->handleEvent(Event::UISelect);

View File

@ -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: GameInfoDialog.cxx,v 1.28 2006-11-28 21:48:56 stephena Exp $ // $Id: GameInfoDialog.cxx,v 1.29 2006-12-01 18:30:20 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -22,6 +22,7 @@
#include "GuiUtils.hxx" #include "GuiUtils.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Props.hxx" #include "Props.hxx"
#include "PropsSet.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "EditTextWidget.hxx" #include "EditTextWidget.hxx"
@ -34,7 +35,8 @@ GameInfoDialog::GameInfoDialog(
OSystem* osystem, DialogContainer* parent, const GUI::Font& font, OSystem* osystem, DialogContainer* parent, const GUI::Font& font,
GuiObject* boss, int x, int y, int w, int h) GuiObject* boss, int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h), : Dialog(osystem, parent, x, y, w, h),
CommandSender(boss) CommandSender(boss),
myDefaultsSelected(false)
{ {
const int fontHeight = font.getFontHeight(), const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
@ -46,7 +48,7 @@ GameInfoDialog::GameInfoDialog(
// The tab widget // The tab widget
xpos = 2; ypos = vBorder; xpos = 2; ypos = vBorder;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos); myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos - 15);
addTabWidget(myTab); addTabWidget(myTab);
// 1) Cartridge properties // 1) Cartridge properties
@ -279,23 +281,29 @@ GameInfoDialog::GameInfoDialog(
myTab->setActiveTab(0); myTab->setActiveTab(0);
// Add message concerning usage // Add message concerning usage
new StaticTextWidget(this, font, 10, _h - 20, 120, fontHeight, lwidth = font.getStringWidth("(*) Changes to properties require a ROM reload");
"(*) Requires a ROM reload", kTextAlignLeft); new StaticTextWidget(this, font, 10, _h - 38, lwidth, fontHeight,
"(*) Changes to properties require a ROM reload",
kTextAlignLeft);
// Add Defaults, OK and Cancel buttons // Add Defaults, OK and Cancel buttons
ButtonWidget* b; ButtonWidget* b;
wid.clear(); wid.clear();
b = addButton(font, 10, _h - 24, "Defaults", kDefaultsCmd);
wid.push_back(b);
#ifndef MAC_OSX #ifndef MAC_OSX
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd); b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
wid.push_back(b); wid.push_back(b);
addOKWidget(b); addOKWidget(b);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd); myCancelButton =
wid.push_back(b); addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
addCancelWidget(b); wid.push_back(myCancelButton);
addCancelWidget(myCancelButton);
#else #else
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd); myCancelButton =
wid.push_back(b); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
addCancelWidget(b); wid.push_back(myCancelButton);
addCancelWidgetmyCancelButton);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd); b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
wid.push_back(b); wid.push_back(b);
addOKWidget(b); addOKWidget(b);
@ -310,30 +318,38 @@ GameInfoDialog::~GameInfoDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::loadConfig() void GameInfoDialog::loadConfig()
{
myDefaultsSelected = false;
myGameProperties = myOSystem->console().properties();
loadView();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::loadView()
{ {
string s; string s;
int i; int i;
// Cartridge properties // Cartridge properties
s = myGameProperties->get(Cartridge_Name); s = myGameProperties.get(Cartridge_Name);
myName->setEditString(s); myName->setEditString(s);
s = myGameProperties->get(Cartridge_MD5); s = myGameProperties.get(Cartridge_MD5);
myMD5->setLabel(s); myMD5->setLabel(s);
s = myGameProperties->get(Cartridge_Manufacturer); s = myGameProperties.get(Cartridge_Manufacturer);
myManufacturer->setEditString(s); myManufacturer->setEditString(s);
s = myGameProperties->get(Cartridge_ModelNo); s = myGameProperties.get(Cartridge_ModelNo);
myModelNo->setEditString(s); myModelNo->setEditString(s);
s = myGameProperties->get(Cartridge_Rarity); s = myGameProperties.get(Cartridge_Rarity);
myRarity->setEditString(s); myRarity->setEditString(s);
s = myGameProperties->get(Cartridge_Note); s = myGameProperties.get(Cartridge_Note);
myNote->setEditString(s); myNote->setEditString(s);
s = myGameProperties->get(Cartridge_Sound); s = myGameProperties.get(Cartridge_Sound);
if(s == "MONO") if(s == "MONO")
mySound->setSelectedTag(1); mySound->setSelectedTag(1);
else if(s == "STEREO") else if(s == "STEREO")
@ -341,7 +357,7 @@ void GameInfoDialog::loadConfig()
else else
mySound->setSelectedTag(0); mySound->setSelectedTag(0);
s = myGameProperties->get(Cartridge_Type); s = myGameProperties.get(Cartridge_Type);
for(i = 0; i < 21; ++i) for(i = 0; i < 21; ++i)
{ {
if(s == ourCartridgeList[i][1]) if(s == ourCartridgeList[i][1])
@ -351,7 +367,7 @@ void GameInfoDialog::loadConfig()
myType->setSelectedTag(i); myType->setSelectedTag(i);
// Console properties // Console properties
s = myGameProperties->get(Console_LeftDifficulty); s = myGameProperties.get(Console_LeftDifficulty);
if(s == "B") if(s == "B")
myLeftDiff->setSelectedTag(1); myLeftDiff->setSelectedTag(1);
else if(s == "A") else if(s == "A")
@ -359,7 +375,7 @@ void GameInfoDialog::loadConfig()
else else
myLeftDiff->setSelectedTag(0); myLeftDiff->setSelectedTag(0);
s = myGameProperties->get(Console_RightDifficulty); s = myGameProperties.get(Console_RightDifficulty);
if(s == "B") if(s == "B")
myRightDiff->setSelectedTag(1); myRightDiff->setSelectedTag(1);
else if(s == "A") else if(s == "A")
@ -367,7 +383,7 @@ void GameInfoDialog::loadConfig()
else else
myRightDiff->setSelectedTag(0); myRightDiff->setSelectedTag(0);
s = myGameProperties->get(Console_TelevisionType); s = myGameProperties.get(Console_TelevisionType);
if(s == "COLOR") if(s == "COLOR")
myTVType->setSelectedTag(1); myTVType->setSelectedTag(1);
else if(s == "BLACKANDWHITE") else if(s == "BLACKANDWHITE")
@ -375,7 +391,7 @@ void GameInfoDialog::loadConfig()
else else
myTVType->setSelectedTag(0); myTVType->setSelectedTag(0);
s = myGameProperties->get(Console_SwapPorts); s = myGameProperties.get(Console_SwapPorts);
if(s == "YES") if(s == "YES")
mySwapPorts->setSelectedTag(1); mySwapPorts->setSelectedTag(1);
else if(s == "NO") else if(s == "NO")
@ -384,7 +400,7 @@ void GameInfoDialog::loadConfig()
mySwapPorts->setSelectedTag(0); mySwapPorts->setSelectedTag(0);
// Controller properties // Controller properties
s = myGameProperties->get(Controller_Left); s = myGameProperties.get(Controller_Left);
for(i = 0; i < 5; ++i) for(i = 0; i < 5; ++i)
{ {
if(s == ourControllerList[i][1]) if(s == ourControllerList[i][1])
@ -393,7 +409,7 @@ void GameInfoDialog::loadConfig()
i = (i == 5) ? 0: i + 1; i = (i == 5) ? 0: i + 1;
myLeftController->setSelectedTag(i); myLeftController->setSelectedTag(i);
s = myGameProperties->get(Controller_Right); s = myGameProperties.get(Controller_Right);
for(i = 0; i < 5; ++i) for(i = 0; i < 5; ++i)
{ {
if(s == ourControllerList[i][1]) if(s == ourControllerList[i][1])
@ -403,7 +419,7 @@ void GameInfoDialog::loadConfig()
myRightController->setSelectedTag(i); myRightController->setSelectedTag(i);
// Display properties // Display properties
s = myGameProperties->get(Display_Format); s = myGameProperties.get(Display_Format);
if(s == "NTSC") if(s == "NTSC")
myFormat->setSelectedTag(1); myFormat->setSelectedTag(1);
else if(s == "PAL") else if(s == "PAL")
@ -413,21 +429,21 @@ void GameInfoDialog::loadConfig()
else else
myFormat->setSelectedTag(0); myFormat->setSelectedTag(0);
s = myGameProperties->get(Display_XStart); s = myGameProperties.get(Display_XStart);
myXStart->setEditString(s); myXStart->setEditString(s);
s = myGameProperties->get(Display_Width); s = myGameProperties.get(Display_Width);
myWidth->setEditString(s); myWidth->setEditString(s);
s = myGameProperties->get(Display_YStart); s = myGameProperties.get(Display_YStart);
myYStart->setEditString(s); myYStart->setEditString(s);
s = myGameProperties->get(Display_Height); s = myGameProperties.get(Display_Height);
myHeight->setEditString(s); myHeight->setEditString(s);
myPPBlend->setEnabled(false); myPPBlend->setEnabled(false);
myPPBlendLabel->setEnabled(false); myPPBlendLabel->setEnabled(false);
s = myGameProperties->get(Display_Phosphor); s = myGameProperties.get(Display_Phosphor);
if(s == "YES") if(s == "YES")
{ {
myPhosphor->setSelectedTag(1); myPhosphor->setSelectedTag(1);
@ -439,11 +455,11 @@ void GameInfoDialog::loadConfig()
else else
myPhosphor->setSelectedTag(0); myPhosphor->setSelectedTag(0);
s = myGameProperties->get(Display_PPBlend); s = myGameProperties.get(Display_PPBlend);
myPPBlend->setValue(atoi(s.c_str())); myPPBlend->setValue(atoi(s.c_str()));
myPPBlendLabel->setLabel(s); myPPBlendLabel->setLabel(s);
s = myGameProperties->get(Emulation_HmoveBlanks); s = myGameProperties.get(Emulation_HmoveBlanks);
if(s == "YES") if(s == "YES")
myHmoveBlanks->setSelectedTag(1); myHmoveBlanks->setSelectedTag(1);
else if(s == "NO") else if(s == "NO")
@ -462,30 +478,30 @@ void GameInfoDialog::saveConfig()
// Cartridge properties // Cartridge properties
s = myName->getEditString(); s = myName->getEditString();
myGameProperties->set(Cartridge_Name, s); myGameProperties.set(Cartridge_Name, s);
s = myManufacturer->getEditString(); s = myManufacturer->getEditString();
myGameProperties->set(Cartridge_Manufacturer, s); myGameProperties.set(Cartridge_Manufacturer, s);
s = myModelNo->getEditString(); s = myModelNo->getEditString();
myGameProperties->set(Cartridge_ModelNo, s); myGameProperties.set(Cartridge_ModelNo, s);
s = myRarity->getEditString(); s = myRarity->getEditString();
myGameProperties->set(Cartridge_Rarity, s); myGameProperties.set(Cartridge_Rarity, s);
s = myNote->getEditString(); s = myNote->getEditString();
myGameProperties->set(Cartridge_Note, s); myGameProperties.set(Cartridge_Note, s);
tag = mySound->getSelectedTag(); tag = mySound->getSelectedTag();
s = (tag == 1) ? "Mono" : "Stereo"; s = (tag == 1) ? "Mono" : "Stereo";
myGameProperties->set(Cartridge_Sound, s); myGameProperties.set(Cartridge_Sound, s);
tag = myType->getSelectedTag(); tag = myType->getSelectedTag();
for(i = 0; i < 21; ++i) for(i = 0; i < 21; ++i)
{ {
if(i == tag-1) if(i == tag-1)
{ {
myGameProperties->set(Cartridge_Type, ourCartridgeList[i][1]); myGameProperties.set(Cartridge_Type, ourCartridgeList[i][1]);
break; break;
} }
} }
@ -493,19 +509,19 @@ void GameInfoDialog::saveConfig()
// Console properties // Console properties
tag = myLeftDiff->getSelectedTag(); tag = myLeftDiff->getSelectedTag();
s = (tag == 1) ? "B" : "A"; s = (tag == 1) ? "B" : "A";
myGameProperties->set(Console_LeftDifficulty, s); myGameProperties.set(Console_LeftDifficulty, s);
tag = myRightDiff->getSelectedTag(); tag = myRightDiff->getSelectedTag();
s = (tag == 1) ? "B" : "A"; s = (tag == 1) ? "B" : "A";
myGameProperties->set(Console_RightDifficulty, s); myGameProperties.set(Console_RightDifficulty, s);
tag = myTVType->getSelectedTag(); tag = myTVType->getSelectedTag();
s = (tag == 1) ? "Color" : "BlackAndWhite"; s = (tag == 1) ? "Color" : "BlackAndWhite";
myGameProperties->set(Console_TelevisionType, s); myGameProperties.set(Console_TelevisionType, s);
tag = mySwapPorts->getSelectedTag(); tag = mySwapPorts->getSelectedTag();
s = (tag == 1) ? "Yes" : "No"; s = (tag == 1) ? "Yes" : "No";
myGameProperties->set(Console_SwapPorts, s); myGameProperties.set(Console_SwapPorts, s);
// Controller properties // Controller properties
tag = myLeftController->getSelectedTag(); tag = myLeftController->getSelectedTag();
@ -513,7 +529,7 @@ void GameInfoDialog::saveConfig()
{ {
if(i == tag-1) if(i == tag-1)
{ {
myGameProperties->set(Controller_Left, ourControllerList[i][0]); myGameProperties.set(Controller_Left, ourControllerList[i][0]);
break; break;
} }
} }
@ -523,7 +539,7 @@ void GameInfoDialog::saveConfig()
{ {
if(i == tag-1) if(i == tag-1)
{ {
myGameProperties->set(Controller_Right, ourControllerList[i][0]); myGameProperties.set(Controller_Right, ourControllerList[i][0]);
break; break;
} }
} }
@ -531,30 +547,52 @@ void GameInfoDialog::saveConfig()
// Display properties // Display properties
tag = myFormat->getSelectedTag(); tag = myFormat->getSelectedTag();
s = (tag == 3) ? "PAL60" : (tag == 2) ? "PAL" : "NTSC"; s = (tag == 3) ? "PAL60" : (tag == 2) ? "PAL" : "NTSC";
myGameProperties->set(Display_Format, s); myGameProperties.set(Display_Format, s);
s = myXStart->getEditString(); s = myXStart->getEditString();
myGameProperties->set(Display_XStart, s); myGameProperties.set(Display_XStart, s);
s = myWidth->getEditString(); s = myWidth->getEditString();
myGameProperties->set(Display_Width, s); myGameProperties.set(Display_Width, s);
s = myYStart->getEditString(); s = myYStart->getEditString();
myGameProperties->set(Display_YStart, s); myGameProperties.set(Display_YStart, s);
s = myHeight->getEditString(); s = myHeight->getEditString();
myGameProperties->set(Display_Height, s); myGameProperties.set(Display_Height, s);
tag = myPhosphor->getSelectedTag(); tag = myPhosphor->getSelectedTag();
s = (tag == 1) ? "Yes" : "No"; s = (tag == 1) ? "Yes" : "No";
myGameProperties->set(Display_Phosphor, s); myGameProperties.set(Display_Phosphor, s);
s = myPPBlendLabel->getLabel(); s = myPPBlendLabel->getLabel();
myGameProperties->set(Display_PPBlend, s); myGameProperties.set(Display_PPBlend, s);
tag = myHmoveBlanks->getSelectedTag(); tag = myHmoveBlanks->getSelectedTag();
s = (tag == 1) ? "Yes" : "No"; s = (tag == 1) ? "Yes" : "No";
myGameProperties->set(Emulation_HmoveBlanks, s); myGameProperties.set(Emulation_HmoveBlanks, s);
// Determine whether to add or remove an entry from the properties set
if(myDefaultsSelected)
instance()->propSet().removeMD5(myGameProperties.get(Cartridge_MD5));
else
instance()->propSet().insert(myGameProperties, true);
// In any event, inform the Console and save the properties
instance()->console().setProperties(myGameProperties);
instance()->propSet().save(myOSystem->propertiesFile());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::setDefaults()
{
// Load the default properties
string md5 = myGameProperties.get(Cartridge_MD5);
instance()->propSet().getMD5(md5, myGameProperties, true);
// Reload the current dialog
loadView();
myDefaultsSelected = true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -565,10 +603,13 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
{ {
case kOKCmd: case kOKCmd:
saveConfig(); saveConfig();
instance()->eventHandler().saveProperties();
close(); close();
break; break;
case kDefaultsCmd:
setDefaults();
break;
case kPhosphorChanged: case kPhosphorChanged:
{ {
bool status = myPhosphor->getSelectedTag() == 1 ? true : false; bool status = myPhosphor->getSelectedTag() == 1 ? true : false;

View File

@ -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: GameInfoDialog.hxx,v 1.17 2006-11-04 19:38:25 stephena Exp $ // $Id: GameInfoDialog.hxx,v 1.18 2006-12-01 18:30:20 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -41,16 +41,20 @@ class GameInfoDialog : public Dialog, public CommandSender
GameInfoDialog(OSystem* osystem, DialogContainer* parent, GameInfoDialog(OSystem* osystem, DialogContainer* parent,
const GUI::Font& font, GuiObject* boss, const GUI::Font& font, GuiObject* boss,
int x, int y, int w, int h); int x, int y, int w, int h);
~GameInfoDialog(); virtual ~GameInfoDialog();
void setGameProfile(Properties& props) { myGameProperties = &props; }
protected:
void loadConfig(); void loadConfig();
void saveConfig(); void saveConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id); void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
void setDefaults();
void loadView();
private: private:
TabWidget* myTab; TabWidget* myTab;
ButtonWidget* myCancelButton;
// Cartridge properties // Cartridge properties
EditTextWidget* myName; EditTextWidget* myName;
@ -95,7 +99,10 @@ class GameInfoDialog : public Dialog, public CommandSender
}; };
/** Game properties for currently loaded ROM */ /** Game properties for currently loaded ROM */
Properties* myGameProperties; Properties myGameProperties;
/** Indicates that the default properties have been loaded */
bool myDefaultsSelected;
/** Holds static strings for Cartridge type */ /** Holds static strings for Cartridge type */
static const char* ourCartridgeList[21][2]; static const char* ourCartridgeList[21][2];

View File

@ -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: Menu.cxx,v 1.12 2005-12-18 18:37:03 stephena Exp $ // $Id: Menu.cxx,v 1.13 2006-12-01 18:30:20 stephena Exp $
//============================================================================ //============================================================================
#include "Dialog.hxx" #include "Dialog.hxx"
@ -25,7 +25,7 @@ class Properties;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Menu::Menu(OSystem* osystem) Menu::Menu(OSystem* osystem)
: DialogContainer(osystem) : DialogContainer(osystem)
{ {
} }
@ -40,9 +40,3 @@ void Menu::initialize()
delete myBaseDialog; delete myBaseDialog;
myBaseDialog = new OptionsDialog(myOSystem, this); myBaseDialog = new OptionsDialog(myOSystem, this);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Menu::setGameProfile(Properties& props)
{
((OptionsDialog*)myBaseDialog)->setGameProfile(props);
}

View File

@ -13,13 +13,12 @@
// 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: Menu.hxx,v 1.11 2005-12-18 18:37:03 stephena Exp $ // $Id: Menu.hxx,v 1.12 2006-12-01 18:30:21 stephena Exp $
//============================================================================ //============================================================================
#ifndef MENU_HXX #ifndef MENU_HXX
#define MENU_HXX #define MENU_HXX
class Properties;
class OSystem; class OSystem;
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
@ -28,7 +27,7 @@ class OSystem;
The base dialog for all configuration menus in Stella. The base dialog for all configuration menus in Stella.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Menu.hxx,v 1.11 2005-12-18 18:37:03 stephena Exp $ @version $Id: Menu.hxx,v 1.12 2006-12-01 18:30:21 stephena Exp $
*/ */
class Menu : public DialogContainer class Menu : public DialogContainer
{ {
@ -43,18 +42,10 @@ class Menu : public DialogContainer
*/ */
virtual ~Menu(); virtual ~Menu();
public:
/** /**
Updates the basedialog to be of the type defined for this derived class. Updates the basedialog to be of the type defined for this derived class.
*/ */
void initialize(); void initialize();
/**
Adds the specified game info to the appropriate menu item
@param props The properties of the current game
*/
void setGameProfile(Properties& props);
}; };
#endif #endif

View File

@ -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: OptionsDialog.cxx,v 1.43 2006-11-28 21:48:56 stephena Exp $ // $Id: OptionsDialog.cxx,v 1.44 2006-12-01 18:30:21 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -129,7 +129,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h); myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h);
w = 255; h = 175; w = 255; h = 190;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myGameInfoDialog = new GameInfoDialog(myOSystem, parent, font, this, x, y, w, h); myGameInfoDialog = new GameInfoDialog(myOSystem, parent, font, this, x, y, w, h);

View File

@ -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: OptionsDialog.hxx,v 1.18 2006-11-18 13:29:11 stephena Exp $ // $Id: OptionsDialog.hxx,v 1.19 2006-12-01 18:30:21 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -22,7 +22,6 @@
#ifndef OPTIONS_DIALOG_HXX #ifndef OPTIONS_DIALOG_HXX
#define OPTIONS_DIALOG_HXX #define OPTIONS_DIALOG_HXX
class Properties;
class CommandSender; class CommandSender;
class DialogContainer; class DialogContainer;
class AudioDialog; class AudioDialog;
@ -43,8 +42,6 @@ class OptionsDialog : public Dialog
OptionsDialog(OSystem* osystem, DialogContainer* parent); OptionsDialog(OSystem* osystem, DialogContainer* parent);
virtual ~OptionsDialog(); virtual ~OptionsDialog();
void setGameProfile(Properties& props) { myGameInfoDialog->setGameProfile(props); }
private: private:
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
void checkBounds(int width, int height, int* x, int* y, int* w, int* h); void checkBounds(int width, int height, int* x, int* y, int* w, int* h);