Modified the commandline parsing to accept the following options:

-Dformat  (changes Display.Format)
-Dxstart  (changes Display.XStart)
-Dystart  (changes Display.YStart)
-Dwidth   (changes Display.Width)
-Dheight  (changes Display.Height)

These are only activated if 'DEVELOPER_SUPPORT' is defined.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@123 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2002-11-10 00:27:26 +00:00
parent 4bf5ac3615
commit 3dbc0b7193
2 changed files with 59 additions and 2 deletions

View File

@ -13,9 +13,13 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Settings.cxx,v 1.3 2002-09-29 14:11:10 stephena Exp $
// $Id: Settings.cxx,v 1.4 2002-11-10 00:27:26 stephena Exp $
//============================================================================
#ifdef DEVELOPER_SUPPORT
#include "Props.hxx"
#endif
#include "Settings.hxx"
@ -39,6 +43,14 @@ Settings::Settings()
theMaxWindowSize = 0;
theHeight = 0;
theWidth = 0;
#ifdef DEVELOPER_SUPPORT
userDefinedProperties.set("Display.Format", "-1");
userDefinedProperties.set("Display.XStart", "-1");
userDefinedProperties.set("Display.Width", "-1");
userDefinedProperties.set("Display.YStart", "-1");
userDefinedProperties.set("Display.Height", "-1");
#endif
}
Settings::~Settings()
@ -175,6 +187,42 @@ bool Settings::handleCommandLineArgs(int argc, char* argv[])
{
theAlternateProFile = argv[++i];
}
#ifdef DEVELOPER_SUPPORT
else if(string(argv[i]) == "-Dformat")
{
string option = argv[++i];
if((option == "NTSC") || (option == "PAL"))
userDefinedProperties.set("Display.Format", option);
}
else if(string(argv[i]) == "-Dxstart")
{
string option = argv[i+1];
uInt32 value = atoi(argv[++i]);
if((value >= 0) && (value <= 80) && ((value % 4) == 0))
userDefinedProperties.set("Display.XStart", option);
}
else if(string(argv[i]) == "-Dwidth")
{
string option = argv[i+1];
uInt32 value = atoi(argv[++i]);
if((value >= 80) && (value <= 160) && ((value % 4) == 0))
userDefinedProperties.set("Display.Width", option);
}
else if(string(argv[i]) == "-Dystart")
{
string option = argv[i+1];
uInt32 value = atoi(argv[++i]);
if((value >= 0) && (value <= 64))
userDefinedProperties.set("Display.YStart", option);
}
else if(string(argv[i]) == "-Dheight")
{
string option = argv[i+1];
uInt32 value = atoi(argv[++i]);
if((value >= 100) && (value <= 256))
userDefinedProperties.set("Display.Height", option);
}
#endif
else
{
cout << "Undefined option " << argv[i] << endl;

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: Settings.hxx,v 1.3 2002-09-29 14:11:11 stephena Exp $
// $Id: Settings.hxx,v 1.4 2002-11-10 00:27:26 stephena Exp $
//============================================================================
#ifndef SETTINGS_HXX
@ -21,6 +21,10 @@
#include "bspf.hxx"
#ifdef DEVELOPER_SUPPORT
#include "Props.hxx"
#endif
class Settings
{
public:
@ -89,6 +93,11 @@ class Settings
// Indicates the width and height of the game display based on properties
uInt32 theHeight;
uInt32 theWidth;
#ifdef DEVELOPER_SUPPORT
// User-modified properties
Properties userDefinedProperties;
#endif
};
#endif