Re-added ROM browser mode ('rombrowse' commandline argument).

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1357 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-08-22 13:55:40 +00:00
parent 88e76cfd6e
commit 4f9b1fdf61
6 changed files with 58 additions and 40 deletions

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.cxx,v 1.124 2007-08-21 17:58:25 stephena Exp $
// $Id: Settings.cxx,v 1.125 2007-08-22 13:55:40 stephena Exp $
//============================================================================
#include <cassert>
@ -82,6 +82,9 @@ Settings::Settings(OSystem* osystem)
setInternal("palettefile", "");
setInternal("propsfile", "");
setInternal("rombrowse", "true");
setInternal("lastrom", "");
setInternal("debuggerres", "1030x690");
setInternal("launcherres", "400x300");
setInternal("uipalette", "0");
@ -306,6 +309,7 @@ void Settings::usage()
<< " -p2speed <number> Speed of emulated mouse movement for paddle 2 (0-100)\n"
<< " -p3speed <number> Speed of emulated mouse movement for paddle 3 (0-100)\n"
<< " -pthresh <number> Set threshold for eliminating paddle jitter\n"
<< " -rombrowse <1|0> Use ROM browser mode (shows files and folders)\n"
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
<< " -ssdir <path> The directory to save snapshot files to\n"
<< " -sssingle <1|0> Generate single snapshot instead of many\n"

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: FileSnapDialog.cxx,v 1.11 2007-08-15 17:43:51 stephena Exp $
// $Id: FileSnapDialog.cxx,v 1.12 2007-08-22 13:55:40 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -49,23 +49,17 @@ FileSnapDialog::FileSnapDialog(
xpos = vBorder; ypos = vBorder;
// ROM path
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Rom path:",
ButtonWidget* romButton =
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Rom path:",
kChooseRomDirCmd);
wid.push_back(b);
wid.push_back(romButton);
xpos += bwidth + 10;
myRomPath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, font.getLineHeight(), "");
wid.push_back(myRomPath);
// ROM settings are disabled while in game mode
if(!myIsGlobal)
{
b->clearFlags(WIDGET_ENABLED);
myRomPath->setEditable(false);
}
// State directory
xpos = vBorder; ypos += b->getHeight() + 3;
xpos = vBorder; ypos += romButton->getHeight() + 3;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "State path:",
kChooseStateDirCmd);
wid.push_back(b);
@ -114,8 +108,23 @@ FileSnapDialog::FileSnapDialog(
_w - xpos - 10, font.getLineHeight(), "");
wid.push_back(mySnapPath);
// Snapshot single or multiple saves
// Use ROM browse mode
xpos = 30; ypos += mySnapPath->getHeight() + 8;
myBrowseCheckbox =
new CheckboxWidget(this, font, xpos, ypos, "Browse folders", kBrowseDirCmd);
wid.push_back(myBrowseCheckbox);
// Reload current ROM listing (in non-browse mode)
xpos += myBrowseCheckbox->getWidth() + 20;
myReloadRomButton =
new ButtonWidget(this, font, xpos, ypos-2,
font.getStringWidth(" Reload ROM Listing "), bheight,
"Reload ROM Listing", kReloadRomDirCmd);
//myReloadButton->setEditable(true);
wid.push_back(myReloadRomButton);
// Snapshot single or multiple saves
xpos = 30; ypos += myBrowseCheckbox->getHeight() + 4;
mySnapSingleCheckbox = new CheckboxWidget(this, font, xpos, ypos,
"Multiple snapshots");
wid.push_back(mySnapSingleCheckbox);
@ -141,6 +150,15 @@ FileSnapDialog::FileSnapDialog(
addToFocusList(wid);
// All ROM settings are disabled while in game mode
if(!myIsGlobal)
{
romButton->clearFlags(WIDGET_ENABLED);
myRomPath->setEditable(false);
myBrowseCheckbox->clearFlags(WIDGET_ENABLED);
myReloadRomButton->clearFlags(WIDGET_ENABLED);
}
// Create file browser dialog
myBrowser = new BrowserDialog(this, font, 60, 20, 200, 200);
}
@ -159,8 +177,10 @@ void FileSnapDialog::loadConfig()
myCheatFile->setEditString(instance()->cheatFile());
myPaletteFile->setEditString(instance()->paletteFile());
myPropsFile->setEditString(instance()->propertiesFile());
mySnapPath->setEditString(instance()->settings().getString("ssdir"));
bool b = instance()->settings().getBool("rombrowse");
myBrowseCheckbox->setState(b);
myReloadRomButton->setEnabled(myIsGlobal && !b);
mySnapSingleCheckbox->setState(!instance()->settings().getBool("sssingle"));
}
@ -172,8 +192,8 @@ void FileSnapDialog::saveConfig()
instance()->settings().setString("cheatfile", myCheatFile->getEditString());
instance()->settings().setString("palettefile", myPaletteFile->getEditString());
instance()->settings().setString("propsfile", myPropsFile->getEditString());
instance()->settings().setString("ssdir", mySnapPath->getEditString());
instance()->settings().setBool("rombrowse", myBrowseCheckbox->getState());
instance()->settings().setBool("sssingle", !mySnapSingleCheckbox->getState());
// Flush changes to disk and inform the OSystem
@ -222,7 +242,10 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
saveConfig();
close();
if(myIsGlobal)
{
sendCommand(kBrowseChangedCmd, 0, 0); // Call this before refreshing ROMs
sendCommand(kRomDirChosenCmd, 0, 0); // Let the boss know romdir has changed
}
break;
case kDefaultsCmd:
@ -301,6 +324,10 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
break;
}
case kReloadRomDirCmd:
sendCommand(kReloadRomDirCmd, 0, 0);
break;
default:
Dialog::handleCommand(sender, cmd, data, 0);
break;

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: FileSnapDialog.hxx,v 1.7 2007-08-15 17:43:51 stephena Exp $
// $Id: FileSnapDialog.hxx,v 1.8 2007-08-22 13:55:40 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -60,6 +60,7 @@ class FileSnapDialog : public Dialog, public CommandSender
kChoosePaletteFileCmd = 'LOpf', // palette file (stella.pal)
kChoosePropsFileCmd = 'LOpr', // properties file (stella.pro)
kChooseSnapDirCmd = 'LOsn', // snapshot dir
kBrowseDirCmd = 'LObd', // browse mode
kStateDirChosenCmd = 'LOsc', // state dir changed
kCheatFileChosenCmd = 'LOcc', // cheatfile changed
kPaletteFileChosenCmd = 'LOpc', // palette file changed
@ -77,6 +78,9 @@ class FileSnapDialog : public Dialog, public CommandSender
EditTextWidget* mySnapPath;
CheckboxWidget* mySnapSingleCheckbox;
CheckboxWidget* myBrowseCheckbox;
ButtonWidget* myReloadRomButton;
// Indicates if this dialog is used for global (vs. in-game) settings
bool myIsGlobal;
};

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: LauncherDialog.cxx,v 1.68 2007-01-19 21:53:27 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.69 2007-08-22 13:55:40 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -201,15 +201,7 @@ void LauncherDialog::updateListing(bool fullReload)
// Disable buttons, pending a reload from disk
enableButtons(false);
// Figure out if the ROM dir has changed since we last accessed it.
// If so, we do a full reload from disk (takes quite some time).
// Otherwise, we can use the cache file (which is much faster).
string currentModTime = FilesystemNode::modTime(romdir);
string oldModTime = instance()->settings().getString("modtime");
if(currentModTime != oldModTime) // romdir has changed
loadListFromDisk();
else if(FilesystemNode::fileExists(instance()->cacheFile()) && !fullReload)
if(FilesystemNode::fileExists(instance()->cacheFile()) && !fullReload)
loadListFromCache();
else // we have no other choice
loadListFromDisk();
@ -329,11 +321,6 @@ void LauncherDialog::loadListFromDisk()
// And create a cache file, so that the next time Stella starts,
// we don't have to do this time-consuming operation again
createListCache();
// Finally, update the modification time so we don't have to needlessly
// call this method again
string currentModTime = FilesystemNode::modTime(romdir);
instance()->settings().setString("modtime", currentModTime);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: LauncherDialog.hxx,v 1.25 2007-01-18 16:45:22 knakos Exp $
// $Id: LauncherDialog.hxx,v 1.26 2007-08-22 13:55:40 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -31,12 +31,8 @@ class StringListWidget;
class ButtonWidget;
class OSystem;
#ifdef _WIN32_WCE
// different include order for the ce compiler
#include "FSNode.hxx"
#endif
#include "Dialog.hxx"
#include "FSNode.hxx"
#include "Dialog.hxx"
#include "GameList.hxx"
#include "bspf.hxx"

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: OptionsDialog.cxx,v 1.58 2007-08-21 17:58:25 stephena Exp $
// $Id: OptionsDialog.cxx,v 1.59 2007-08-22 13:55:40 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -126,7 +126,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
w = 200; h = 155;
myUIDialog = new UIDialog(myOSystem, parent, font, x, y, w, h);
w = 280; h = 170;
w = 280; h = 190;
myFileSnapDialog = new FileSnapDialog(myOSystem, parent, font,
boss, x, y, w, h);