mirror of https://github.com/stella-emu/stella.git
Removed the concept of a 'romlauncher' argument. The default behaviour is
if you specify a valid ROM on the commandline, it will automatically used, and when you exit that ROM, the emulator will exit as well. If you don't specify any ROM, the internal ROM browser will be used. So it was pointless to have a separate argument, when Stella can figure out what to do. Cleaned up the handling of OSystem::createConsole() a little. Now, if it's called without a ROM, it will simply reload the last one specified. Fixed some missing settings that were always in the code, but never listed in the Settings::usage() method. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@411 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
e5df395075
commit
4bd9ef8b3d
stella/src
|
@ -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: mainSDL.cxx,v 1.35 2005-05-05 00:10:43 stephena Exp $
|
||||
// $Id: mainSDL.cxx,v 1.36 2005-05-05 19:00:44 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
|
@ -140,6 +140,7 @@ int main(int argc, char* argv[])
|
|||
// Finally, make sure the settings are valid
|
||||
// We do it once here, so the rest of the program can assume valid settings
|
||||
theOSystem->settings().validate();
|
||||
bool theShowInfoFlag = theOSystem->settings().getBool("showinfo");
|
||||
|
||||
// Make sure the OSystem has a valid framerate set, since it's used for
|
||||
// more then just emulation mode
|
||||
|
@ -188,22 +189,22 @@ int main(int argc, char* argv[])
|
|||
|
||||
// Print message about the framerate
|
||||
string framerate = "Framerate: " + theOSystem->settings().getString("framerate");
|
||||
if(theOSystem->settings().getBool("showinfo"))
|
||||
if(theShowInfoFlag)
|
||||
cout << framerate << endl;
|
||||
|
||||
//// Main loop ////
|
||||
// If the ROM browser is being used, we enter 'browser' mode and let the
|
||||
// main event loop take care of opening a new console/ROM.
|
||||
// Otherwise, we use the ROM specified on the commandline.
|
||||
if(theOSystem->settings().getBool("browser"))
|
||||
// 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.
|
||||
// If not, use the built-in ROM browser. In this case, we enter 'browser'
|
||||
// mode and let the main event loop take care of opening a new console/ROM.
|
||||
string romfile = argv[argc - 1];
|
||||
if(theOSystem->fileExists(romfile))
|
||||
{
|
||||
theOSystem->eventHandler().reset(EventHandler::S_BROWSER);
|
||||
theOSystem->createConsole(romfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
string romfile = argv[argc - 1];
|
||||
theOSystem->setRom(romfile);
|
||||
theOSystem->createConsole();
|
||||
theOSystem->eventHandler().reset(EventHandler::S_BROWSER);
|
||||
}
|
||||
|
||||
// Start the main loop, and don't exit until the user issues a QUIT command
|
||||
|
|
|
@ -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: EventHandler.cxx,v 1.50 2005-05-05 00:10:47 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.51 2005-05-05 19:00:46 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -339,7 +339,7 @@ void EventHandler::handleKeyEvent(SDLKey key, SDLMod mod, uInt8 state)
|
|||
break;
|
||||
|
||||
case SDLK_r: // Ctrl-r reloads the currently loaded ROM
|
||||
myOSystem->createConsole(true);
|
||||
myOSystem->createConsole();
|
||||
break;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
|
|
|
@ -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: OSystem.cxx,v 1.9 2005-05-05 00:10:49 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.10 2005-05-05 19:00:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -223,22 +223,30 @@ void OSystem::createSound()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::createConsole(bool showmessage)
|
||||
bool OSystem::createConsole(const string& romfile)
|
||||
{
|
||||
if(myRomFile == "")
|
||||
bool retval = false, showmessage = false;
|
||||
|
||||
// If a blank ROM has been given, we reload the current one (assuming one exists)
|
||||
if(romfile == "")
|
||||
{
|
||||
cerr << "ERROR: Rom file not specified ..." << endl;
|
||||
myEventHandler->quit();
|
||||
return;
|
||||
showmessage = true; // we show a message if a ROM is being reloaded
|
||||
if(myRomFile == "")
|
||||
{
|
||||
cerr << "ERROR: Rom file not specified ..." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
myRomFile = romfile;
|
||||
|
||||
// Open the cartridge image and read it in
|
||||
ifstream in(myRomFile.c_str(), ios_base::binary);
|
||||
if(!in)
|
||||
{
|
||||
cerr << "ERROR: Couldn't open " << myRomFile << "..." << endl;
|
||||
myEventHandler->quit();
|
||||
return;
|
||||
// myEventHandler->quit();
|
||||
retval = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -258,7 +266,13 @@ void OSystem::createConsole(bool showmessage)
|
|||
|
||||
if(showmessage)
|
||||
myFrameBuffer->showMessage("New console created");
|
||||
if(mySettings->getBool("showinfo"))
|
||||
cout << "Game console created: " << myRomFile << endl;
|
||||
|
||||
retval = true;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: OSystem.hxx,v 1.9 2005-05-05 00:10:49 stephena Exp $
|
||||
// $Id: OSystem.hxx,v 1.10 2005-05-05 19:00:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef OSYSTEM_HXX
|
||||
|
@ -38,7 +38,7 @@ class Browser;
|
|||
other objects belong.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: OSystem.hxx,v 1.9 2005-05-05 00:10:49 stephena Exp $
|
||||
@version $Id: OSystem.hxx,v 1.10 2005-05-05 19:00:47 stephena Exp $
|
||||
*/
|
||||
class OSystem
|
||||
{
|
||||
|
@ -140,11 +140,6 @@ class OSystem
|
|||
void setFramerate(uInt32 framerate)
|
||||
{ myTimePerFrame = (uInt32)(1000000.0 / (double) framerate); }
|
||||
|
||||
/**
|
||||
Set the ROM file (filename of current ROM to load)
|
||||
*/
|
||||
void setRom(const string& romfile) { myRomFile = romfile; }
|
||||
|
||||
/**
|
||||
Set the base directory for all configuration files
|
||||
*/
|
||||
|
@ -227,13 +222,12 @@ class OSystem
|
|||
void createSound();
|
||||
|
||||
/**
|
||||
Creates a new game console. It is assumed that setRom() has
|
||||
been called before this method, to set actual ROM file name.
|
||||
Creates a new game console from the specified romfile.
|
||||
|
||||
@param showmessage Whether to show an onscreen message that
|
||||
the console has been (re)created
|
||||
@param romfile The full pathname of the ROM to use
|
||||
@return True on successful creation, otherwise false
|
||||
*/
|
||||
void createConsole(bool showmessage = false);
|
||||
bool createConsole(const string& romfile = "");
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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.36 2005-05-02 19:36:05 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.37 2005-05-05 19:00:48 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -224,7 +224,10 @@ void Settings::usage()
|
|||
{
|
||||
#ifndef MAC_OSX
|
||||
cout << endl
|
||||
<< "Stella version 1.5_cvs\n\nUsage: stella [options ...] romfile" << endl
|
||||
<< "Stella version 1.5_cvs" << endl
|
||||
<< endl
|
||||
<< "Usage: stella [options ...] romfile" << endl
|
||||
<< " Run without any options or romfile to use the ROM launcher" << endl
|
||||
<< endl
|
||||
<< "Valid options are:" << endl
|
||||
<< endl
|
||||
|
@ -261,6 +264,8 @@ void Settings::usage()
|
|||
#endif
|
||||
<< " -mergeprops <1|0> Merge changed properties into properties file,\n"
|
||||
<< " or save into a separate file\n"
|
||||
<< " -listrominfo Display contents of stella.pro, one line per ROM entry\n"
|
||||
<< " -help Show the text you're now reading\n"
|
||||
<< endl;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue