2002-03-21 22:47:00 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
2016-12-30 00:00:30 +00:00
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
2002-03-21 22:47:00 +00:00
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2016-12-30 00:00:30 +00:00
|
|
|
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2002-03-21 22:47:00 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2002-03-21 22:47:00 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//============================================================================
|
|
|
|
|
The first version of a GUI for event remapping is here!
Now for the things that aren't finished yet:
- Only the most basic functions can be remapped. If you
erase the mapping for those that can't yet be remapped,
you'll have to delete the 'keymap' line from stellarc and
start over.
- Core events can only be remapped to other keys on the keyboard.
I haven't got the joystick remapping working yet (but it should
be easy to do).
- The TIA needs to be modified to show 320 pixels horizontally.
Right now, I'm using 8 pixel-width fonts on a framebuffer of
160 pixels, so there's not a lot of horizontal real estate.
So text will probably overwrite other stuff. This is cosmetic,
and WILL be fixed.
- Modification of the TIA will break every frontends rendering
code. It had to be done sometime ...
- I haven't yet added any user feedback mechanism for the user. So when
you go into remap mode and are about to remap a key, you won't
know it :) I'll be adding arrows (like in XMAME) ...
I've added a "Game Information" menu, which shows things like Game name,
manufacturer, rarity, type, etc. Basically stuff from the stella.pro file.
It has no purpose other than for coolness :)
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@193 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-09-28 21:59:24 +00:00
|
|
|
#include <cassert>
|
2003-09-19 15:45:01 +00:00
|
|
|
#include <sstream>
|
|
|
|
#include <fstream>
|
2007-06-20 20:36:28 +00:00
|
|
|
#include <algorithm>
|
2003-09-19 15:45:01 +00:00
|
|
|
|
2007-09-03 18:37:24 +00:00
|
|
|
#include "bspf.hxx"
|
|
|
|
|
2005-02-21 20:43:53 +00:00
|
|
|
#include "OSystem.hxx"
|
2005-05-11 19:36:00 +00:00
|
|
|
#include "Version.hxx"
|
2007-09-03 18:37:24 +00:00
|
|
|
|
2013-09-27 19:47:15 +00:00
|
|
|
#ifdef DEBUGGER_SUPPORT
|
|
|
|
#include "DebuggerDialog.hxx"
|
|
|
|
#endif
|
|
|
|
|
2002-03-21 22:47:00 +00:00
|
|
|
#include "Settings.hxx"
|
|
|
|
|
X11 and SDL versions now fully compile and fully support the new
EventHandler class. All thats left to do there is integrate the
Snapshot code into the core, but that will have to wait until I
rewrite the PNG handler to not need the PNG library ...
Changed the Settings class to a virtual abstract class, and created
a SettingsUNIX class to derive from it and work with the X11 and SDL
versions.
Some notes on updating the DOS and Windows ports (which I will probably
do eventually), and on porting to other toolkits:
A port needs the following:
- a main function which takes native events and converts to the core
format, and generally acts as the dispatcher (mainXXX.cxx)
- a specific frontend, derived from Frontend.hxx, which sets up port
specific filename and locations (FrontendXXX.hxx)
- a specific settings class, derived from Settings.hxx, which deals
with settings/commandline arguments specific to that port (SettingsXXX.hxx)
- probably some other stuff that I've forgotten
The next step is get the DOS port working with the new EventHandler (easy)
and attempt to bring the Windows port into the year 2003 (it hasn't been
touched for almost a year, quite hard).
I also have to write a GUI class that will draw menus, etc. and actually let
you remap keys from the emulator itself. And that may have to wait until
the fabled graphics rewrite that Brad and I will be working on. It never ends ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@181 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-09-11 20:53:51 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-05-12 23:34:25 +00:00
|
|
|
Settings::Settings(OSystem& osystem)
|
2006-03-05 01:18:42 +00:00
|
|
|
: myOSystem(osystem)
|
2002-03-21 22:47:00 +00:00
|
|
|
{
|
2014-02-28 21:21:50 +00:00
|
|
|
// Video-related options
|
2014-03-08 22:57:16 +00:00
|
|
|
setInternal("video", "");
|
2014-02-28 21:21:50 +00:00
|
|
|
setInternal("vsync", "true");
|
2014-04-28 16:47:10 +00:00
|
|
|
setInternal("fullscreen", "false");
|
2010-09-09 13:40:15 +00:00
|
|
|
setInternal("center", "false");
|
2006-03-06 02:26:16 +00:00
|
|
|
setInternal("palette", "standard");
|
2017-05-13 23:54:43 +00:00
|
|
|
setInternal("colorloss", "false");
|
2008-05-21 16:49:07 +00:00
|
|
|
setInternal("timing", "sleep");
|
Revamped the result on floating pins for TIA reads. Previously, this was
controlled by 'tiafloat', which has now been removed. Now, all
undriven pins take on the last value on the databus. This fixes a bug
in those reads where bit 6 or bits 6 & 7 are also undriven (previously,
these bits would always be zero, and only bits 0-5 were from lastdatabus.
Added new commandline argument 'tiadriven', which defaults to false.
In this default case, relevant bits take on values from the databus.
If true, relevant bits still take on databus values, but some are
randomly driven high as well. This helps to expose bugs when
developers assume the values for undriven/floating bits.
Added 'uimessages' commandline argument and associated UI item. When
disabled, messages which are normally shown in-game are disabled.
Certain messages which indicate a serious error are still shown, however.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1900 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-11-10 20:12:50 +00:00
|
|
|
setInternal("uimessages", "true");
|
2006-03-06 02:26:16 +00:00
|
|
|
|
2014-02-28 21:21:50 +00:00
|
|
|
// TIA specific options
|
2017-05-05 19:20:02 +00:00
|
|
|
setInternal("tia.zoom", "3");
|
2014-02-28 21:21:50 +00:00
|
|
|
setInternal("tia.inter", "false");
|
|
|
|
setInternal("tia.aspectn", "90");
|
|
|
|
setInternal("tia.aspectp", "100");
|
2014-06-02 14:34:12 +00:00
|
|
|
setInternal("tia.fsfill", "false");
|
2017-07-01 22:24:02 +00:00
|
|
|
setInternal("tia.dbgcolors", "roygpb");
|
2014-02-28 21:21:50 +00:00
|
|
|
|
2012-05-06 17:45:48 +00:00
|
|
|
// TV filtering options
|
2014-02-28 21:21:50 +00:00
|
|
|
setInternal("tv.filter", "0");
|
2017-07-10 01:06:50 +00:00
|
|
|
setInternal("tv.phosphor", "50");
|
2017-07-14 11:57:04 +00:00
|
|
|
setInternal("tv.jitter", "true");
|
2016-02-12 14:23:40 +00:00
|
|
|
setInternal("tv.jitter_recovery", "10");
|
2017-07-10 01:06:50 +00:00
|
|
|
setInternal("tv.scanlines", "25");
|
|
|
|
setInternal("tv.scaninter", "true");
|
2012-05-10 15:36:20 +00:00
|
|
|
// TV options when using 'custom' mode
|
2014-02-28 21:21:50 +00:00
|
|
|
setInternal("tv.contrast", "0.0");
|
|
|
|
setInternal("tv.brightness", "0.0");
|
|
|
|
setInternal("tv.hue", "0.0");
|
|
|
|
setInternal("tv.saturation", "0.0");
|
|
|
|
setInternal("tv.gamma", "0.0");
|
|
|
|
setInternal("tv.sharpness", "0.0");
|
|
|
|
setInternal("tv.resolution", "0.0");
|
|
|
|
setInternal("tv.artifacts", "0.0");
|
|
|
|
setInternal("tv.fringing", "0.0");
|
|
|
|
setInternal("tv.bleed", "0.0");
|
2012-03-25 17:51:13 +00:00
|
|
|
|
2007-09-13 00:48:13 +00:00
|
|
|
// Sound options
|
2006-03-06 02:26:16 +00:00
|
|
|
setInternal("sound", "true");
|
|
|
|
setInternal("fragsize", "512");
|
|
|
|
setInternal("freq", "31400");
|
|
|
|
setInternal("volume", "100");
|
|
|
|
|
2007-09-13 00:48:13 +00:00
|
|
|
// Input event options
|
2006-03-06 02:26:16 +00:00
|
|
|
setInternal("keymap", "");
|
|
|
|
setInternal("joymap", "");
|
2010-07-21 17:05:34 +00:00
|
|
|
setInternal("combomap", "");
|
2010-08-21 23:08:44 +00:00
|
|
|
setInternal("joydeadzone", "13");
|
2009-08-05 20:33:40 +00:00
|
|
|
setInternal("joyallow4", "false");
|
2013-08-24 18:40:02 +00:00
|
|
|
setInternal("usemouse", "analog");
|
2014-06-04 16:01:45 +00:00
|
|
|
setInternal("grabmouse", "true");
|
2015-06-28 18:16:33 +00:00
|
|
|
setInternal("cursor", "2");
|
2015-12-30 23:57:54 +00:00
|
|
|
setInternal("dsense", "10");
|
|
|
|
setInternal("msense", "10");
|
2012-03-03 00:56:31 +00:00
|
|
|
setInternal("saport", "lr");
|
2010-03-05 22:02:12 +00:00
|
|
|
setInternal("ctrlcombo", "true");
|
2006-03-06 02:26:16 +00:00
|
|
|
|
2007-09-13 00:48:13 +00:00
|
|
|
// Snapshot options
|
2013-02-16 19:56:09 +00:00
|
|
|
setInternal("snapsavedir", "");
|
|
|
|
setInternal("snaploaddir", "");
|
2013-06-21 12:15:32 +00:00
|
|
|
setInternal("snapname", "int");
|
2006-03-06 02:26:16 +00:00
|
|
|
setInternal("sssingle", "false");
|
2009-01-03 22:57:12 +00:00
|
|
|
setInternal("ss1x", "false");
|
2010-04-14 20:27:59 +00:00
|
|
|
setInternal("ssinterval", "2");
|
2006-03-06 02:26:16 +00:00
|
|
|
|
2007-09-13 00:48:13 +00:00
|
|
|
// Config files and paths
|
2010-07-06 15:08:35 +00:00
|
|
|
setInternal("romdir", "");
|
2007-07-19 16:21:39 +00:00
|
|
|
setInternal("statedir", "");
|
|
|
|
setInternal("cheatfile", "");
|
|
|
|
setInternal("palettefile", "");
|
|
|
|
setInternal("propsfile", "");
|
2013-02-17 00:19:14 +00:00
|
|
|
setInternal("nvramdir", "");
|
2010-09-06 00:17:51 +00:00
|
|
|
setInternal("cfgdir", "");
|
2007-08-07 14:38:52 +00:00
|
|
|
|
2007-09-13 00:48:13 +00:00
|
|
|
// ROM browser options
|
2012-04-20 20:47:53 +00:00
|
|
|
setInternal("exitlauncher", "false");
|
2017-05-05 19:20:02 +00:00
|
|
|
setInternal("launcherres", GUI::Size(900, 600));
|
2009-01-04 22:27:44 +00:00
|
|
|
setInternal("launcherfont", "medium");
|
2011-12-21 17:18:53 +00:00
|
|
|
setInternal("launcherexts", "allroms");
|
2017-05-05 19:20:02 +00:00
|
|
|
setInternal("romviewer", "1");
|
2008-03-30 15:47:10 +00:00
|
|
|
setInternal("lastrom", "");
|
2007-08-22 13:55:40 +00:00
|
|
|
|
2007-09-13 00:48:13 +00:00
|
|
|
// UI-related options
|
2013-09-27 19:47:15 +00:00
|
|
|
#ifdef DEBUGGER_SUPPORT
|
2013-08-24 15:51:37 +00:00
|
|
|
setInternal("dbg.res",
|
2013-09-27 19:47:15 +00:00
|
|
|
GUI::Size(DebuggerDialog::kMediumFontMinW,
|
|
|
|
DebuggerDialog::kMediumFontMinH));
|
|
|
|
#endif
|
2014-09-03 13:27:33 +00:00
|
|
|
setInternal("uipalette", "standard");
|
2009-01-05 22:05:35 +00:00
|
|
|
setInternal("listdelay", "300");
|
2007-08-15 17:43:51 +00:00
|
|
|
setInternal("mwheel", "4");
|
2007-09-13 00:48:13 +00:00
|
|
|
|
|
|
|
// Misc options
|
2007-08-07 14:38:52 +00:00
|
|
|
setInternal("autoslot", "false");
|
Added logging capability and viewer. This is useful for those platforms that
don't normally use the commandline (mostly Windows, but in some cases OSX as
well). The 'showinfo' commandline argument has been renamed 'loglevel', but
it has the same purpose. A new option 'logtoconsole' has been added, which
determines whether log output should also be directed to the commandline/
console (previously, it was always printed to the console). All these items
are now accessible from Options -> System Logs.
For anyone reading this (and that cares), now I can finally move on to the
OpenGL rewrite. The plan is that the new code will use OpenGL ES, which
is a subset of OpenGL 1.5. The main advantages are that you won't need
an advanced OpenGL card, and OpenGL ES is supported on most new 'smaller'
systems (iPhone, Android, etc), making ports much easier.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2264 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2011-08-16 13:38:34 +00:00
|
|
|
setInternal("loglevel", "1");
|
|
|
|
setInternal("logtoconsole", "0");
|
Revamped the result on floating pins for TIA reads. Previously, this was
controlled by 'tiafloat', which has now been removed. Now, all
undriven pins take on the last value on the databus. This fixes a bug
in those reads where bit 6 or bits 6 & 7 are also undriven (previously,
these bits would always be zero, and only bits 0-5 were from lastdatabus.
Added new commandline argument 'tiadriven', which defaults to false.
In this default case, relevant bits take on values from the databus.
If true, relevant bits still take on databus values, but some are
randomly driven high as well. This helps to expose bugs when
developers assume the values for undriven/floating bits.
Added 'uimessages' commandline argument and associated UI item. When
disabled, messages which are normally shown in-game are disabled.
Certain messages which indicate a serious error are still shown, however.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1900 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-11-10 20:12:50 +00:00
|
|
|
setInternal("tiadriven", "false");
|
2014-10-23 15:52:39 +00:00
|
|
|
setInternal("cpurandom", "");
|
2010-08-20 01:02:32 +00:00
|
|
|
setInternal("ramrandom", "true");
|
2008-04-11 17:56:35 +00:00
|
|
|
setInternal("avoxport", "");
|
2008-05-20 13:42:50 +00:00
|
|
|
setInternal("stats", "false");
|
2017-07-13 23:23:20 +00:00
|
|
|
setInternal("fastscbios", "true");
|
2009-06-12 18:44:32 +00:00
|
|
|
setExternal("romloadcount", "0");
|
2010-07-22 15:41:46 +00:00
|
|
|
setExternal("maxres", "");
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
|
2013-09-27 19:47:15 +00:00
|
|
|
#ifdef DEBUGGER_SUPPORT
|
2013-07-27 22:28:41 +00:00
|
|
|
// Debugger/disassembly options
|
2013-08-26 13:01:29 +00:00
|
|
|
setInternal("dbg.fontstyle", "0");
|
2013-07-27 22:28:41 +00:00
|
|
|
setInternal("dbg.uhex", "true");
|
2013-06-17 15:57:41 +00:00
|
|
|
setInternal("dis.resolve", "true");
|
2012-05-27 19:27:55 +00:00
|
|
|
setInternal("dis.gfxformat", "2");
|
|
|
|
setInternal("dis.showaddr", "true");
|
|
|
|
setInternal("dis.relocate", "false");
|
2013-09-27 19:47:15 +00:00
|
|
|
#endif
|
2011-11-07 22:50:23 +00:00
|
|
|
|
2013-09-27 19:47:15 +00:00
|
|
|
#ifdef DTHUMB_SUPPORT
|
2011-11-07 22:50:23 +00:00
|
|
|
// Thumb ARM emulation options
|
|
|
|
setInternal("thumb.trapfatal", "true");
|
2013-09-27 19:47:15 +00:00
|
|
|
#endif
|
2002-03-21 22:47:00 +00:00
|
|
|
}
|
|
|
|
|
X11 and SDL versions now fully compile and fully support the new
EventHandler class. All thats left to do there is integrate the
Snapshot code into the core, but that will have to wait until I
rewrite the PNG handler to not need the PNG library ...
Changed the Settings class to a virtual abstract class, and created
a SettingsUNIX class to derive from it and work with the X11 and SDL
versions.
Some notes on updating the DOS and Windows ports (which I will probably
do eventually), and on porting to other toolkits:
A port needs the following:
- a main function which takes native events and converts to the core
format, and generally acts as the dispatcher (mainXXX.cxx)
- a specific frontend, derived from Frontend.hxx, which sets up port
specific filename and locations (FrontendXXX.hxx)
- a specific settings class, derived from Settings.hxx, which deals
with settings/commandline arguments specific to that port (SettingsXXX.hxx)
- probably some other stuff that I've forgotten
The next step is get the DOS port working with the new EventHandler (easy)
and attempt to bring the Windows port into the year 2003 (it hasn't been
touched for almost a year, quite hard).
I also have to write a GUI class that will draw menus, etc. and actually let
you remap keys from the emulator itself. And that may have to wait until
the fabled graphics rewrite that Brad and I will be working on. It never ends ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@181 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-09-11 20:53:51 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2003-09-19 15:45:01 +00:00
|
|
|
void Settings::loadConfig()
|
|
|
|
{
|
|
|
|
string line, key, value;
|
2005-05-12 18:45:21 +00:00
|
|
|
string::size_type equalPos, garbage;
|
2003-09-19 15:45:01 +00:00
|
|
|
|
2015-06-12 17:37:58 +00:00
|
|
|
ifstream in(myOSystem.configFile());
|
2003-09-19 15:45:01 +00:00
|
|
|
if(!in || !in.is_open())
|
|
|
|
{
|
2014-05-12 23:34:25 +00:00
|
|
|
myOSystem.logMessage("ERROR: Couldn't load settings file", 0);
|
2003-09-19 15:45:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while(getline(in, line))
|
|
|
|
{
|
|
|
|
// Strip all whitespace and tabs from the line
|
|
|
|
while((garbage = line.find("\t")) != string::npos)
|
|
|
|
line.erase(garbage, 1);
|
|
|
|
|
|
|
|
// Ignore commented and empty lines
|
|
|
|
if((line.length() == 0) || (line[0] == ';'))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Search for the equal sign and discard the line if its not found
|
|
|
|
if((equalPos = line.find("=")) == string::npos)
|
|
|
|
continue;
|
|
|
|
|
2004-07-09 00:27:39 +00:00
|
|
|
// Split the line into key/value pairs and trim any whitespace
|
2003-09-19 15:45:01 +00:00
|
|
|
key = line.substr(0, equalPos);
|
|
|
|
value = line.substr(equalPos + 1, line.length() - key.length() - 1);
|
2004-07-09 00:27:39 +00:00
|
|
|
key = trim(key);
|
|
|
|
value = trim(value);
|
2003-09-19 15:45:01 +00:00
|
|
|
|
|
|
|
// Check for absent key or value
|
|
|
|
if((key.length() == 0) || (value.length() == 0))
|
|
|
|
continue;
|
|
|
|
|
2003-09-23 17:27:11 +00:00
|
|
|
// Only settings which have been previously set are valid
|
2006-03-06 02:26:16 +00:00
|
|
|
if(int idx = getInternalPos(key) != -1)
|
|
|
|
setInternal(key, value, idx, true);
|
2003-09-19 15:45:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2007-07-27 13:49:16 +00:00
|
|
|
string Settings::loadCommandLine(int argc, char** argv)
|
2003-09-19 15:45:01 +00:00
|
|
|
{
|
2005-05-12 18:45:21 +00:00
|
|
|
for(int i = 1; i < argc; ++i)
|
2003-09-19 15:45:01 +00:00
|
|
|
{
|
|
|
|
// strip off the '-' character
|
|
|
|
string key = argv[i];
|
2007-07-27 13:49:16 +00:00
|
|
|
if(key[0] == '-')
|
2005-06-28 04:40:21 +00:00
|
|
|
{
|
2007-07-27 13:49:16 +00:00
|
|
|
key = key.substr(1, key.length());
|
|
|
|
|
|
|
|
// Take care of the arguments which are meant to be executed immediately
|
|
|
|
// (and then Stella should exit)
|
|
|
|
if(key == "help" || key == "listrominfo")
|
|
|
|
{
|
|
|
|
setExternal(key, "true");
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2013-08-09 13:09:47 +00:00
|
|
|
// Take care of arguments without an option or ones that shouldn't
|
|
|
|
// be saved to the config file
|
2007-07-27 13:49:16 +00:00
|
|
|
if(key == "rominfo" || key == "debug" || key == "holdreset" ||
|
2013-08-09 13:09:47 +00:00
|
|
|
key == "holdselect" || key == "takesnapshot")
|
2007-07-27 13:49:16 +00:00
|
|
|
{
|
|
|
|
setExternal(key, "true");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-05-03 12:01:43 +00:00
|
|
|
ostringstream buf;
|
2007-07-27 13:49:16 +00:00
|
|
|
if(++i >= argc)
|
|
|
|
{
|
2010-04-29 12:46:07 +00:00
|
|
|
buf << "Missing argument for '" << key << "'" << endl;
|
2014-05-12 23:34:25 +00:00
|
|
|
myOSystem.logMessage(buf.str(), 0);
|
2007-07-27 13:49:16 +00:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
string value = argv[i];
|
|
|
|
|
2010-05-03 12:01:43 +00:00
|
|
|
buf.str("");
|
|
|
|
buf << " key = '" << key << "', value = '" << value << "'";
|
|
|
|
|
2016-12-30 00:00:30 +00:00
|
|
|
// Settings read from the commandline must not be saved to
|
2007-07-27 13:49:16 +00:00
|
|
|
// the rc-file, unless they were previously set
|
|
|
|
if(int idx = getInternalPos(key) != -1)
|
2010-05-03 12:01:43 +00:00
|
|
|
{
|
2007-07-27 13:49:16 +00:00
|
|
|
setInternal(key, value, idx); // don't set initialValue here
|
2010-05-03 12:01:43 +00:00
|
|
|
buf << "(I)\n";
|
|
|
|
}
|
2007-07-27 13:49:16 +00:00
|
|
|
else
|
2010-05-03 12:01:43 +00:00
|
|
|
{
|
2007-07-27 13:49:16 +00:00
|
|
|
setExternal(key, value);
|
2010-05-03 12:01:43 +00:00
|
|
|
buf << "(E)\n";
|
|
|
|
}
|
|
|
|
|
2014-05-12 23:34:25 +00:00
|
|
|
myOSystem.logMessage(buf.str(), 2);
|
2005-06-28 04:40:21 +00:00
|
|
|
}
|
2006-03-06 02:26:16 +00:00
|
|
|
else
|
2007-07-27 13:49:16 +00:00
|
|
|
return key;
|
2003-09-19 15:45:01 +00:00
|
|
|
}
|
|
|
|
|
2015-06-11 00:26:13 +00:00
|
|
|
return EmptyString;
|
2003-09-19 15:45:01 +00:00
|
|
|
}
|
|
|
|
|
2005-05-02 19:36:05 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Settings::validate()
|
|
|
|
{
|
|
|
|
string s;
|
2005-05-13 18:28:06 +00:00
|
|
|
int i;
|
2005-05-02 19:36:05 +00:00
|
|
|
|
2008-05-21 16:49:07 +00:00
|
|
|
s = getString("timing");
|
2009-05-25 17:51:52 +00:00
|
|
|
if(s != "sleep" && s != "busy") setInternal("timing", "sleep");
|
2008-05-21 16:49:07 +00:00
|
|
|
|
2014-02-28 21:21:50 +00:00
|
|
|
i = getInt("tia.aspectn");
|
2014-03-08 22:57:16 +00:00
|
|
|
if(i < 80 || i > 120) setInternal("tia.aspectn", "90");
|
2014-02-28 21:21:50 +00:00
|
|
|
i = getInt("tia.aspectp");
|
|
|
|
if(i < 80 || i > 120) setInternal("tia.aspectp", "100");
|
2012-05-06 17:45:48 +00:00
|
|
|
|
2017-07-01 22:24:02 +00:00
|
|
|
s = getString("tia.dbgcolors");
|
|
|
|
sort(s.begin(), s.end());
|
|
|
|
if(s != "bgopry") setInternal("tia.dbgcolors", "roygpb");
|
|
|
|
|
2017-07-10 01:06:50 +00:00
|
|
|
i = getInt("tv.phosphor");
|
|
|
|
if(i < 0 || i > 100) setInternal("tv.phosphor", "50");
|
|
|
|
|
2014-02-28 21:21:50 +00:00
|
|
|
i = getInt("tv.filter");
|
|
|
|
if(i < 0 || i > 5) setInternal("tv.filter", "0");
|
2005-05-02 19:36:05 +00:00
|
|
|
|
2016-02-12 14:23:40 +00:00
|
|
|
i = getInt("tv.jitter_recovery");
|
|
|
|
if(i < 1 || i > 20) setInternal("tv.jitter_recovery", "10");
|
|
|
|
|
2005-05-02 19:36:05 +00:00
|
|
|
#ifdef SOUND_SUPPORT
|
|
|
|
i = getInt("volume");
|
2009-05-25 17:51:52 +00:00
|
|
|
if(i < 0 || i > 100) setInternal("volume", "100");
|
2006-01-06 00:31:56 +00:00
|
|
|
i = getInt("freq");
|
2013-01-27 15:08:04 +00:00
|
|
|
if(!(i == 11025 || i == 22050 || i == 31400 || i == 44100 || i == 48000))
|
|
|
|
setInternal("freq", "31400");
|
2005-05-02 19:36:05 +00:00
|
|
|
#endif
|
|
|
|
|
2008-05-11 21:18:35 +00:00
|
|
|
i = getInt("joydeadzone");
|
2009-05-25 17:51:52 +00:00
|
|
|
if(i < 0) setInternal("joydeadzone", "0");
|
|
|
|
else if(i > 29) setInternal("joydeadzone", "29");
|
2008-05-11 21:18:35 +00:00
|
|
|
|
2015-06-28 18:16:33 +00:00
|
|
|
i = getInt("cursor");
|
|
|
|
if(i < 0 || i > 3)
|
|
|
|
setInternal("cursor", "2");
|
|
|
|
|
2011-05-06 14:29:39 +00:00
|
|
|
i = getInt("dsense");
|
|
|
|
if(i < 1) setInternal("dsense", "1");
|
2015-12-30 23:57:54 +00:00
|
|
|
else if(i > 20) setInternal("dsense", "10");
|
2011-05-06 14:29:39 +00:00
|
|
|
|
|
|
|
i = getInt("msense");
|
|
|
|
if(i < 1) setInternal("msense", "1");
|
2015-12-30 23:57:54 +00:00
|
|
|
else if(i > 20) setInternal("msense", "15");
|
2006-04-05 12:28:39 +00:00
|
|
|
|
2010-04-14 20:27:59 +00:00
|
|
|
i = getInt("ssinterval");
|
|
|
|
if(i < 1) setInternal("ssinterval", "2");
|
|
|
|
else if(i > 10) setInternal("ssinterval", "10");
|
2010-04-14 15:41:42 +00:00
|
|
|
|
2005-05-02 19:36:05 +00:00
|
|
|
s = getString("palette");
|
2007-07-27 13:49:16 +00:00
|
|
|
if(s != "standard" && s != "z26" && s != "user")
|
2006-03-06 02:26:16 +00:00
|
|
|
setInternal("palette", "standard");
|
2008-03-23 16:22:46 +00:00
|
|
|
|
|
|
|
s = getString("launcherfont");
|
2009-01-04 22:27:44 +00:00
|
|
|
if(s != "small" && s != "medium" && s != "large")
|
|
|
|
setInternal("launcherfont", "medium");
|
2008-12-29 20:42:15 +00:00
|
|
|
|
|
|
|
i = getInt("romviewer");
|
2009-05-25 17:51:52 +00:00
|
|
|
if(i < 0) setInternal("romviewer", "0");
|
|
|
|
else if(i > 2) setInternal("romviewer", "2");
|
|
|
|
|
Added logging capability and viewer. This is useful for those platforms that
don't normally use the commandline (mostly Windows, but in some cases OSX as
well). The 'showinfo' commandline argument has been renamed 'loglevel', but
it has the same purpose. A new option 'logtoconsole' has been added, which
determines whether log output should also be directed to the commandline/
console (previously, it was always printed to the console). All these items
are now accessible from Options -> System Logs.
For anyone reading this (and that cares), now I can finally move on to the
OpenGL rewrite. The plan is that the new code will use OpenGL ES, which
is a subset of OpenGL 1.5. The main advantages are that you won't need
an advanced OpenGL card, and OpenGL ES is supported on most new 'smaller'
systems (iPhone, Android, etc), making ports much easier.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2264 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2011-08-16 13:38:34 +00:00
|
|
|
i = getInt("loglevel");
|
2010-04-29 12:46:07 +00:00
|
|
|
if(i < 0 || i > 2)
|
Added logging capability and viewer. This is useful for those platforms that
don't normally use the commandline (mostly Windows, but in some cases OSX as
well). The 'showinfo' commandline argument has been renamed 'loglevel', but
it has the same purpose. A new option 'logtoconsole' has been added, which
determines whether log output should also be directed to the commandline/
console (previously, it was always printed to the console). All these items
are now accessible from Options -> System Logs.
For anyone reading this (and that cares), now I can finally move on to the
OpenGL rewrite. The plan is that the new code will use OpenGL ES, which
is a subset of OpenGL 1.5. The main advantages are that you won't need
an advanced OpenGL card, and OpenGL ES is supported on most new 'smaller'
systems (iPhone, Android, etc), making ports much easier.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2264 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2011-08-16 13:38:34 +00:00
|
|
|
setInternal("loglevel", "1");
|
2005-05-02 19:36:05 +00:00
|
|
|
}
|
|
|
|
|
2004-07-05 00:53:48 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-21 23:02:20 +00:00
|
|
|
void Settings::usage() const
|
2004-07-05 00:53:48 +00:00
|
|
|
{
|
|
|
|
cout << endl
|
2005-05-11 19:36:00 +00:00
|
|
|
<< "Stella version " << STELLA_VERSION << endl
|
2005-05-05 19:00:48 +00:00
|
|
|
<< endl
|
|
|
|
<< "Usage: stella [options ...] romfile" << endl
|
|
|
|
<< " Run without any options or romfile to use the ROM launcher" << endl
|
2009-01-13 14:45:34 +00:00
|
|
|
<< " Consult the manual for more in-depth information" << endl
|
2004-07-05 00:53:48 +00:00
|
|
|
<< endl
|
|
|
|
<< "Valid options are:" << endl
|
|
|
|
<< endl
|
2004-09-14 16:10:28 +00:00
|
|
|
<< " -video <type> Type is one of the following:\n"
|
2014-03-12 16:56:15 +00:00
|
|
|
#ifdef BSPF_WINDOWS
|
2014-06-02 14:34:12 +00:00
|
|
|
<< " direct3d Direct3D acceleration\n"
|
2014-03-12 16:56:15 +00:00
|
|
|
#endif
|
|
|
|
<< " opengl OpenGL acceleration\n"
|
|
|
|
<< " opengles2 OpenGLES 2 acceleration\n"
|
|
|
|
<< " opengles OpenGLES 1 acceleration\n"
|
|
|
|
<< " software Software mode (no acceleration)\n"
|
2004-07-05 00:53:48 +00:00
|
|
|
<< endl
|
2014-03-12 16:56:15 +00:00
|
|
|
<< " -vsync <1|0> Enable 'synchronize to vertical blank interrupt'\n"
|
|
|
|
<< " -fullscreen <1|0> Enable fullscreen mode\n"
|
|
|
|
<< " -center <1|0> Centers game window (if possible)\n"
|
|
|
|
<< " -palette <standard| Use the specified color palette\n"
|
|
|
|
<< " z26|\n"
|
|
|
|
<< " user>\n"
|
|
|
|
<< " -colorloss <1|0> Enable PAL color-loss effect\n"
|
|
|
|
<< " -framerate <number> Display the given number of frames per second (0 to auto-calculate)\n"
|
|
|
|
<< " -timing <sleep|busy> Use the given type of wait between frames\n"
|
|
|
|
<< " -uimessages <1|0> Show onscreen UI messages for different events\n"
|
|
|
|
<< endl
|
|
|
|
#ifdef SOUND_SUPPORT
|
|
|
|
<< " -sound <1|0> Enable sound generation\n"
|
|
|
|
<< " -fragsize <number> The size of sound fragments (must be a power of two)\n"
|
|
|
|
<< " -freq <number> Set sound sample output frequency (11025|22050|31400|44100|48000)\n"
|
|
|
|
<< " -volume <number> Set the volume (0 - 100)\n"
|
|
|
|
<< endl
|
|
|
|
#endif
|
2017-07-10 01:06:50 +00:00
|
|
|
<< " -tia.zoom <zoom> Use the specified zoom level (windowed mode) for TIA image\n"
|
|
|
|
<< " -tia.inter <1|0> Enable interpolated (smooth) scaling for TIA image\n"
|
|
|
|
<< " -tia.aspectn <number> Scale TIA width by the given percentage in NTSC mode\n"
|
|
|
|
<< " -tia.aspectp <number> Scale TIA width by the given percentage in PAL mode\n"
|
|
|
|
<< " -tia.fsfill <1|0> Stretch TIA image to fill fullscreen mode\n"
|
|
|
|
<< " -tia.dbgcolors <string> Debug colors to use for each object (see manual for description)\n"
|
2004-07-05 00:53:48 +00:00
|
|
|
<< endl
|
2014-02-28 21:21:50 +00:00
|
|
|
<< " -tv.filter <0-5> Set TV effects off (0) or to specified mode (1-5)\n"
|
2017-07-10 01:06:50 +00:00
|
|
|
<< " -tv.phosphor <0-100> Set default blend level in phosphor mode\n"
|
2016-02-12 14:28:30 +00:00
|
|
|
<< " -tv.jitter <1|0> Enable TV jitter effect\n"
|
|
|
|
<< " -tv.jitter_recovery <1-20> Set recovery time for TV jitter effect\n"
|
2017-07-10 01:06:50 +00:00
|
|
|
<< " -tv.scanlines <0-100> Set scanline intensity to percentage (0 disables completely)\n"
|
|
|
|
<< " -tv.scaninter <1|0> Enable interpolated (smooth) scanlines\n"
|
2014-02-28 21:21:50 +00:00
|
|
|
<< " -tv.contrast <value> Set TV effects custom contrast to value 1.0 - 1.0\n"
|
|
|
|
<< " -tv.brightness <value> Set TV effects custom brightness to value 1.0 - 1.0\n"
|
|
|
|
<< " -tv.hue <value> Set TV effects custom hue to value 1.0 - 1.0\n"
|
|
|
|
<< " -tv.saturation <value> Set TV effects custom saturation to value 1.0 - 1.0\n"
|
|
|
|
<< " -tv.gamma <value> Set TV effects custom gamma to value 1.0 - 1.0\n"
|
|
|
|
<< " -tv.sharpness <value> Set TV effects custom sharpness to value 1.0 - 1.0\n"
|
|
|
|
<< " -tv.resolution <value> Set TV effects custom resolution to value 1.0 - 1.0\n"
|
|
|
|
<< " -tv.artifacts <value> Set TV effects custom artifacts to value 1.0 - 1.0\n"
|
|
|
|
<< " -tv.fringing <value> Set TV effects custom fringing to value 1.0 - 1.0\n"
|
|
|
|
<< " -tv.bleed <value> Set TV effects custom bleed to value 1.0 - 1.0\n"
|
2012-03-25 17:51:13 +00:00
|
|
|
<< endl
|
2006-01-15 20:46:20 +00:00
|
|
|
<< " -cheat <code> Use the specified cheatcode (see manual for description)\n"
|
Added logging capability and viewer. This is useful for those platforms that
don't normally use the commandline (mostly Windows, but in some cases OSX as
well). The 'showinfo' commandline argument has been renamed 'loglevel', but
it has the same purpose. A new option 'logtoconsole' has been added, which
determines whether log output should also be directed to the commandline/
console (previously, it was always printed to the console). All these items
are now accessible from Options -> System Logs.
For anyone reading this (and that cares), now I can finally move on to the
OpenGL rewrite. The plan is that the new code will use OpenGL ES, which
is a subset of OpenGL 1.5. The main advantages are that you won't need
an advanced OpenGL card, and OpenGL ES is supported on most new 'smaller'
systems (iPhone, Android, etc), making ports much easier.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2264 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2011-08-16 13:38:34 +00:00
|
|
|
<< " -loglevel <0|1|2> Set level of logging during application run\n"
|
|
|
|
<< " -logtoconsole <1|0> Log output to console/commandline\n"
|
2008-05-11 21:18:35 +00:00
|
|
|
<< " -joydeadzone <number> Sets 'deadzone' area for analog joysticks (0-29)\n"
|
2009-08-05 20:33:40 +00:00
|
|
|
<< " -joyallow4 <1|0> Allow all 4 directions on a joystick to be pressed simultaneously\n"
|
2013-08-24 18:40:02 +00:00
|
|
|
<< " -usemouse <always|\n"
|
|
|
|
<< " analog|\n"
|
|
|
|
<< " never> Use mouse as a controller as specified by ROM properties in given mode(see manual)\n"
|
2014-06-04 16:01:45 +00:00
|
|
|
<< " -grabmouse <1|0> Locks the mouse cursor in the TIA window\n"
|
2015-06-28 18:16:33 +00:00
|
|
|
<< " -cursor <0,1,2,3> Set cursor state in UI/emulation modes\n"
|
2015-12-30 23:57:54 +00:00
|
|
|
<< " -dsense <number> Sensitivity of digital emulated paddle movement (1-20)\n"
|
|
|
|
<< " -msense <number> Sensitivity of mouse emulated paddle movement (1-20)\n"
|
2012-03-03 00:56:31 +00:00
|
|
|
<< " -saport <lr|rl> How to assign virtual ports to multiple Stelladaptor/2600-daptors\n"
|
2010-03-05 22:02:12 +00:00
|
|
|
<< " -ctrlcombo <1|0> Use key combos involving the Control key (Control-Q for quit may be disabled!)\n"
|
2006-12-13 00:05:46 +00:00
|
|
|
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
|
2010-04-08 13:11:36 +00:00
|
|
|
<< " -stats <1|0> Overlay console info during emulation\n"
|
2009-06-09 14:27:21 +00:00
|
|
|
<< " -fastscbios <1|0> Disable Supercharger BIOS progress loading bars\n"
|
2013-02-16 19:56:09 +00:00
|
|
|
<< " -snapsavedir <path> The directory to save snapshot files to\n"
|
|
|
|
<< " -snaploaddir <path> The directory to load snapshot files from\n"
|
2013-06-21 12:15:32 +00:00
|
|
|
<< " -snapname <int|rom> Name snapshots according to internal database or ROM\n"
|
2004-09-14 16:10:28 +00:00
|
|
|
<< " -sssingle <1|0> Generate single snapshot instead of many\n"
|
2009-05-25 17:51:52 +00:00
|
|
|
<< " -ss1x <1|0> Generate TIA snapshot in 1x mode (ignore scaling/effects)\n"
|
2010-04-14 20:27:59 +00:00
|
|
|
<< " -ssinterval <number Number of seconds between snapshots in continuous snapshot mode\n"
|
2005-09-13 18:27:42 +00:00
|
|
|
<< endl
|
2006-12-26 00:39:44 +00:00
|
|
|
<< " -rominfo <rom> Display detailed information for the given ROM\n"
|
2009-01-13 14:45:34 +00:00
|
|
|
<< " -listrominfo Display contents of stella.pro, one line per ROM entry\n"
|
2012-04-20 20:47:53 +00:00
|
|
|
<< " -exitlauncher <1|0> On exiting a ROM, go back to the ROM launcher\n"
|
2007-07-27 13:49:16 +00:00
|
|
|
<< " -launcherres <WxH> The resolution to use in ROM launcher mode\n"
|
2009-01-04 22:27:44 +00:00
|
|
|
<< " -launcherfont <small|medium| Use the specified font in the ROM launcher\n"
|
|
|
|
<< " large>\n"
|
2009-01-05 19:44:30 +00:00
|
|
|
<< " -launcherexts <allfiles| Show files with the given extensions in ROM launcher\n"
|
2009-05-25 17:51:52 +00:00
|
|
|
<< " allroms| (exts is a ':' separated list of extensions)\n"
|
2009-01-05 19:44:30 +00:00
|
|
|
<< " exts\n"
|
2009-01-13 14:45:34 +00:00
|
|
|
<< " -romviewer <0|1|2> Show ROM info viewer at given zoom level in ROM launcher (0 for off)\n"
|
2009-01-05 22:05:35 +00:00
|
|
|
<< " -listdelay <delay> Time to wait between keypresses in list widgets (300-1000)\n"
|
2007-08-15 17:43:51 +00:00
|
|
|
<< " -mwheel <lines> Number of lines the mouse wheel will scroll in UI\n"
|
2014-03-12 16:56:15 +00:00
|
|
|
<< " -romdir <dir> Directory in which to load ROM files\n"
|
2013-02-17 00:19:14 +00:00
|
|
|
<< " -statedir <dir> Directory in which to save/load state files\n"
|
2007-07-19 16:21:39 +00:00
|
|
|
<< " -cheatfile <file> Full pathname of cheatfile database\n"
|
|
|
|
<< " -palettefile <file> Full pathname of user-defined palette file\n"
|
|
|
|
<< " -propsfile <file> Full pathname of ROM properties file\n"
|
2013-02-17 00:19:14 +00:00
|
|
|
<< " -nvramdir <dir> Directory in which to save/load flash/EEPROM files\n"
|
2010-09-06 00:17:51 +00:00
|
|
|
<< " -cfgdir <dir> Directory in which to save Distella config files\n"
|
2008-05-16 12:04:35 +00:00
|
|
|
<< " -avoxport <name> The name of the serial port where an AtariVox is connected\n"
|
2010-08-19 21:48:28 +00:00
|
|
|
<< " -holdreset Start the emulator with the Game Reset switch held down\n"
|
|
|
|
<< " -holdselect Start the emulator with the Game Select switch held down\n"
|
2013-08-09 13:09:47 +00:00
|
|
|
<< " -holdjoy0 <U,D,L,R,F> Start the emulator with the left joystick direction/fire button held down\n"
|
|
|
|
<< " -holdjoy1 <U,D,L,R,F> Start the emulator with the right joystick direction/fire button held down\n"
|
2010-08-19 21:48:28 +00:00
|
|
|
<< " -tiadriven <1|0> Drive unused TIA pins randomly on a read/peek\n"
|
2013-07-21 00:27:52 +00:00
|
|
|
<< " -cpurandom <1|0> Randomize the contents of CPU registers on reset\n"
|
2010-08-19 21:48:28 +00:00
|
|
|
<< " -ramrandom <1|0> Randomize the contents of RAM on reset\n"
|
2014-03-12 16:56:15 +00:00
|
|
|
<< " -maxres <WxH> Used by developers to force the maximum size of the application window\n"
|
2005-05-05 19:00:48 +00:00
|
|
|
<< " -help Show the text you're now reading\n"
|
2006-12-15 16:43:12 +00:00
|
|
|
#ifdef DEBUGGER_SUPPORT
|
2005-05-12 18:45:21 +00:00
|
|
|
<< endl
|
|
|
|
<< " The following options are meant for developers\n"
|
|
|
|
<< " Arguments are more fully explained in the manual\n"
|
|
|
|
<< endl
|
2013-06-17 15:57:41 +00:00
|
|
|
<< " -dis.resolve <1|0> Attempt to resolve code sections in disassembler\n"
|
|
|
|
<< " -dis.gfxformat <2|16> Set base to use for displaying GFX sections in disassembler\n"
|
|
|
|
<< " -dis.showaddr <1|0> Show opcode addresses in disassembler\n"
|
|
|
|
<< " -dis.relocate <1|0> Relocate calls out of address range in disassembler\n"
|
2012-05-27 19:27:55 +00:00
|
|
|
<< endl
|
2013-08-26 13:01:29 +00:00
|
|
|
<< " -dbg.res <WxH> The resolution to use in debugger mode\n"
|
|
|
|
<< " -dbg.fontstyle <0-3> Font style to use in debugger window (bold vs. normal)\n"
|
|
|
|
<< " -break <address> Set a breakpoint at 'address'\n"
|
2005-09-13 18:27:42 +00:00
|
|
|
<< " -debug Start in debugger mode\n"
|
|
|
|
<< endl
|
2008-03-03 14:53:34 +00:00
|
|
|
<< " -bs <arg> Sets the 'Cartridge.Type' (bankswitch) property\n"
|
|
|
|
<< " -type <arg> Same as using -bs\n"
|
2007-07-27 13:49:16 +00:00
|
|
|
<< " -channels <arg> Sets the 'Cartridge.Sound' property\n"
|
2005-05-12 18:45:21 +00:00
|
|
|
<< " -ld <arg> Sets the 'Console.LeftDifficulty' property\n"
|
|
|
|
<< " -rd <arg> Sets the 'Console.RightDifficulty' property\n"
|
|
|
|
<< " -tv <arg> Sets the 'Console.TelevisionType' property\n"
|
2006-01-08 02:28:04 +00:00
|
|
|
<< " -sp <arg> Sets the 'Console.SwapPorts' property\n"
|
2005-05-12 18:45:21 +00:00
|
|
|
<< " -lc <arg> Sets the 'Controller.Left' property\n"
|
|
|
|
<< " -rc <arg> Sets the 'Controller.Right' property\n"
|
|
|
|
<< " -bc <arg> Same as using both -lc and -rc\n"
|
2006-12-13 00:05:46 +00:00
|
|
|
<< " -cp <arg> Sets the 'Controller.SwapPaddles' property\n"
|
2005-05-12 18:45:21 +00:00
|
|
|
<< " -format <arg> Sets the 'Display.Format' property\n"
|
|
|
|
<< " -ystart <arg> Sets the 'Display.YStart' property\n"
|
|
|
|
<< " -height <arg> Sets the 'Display.Height' property\n"
|
2006-01-10 20:37:00 +00:00
|
|
|
<< " -pp <arg> Sets the 'Display.Phosphor' property\n"
|
2006-11-04 19:38:25 +00:00
|
|
|
<< " -ppblend <arg> Sets the 'Display.PPBlend' property\n"
|
2005-10-19 00:59:51 +00:00
|
|
|
#endif
|
2016-05-24 16:55:45 +00:00
|
|
|
<< endl << std::flush;
|
2004-07-05 00:53:48 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 23:34:42 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
const Variant& Settings::value(const string& key) const
|
|
|
|
{
|
|
|
|
// Try to find the named setting and answer its value
|
|
|
|
int idx = -1;
|
|
|
|
if((idx = getInternalPos(key)) != -1)
|
|
|
|
return myInternalSettings[idx].value;
|
|
|
|
else if((idx = getExternalPos(key)) != -1)
|
|
|
|
return myExternalSettings[idx].value;
|
|
|
|
else
|
|
|
|
return EmptyVariant;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Settings::setValue(const string& key, const Variant& value)
|
|
|
|
{
|
|
|
|
if(int idx = getInternalPos(key) != -1)
|
|
|
|
setInternal(key, value, idx);
|
|
|
|
else
|
|
|
|
setExternal(key, value);
|
|
|
|
}
|
|
|
|
|
2003-09-19 15:45:01 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Settings::saveConfig()
|
|
|
|
{
|
2006-03-06 02:26:16 +00:00
|
|
|
// Do a quick scan of the internal settings to see if any have
|
|
|
|
// changed. If not, we don't need to save them at all.
|
|
|
|
bool settingsChanged = false;
|
2014-11-10 21:59:56 +00:00
|
|
|
for(const auto& s: myInternalSettings)
|
2006-03-06 02:26:16 +00:00
|
|
|
{
|
2014-11-10 21:59:56 +00:00
|
|
|
if(s.value != s.initialValue)
|
2006-03-06 02:26:16 +00:00
|
|
|
{
|
|
|
|
settingsChanged = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!settingsChanged)
|
|
|
|
return;
|
|
|
|
|
2015-06-12 17:37:58 +00:00
|
|
|
ofstream out(myOSystem.configFile());
|
2003-09-19 15:45:01 +00:00
|
|
|
if(!out || !out.is_open())
|
|
|
|
{
|
2014-05-12 23:34:25 +00:00
|
|
|
myOSystem.logMessage("ERROR: Couldn't save settings file", 0);
|
2003-09-19 15:45:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-01-01 18:21:04 +00:00
|
|
|
out << "; Stella configuration file" << endl
|
2003-09-21 14:33:34 +00:00
|
|
|
<< ";" << endl
|
|
|
|
<< "; Lines starting with ';' are comments and are ignored." << endl
|
|
|
|
<< "; Spaces and tabs are ignored." << endl
|
|
|
|
<< ";" << endl
|
|
|
|
<< "; Format MUST be as follows:" << endl
|
|
|
|
<< "; command = value" << endl
|
|
|
|
<< ";" << endl
|
|
|
|
<< "; Commmands are the same as those specified on the commandline," << endl
|
|
|
|
<< "; without the '-' character." << endl
|
|
|
|
<< ";" << endl
|
|
|
|
<< "; Values are the same as those allowed on the commandline." << endl
|
2003-09-23 00:58:31 +00:00
|
|
|
<< "; Boolean values are specified as 1 (or true) and 0 (or false)" << endl
|
|
|
|
<< ";" << endl;
|
|
|
|
|
|
|
|
// Write out each of the key and value pairs
|
2014-11-10 21:59:56 +00:00
|
|
|
for(const auto& s: myInternalSettings)
|
|
|
|
out << s.key << " = " << s.value << endl;
|
2003-09-23 00:58:31 +00:00
|
|
|
}
|
|
|
|
|
2006-03-06 02:26:16 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
int Settings::getInternalPos(const string& key) const
|
|
|
|
{
|
2014-11-17 14:17:19 +00:00
|
|
|
for(uInt32 i = 0; i < myInternalSettings.size(); ++i)
|
2006-03-06 02:26:16 +00:00
|
|
|
if(myInternalSettings[i].key == key)
|
|
|
|
return i;
|
2003-09-23 00:58:31 +00:00
|
|
|
|
2006-03-06 02:26:16 +00:00
|
|
|
return -1;
|
2003-09-04 16:50:48 +00:00
|
|
|
}
|
|
|
|
|
2003-09-23 17:27:11 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2006-03-06 02:26:16 +00:00
|
|
|
int Settings::getExternalPos(const string& key) const
|
2003-09-23 17:27:11 +00:00
|
|
|
{
|
2014-11-17 14:17:19 +00:00
|
|
|
for(uInt32 i = 0; i < myExternalSettings.size(); ++i)
|
2006-03-06 02:26:16 +00:00
|
|
|
if(myExternalSettings[i].key == key)
|
|
|
|
return i;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2013-05-08 23:34:42 +00:00
|
|
|
int Settings::setInternal(const string& key, const Variant& value,
|
2006-03-06 02:26:16 +00:00
|
|
|
int pos, bool useAsInitial)
|
|
|
|
{
|
|
|
|
int idx = -1;
|
|
|
|
|
2015-09-14 21:33:50 +00:00
|
|
|
if(pos >= 0 && pos < int(myInternalSettings.size()) &&
|
2006-03-06 02:26:16 +00:00
|
|
|
myInternalSettings[pos].key == key)
|
|
|
|
{
|
|
|
|
idx = pos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-11-17 14:17:19 +00:00
|
|
|
for(uInt32 i = 0; i < myInternalSettings.size(); ++i)
|
2006-03-06 02:26:16 +00:00
|
|
|
{
|
|
|
|
if(myInternalSettings[i].key == key)
|
|
|
|
{
|
|
|
|
idx = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(idx != -1)
|
|
|
|
{
|
|
|
|
myInternalSettings[idx].key = key;
|
|
|
|
myInternalSettings[idx].value = value;
|
|
|
|
if(useAsInitial) myInternalSettings[idx].initialValue = value;
|
|
|
|
|
|
|
|
/*cerr << "modify internal: key = " << key
|
2006-03-19 00:46:04 +00:00
|
|
|
<< ", value = " << value
|
|
|
|
<< ", ivalue = " << myInternalSettings[idx].initialValue
|
2006-03-06 02:26:16 +00:00
|
|
|
<< " @ index = " << idx
|
|
|
|
<< endl;*/
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Setting setting;
|
|
|
|
setting.key = key;
|
|
|
|
setting.value = value;
|
|
|
|
if(useAsInitial) setting.initialValue = value;
|
|
|
|
|
|
|
|
myInternalSettings.push_back(setting);
|
2014-11-08 22:40:50 +00:00
|
|
|
idx = int(myInternalSettings.size()) - 1;
|
2006-03-06 02:26:16 +00:00
|
|
|
|
|
|
|
/*cerr << "insert internal: key = " << key
|
2006-03-19 00:46:04 +00:00
|
|
|
<< ", value = " << value
|
|
|
|
<< ", ivalue = " << setting.initialValue
|
2006-03-06 02:26:16 +00:00
|
|
|
<< " @ index = " << idx
|
|
|
|
<< endl;*/
|
|
|
|
}
|
|
|
|
|
|
|
|
return idx;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2013-05-08 23:34:42 +00:00
|
|
|
int Settings::setExternal(const string& key, const Variant& value,
|
2006-03-06 02:26:16 +00:00
|
|
|
int pos, bool useAsInitial)
|
|
|
|
{
|
|
|
|
int idx = -1;
|
|
|
|
|
2015-09-14 21:33:50 +00:00
|
|
|
if(pos >= 0 && pos < int(myExternalSettings.size()) &&
|
2006-03-06 02:26:16 +00:00
|
|
|
myExternalSettings[pos].key == key)
|
|
|
|
{
|
|
|
|
idx = pos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-11-17 14:17:19 +00:00
|
|
|
for(uInt32 i = 0; i < myExternalSettings.size(); ++i)
|
2006-03-06 02:26:16 +00:00
|
|
|
{
|
|
|
|
if(myExternalSettings[i].key == key)
|
|
|
|
{
|
|
|
|
idx = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(idx != -1)
|
|
|
|
{
|
|
|
|
myExternalSettings[idx].key = key;
|
|
|
|
myExternalSettings[idx].value = value;
|
|
|
|
if(useAsInitial) myExternalSettings[idx].initialValue = value;
|
|
|
|
|
|
|
|
/*cerr << "modify external: key = " << key
|
|
|
|
<< ", value = " << value
|
|
|
|
<< " @ index = " << idx
|
|
|
|
<< endl;*/
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Setting setting;
|
|
|
|
setting.key = key;
|
|
|
|
setting.value = value;
|
|
|
|
if(useAsInitial) setting.initialValue = value;
|
|
|
|
|
|
|
|
myExternalSettings.push_back(setting);
|
2014-11-08 22:40:50 +00:00
|
|
|
idx = int(myExternalSettings.size()) - 1;
|
2006-03-06 02:26:16 +00:00
|
|
|
|
|
|
|
/*cerr << "insert external: key = " << key
|
|
|
|
<< ", value = " << value
|
|
|
|
<< " @ index = " << idx
|
|
|
|
<< endl;*/
|
|
|
|
}
|
2003-09-23 17:27:11 +00:00
|
|
|
|
2006-03-06 02:26:16 +00:00
|
|
|
return idx;
|
2003-09-23 17:27:11 +00:00
|
|
|
}
|