mirror of https://github.com/stella-emu/stella.git
Removed 'non-browse' mode in the ROM launcher, this time for good. I
actually removed it from 2.4.1, and re-added it in 2.4.2. But I think I've figured out a way to get the best of both worlds, and only have one browsing mode. This will become clearer once I finish the ROM auditing feature. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1426 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
cb0b5ae1ee
commit
3b32d07c1d
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Settings.cxx,v 1.133 2008-03-03 18:54:51 stephena Exp $
|
// $Id: Settings.cxx,v 1.134 2008-03-12 19:42:36 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -86,8 +86,6 @@ Settings::Settings(OSystem* osystem)
|
||||||
setInternal("propsfile", "");
|
setInternal("propsfile", "");
|
||||||
|
|
||||||
// ROM browser options
|
// ROM browser options
|
||||||
setInternal("rombrowse", "true");
|
|
||||||
setInternal("lastrom", "");
|
|
||||||
setInternal("romviewer", "false");
|
setInternal("romviewer", "false");
|
||||||
|
|
||||||
// UI-related options
|
// UI-related options
|
||||||
|
@ -316,7 +314,6 @@ void Settings::usage()
|
||||||
<< " -pspeed <number> Speed of digital emulated paddle movement (1-15)\n"
|
<< " -pspeed <number> Speed of digital emulated paddle movement (1-15)\n"
|
||||||
<< " -sa1 <left|right> Stelladaptor 1 emulates specified joystick port\n"
|
<< " -sa1 <left|right> Stelladaptor 1 emulates specified joystick port\n"
|
||||||
<< " -sa2 <left|right> Stelladaptor 2 emulates specified joystick port\n"
|
<< " -sa2 <left|right> Stelladaptor 2 emulates specified joystick port\n"
|
||||||
<< " -rombrowse <1|0> Use ROM browser mode (shows files and folders)\n"
|
|
||||||
<< " -romviewer <1|0> Show ROM info viewer in ROM launcher\n"
|
<< " -romviewer <1|0> Show ROM info viewer in ROM launcher\n"
|
||||||
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
|
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
|
||||||
<< " -ssdir <path> The directory to save snapshot files to\n"
|
<< " -ssdir <path> The directory to save snapshot files to\n"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FileSnapDialog.cxx,v 1.14 2008-02-06 13:45:23 stephena Exp $
|
// $Id: FileSnapDialog.cxx,v 1.15 2008-03-12 19:42:36 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -110,23 +110,8 @@ FileSnapDialog::FileSnapDialog(
|
||||||
_w - xpos - 10, font.getLineHeight(), "");
|
_w - xpos - 10, font.getLineHeight(), "");
|
||||||
wid.push_back(mySnapPath);
|
wid.push_back(mySnapPath);
|
||||||
|
|
||||||
// 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
|
// Snapshot single or multiple saves
|
||||||
xpos = 30; ypos += myBrowseCheckbox->getHeight() + 4;
|
xpos = 30; ypos += b->getHeight() + 5;
|
||||||
mySnapSingleCheckbox = new CheckboxWidget(this, font, xpos, ypos,
|
mySnapSingleCheckbox = new CheckboxWidget(this, font, xpos, ypos,
|
||||||
"Multiple snapshots");
|
"Multiple snapshots");
|
||||||
wid.push_back(mySnapSingleCheckbox);
|
wid.push_back(mySnapSingleCheckbox);
|
||||||
|
@ -157,8 +142,6 @@ FileSnapDialog::FileSnapDialog(
|
||||||
{
|
{
|
||||||
romButton->clearFlags(WIDGET_ENABLED);
|
romButton->clearFlags(WIDGET_ENABLED);
|
||||||
myRomPath->setEditable(false);
|
myRomPath->setEditable(false);
|
||||||
myBrowseCheckbox->clearFlags(WIDGET_ENABLED);
|
|
||||||
myReloadRomButton->clearFlags(WIDGET_ENABLED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create file browser dialog
|
// Create file browser dialog
|
||||||
|
@ -180,9 +163,6 @@ void FileSnapDialog::loadConfig()
|
||||||
myPaletteFile->setEditString(instance()->paletteFile());
|
myPaletteFile->setEditString(instance()->paletteFile());
|
||||||
myPropsFile->setEditString(instance()->propertiesFile());
|
myPropsFile->setEditString(instance()->propertiesFile());
|
||||||
mySnapPath->setEditString(instance()->settings().getString("ssdir"));
|
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"));
|
mySnapSingleCheckbox->setState(!instance()->settings().getBool("sssingle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +175,6 @@ void FileSnapDialog::saveConfig()
|
||||||
instance()->settings().setString("palettefile", myPaletteFile->getEditString());
|
instance()->settings().setString("palettefile", myPaletteFile->getEditString());
|
||||||
instance()->settings().setString("propsfile", myPropsFile->getEditString());
|
instance()->settings().setString("propsfile", myPropsFile->getEditString());
|
||||||
instance()->settings().setString("ssdir", mySnapPath->getEditString());
|
instance()->settings().setString("ssdir", mySnapPath->getEditString());
|
||||||
instance()->settings().setBool("rombrowse", myBrowseCheckbox->getState());
|
|
||||||
instance()->settings().setBool("sssingle", !mySnapSingleCheckbox->getState());
|
instance()->settings().setBool("sssingle", !mySnapSingleCheckbox->getState());
|
||||||
|
|
||||||
// Flush changes to disk and inform the OSystem
|
// Flush changes to disk and inform the OSystem
|
||||||
|
@ -212,6 +191,7 @@ void FileSnapDialog::setDefaults()
|
||||||
const string& cheatfile = basedir + BSPF_PATH_SEPARATOR + "stella.cht";
|
const string& cheatfile = basedir + BSPF_PATH_SEPARATOR + "stella.cht";
|
||||||
const string& palettefile = basedir + BSPF_PATH_SEPARATOR + "stella.pal";
|
const string& palettefile = basedir + BSPF_PATH_SEPARATOR + "stella.pal";
|
||||||
const string& propsfile = basedir + BSPF_PATH_SEPARATOR + "stella.pro";
|
const string& propsfile = basedir + BSPF_PATH_SEPARATOR + "stella.pro";
|
||||||
|
const string& ssdir = basedir + BSPF_PATH_SEPARATOR;
|
||||||
|
|
||||||
myRomPath->setEditString(romdir);
|
myRomPath->setEditString(romdir);
|
||||||
myStatePath->setEditString(statedir);
|
myStatePath->setEditString(statedir);
|
||||||
|
@ -219,7 +199,7 @@ void FileSnapDialog::setDefaults()
|
||||||
myPaletteFile->setEditString(palettefile);
|
myPaletteFile->setEditString(palettefile);
|
||||||
myPropsFile->setEditString(propsfile);
|
myPropsFile->setEditString(propsfile);
|
||||||
|
|
||||||
mySnapPath->setEditString(string(".") + BSPF_PATH_SEPARATOR);
|
mySnapPath->setEditString(ssdir);
|
||||||
mySnapSingleCheckbox->setState(true);
|
mySnapSingleCheckbox->setState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,10 +224,7 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
saveConfig();
|
saveConfig();
|
||||||
close();
|
close();
|
||||||
if(myIsGlobal)
|
if(myIsGlobal)
|
||||||
{
|
|
||||||
sendCommand(kBrowseChangedCmd, 0, 0); // Call this before refreshing ROMs
|
|
||||||
sendCommand(kRomDirChosenCmd, 0, 0); // Let the boss know romdir has changed
|
sendCommand(kRomDirChosenCmd, 0, 0); // Let the boss know romdir has changed
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDefaultsCmd:
|
case kDefaultsCmd:
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FileSnapDialog.hxx,v 1.9 2008-02-06 13:45:23 stephena Exp $
|
// $Id: FileSnapDialog.hxx,v 1.10 2008-03-12 19:42:36 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -60,7 +60,6 @@ class FileSnapDialog : public Dialog, public CommandSender
|
||||||
kChoosePaletteFileCmd = 'LOpf', // palette file (stella.pal)
|
kChoosePaletteFileCmd = 'LOpf', // palette file (stella.pal)
|
||||||
kChoosePropsFileCmd = 'LOpr', // properties file (stella.pro)
|
kChoosePropsFileCmd = 'LOpr', // properties file (stella.pro)
|
||||||
kChooseSnapDirCmd = 'LOsn', // snapshot dir
|
kChooseSnapDirCmd = 'LOsn', // snapshot dir
|
||||||
kBrowseDirCmd = 'LObd', // browse mode
|
|
||||||
kStateDirChosenCmd = 'LOsc', // state dir changed
|
kStateDirChosenCmd = 'LOsc', // state dir changed
|
||||||
kCheatFileChosenCmd = 'LOcc', // cheatfile changed
|
kCheatFileChosenCmd = 'LOcc', // cheatfile changed
|
||||||
kPaletteFileChosenCmd = 'LOpc', // palette file changed
|
kPaletteFileChosenCmd = 'LOpc', // palette file changed
|
||||||
|
@ -78,9 +77,6 @@ class FileSnapDialog : public Dialog, public CommandSender
|
||||||
EditTextWidget* mySnapPath;
|
EditTextWidget* mySnapPath;
|
||||||
CheckboxWidget* mySnapSingleCheckbox;
|
CheckboxWidget* mySnapSingleCheckbox;
|
||||||
|
|
||||||
CheckboxWidget* myBrowseCheckbox;
|
|
||||||
ButtonWidget* myReloadRomButton;
|
|
||||||
|
|
||||||
// Indicates if this dialog is used for global (vs. in-game) settings
|
// Indicates if this dialog is used for global (vs. in-game) settings
|
||||||
bool myIsGlobal;
|
bool myIsGlobal;
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: LauncherDialog.cxx,v 1.76 2008-02-06 13:45:24 stephena Exp $
|
// $Id: LauncherDialog.cxx,v 1.77 2008-03-12 19:42:36 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -55,7 +55,6 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
myProgressBar(NULL),
|
myProgressBar(NULL),
|
||||||
myRomInfoWidget(NULL),
|
myRomInfoWidget(NULL),
|
||||||
mySelectedItem(0),
|
mySelectedItem(0),
|
||||||
myBrowseModeFlag(true),
|
|
||||||
myRomInfoFlag(false)
|
myRomInfoFlag(false)
|
||||||
{
|
{
|
||||||
const GUI::Font& font = instance()->launcherFont();
|
const GUI::Font& font = instance()->launcherFont();
|
||||||
|
@ -109,15 +108,15 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
xpos = 10;
|
xpos = 10;
|
||||||
xpos += 5; ypos += myList->getHeight() + 4;
|
xpos += 5; ypos += myList->getHeight() + 4;
|
||||||
lwidth = font.getStringWidth("Note:");
|
lwidth = font.getStringWidth("Note:");
|
||||||
myNoteLabel = new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
|
myDirLabel = new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
|
||||||
"Note:", kTextAlignLeft);
|
"Dir:", kTextAlignLeft);
|
||||||
xpos += lwidth + 5;
|
xpos += lwidth + 5;
|
||||||
myNote = new StaticTextWidget(this, font, xpos, ypos,
|
myDir = new StaticTextWidget(this, font, xpos, ypos,
|
||||||
_w - xpos - 10, fontHeight,
|
_w - xpos - 10, fontHeight,
|
||||||
"", kTextAlignLeft);
|
"", kTextAlignLeft);
|
||||||
|
|
||||||
// Add four buttons at the bottom
|
// Add four buttons at the bottom
|
||||||
xpos = 10; ypos += myNote->getHeight() + 4;
|
xpos = 10; ypos += myDir->getHeight() + 4;
|
||||||
#ifndef MAC_OSX
|
#ifndef MAC_OSX
|
||||||
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
|
||||||
"Select", kStartCmd);
|
"Select", kStartCmd);
|
||||||
|
@ -179,9 +178,6 @@ string LauncherDialog::selectedRomMD5(string& file)
|
||||||
if(item < 0 || myGameList->isDir(item))
|
if(item < 0 || myGameList->isDir(item))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
FilesystemNode node(myGameList->path(item));
|
|
||||||
file = node.displayName();
|
|
||||||
|
|
||||||
// Make sure we have a valid md5 for this ROM
|
// Make sure we have a valid md5 for this ROM
|
||||||
if(myGameList->md5(item) == "")
|
if(myGameList->md5(item) == "")
|
||||||
{
|
{
|
||||||
|
@ -200,10 +196,7 @@ void LauncherDialog::loadConfig()
|
||||||
// has been called (and we should reload the list).
|
// has been called (and we should reload the list).
|
||||||
if(myList->getList().isEmpty())
|
if(myList->getList().isEmpty())
|
||||||
{
|
{
|
||||||
// (De)activate browse mode
|
myPrevDirButton->setEnabled(false);
|
||||||
myBrowseModeFlag = instance()->settings().getBool("rombrowse");
|
|
||||||
myPrevDirButton->setEnabled(myBrowseModeFlag);
|
|
||||||
myNoteLabel->setLabel(myBrowseModeFlag ? "Dir:" : "Note:");
|
|
||||||
myCurrentNode = instance()->settings().getString("romdir");
|
myCurrentNode = instance()->settings().getString("romdir");
|
||||||
|
|
||||||
updateListing();
|
updateListing();
|
||||||
|
@ -215,7 +208,7 @@ void LauncherDialog::loadConfig()
|
||||||
void LauncherDialog::enableButtons(bool enable)
|
void LauncherDialog::enableButtons(bool enable)
|
||||||
{
|
{
|
||||||
myStartButton->setEnabled(enable);
|
myStartButton->setEnabled(enable);
|
||||||
myPrevDirButton->setEnabled(enable && myBrowseModeFlag);
|
myPrevDirButton->setEnabled(enable);
|
||||||
myOptionsButton->setEnabled(enable);
|
myOptionsButton->setEnabled(enable);
|
||||||
myQuitButton->setEnabled(enable);
|
myQuitButton->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
@ -225,35 +218,16 @@ void LauncherDialog::updateListing(bool fullReload)
|
||||||
{
|
{
|
||||||
// Start with empty list
|
// Start with empty list
|
||||||
myGameList->clear();
|
myGameList->clear();
|
||||||
myNote->setLabel("");
|
myDir->setLabel("");
|
||||||
|
|
||||||
string romdir = instance()->settings().getString("romdir");
|
string romdir = instance()->settings().getString("romdir");
|
||||||
|
|
||||||
// If in ROM browse mode, just load the current directory and
|
|
||||||
// don't translate by md5sum at all
|
|
||||||
if(myBrowseModeFlag)
|
|
||||||
{
|
|
||||||
loadDirListing();
|
loadDirListing();
|
||||||
|
|
||||||
// Only hilite the 'up' button if there's a parent directory
|
// Only hilite the 'up' button if there's a parent directory
|
||||||
myPrevDirButton->setEnabled(myCurrentNode.hasParent());
|
myPrevDirButton->setEnabled(myCurrentNode.hasParent());
|
||||||
|
|
||||||
// Show current directory
|
// Show current directory
|
||||||
myNote->setLabel(myCurrentNode.path());
|
myDir->setLabel(myCurrentNode.path());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Disable buttons, pending a reload from disk
|
|
||||||
enableButtons(false);
|
|
||||||
|
|
||||||
if(FilesystemNode::fileExists(instance()->cacheFile()) && !fullReload)
|
|
||||||
loadListFromCache();
|
|
||||||
else // we have no other choice
|
|
||||||
loadListFromDisk();
|
|
||||||
|
|
||||||
// Re-enable buttons
|
|
||||||
enableButtons(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now fill the list widget with the contents of the GameList
|
// Now fill the list widget with the contents of the GameList
|
||||||
StringList l;
|
StringList l;
|
||||||
|
@ -264,40 +238,10 @@ void LauncherDialog::updateListing(bool fullReload)
|
||||||
|
|
||||||
// Indicate how many files were found
|
// Indicate how many files were found
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
buf << (myBrowseModeFlag ? myGameList->size() -1 : myGameList->size())
|
buf << (myGameList->size() - 1) << " items found";
|
||||||
<< " items found";
|
|
||||||
myRomCount->setLabel(buf.str());
|
myRomCount->setLabel(buf.str());
|
||||||
|
|
||||||
// Restore last selection
|
myList->setSelected(myList->getList().isEmpty() ? -1 : 0);
|
||||||
if(!myList->getList().isEmpty())
|
|
||||||
{
|
|
||||||
if(myBrowseModeFlag)
|
|
||||||
myList->setSelected(0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string lastrom = instance()->settings().getString("lastrom");
|
|
||||||
if(lastrom == "")
|
|
||||||
myList->setSelected(0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned int itemToSelect = 0;
|
|
||||||
StringList::const_iterator iter;
|
|
||||||
for (iter = myList->getList().begin(); iter != myList->getList().end();
|
|
||||||
++iter, ++itemToSelect)
|
|
||||||
{
|
|
||||||
if (lastrom == *iter)
|
|
||||||
{
|
|
||||||
myList->setSelected(itemToSelect);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(itemToSelect > myList->getList().size())
|
|
||||||
myList->setSelected(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
myList->setSelected(-1); // redraw the empty list
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -327,6 +271,7 @@ void LauncherDialog::loadDirListing()
|
||||||
myGameList->sortByName();
|
myGameList->sortByName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void LauncherDialog::loadListFromDisk()
|
void LauncherDialog::loadListFromDisk()
|
||||||
{
|
{
|
||||||
|
@ -421,20 +366,17 @@ void LauncherDialog::createListCache()
|
||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void LauncherDialog::loadRomInfo()
|
void LauncherDialog::loadRomInfo()
|
||||||
{
|
{
|
||||||
|
if(!myRomInfoFlag) return;
|
||||||
int item = myList->getSelected();
|
int item = myList->getSelected();
|
||||||
if(item < 0) return;
|
if(item < 0 || myGameList->isDir(item)) return;
|
||||||
|
|
||||||
if(myGameList->isDir(item))
|
if(isValidRomName(myGameList->name(item)))
|
||||||
{
|
{
|
||||||
if(myRomInfoFlag)
|
|
||||||
myRomInfoWidget->clearInfo();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we have a valid md5 for this ROM
|
// Make sure we have a valid md5 for this ROM
|
||||||
if(myGameList->md5(item) == "")
|
if(myGameList->md5(item) == "")
|
||||||
myGameList->setMd5(item, MD5FromFile(myGameList->path(item)));
|
myGameList->setMd5(item, MD5FromFile(myGameList->path(item)));
|
||||||
|
@ -444,11 +386,10 @@ void LauncherDialog::loadRomInfo()
|
||||||
const string& md5 = myGameList->md5(item);
|
const string& md5 = myGameList->md5(item);
|
||||||
instance()->propSet().getMD5(md5, props);
|
instance()->propSet().getMD5(md5, props);
|
||||||
|
|
||||||
if(!myBrowseModeFlag)
|
|
||||||
myNote->setLabel(props.get(Cartridge_Note));
|
|
||||||
|
|
||||||
if(myRomInfoFlag)
|
|
||||||
myRomInfoWidget->showInfo(props);
|
myRomInfoWidget->showInfo(props);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myRomInfoWidget->clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -465,6 +406,22 @@ string LauncherDialog::MD5FromFile(const string& path)
|
||||||
return md5;
|
return md5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool LauncherDialog::isValidRomName(const string& filename)
|
||||||
|
{
|
||||||
|
string::size_type idx = filename.find_last_of('.');
|
||||||
|
if(idx != string::npos)
|
||||||
|
{
|
||||||
|
string ext = filename.substr(idx+1);
|
||||||
|
return BSPF_strncasecmp(ext.c_str(), "bin", 3) == 0 ||
|
||||||
|
BSPF_strncasecmp(ext.c_str(), "a26", 3) == 0 ||
|
||||||
|
BSPF_strncasecmp(ext.c_str(), "zip", 3) == 0 ||
|
||||||
|
BSPF_strncasecmp(ext.c_str(), "rom", 3) == 0 ||
|
||||||
|
BSPF_strncasecmp(ext.c_str(), "gz", 2) == 0 ;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
int data, int id)
|
int data, int id)
|
||||||
|
@ -482,7 +439,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
const string& md5 = myGameList->md5(item);
|
const string& md5 = myGameList->md5(item);
|
||||||
|
|
||||||
// Directory's should be selected (ie, enter them and redisplay)
|
// Directory's should be selected (ie, enter them and redisplay)
|
||||||
if(myBrowseModeFlag && myGameList->isDir(item))
|
if(myGameList->isDir(item))
|
||||||
{
|
{
|
||||||
if(myGameList->name(item) == " [..]")
|
if(myGameList->name(item) == " [..]")
|
||||||
myCurrentNode = myCurrentNode.getParent();
|
myCurrentNode = myCurrentNode.getParent();
|
||||||
|
@ -490,11 +447,10 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
myCurrentNode = rom;
|
myCurrentNode = rom;
|
||||||
updateListing();
|
updateListing();
|
||||||
}
|
}
|
||||||
else if(instance()->createConsole(rom, md5))
|
else if(!isValidRomName(rom) || !instance()->createConsole(rom, md5))
|
||||||
{
|
{
|
||||||
#if !defined(GP2X) // Quick GP2X hack to spare flash-card saves
|
// TODO - show messagebox that ROM couldn't be started
|
||||||
instance()->settings().setString("lastrom", myList->getSelectedString());
|
cerr << "Error: invalid ROM (name or file)\n";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -506,7 +462,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
|
|
||||||
case kPrevDirCmd:
|
case kPrevDirCmd:
|
||||||
myCurrentNode = myCurrentNode.getParent();
|
myCurrentNode = myCurrentNode.getParent();
|
||||||
updateListing(!myBrowseModeFlag); // Force full update in non-browse mode
|
updateListing(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kListSelectionChangedCmd:
|
case kListSelectionChangedCmd:
|
||||||
|
@ -527,13 +483,6 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
// Stub just in case we need it
|
// Stub just in case we need it
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBrowseChangedCmd:
|
|
||||||
myCurrentNode = instance()->settings().getString("romdir");
|
|
||||||
myBrowseModeFlag = instance()->settings().getBool("rombrowse");
|
|
||||||
myPrevDirButton->setEnabled(myBrowseModeFlag);
|
|
||||||
myNoteLabel->setLabel(myBrowseModeFlag ? "Dir:" : "Note:");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kReloadRomDirCmd:
|
case kReloadRomDirCmd:
|
||||||
updateListing(true);
|
updateListing(true);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: LauncherDialog.hxx,v 1.31 2008-02-06 13:45:24 stephena Exp $
|
// $Id: LauncherDialog.hxx,v 1.32 2008-03-12 19:42:36 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -44,7 +44,6 @@ class StringListWidget;
|
||||||
enum {
|
enum {
|
||||||
kRomDirChosenCmd = 'romc', // rom chosen
|
kRomDirChosenCmd = 'romc', // rom chosen
|
||||||
kSnapDirChosenCmd = 'snpc', // snap chosen
|
kSnapDirChosenCmd = 'snpc', // snap chosen
|
||||||
kBrowseChangedCmd = 'broc', // browse mode toggled
|
|
||||||
kReloadRomDirCmd = 'rdrl' // reload the current listing
|
kReloadRomDirCmd = 'rdrl' // reload the current listing
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,6 +56,13 @@ class LauncherDialog : public Dialog
|
||||||
|
|
||||||
string selectedRomMD5(string& file);
|
string selectedRomMD5(string& file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Is this a valid ROM filename (does it have a valid extension?)
|
||||||
|
|
||||||
|
@param filename Filename of potential ROM file
|
||||||
|
*/
|
||||||
|
static bool isValidRomName(const string& filename);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
|
@ -70,8 +76,8 @@ class LauncherDialog : public Dialog
|
||||||
ButtonWidget* myQuitButton;
|
ButtonWidget* myQuitButton;
|
||||||
|
|
||||||
StringListWidget* myList;
|
StringListWidget* myList;
|
||||||
StaticTextWidget* myNoteLabel;
|
StaticTextWidget* myDirLabel;
|
||||||
StaticTextWidget* myNote;
|
StaticTextWidget* myDir;
|
||||||
StaticTextWidget* myRomCount;
|
StaticTextWidget* myRomCount;
|
||||||
GameList* myGameList;
|
GameList* myGameList;
|
||||||
|
|
||||||
|
@ -83,15 +89,11 @@ class LauncherDialog : public Dialog
|
||||||
private:
|
private:
|
||||||
void enableButtons(bool enable);
|
void enableButtons(bool enable);
|
||||||
void loadDirListing();
|
void loadDirListing();
|
||||||
void loadListFromDisk();
|
|
||||||
void loadListFromCache();
|
|
||||||
void createListCache();
|
|
||||||
void loadRomInfo();
|
void loadRomInfo();
|
||||||
string MD5FromFile(const string& path);
|
string MD5FromFile(const string& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mySelectedItem;
|
int mySelectedItem;
|
||||||
bool myBrowseModeFlag;
|
|
||||||
bool myRomInfoFlag;
|
bool myRomInfoFlag;
|
||||||
FilesystemNode myCurrentNode;
|
FilesystemNode myCurrentNode;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: OptionsDialog.cxx,v 1.62 2008-02-06 13:45:24 stephena Exp $
|
// $Id: OptionsDialog.cxx,v 1.63 2008-03-12 19:42:36 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -126,7 +126,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
w = 200; h = 155;
|
w = 200; h = 155;
|
||||||
myUIDialog = new UIDialog(myOSystem, parent, font, x, y, w, h);
|
myUIDialog = new UIDialog(myOSystem, parent, font, x, y, w, h);
|
||||||
|
|
||||||
w = 280; h = 190;
|
w = 280; h = 180;
|
||||||
myFileSnapDialog = new FileSnapDialog(myOSystem, parent, font,
|
myFileSnapDialog = new FileSnapDialog(myOSystem, parent, font,
|
||||||
boss, x, y, w, h);
|
boss, x, y, w, h);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue