From 7366c31b3d222b463fe5f00e397b18e99e077a87 Mon Sep 17 00:00:00 2001 From: urchlay Date: Tue, 28 Jun 2005 04:40:21 +0000 Subject: [PATCH] Added -holdstart, -holdreset, -holdbutton0 command line options. These should also be selectable from the GUI. They might also need to include more controls, but these seems to be the ones that cause interesting effects: -holdreset gives you double shots in space invaders, -holdbutton0 gives you "the dot" in carnival. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@576 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/common/mainSDL.cxx | 12 +++++++++++- stella/src/emucore/EventHandler.hxx | 6 +++--- stella/src/emucore/Settings.cxx | 22 +++++++++++++++++++++- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/stella/src/common/mainSDL.cxx b/stella/src/common/mainSDL.cxx index c36a12226..2ffa6f814 100644 --- a/stella/src/common/mainSDL.cxx +++ b/stella/src/common/mainSDL.cxx @@ -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.47 2005-06-19 16:53:57 urchlay Exp $ +// $Id: mainSDL.cxx,v 1.48 2005-06-28 04:40:21 urchlay Exp $ //============================================================================ #include @@ -180,6 +180,16 @@ int main(int argc, char* argv[]) else { theOSystem->createConsole(romfile); + + if(theOSystem->settings().getBool("holdreset")) + theOSystem->eventHandler().handleEvent(Event::ConsoleReset, 1); + + if(theOSystem->settings().getBool("holdselect")) + theOSystem->eventHandler().handleEvent(Event::ConsoleSelect, 1); + + if(theOSystem->settings().getBool("holdbutton0")) + theOSystem->eventHandler().handleEvent(Event::JoystickZeroFire, 1); + if(theOSystem->settings().getBool("debug")) handler.enterDebugMode(); } diff --git a/stella/src/emucore/EventHandler.hxx b/stella/src/emucore/EventHandler.hxx index 3c6db75cc..e48674cae 100644 --- a/stella/src/emucore/EventHandler.hxx +++ b/stella/src/emucore/EventHandler.hxx @@ -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.hxx,v 1.41 2005-06-28 03:34:41 urchlay Exp $ +// $Id: EventHandler.hxx,v 1.42 2005-06-28 04:40:21 urchlay Exp $ //============================================================================ #ifndef EVENTHANDLER_HXX @@ -74,7 +74,7 @@ struct Stella_Joystick { mapping can take place. @author Stephen Anthony - @version $Id: EventHandler.hxx,v 1.41 2005-06-28 03:34:41 urchlay Exp $ + @version $Id: EventHandler.hxx,v 1.42 2005-06-28 04:40:21 urchlay Exp $ */ class EventHandler { @@ -231,7 +231,6 @@ class EventHandler static const Event::Type SA_Axis[2][2][3]; static const Event::Type SA_DrivingValue[2]; - private: /** Send an event directly to the event handler. These events cannot be remapped. @@ -241,6 +240,7 @@ class EventHandler */ void handleEvent(Event::Type type, Int32 value); + private: /** Send a keyboard event to the handler. diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 75ce96c12..b291e5564 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.cxx @@ -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.51 2005-06-20 18:32:12 stephena Exp $ +// $Id: Settings.cxx,v 1.52 2005-06-28 04:40:21 urchlay Exp $ //============================================================================ #include @@ -152,6 +152,21 @@ bool Settings::loadCommandLine(int argc, char** argv) set(key, "true", false); // don't save this to the config file either return true; } + else if(key == "holdreset") // this doesn't make Stella exit + { + set(key, "true", false); // don't save this to the config file either + return true; + } + else if(key == "holdselect") // this doesn't make Stella exit + { + set(key, "true", false); // don't save this to the config file either + return true; + } + else if(key == "holdbutton0") // this doesn't make Stella exit + { + set(key, "true", false); // don't save this to the config file either + return true; + } if(++i >= argc) { @@ -253,6 +268,11 @@ void Settings::usage() << " standard|\n" << " z26>\n" << " -framerate Display the given number of frames per second\n" + << " -debug <1|0> Start in the debugger\n" + << " -debugheight Set height of debugger in lines of text (NOT pixels)\n" + << " -holdreset Start the emulator with the Game Reset switch held down\n" + << " -holdselect Start the emulator with the Game Select switch held down\n" + << " -holdbutton0 Start the emulator with the left joystick button held down\n" #ifdef SOUND_SUPPORT << " -sound <1|0> Enable sound generation\n" << " -fragsize The size of sound fragments (must be a power of two)\n"