Added shortcut for temporarily starting Stella in a rom directory

other than that specified by 'romdir'.  I'm not going to document
this functionality, since it's a convenience function that will
probably only be used by me anyway.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2333 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-01-04 14:54:21 +00:00
parent 06de98d05d
commit 0138086583
5 changed files with 21 additions and 9 deletions

View File

@ -109,7 +109,6 @@ int main(int argc, char* argv[])
// Take care of commandline arguments // Take care of commandline arguments
theOSystem->logMessage("Loading commandline arguments ...\n", 2); theOSystem->logMessage("Loading commandline arguments ...\n", 2);
string romfile = theOSystem->settings().loadCommandLine(argc, argv); string romfile = theOSystem->settings().loadCommandLine(argc, argv);
FilesystemNode romnode(romfile);
// Finally, make sure the settings are valid // Finally, make sure the settings are valid
// We do it once here, so the rest of the program can assume valid settings // We do it once here, so the rest of the program can assume valid settings
@ -137,7 +136,8 @@ int main(int argc, char* argv[])
else if(theOSystem->settings().getBool("rominfo")) else if(theOSystem->settings().getBool("rominfo"))
{ {
theOSystem->logMessage("Showing output from 'rominfo' ...\n", 2); theOSystem->logMessage("Showing output from 'rominfo' ...\n", 2);
if(argc > 1 && romnode.exists()) FilesystemNode romnode(romfile);
if(argc > 1 && romnode.exists() && !romnode.isDirectory())
theOSystem->logMessage(theOSystem->getROMInfo(romfile), 0); theOSystem->logMessage(theOSystem->getROMInfo(romfile), 0);
else else
theOSystem->logMessage("ERROR: ROM doesn't exist\n", 0); theOSystem->logMessage("ERROR: ROM doesn't exist\n", 0);
@ -163,14 +163,19 @@ int main(int argc, char* argv[])
//// Main loop //// //// Main loop ////
// First we check if a ROM is specified on the commandline. If so, and if // First we check if a ROM is specified on the commandline. If so, and if
// the ROM actually exists, use it to create a new console. // the ROM actually exists, use it to create a new console.
// Next we check if a directory is specified on the commandline. If so,
// open the rom launcher in that directory.
// If not, use the built-in ROM launcher. In this case, we enter 'launcher' // If not, use the built-in ROM launcher. In this case, we enter 'launcher'
// mode and let the main event loop take care of opening a new console/ROM. // mode and let the main event loop take care of opening a new console/ROM.
if(argc == 1 || romfile == "" || !romnode.exists() || romnode.isDirectory()) FilesystemNode romnode(romfile);
if(romfile == "" || romnode.isDirectory())
{ {
theOSystem->logMessage("Attempting to use ROM launcher ...\n", 2); theOSystem->logMessage("Attempting to use ROM launcher ...\n", 2);
if(theOSystem->settings().getBool("uselauncher")) if(theOSystem->settings().getBool("uselauncher"))
{ {
if(!theOSystem->createLauncher()) bool launcherOpened = romfile != "" ?
theOSystem->createLauncher(romnode.getPath()) : theOSystem->createLauncher();
if(!launcherOpened)
return Cleanup(); return Cleanup();
} }
else else
@ -180,7 +185,7 @@ int main(int argc, char* argv[])
return Cleanup(); return Cleanup();
} }
} }
else if(theOSystem->createConsole(romfile)) else if(theOSystem->createConsole(romnode.getPath()))
{ {
if(theOSystem->settings().getBool("takesnapshot")) if(theOSystem->settings().getBool("takesnapshot"))
{ {

View File

@ -592,8 +592,10 @@ void OSystem::deleteConsole()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool OSystem::createLauncher() bool OSystem::createLauncher(const string& startdir)
{ {
mySettings->setString("tmpromdir", startdir);
myEventHandler->reset(EventHandler::S_LAUNCHER); myEventHandler->reset(EventHandler::S_LAUNCHER);
if(createFrameBuffer() != kSuccess) if(createFrameBuffer() != kSuccess)
{ {

View File

@ -338,9 +338,12 @@ class OSystem
/** /**
Creates a new ROM launcher, to select a new ROM to emulate. Creates a new ROM launcher, to select a new ROM to emulate.
@param startdir The directory to use when opening the launcher;
if blank, use 'romdir' setting.
@return True on successful creation, otherwise false @return True on successful creation, otherwise false
*/ */
bool createLauncher(); bool createLauncher(const string& startdir = "");
/** /**
Gets all possible info about the ROM by creating a temporary Gets all possible info about the ROM by creating a temporary

View File

@ -233,7 +233,9 @@ const string& LauncherDialog::selectedRomMD5()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::loadConfig() void LauncherDialog::loadConfig()
{ {
const string& romdir = instance().settings().getString("romdir"); const string& tmpromdir = instance().settings().getString("tmpromdir");
const string& romdir = tmpromdir != "" ? tmpromdir :
instance().settings().getString("romdir");
// When romdir hasn't been set, it probably indicates that this is the first // When romdir hasn't been set, it probably indicates that this is the first
// time running Stella; in this case, we should prompt the user // time running Stella; in this case, we should prompt the user

View File

@ -1964,7 +1964,7 @@
2D91752309BA903B0026E9FF /* Deployment */ = { 2D91752309BA903B0026E9FF /* Deployment */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; ARCHS = "$(ARCHS_STANDARD_64_BIT)";
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
., .,
"$(HOME)/Library/Frameworks", "$(HOME)/Library/Frameworks",