-maxres <WxH> |
Useful for developers, this sets the maximum size of window that
diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx
index b91e5dc26..47d3212ab 100644
--- a/src/debugger/CartDebug.cxx
+++ b/src/debugger/CartDebug.cxx
@@ -1352,7 +1352,7 @@ string CartDebug::saveDisassembly(string path)
if(path.empty())
- path = myOSystem.userSaveDir().getPath()
+ path = myOSystem.userDir().getPath()
+ myConsole.properties().get(PropType::Cart_Name) + ".asm";
else
// Append default extension when missing
@@ -1380,7 +1380,7 @@ string CartDebug::saveDisassembly(string path)
string CartDebug::saveRom(string path)
{
if(path.empty())
- path = myOSystem.userSaveDir().getPath()
+ path = myOSystem.userDir().getPath()
+ myConsole.properties().get(PropType::Cart_Name) + ".a26";
else
// Append default extension when missing
@@ -1406,7 +1406,7 @@ string CartDebug::saveAccessFile(string path)
try
{
if(path.empty())
- path = myOSystem.userSaveDir().getPath()
+ path = myOSystem.userDir().getPath()
+ myConsole.properties().get(PropType::Cart_Name) + ".csv";
else
// Append default extension when missing
diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx
index 2c02c53dd..488fb68f6 100644
--- a/src/debugger/DebuggerParser.cxx
+++ b/src/debugger/DebuggerParser.cxx
@@ -683,7 +683,7 @@ string DebuggerParser::saveScriptFile(string file)
// Use default path if no path is provided
if(file.find_first_of(FilesystemNode::PATH_SEPARATOR) == string::npos)
- file = debugger.myOSystem.userSaveDir().getPath() + file;
+ file = debugger.myOSystem.userDir().getPath() + file;
FilesystemNode node(file);
@@ -1144,7 +1144,7 @@ void DebuggerParser::executeDump()
else
{
ostringstream file;
- file << debugger.myOSystem.userSaveDir()
+ file << debugger.myOSystem.userDir()
<< debugger.myOSystem.console().properties().get(PropType::Cart_Name) << "_dbg_";
if(execDepth > 0)
{
@@ -1240,7 +1240,7 @@ void DebuggerParser::executeExec()
file += ".script";
FilesystemNode node(file);
if (!node.exists())
- node = FilesystemNode(debugger.myOSystem.userSaveDir().getPath() + file);
+ node = FilesystemNode(debugger.myOSystem.userDir().getPath() + file);
if (argCount == 2) {
execPrefix = argStrings[1];
@@ -1910,7 +1910,7 @@ void DebuggerParser::executeSaveses()
{
ostringstream filename;
auto timeinfo = BSPF::localTime();
- filename << debugger.myOSystem.userSaveDir()
+ filename << debugger.myOSystem.userDir()
<< std::put_time(&timeinfo, "session_%F_%H-%M-%S.txt");
if(argCount && argStrings[0] == "?")
diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx
index e258aca08..24b2ed4bf 100644
--- a/src/debugger/gui/DebuggerDialog.cxx
+++ b/src/debugger/gui/DebuggerDialog.cxx
@@ -466,7 +466,7 @@ void DebuggerDialog::showBrowser(BrowserType type, const string& defaultName)
{
createBrowser("Save " + title + " as");
- const string path = instance().userSaveDir().getPath() + defaultName;
+ const string path = instance().userDir().getPath() + defaultName;
myBrowser->show(path, BrowserDialog::FileSave, cmd, kBdCancelCmd);
}
}
diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx
index c9fb0070b..72ec65814 100644
--- a/src/emucore/OSystem.cxx
+++ b/src/emucore/OSystem.cxx
@@ -217,8 +217,8 @@ void OSystem::loadConfig(const Settings::Options& options)
{
// Get base directory and config file from derived class
// It will decide whether it can override its default location
- string baseDir, cfgFile, defSaveDir, defLoadDir;
- getBaseDirAndConfig(baseDir, cfgFile, defSaveDir, defLoadDir,
+ string baseDir, cfgFile, homeDir, unused;
+ getBaseDirAndConfig(baseDir, cfgFile, homeDir, unused,
ourOverrideBaseDirWithApp, ourOverrideBaseDir);
// Get fully-qualified pathnames, and make directories when needed
@@ -228,13 +228,9 @@ void OSystem::loadConfig(const Settings::Options& options)
if(!cfgFile.empty())
myConfigFile = FilesystemNode(cfgFile);
- myDefaultSaveDir = FilesystemNode(defSaveDir);
- if(!myDefaultSaveDir.isDirectory())
- myDefaultSaveDir.makeDir();
-
- myDefaultLoadDir = FilesystemNode(defLoadDir);
- if(!myDefaultLoadDir.isDirectory())
- myDefaultLoadDir.makeDir();
+ myHomeDir = FilesystemNode(homeDir);
+ if(!myHomeDir.isDirectory())
+ myHomeDir.makeDir();
#ifdef SQLITE_SUPPORT
mySettingsDb = make_shared(myBaseDir.getPath(), "settings");
@@ -249,10 +245,10 @@ void OSystem::loadConfig(const Settings::Options& options)
// TODO: check if affected by '-baseDir'and 'basedirinapp' params
string userDir = mySettings->getString("userdir");
if(userDir.empty())
- userDir = defSaveDir;
- myUserSaveDir = FilesystemNode(userDir);
- if(!myUserSaveDir.isDirectory())
- myUserSaveDir.makeDir();
+ userDir = homeDir;
+ myUserDir = FilesystemNode(userDir);
+ if(!myUserDir.isDirectory())
+ myUserDir.makeDir();
Logger::instance().setLogParameters(mySettings->getInt("loglevel"),
mySettings->getBool("logtoconsole"));
@@ -303,7 +299,7 @@ void OSystem::setConfigPaths()
#ifdef PNG_SUPPORT
const string& ssSaveDir = mySettings->getString("snapsavedir");
if(ssSaveDir == EmptyString)
- mySnapshotSaveDir = defaultSaveDir();
+ mySnapshotSaveDir = userDir();
else
mySnapshotSaveDir = FilesystemNode(ssSaveDir);
if(!mySnapshotSaveDir.isDirectory())
@@ -311,7 +307,7 @@ void OSystem::setConfigPaths()
const string& ssLoadDir = mySettings->getString("snaploaddir");
if(ssLoadDir == EmptyString)
- mySnapshotLoadDir = defaultLoadDir();
+ mySnapshotLoadDir = userDir();
else
mySnapshotLoadDir = FilesystemNode(ssLoadDir);
if(!mySnapshotLoadDir.isDirectory())
@@ -346,7 +342,7 @@ void OSystem::setUserDir(const string& path)
{
mySettings->setValue("userdir", path);
- myUserSaveDir = FilesystemNode(path);
+ myUserDir = FilesystemNode(path);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx
index 1ac973976..0ce5aef4b 100644
--- a/src/emucore/OSystem.hxx
+++ b/src/emucore/OSystem.hxx
@@ -318,12 +318,11 @@ class OSystem
const FilesystemNode& romFile() const { return myRomFile; }
/**
- The default locations for saving and loading various files that
- don't already have a specific location.
+ The default and user defined locations for saving and loading various
+ files that don't already have a specific location.
*/
- const FilesystemNode& defaultSaveDir() const { return myDefaultSaveDir; }
- const FilesystemNode& defaultLoadDir() const { return myDefaultLoadDir; }
- const FilesystemNode& userSaveDir() const { return myUserSaveDir; }
+ const FilesystemNode& homeDir() const { return myHomeDir; }
+ const FilesystemNode& userDir() const { return myUserDir; }
/**
Open the given ROM and return an array containing its contents.
@@ -556,8 +555,8 @@ class OSystem
private:
FilesystemNode myBaseDir, myStateDir, mySnapshotSaveDir, mySnapshotLoadDir,
- myNVRamDir, myCfgDir, myDefaultSaveDir, myDefaultLoadDir,
- myUserSaveDir;
+ myNVRamDir, myCfgDir, myHomeDir,
+ myUserDir;
FilesystemNode myCheatFile, myConfigFile, myPaletteFile, myPropertiesFile;
FilesystemNode myRomFile; string myRomMD5;
diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx
index 8068b29a9..f9d8e459e 100644
--- a/src/emucore/Settings.cxx
+++ b/src/emucore/Settings.cxx
@@ -528,14 +528,14 @@ void Settings::usage() const
<< endl
<< " -saveonexit emulation\n"
- << " -autoslot <1|0> Automatically change to next save slot when\n"
+ << " -autoslot <0|1> Automatically change to next save slot when\n"
<< " state saving\n"
<< endl
<< " -rominfo Display detailed information for the given ROM\n"
<< " -listrominfo Display contents of stella.pro, one line per ROM\n"
<< " entry\n"
<< endl
- << " -exitlauncher <1|0> On exiting a ROM, go back to the ROM launcher\n"
+ << " -exitlauncher <0|1> On exiting a ROM, go back to the ROM launcher\n"
<< " -launcherpos Sets the window position in windowed EOM launcher mode\n"
<< " -launcherdisplay Sets the display for the ROM launcher\n"
<< " -launcherres The resolution to use in ROM launcher mode\n"
@@ -544,11 +544,14 @@ void Settings::usage() const
<< " medium|large|\n"
<< " large12|large14|\n"
<< " large16>\n"
- << " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n"
- << " -launchersubdirs <1|0> Show files from subdirectories too\n"
<< " -romviewer Show ROM info viewer at given zoom level in ROM\n"
<< " launcher (use 0 for off)\n"
- << " -followlauncher <0|1> Default ROM path follows launcher navigation\n"
+ << " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n"
+ << " -launchersubdirs <0|1> Show files from subdirectories too\n"
+ << " -romdir Set the path where the ROM launcher will start\n"
+ << " -followlauncher <0|1> Default ROM path follows launcher navigation\n"
+ << " -userdir Set the path to save user files to\n"
+ << " -saveuserdir <0|1> Update user path when navigating in browser\n"
<< " -lastrom Last played ROM, automatically selected in\n"
<< " launcher\n"
<< " -romloadcount Number of ROM to load next from multicard\n"
@@ -572,10 +575,6 @@ void Settings::usage() const
<< " -ctrlrate Rate per second of repeated controller input in\n"
<< " UI\n"
<< " -basic_settings <0|1> Display only a basic settings dialog\n"
- << " -romdir Set the directory where the ROM launcher will\n"
- << " start\n"
- << " -userdir The directory to save user files to\n"
- << " -saveuserdir <1|0> Update user directory when navigating in browser\n"
<< " -avoxport The name of the serial port where an AtariVox is\n"
<< " connected\n"
<< " -holdreset Start the emulator with the Game Reset switch\n"
diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx
index 026c16b2f..d401ed8cb 100644
--- a/src/gui/BrowserDialog.cxx
+++ b/src/gui/BrowserDialog.cxx
@@ -271,7 +271,7 @@ void BrowserDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kHomeDirCmd:
- _fileList->setDirectory(FilesystemNode(instance().defaultSaveDir()));
+ _fileList->setDirectory(FilesystemNode(instance().homeDir()));
break;
case EditableWidget::kChangedCmd:
diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx
index 4273ce6fc..7710e9fa1 100644
--- a/src/gui/GameInfoDialog.cxx
+++ b/src/gui/GameInfoDialog.cxx
@@ -1397,7 +1397,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
// to re-create it as necessary
createBrowser("Export properties as");
- myBrowser->show(instance().userSaveDir().getPath() + myGameFile.getNameWithExt(".pro"),
+ myBrowser->show(instance().userDir().getPath() + myGameFile.getNameWithExt(".pro"),
BrowserDialog::FileSave, kExportChosen);
break;
diff --git a/src/gui/LoggerDialog.cxx b/src/gui/LoggerDialog.cxx
index 3f94e093e..83929464e 100644
--- a/src/gui/LoggerDialog.cxx
+++ b/src/gui/LoggerDialog.cxx
@@ -116,7 +116,7 @@ void LoggerDialog::saveConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LoggerDialog::saveLogFile()
{
- FilesystemNode node = instance().defaultSaveDir();
+ FilesystemNode node = instance().userDir();
node /= "stella.log";
try
diff --git a/src/gui/SnapshotDialog.cxx b/src/gui/SnapshotDialog.cxx
index 1f3edc36f..69ad94936 100644
--- a/src/gui/SnapshotDialog.cxx
+++ b/src/gui/SnapshotDialog.cxx
@@ -131,7 +131,7 @@ void SnapshotDialog::saveConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SnapshotDialog::setDefaults()
{
- mySnapSavePath->setText(instance().userSaveDir().getShortPath());
+ mySnapSavePath->setText(instance().userDir().getShortPath());
mySnapInterval->setValue(2);
mySnapName->setState(false);
mySnapSingle->setState(false);
diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx
index 6ba10d9f8..b5b8fb72c 100644
--- a/src/gui/UIDialog.cxx
+++ b/src/gui/UIDialog.cxx
@@ -515,7 +515,7 @@ void UIDialog::setDefaults()
myLauncherHeightSlider->setValue(h);
myLauncherFontPopup->setSelected("medium", "");
myRomViewerSize->setValue(35);
- mySnapLoadPath->setText(instance().defaultLoadDir().getShortPath());
+ mySnapLoadPath->setText(instance().userDir().getShortPath());
myLauncherExitWidget->setState(false);
break;
}
From dfee0703246478c53affe6aadba4bafcff3da241 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 24 Dec 2020 14:50:26 +0100
Subject: [PATCH 6/8] fixed a saveses bug renamed browser titles
---
src/debugger/DebuggerParser.cxx | 13 ++++++++-----
src/debugger/gui/DebuggerDialog.cxx | 8 ++++----
src/gui/GameInfoDialog.cxx | 2 +-
src/gui/RomAuditDialog.cxx | 2 +-
src/gui/SnapshotDialog.cxx | 2 +-
src/gui/UIDialog.cxx | 4 ++--
6 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx
index 488fb68f6..3c8bdac5b 100644
--- a/src/debugger/DebuggerParser.cxx
+++ b/src/debugger/DebuggerParser.cxx
@@ -1144,8 +1144,7 @@ void DebuggerParser::executeDump()
else
{
ostringstream file;
- file << debugger.myOSystem.userDir()
- << debugger.myOSystem.console().properties().get(PropType::Cart_Name) << "_dbg_";
+ file << debugger.myOSystem.userDir() << cartName() << "_dbg_";
if(execDepth > 0)
{
file << execPrefix;
@@ -1910,8 +1909,7 @@ void DebuggerParser::executeSaveses()
{
ostringstream filename;
auto timeinfo = BSPF::localTime();
- filename << debugger.myOSystem.userDir()
- << std::put_time(&timeinfo, "session_%F_%H-%M-%S.txt");
+ filename << std::put_time(&timeinfo, "session_%F_%H-%M-%S.txt");
if(argCount && argStrings[0] == "?")
{
@@ -1920,7 +1918,12 @@ void DebuggerParser::executeSaveses()
}
else
{
- FilesystemNode file(filename.str());
+ ostringstream path;
+ if(argCount)
+ path << argStrings[0];
+ else
+ path << debugger.myOSystem.userDir() << filename.str();
+ FilesystemNode file(path.str());
if(debugger.prompt().saveBuffer(file))
commandResult << "saved " + file.getShortPath() + " OK";
diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx
index 24b2ed4bf..4403009b8 100644
--- a/src/debugger/gui/DebuggerDialog.cxx
+++ b/src/debugger/gui/DebuggerDialog.cxx
@@ -434,12 +434,12 @@ void DebuggerDialog::showBrowser(BrowserType type, const string& defaultName)
{
case BrowserType::svAccess:
cmd = kSvAccessCmd;
- title = "access counters";
+ title = "Access Counters";
break;
case BrowserType::svDis:
cmd = kSvDisCmd;
- title = "disassembly";
+ title = "Disassembly";
break;
case BrowserType::svRom:
@@ -449,12 +449,12 @@ void DebuggerDialog::showBrowser(BrowserType type, const string& defaultName)
case BrowserType::svScript:
cmd = kSvScriptCmd;
- title = "workbench";
+ title = "Workbench";
break;
case BrowserType::svSession:
cmd = kSvSessionCmd;
- title = "session";
+ title = "Session";
break;
default:
diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx
index 7710e9fa1..9a0cb3fe7 100644
--- a/src/gui/GameInfoDialog.cxx
+++ b/src/gui/GameInfoDialog.cxx
@@ -1395,7 +1395,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
case kExportPressed:
// This dialog is resizable under certain conditions, so we need
// to re-create it as necessary
- createBrowser("Export properties as");
+ createBrowser("Export Properties as");
myBrowser->show(instance().userDir().getPath() + myGameFile.getNameWithExt(".pro"),
BrowserDialog::FileSave, kExportChosen);
diff --git a/src/gui/RomAuditDialog.cxx b/src/gui/RomAuditDialog.cxx
index 60b627f8d..de7f3f5cd 100644
--- a/src/gui/RomAuditDialog.cxx
+++ b/src/gui/RomAuditDialog.cxx
@@ -198,7 +198,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kChooseAuditDirCmd:
- createBrowser("Select ROM directory to audit");
+ createBrowser("Select ROM Directory to Audit");
myBrowser->show(myRomPath->getText(),
BrowserDialog::Directories, kAuditDirChosenCmd);
break;
diff --git a/src/gui/SnapshotDialog.cxx b/src/gui/SnapshotDialog.cxx
index 69ad94936..28067213c 100644
--- a/src/gui/SnapshotDialog.cxx
+++ b/src/gui/SnapshotDialog.cxx
@@ -156,7 +156,7 @@ void SnapshotDialog::handleCommand(CommandSender* sender, int cmd,
case kChooseSnapSaveDirCmd:
// This dialog is resizable under certain conditions, so we need
// to re-create it as necessary
- createBrowser("Select snapshot save directory");
+ createBrowser("Select Snapshot Save Directory");
myBrowser->show(mySnapSavePath->getText(),
BrowserDialog::Directories, kSnapSaveDirChosenCmd);
break;
diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx
index b5b8fb72c..65c7d927b 100644
--- a/src/gui/UIDialog.cxx
+++ b/src/gui/UIDialog.cxx
@@ -586,7 +586,7 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
case kChooseRomDirCmd:
// This dialog is resizable under certain conditions, so we need
// to re-create it as necessary
- createBrowser("Select ROM directory");
+ createBrowser("Select ROM Directory");
myBrowser->show(myRomPath->getText(),
BrowserDialog::Directories, LauncherDialog::kRomDirChosenCmd);
break;
@@ -602,7 +602,7 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
case kChooseSnapLoadDirCmd:
// This dialog is resizable under certain conditions, so we need
// to re-create it as necessary
- createBrowser("Select snapshot load directory");
+ createBrowser("Select ROM Info Viewer Image Directory");
myBrowser->show(mySnapLoadPath->getText(),
BrowserDialog::Directories, kSnapLoadDirChosenCmd);
break;
From b976bd95ca0eff50a7a0f067b1a8b16c9b55e278 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 25 Dec 2020 09:15:58 +0100
Subject: [PATCH 7/8] enhanced and cleaned up OS specific path code improved
mouse double click marking added file list resizing in browser dialog
---
src/common/bspf.hxx | 11 +++++++++++
src/emucore/OSystem.cxx | 7 +++----
src/emucore/OSystem.hxx | 7 +++----
src/gui/BrowserDialog.cxx | 12 ++++++------
src/gui/EditableWidget.cxx | 12 ++++++------
src/gui/ListWidget.cxx | 11 +++++++++++
src/gui/ListWidget.hxx | 1 +
src/libretro/OSystemLIBRETRO.cxx | 6 +++---
src/libretro/OSystemLIBRETRO.hxx | 7 +++----
src/macos/OSystemMACOS.cxx | 9 +++------
src/macos/OSystemMACOS.hxx | 7 +++----
src/unix/OSystemUNIX.cxx | 10 ++++------
src/unix/OSystemUNIX.hxx | 7 +++----
src/unix/r77/OSystemR77.cxx | 4 ++--
src/unix/r77/OSystemR77.hxx | 7 +++----
src/windows/OSystemWINDOWS.cxx | 15 +++++++++------
src/windows/OSystemWINDOWS.hxx | 7 +++----
17 files changed, 77 insertions(+), 63 deletions(-)
diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx
index 4a17719ad..44d649869 100644
--- a/src/common/bspf.hxx
+++ b/src/common/bspf.hxx
@@ -336,6 +336,17 @@ namespace BSPF
}
#endif
}
+
+ inline bool isWhiteSpace(const char s)
+ {
+ const string WHITESPACES = " ,.;:+-*&/\\'";
+
+ for(size_t i = 0; i < WHITESPACES.length(); ++i)
+ if(s == WHITESPACES[i])
+ return true;
+
+ return false;
+ }
} // namespace BSPF
#endif
diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx
index 72ec65814..f920537b5 100644
--- a/src/emucore/OSystem.cxx
+++ b/src/emucore/OSystem.cxx
@@ -217,8 +217,8 @@ void OSystem::loadConfig(const Settings::Options& options)
{
// Get base directory and config file from derived class
// It will decide whether it can override its default location
- string baseDir, cfgFile, homeDir, unused;
- getBaseDirAndConfig(baseDir, cfgFile, homeDir, unused,
+ string baseDir, cfgFile, homeDir;
+ getBaseDirAndConfig(baseDir, cfgFile, homeDir,
ourOverrideBaseDirWithApp, ourOverrideBaseDir);
// Get fully-qualified pathnames, and make directories when needed
@@ -239,10 +239,9 @@ void OSystem::loadConfig(const Settings::Options& options)
#endif
mySettings->setRepository(createSettingsRepository());
-
mySettings->load(options);
- // TODO: check if affected by '-baseDir'and 'basedirinapp' params
+ // userDir is NOT affected by '-baseDir'and '-basedirinapp' params
string userDir = mySettings->getString("userdir");
if(userDir.empty())
userDir = homeDir;
diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx
index 0ce5aef4b..484bf8861 100644
--- a/src/emucore/OSystem.hxx
+++ b/src/emucore/OSystem.hxx
@@ -463,8 +463,7 @@ class OSystem
@param basedir The base directory for all configuration files
@param cfgfile The fully qualified pathname of the config file
(including the base directory)
- @param savedir The default directory to save various other files
- @param loaddir The default directory to load various other files
+ @param homedir The default directory to store various other files
@param useappdir A hint that the base dir should be set to the
app directory; not all ports can do this, so
they are free to ignore it
@@ -473,8 +472,8 @@ class OSystem
they are free to ignore it
*/
virtual void getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir) = 0;
+ string& homedir,
+ bool useappdir, const string& usedir) = 0;
protected:
// Pointer to the EventHandler object
diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx
index d401ed8cb..d56b8558d 100644
--- a/src/gui/BrowserDialog.cxx
+++ b/src/gui/BrowserDialog.cxx
@@ -126,9 +126,9 @@ void BrowserDialog::show(const string& startpath,
const string& ext)
{
const int fontWidth = _font.getMaxCharWidth(),
- //fontHeight = _font.getFontHeight(),
- HBORDER = fontWidth * 1.25;
- //VGAP = fontHeight / 4;
+ fontHeight = _font.getFontHeight(),
+ HBORDER = fontWidth * 1.25,
+ VGAP = fontHeight / 4;
_mode = mode;
_cmd = cmd;
@@ -153,7 +153,7 @@ void BrowserDialog::show(const string& startpath,
_fileList->setNameFilter([ext](const FilesystemNode& node) {
return BSPF::endsWithIgnoreCase(node.getName(), ext);
});
- //_fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
+ _fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
_currentPath->setWidth(_savePathBox->getLeft() - _currentPath->getLeft() - fontWidth);
_savePathBox->setEnabled(true);
@@ -172,7 +172,7 @@ void BrowserDialog::show(const string& startpath,
_fileList->setNameFilter([ext](const FilesystemNode& node) {
return BSPF::endsWithIgnoreCase(node.getName(), ext);
});
- //_fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
+ _fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
_currentPath->setWidth(_savePathBox->getLeft() - _currentPath->getLeft() - fontWidth);
_savePathBox->setEnabled(true);
@@ -192,7 +192,7 @@ void BrowserDialog::show(const string& startpath,
_fileList->setListMode(FilesystemNode::ListMode::DirectoriesOnly);
_fileList->setNameFilter([](const FilesystemNode&) { return true; });
// TODO: scrollbar affected too!
- //_fileList->setHeight(_selected->getBottom() - _fileList->getTop());
+ _fileList->setHeight(_selected->getBottom() - _fileList->getTop());
_currentPath->setWidth(_savePathBox->getRight() - _currentPath->getLeft());
_savePathBox->setEnabled(false);
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 0a76bd7d1..2b37a0ba2 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -657,7 +657,7 @@ bool EditableWidget::killWord(int direction)
{
while(currentPos > 0)
{
- if(_editString[currentPos - 1] == ' ')
+ if(BSPF::isWhiteSpace(_editString[currentPos - 1]))
{
if(!space)
break;
@@ -673,7 +673,7 @@ bool EditableWidget::killWord(int direction)
{
while(currentPos < int(_editString.size()))
{
- if(currentPos && _editString[currentPos - 1] == ' ')
+ if(currentPos && BSPF::isWhiteSpace(_editString[currentPos - 1]))
{
if(!space)
break;
@@ -709,7 +709,7 @@ bool EditableWidget::moveWord(int direction, bool select)
{
while (currentPos > 0)
{
- if (_editString[currentPos - 1] == ' ')
+ if (BSPF::isWhiteSpace(_editString[currentPos - 1]))
{
if (!space)
break;
@@ -728,7 +728,7 @@ bool EditableWidget::moveWord(int direction, bool select)
{
while (currentPos < int(_editString.size()))
{
- if (currentPos && _editString[currentPos - 1] == ' ')
+ if (currentPos && BSPF::isWhiteSpace(_editString[currentPos - 1]))
{
if (!space)
break;
@@ -754,14 +754,14 @@ bool EditableWidget::markWord()
while(_caretPos + _selectSize < int(_editString.size()))
{
- if(_editString[_caretPos + _selectSize] == ' ')
+ if(BSPF::isWhiteSpace(_editString[_caretPos + _selectSize]))
break;
_selectSize++;
}
while(_caretPos > 0)
{
- if(_editString[_caretPos - 1] == ' ')
+ if(BSPF::isWhiteSpace(_editString[_caretPos - 1]))
break;
_caretPos--;
_selectSize++;
diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx
index a8c0c37da..ae2551e8f 100644
--- a/src/gui/ListWidget.cxx
+++ b/src/gui/ListWidget.cxx
@@ -56,6 +56,17 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
_w = w - 1;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void ListWidget::setHeight(int h)
+{
+ Widget::setHeight(h);
+ if(_useScrollbar)
+ _scrollBar->setHeight(h);
+
+ _rows = (h - 2) / _lineHeight;
+ recalc();
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ListWidget::setSelected(int item)
{
diff --git a/src/gui/ListWidget.hxx b/src/gui/ListWidget.hxx
index 1fba03f01..25ea1906f 100644
--- a/src/gui/ListWidget.hxx
+++ b/src/gui/ListWidget.hxx
@@ -47,6 +47,7 @@ class ListWidget : public EditableWidget
int rows() const { return _rows; }
int currentPos() const { return _currentPos; }
+ void setHeight(int h) override;
int getSelected() const { return _selectedItem; }
void setSelected(int item);
diff --git a/src/libretro/OSystemLIBRETRO.cxx b/src/libretro/OSystemLIBRETRO.cxx
index 02844de63..4d1578f69 100644
--- a/src/libretro/OSystemLIBRETRO.cxx
+++ b/src/libretro/OSystemLIBRETRO.cxx
@@ -26,8 +26,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemLIBRETRO::getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir)
+ string& homedir,
+ bool useappdir, const string& usedir)
{
- loaddir = savedir = cfgfile = basedir = "." + slash;
+ basedir = cfgfile = homedir = "." + slash;
}
diff --git a/src/libretro/OSystemLIBRETRO.hxx b/src/libretro/OSystemLIBRETRO.hxx
index 60b1fc4e5..0fdadb8af 100644
--- a/src/libretro/OSystemLIBRETRO.hxx
+++ b/src/libretro/OSystemLIBRETRO.hxx
@@ -41,8 +41,7 @@ class OSystemLIBRETRO : public OSystem
@param basedir The base directory for all configuration files
@param cfgfile The fully qualified pathname of the config file
(including the base directory)
- @param savedir The default directory to save various other files
- @param loaddir The default directory to load various other files
+ @param homedir The default directory to store various other files
@param useappdir A hint that the base dir should be set to the
app directory; not all ports can do this, so
they are free to ignore it
@@ -51,8 +50,8 @@ class OSystemLIBRETRO : public OSystem
they are free to ignore it
*/
void getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir) override;
+ string& homedir,
+ bool useappdir, const string& usedir) override;
};
#endif
diff --git a/src/macos/OSystemMACOS.cxx b/src/macos/OSystemMACOS.cxx
index 9d933da8b..0ba22279e 100644
--- a/src/macos/OSystemMACOS.cxx
+++ b/src/macos/OSystemMACOS.cxx
@@ -21,8 +21,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemMACOS::getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir)
+ string& homedir,
+ bool useappdir, const string& usedir)
{
basedir = "~/Library/Application Support/Stella/";
@@ -31,14 +31,11 @@ void OSystemMACOS::getBaseDirAndConfig(string& basedir, string& cfgfile,
if(useappdir)
cout << "ERROR: base dir in app folder not supported" << endl;
else if(usedir != "")
- {
basedir = FilesystemNode(usedir).getPath();
- savedir = loaddir = basedir;
- }
#endif
FilesystemNode desktop("~/Desktop/");
- savedir = loaddir = desktop.isDirectory() ? desktop.getShortPath() : "~/";
+ homedir = desktop.isDirectory() ? desktop.getShortPath() : "~/";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/macos/OSystemMACOS.hxx b/src/macos/OSystemMACOS.hxx
index 89d6638c1..1bfedb011 100644
--- a/src/macos/OSystemMACOS.hxx
+++ b/src/macos/OSystemMACOS.hxx
@@ -41,8 +41,7 @@ class OSystemMACOS : public OSystem
@param basedir The base directory for all configuration files
@param cfgfile The fully qualified pathname of the config file
(including the base directory)
- @param savedir The default directory to save various other files
- @param loaddir The default directory to load various other files
+ @param homedir The default directory to store various other files
@param useappdir A hint that the base dir should be set to the
app directory; not all ports can do this, so
they are free to ignore it
@@ -51,8 +50,8 @@ class OSystemMACOS : public OSystem
they are free to ignore it
*/
void getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir) override;
+ string& homedir,
+ bool useappdir, const string& usedir) override;
protected:
virtual shared_ptr createSettingsRepository() override;
diff --git a/src/unix/OSystemUNIX.cxx b/src/unix/OSystemUNIX.cxx
index 6b6ec4df3..2156e0975 100644
--- a/src/unix/OSystemUNIX.cxx
+++ b/src/unix/OSystemUNIX.cxx
@@ -23,23 +23,21 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemUNIX::getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir)
+ string& homedir,
+ bool useappdir, const string& usedir)
{
// Use XDG_CONFIG_HOME if defined, otherwise use the default
string configDir = BSPF::getenv("XDG_CONFIG_HOME");
+
if(configDir == EmptyString) configDir = "~/.config";
basedir = configDir + "/stella";
- savedir = loaddir = "~/";
+ homedir = "~/";
// Check to see if basedir overrides are active
if(useappdir)
cout << "ERROR: base dir in app folder not supported" << endl;
else if(usedir != "")
- {
basedir = FilesystemNode(usedir).getPath();
- savedir = loaddir = basedir;
- }
// (Currently) non-documented alternative for using version-specific
// config file
diff --git a/src/unix/OSystemUNIX.hxx b/src/unix/OSystemUNIX.hxx
index b562a3c3d..e9309787e 100644
--- a/src/unix/OSystemUNIX.hxx
+++ b/src/unix/OSystemUNIX.hxx
@@ -41,8 +41,7 @@ class OSystemUNIX : public OSystem
@param basedir The base directory for all configuration files
@param cfgfile The fully qualified pathname of the config file
(including the base directory)
- @param savedir The default directory to save various other files
- @param loaddir The default directory to load various other files
+ @param homedir The default directory to store various other files
@param useappdir A hint that the base dir should be set to the
app directory; not all ports can do this, so
they are free to ignore it
@@ -51,8 +50,8 @@ class OSystemUNIX : public OSystem
they are free to ignore it
*/
void getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir) override;
+ string& homedir,
+ bool useappdir, const string& usedir) override;
private:
// Following constructors and assignment operators not supported
diff --git a/src/unix/r77/OSystemR77.cxx b/src/unix/r77/OSystemR77.cxx
index dd692b24f..50da2b086 100644
--- a/src/unix/r77/OSystemR77.cxx
+++ b/src/unix/r77/OSystemR77.cxx
@@ -19,8 +19,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemR77::getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir, bool, const string&)
+ string& homeDir, bool, const string&)
{
- basedir = savedir = loaddir = "/mnt/stella";
+ basedir = homeDir = "/mnt/stella";
cfgfile = "/mnt/stella/stellarc";
}
diff --git a/src/unix/r77/OSystemR77.hxx b/src/unix/r77/OSystemR77.hxx
index 58d80d80e..fc7f4efa4 100644
--- a/src/unix/r77/OSystemR77.hxx
+++ b/src/unix/r77/OSystemR77.hxx
@@ -43,8 +43,7 @@ class OSystemR77 : public OSystem
@param basedir The base directory for all configuration files
@param cfgfile The fully qualified pathname of the config file
(including the base directory)
- @param savedir The default directory to save various other files
- @param loaddir The default directory to load various other files
+ @param homedir The default directory to store various other files
@param useappdir A hint that the base dir should be set to the
app directory; not all ports can do this, so
they are free to ignore it
@@ -53,8 +52,8 @@ class OSystemR77 : public OSystem
they are free to ignore it
*/
void getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir) override;
+ string& homedir,
+ bool useappdir, const string& usedir) override;
private:
// Following constructors and assignment operators not supported
diff --git a/src/windows/OSystemWINDOWS.cxx b/src/windows/OSystemWINDOWS.cxx
index d1df4f55c..f7b6787fb 100644
--- a/src/windows/OSystemWINDOWS.cxx
+++ b/src/windows/OSystemWINDOWS.cxx
@@ -23,11 +23,12 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemWINDOWS::getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir)
+ string& homedir,
+ bool useappdir, const string& usedir)
{
HomeFinder homefinder;
FilesystemNode appdata(homefinder.getAppDataPath());
+
if(appdata.isDirectory())
{
basedir = appdata.getShortPath();
@@ -35,8 +36,9 @@ void OSystemWINDOWS::getBaseDirAndConfig(string& basedir, string& cfgfile,
basedir += '\\';
basedir += "Stella\\";
}
- FilesystemNode defaultLoadSaveDir(homefinder.getDesktopPath());
- savedir = loaddir = defaultLoadSaveDir.getShortPath();
+
+ FilesystemNode defaultHomeDir(homefinder.getDesktopPath());
+ homedir = defaultHomeDir.getShortPath();
// Check to see if basedir overrides are active
if(useappdir)
@@ -44,12 +46,13 @@ void OSystemWINDOWS::getBaseDirAndConfig(string& basedir, string& cfgfile,
char filename[MAX_PATH];
GetModuleFileNameA(NULL, filename, sizeof(filename));
FilesystemNode appdir(filename);
+
appdir = appdir.getParent();
if(appdir.isDirectory())
- savedir = loaddir = basedir = appdir.getPath();
+ basedir = appdir.getPath();
}
else if(usedir != "")
- savedir = loaddir = basedir = FilesystemNode(usedir).getPath();
+ basedir = FilesystemNode(usedir).getPath();
cfgfile = basedir + "stella.ini";
}
diff --git a/src/windows/OSystemWINDOWS.hxx b/src/windows/OSystemWINDOWS.hxx
index 4995f9f51..b938c3719 100644
--- a/src/windows/OSystemWINDOWS.hxx
+++ b/src/windows/OSystemWINDOWS.hxx
@@ -41,8 +41,7 @@ class OSystemWINDOWS : public OSystem
@param basedir The base directory for all configuration files
@param cfgfile The fully qualified pathname of the config file
(including the base directory)
- @param savedir The default directory to save various other files
- @param loaddir The default directory to load various other files
+ @param homedir The default directory to store various other files
@param useappdir A hint that the base dir should be set to the
app directory; not all ports can do this, so
they are free to ignore it
@@ -51,8 +50,8 @@ class OSystemWINDOWS : public OSystem
they are free to ignore it
*/
void getBaseDirAndConfig(string& basedir, string& cfgfile,
- string& savedir, string& loaddir,
- bool useappdir, const string& usedir) override;
+ string& homedir,
+ bool useappdir, const string& usedir) override;
private:
// Following constructors and assignment operators not supported
From 717a678a035b399ad2ad22926a52b97e456ec4c6 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 25 Dec 2020 09:38:37 +0100
Subject: [PATCH 8/8] minor doc updates
---
docs/index.html | 2 +-
src/debugger/DebuggerParser.cxx | 18 ++++++++++--------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index 5657ce955..aa200a645 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -3191,7 +3191,7 @@
-userdir <dir> |
- Set the path to save user files to. |
+ Set the path to save user files (property exports, debugger saves) to. |
diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx
index 3c8bdac5b..0d35b5e30 100644
--- a/src/debugger/DebuggerParser.cxx
+++ b/src/debugger/DebuggerParser.cxx
@@ -681,7 +681,7 @@ string DebuggerParser::saveScriptFile(string file)
if(file.find_last_of('.') == string::npos)
file += ".script";
- // Use default path if no path is provided
+ // Use user dir if no path is provided
if(file.find_first_of(FilesystemNode::PATH_SEPARATOR) == string::npos)
file = debugger.myOSystem.userDir().getPath() + file;
@@ -2669,9 +2669,10 @@ std::array DebuggerParser::commands = { {
"dump",
"Dump data at address [to yy] [1: memory; 2: CPU state; 4: input regs]",
"Example:\n"
- " dump f000 - dumps 128 bytes @ f000\n"
+ " dump f000 - dumps 128 bytes from f000\n"
" dump f000 f0ff - dumps all bytes from f000 to f0ff\n"
- " dump f000 f0ff 7 - dumps all bytes from f000 to f0ff, CPU state and input registers into a file",
+ " dump f000 f0ff 7 - dumps all bytes from f000 to f0ff,\n"
+ " CPU state and input registers into a file in user dir",
true,
false,
{ Parameters::ARG_WORD, Parameters::ARG_MULTI_BYTE },
@@ -3095,7 +3096,8 @@ std::array DebuggerParser::commands = { {
{
"save",
"Save breaks, watches, traps and functions to file xx",
- "Example: save commands.script, save ?",
+ "Example: save commands.script, save ?\n"
+ "NOTE: saves to user dir by default",
true,
false,
{ Parameters::ARG_FILE, Parameters::ARG_END_ARGS },
@@ -3106,7 +3108,7 @@ std::array DebuggerParser::commands = { {
"saveaccess",
"Save the access counters to CSV file",
"Example: saveaccess, saveaccess ?\n"
- "NOTE: saves to default save location without ? parameter",
+ "NOTE: saves to user dir by default",
false,
false,
{ Parameters::ARG_FILE, Parameters::ARG_END_ARGS },
@@ -3127,7 +3129,7 @@ std::array DebuggerParser::commands = { {
"savedis",
"Save Distella disassembly",
"Example: savedis, savedis ?\n"
- "NOTE: saves to default save location without ? parameter",
+ "NOTE: saves to user dir by default",
false,
false,
{ Parameters::ARG_FILE, Parameters::ARG_END_ARGS },
@@ -3138,7 +3140,7 @@ std::array DebuggerParser::commands = { {
"saverom",
"Save (possibly patched) ROM",
"Example: saverom, saverom ?\n"
- "NOTE: saves to default save location without ? parameter",
+ "NOTE: saves to user dir by default",
false,
false,
{ Parameters::ARG_FILE, Parameters::ARG_END_ARGS },
@@ -3149,7 +3151,7 @@ std::array DebuggerParser::commands = { {
"saveses",
"Save console session",
"Example: saveses, saveses ?\n"
- "NOTE: saves to default save location without ? parameter",
+ "NOTE: saves to user dir by default",
false,
false,
{ Parameters::ARG_FILE, Parameters::ARG_END_ARGS },
|