diff --git a/stella/src/gui/CheatCodeDialog.cxx b/stella/src/cheat/CheatCodeDialog.cxx similarity index 98% rename from stella/src/gui/CheatCodeDialog.cxx rename to stella/src/cheat/CheatCodeDialog.cxx index fdc9aeaa2..573305ed4 100644 --- a/stella/src/gui/CheatCodeDialog.cxx +++ b/stella/src/cheat/CheatCodeDialog.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: CheatCodeDialog.cxx,v 1.8 2005-11-11 21:44:19 stephena Exp $ +// $Id: CheatCodeDialog.cxx,v 1.1 2005-11-12 22:59:20 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project diff --git a/stella/src/gui/CheatCodeDialog.hxx b/stella/src/cheat/CheatCodeDialog.hxx similarity index 96% rename from stella/src/gui/CheatCodeDialog.hxx rename to stella/src/cheat/CheatCodeDialog.hxx index 41ac13bca..3ca4be3e8 100644 --- a/stella/src/gui/CheatCodeDialog.hxx +++ b/stella/src/cheat/CheatCodeDialog.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: CheatCodeDialog.hxx,v 1.5 2005-11-11 21:44:19 stephena Exp $ +// $Id: CheatCodeDialog.hxx,v 1.1 2005-11-12 22:59:20 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project diff --git a/stella/src/cheat/module.mk b/stella/src/cheat/module.mk index dd74d794d..2b454e45c 100644 --- a/stella/src/cheat/module.mk +++ b/stella/src/cheat/module.mk @@ -1,6 +1,7 @@ MODULE := src/cheat MODULE_OBJS := \ + src/cheat/CheatCodeDialog.o \ src/cheat/CheatManager.o \ src/cheat/CheetahCheat.o \ src/cheat/BankRomCheat.o \ diff --git a/stella/src/emucore/Booster.cxx b/stella/src/emucore/Booster.cxx index dd2acf82d..04b4dceb4 100644 --- a/stella/src/emucore/Booster.cxx +++ b/stella/src/emucore/Booster.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: Booster.cxx,v 1.4 2005-11-12 22:04:57 stephena Exp $ +// $Id: Booster.cxx,v 1.5 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #include "Event.hxx" @@ -23,6 +23,7 @@ BoosterGrip::BoosterGrip(Jack jack, const Event& event) : Controller(jack, event) { + myType = Controller::BoosterGrip; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -102,9 +103,3 @@ void BoosterGrip::write(DigitalPin, bool) { // Writing doesn't do anything to the booster grip... } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Controller::Type BoosterGrip::type() -{ - return Controller::BoosterGrip; -} diff --git a/stella/src/emucore/Booster.hxx b/stella/src/emucore/Booster.hxx index ae0b4a8fb..df9932ac4 100644 --- a/stella/src/emucore/Booster.hxx +++ b/stella/src/emucore/Booster.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: Booster.hxx,v 1.4 2005-11-12 22:04:57 stephena Exp $ +// $Id: Booster.hxx,v 1.5 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #ifndef BOOSTERGRIP_HXX @@ -28,7 +28,7 @@ on it (a booster and a trigger). @author Bradford W. Mott - @version $Id: Booster.hxx,v 1.4 2005-11-12 22:04:57 stephena Exp $ + @version $Id: Booster.hxx,v 1.5 2005-11-12 22:59:20 stephena Exp $ */ class BoosterGrip : public Controller { @@ -73,11 +73,6 @@ class BoosterGrip : public Controller @param value The value to write to the pin */ virtual void write(DigitalPin pin, bool value); - - /** - Returns the type of this controller, - */ - virtual Type type(); }; #endif diff --git a/stella/src/emucore/Control.cxx b/stella/src/emucore/Control.cxx index d3d13d536..4115c4f0f 100644 --- a/stella/src/emucore/Control.cxx +++ b/stella/src/emucore/Control.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: Control.cxx,v 1.2 2005-06-16 01:11:27 stephena Exp $ +// $Id: Control.cxx,v 1.3 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #include @@ -22,7 +22,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Controller::Controller(Jack jack, const Event& event) : myJack(jack), - myEvent(event) + myEvent(event), + myType(Joystick) // use joystick by default { } @@ -31,6 +32,12 @@ Controller::~Controller() { } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +const Controller::Type Controller::type() +{ + return myType; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const Int32 Controller::maximumResistance = 0x7FFFFFFF; @@ -40,7 +47,8 @@ const Int32 Controller::minimumResistance = 0x00000000; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Controller::Controller(const Controller& c) : myJack(c.myJack), - myEvent(c.myEvent) + myEvent(c.myEvent), + myType(c.myType) { assert(false); } @@ -51,4 +59,3 @@ Controller& Controller::operator = (const Controller&) assert(false); return *this; } - diff --git a/stella/src/emucore/Control.hxx b/stella/src/emucore/Control.hxx index 215f071ce..1a50c949e 100644 --- a/stella/src/emucore/Control.hxx +++ b/stella/src/emucore/Control.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: Control.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ +// $Id: Control.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #ifndef CONTROLLER_HXX @@ -55,7 +55,7 @@ class Event; of the controller from the prespective of the controller's jack. @author Bradford W. Mott - @version $Id: Control.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ + @version $Id: Control.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ */ class Controller { @@ -90,6 +90,11 @@ class Controller */ virtual ~Controller(); + /** + Returns the type of this controller. + */ + const Type type(); + public: /** Enumeration of the digital pins of a controller port @@ -135,11 +140,6 @@ class Controller */ virtual void write(DigitalPin pin, bool value) = 0; - /** - Returns the type of this controller. - */ - virtual Type type() = 0; - public: /// Constant which represents maximum resistance for analog pins static const Int32 maximumResistance; @@ -154,6 +154,9 @@ class Controller /// Reference to the event object this controller uses const Event& myEvent; + /// Specifies which type of controller this is (defined by child classes) + Type myType; + protected: // Copy constructor isn't supported by controllers so make it private Controller(const Controller&); @@ -161,5 +164,5 @@ class Controller // Assignment operator isn't supported by controllers so make it private Controller& operator = (const Controller&); }; -#endif +#endif diff --git a/stella/src/emucore/Driving.cxx b/stella/src/emucore/Driving.cxx index 365fc1846..06d950e92 100644 --- a/stella/src/emucore/Driving.cxx +++ b/stella/src/emucore/Driving.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: Driving.cxx,v 1.5 2005-11-12 22:04:57 stephena Exp $ +// $Id: Driving.cxx,v 1.6 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #include @@ -26,6 +26,7 @@ Driving::Driving(Jack jack, const Event& event) : Controller(jack, event) { myCounter = 0; + myType = Controller::Driving; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -133,9 +134,3 @@ void Driving::write(DigitalPin, bool) { // Writing doesn't do anything to the driving controller... } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Controller::Type Driving::type() -{ - return Controller::Driving; -} diff --git a/stella/src/emucore/Driving.hxx b/stella/src/emucore/Driving.hxx index 3cade8a15..a9cb447f1 100644 --- a/stella/src/emucore/Driving.hxx +++ b/stella/src/emucore/Driving.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: Driving.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ +// $Id: Driving.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #ifndef DRIVING_HXX @@ -29,7 +29,7 @@ class System; The standard Atari 2600 Indy 500 driving controller. @author Bradford W. Mott - @version $Id: Driving.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ + @version $Id: Driving.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ */ class Driving : public Controller { @@ -76,11 +76,6 @@ class Driving : public Controller */ virtual void write(DigitalPin pin, bool value); - /** - Returns the type of this controller. - */ - virtual Type type(); - private: // Counter to iterate through the gray codes uInt32 myCounter; diff --git a/stella/src/emucore/Joystick.cxx b/stella/src/emucore/Joystick.cxx index 957a83aff..1d069ca13 100644 --- a/stella/src/emucore/Joystick.cxx +++ b/stella/src/emucore/Joystick.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: Joystick.cxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ +// $Id: Joystick.cxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #include @@ -24,6 +24,7 @@ Joystick::Joystick(Jack jack, const Event& event) : Controller(jack, event) { + myType = Controller::Joystick; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -73,9 +74,3 @@ void Joystick::write(DigitalPin, bool) { // Writing doesn't do anything to the joystick... } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Controller::Type Joystick::type() -{ - return Controller::Joystick; -} diff --git a/stella/src/emucore/Joystick.hxx b/stella/src/emucore/Joystick.hxx index 24336d315..fa1e3dbd8 100644 --- a/stella/src/emucore/Joystick.hxx +++ b/stella/src/emucore/Joystick.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: Joystick.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ +// $Id: Joystick.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #ifndef JOYSTICK_HXX @@ -26,7 +26,7 @@ The standard Atari 2600 joystick controller. @author Bradford W. Mott - @version $Id: Joystick.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ + @version $Id: Joystick.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ */ class Joystick : public Controller { @@ -71,11 +71,6 @@ class Joystick : public Controller @param value The value to write to the pin */ virtual void write(DigitalPin pin, bool value); - - /** - Returns the type of this controller. - */ - virtual Type type(); }; -#endif +#endif diff --git a/stella/src/emucore/Keyboard.cxx b/stella/src/emucore/Keyboard.cxx index 54b6db0f5..873eefba1 100644 --- a/stella/src/emucore/Keyboard.cxx +++ b/stella/src/emucore/Keyboard.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: Keyboard.cxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ +// $Id: Keyboard.cxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #include "Event.hxx" @@ -24,6 +24,7 @@ Keyboard::Keyboard(Jack jack, const Event& event) : Controller(jack, event), myPinState(0) { + myType = Controller::Keyboard; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -204,9 +205,3 @@ void Keyboard::write(DigitalPin pin, bool value) break; } } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Controller::Type Keyboard::type() -{ - return Controller::Keyboard; -} diff --git a/stella/src/emucore/Keyboard.hxx b/stella/src/emucore/Keyboard.hxx index ebce6c500..94f3db55d 100644 --- a/stella/src/emucore/Keyboard.hxx +++ b/stella/src/emucore/Keyboard.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: Keyboard.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ +// $Id: Keyboard.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #ifndef KEYBOARD_HXX @@ -26,7 +26,7 @@ The standard Atari 2600 keyboard controller @author Bradford W. Mott - @version $Id: Keyboard.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ + @version $Id: Keyboard.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ */ class Keyboard : public Controller { @@ -72,14 +72,9 @@ class Keyboard : public Controller */ virtual void write(DigitalPin pin, bool value); - /** - Returns the type of this controller. - */ - virtual Type type(); - private: // State of the output pins uInt8 myPinState; }; -#endif +#endif diff --git a/stella/src/emucore/Paddles.cxx b/stella/src/emucore/Paddles.cxx index 22102b917..42c9d6942 100644 --- a/stella/src/emucore/Paddles.cxx +++ b/stella/src/emucore/Paddles.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: Paddles.cxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ +// $Id: Paddles.cxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #include @@ -24,6 +24,7 @@ Paddles::Paddles(Jack jack, const Event& event) : Controller(jack, event) { + myType = Controller::Paddles; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -73,9 +74,3 @@ void Paddles::write(DigitalPin, bool) { // Writing doesn't do anything to the paddles... } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Controller::Type Paddles::type() -{ - return Controller::Paddles; -} diff --git a/stella/src/emucore/Paddles.hxx b/stella/src/emucore/Paddles.hxx index 0b71bb624..48d0870f9 100644 --- a/stella/src/emucore/Paddles.hxx +++ b/stella/src/emucore/Paddles.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: Paddles.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ +// $Id: Paddles.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ //============================================================================ #ifndef PADDLES_HXX @@ -26,7 +26,7 @@ The standard Atari 2600 pair of paddle controllers. @author Bradford W. Mott - @version $Id: Paddles.hxx,v 1.3 2005-11-12 22:04:57 stephena Exp $ + @version $Id: Paddles.hxx,v 1.4 2005-11-12 22:59:20 stephena Exp $ */ class Paddles : public Controller { @@ -71,11 +71,6 @@ class Paddles : public Controller @param value The value to write to the pin */ virtual void write(DigitalPin pin, bool value); - - /** - Returns the type of this controller. - */ - virtual Type type(); }; -#endif +#endif diff --git a/stella/src/gui/OptionsDialog.cxx b/stella/src/gui/OptionsDialog.cxx index f750ca98c..1467ec80c 100644 --- a/stella/src/gui/OptionsDialog.cxx +++ b/stella/src/gui/OptionsDialog.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: OptionsDialog.cxx,v 1.31 2005-09-30 00:40:34 stephena Exp $ +// $Id: OptionsDialog.cxx,v 1.32 2005-11-12 22:59:20 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -32,6 +32,10 @@ #include "AboutDialog.hxx" #include "OptionsDialog.hxx" +#ifdef CHEATCODE_SUPPORT + #include "CheatCodeDialog.hxx" +#endif + #include "bspf.hxx" enum { @@ -71,17 +75,23 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent) { int yoffset = 7; const int xoffset = (_w - kBigButtonWidth) / 2; + ButtonWidget* b = NULL; - addBigButton("Video Settings", kVidCmd, 0); + b = addBigButton("Video Settings", kVidCmd, 0); #ifdef SOUND_SUPPORT addBigButton("Audio Settings", kAudCmd, 0); #else - ButtonWidget* b = addBigButton("Audio Settings", kAudCmd, 0); + b = addBigButton("Audio Settings", kAudCmd, 0); b->clearFlags(WIDGET_ENABLED); #endif addBigButton("Event Mapping", kEMapCmd, 0); addBigButton("Game Properties", kInfoCmd, 0); +#ifdef CHEATCODE_SUPPORT addBigButton("Cheat Code", kCheatCmd, 0); +#else + b = addBigButton("Cheat Code", kCheatCmd, 0); + b->clearFlags(WIDGET_ENABLED); +#endif addBigButton("Help", kHelpCmd, 0); addBigButton("About", kAboutCmd, 0); addBigButton("Exit Menu", kExitCmd, 0); @@ -108,9 +118,11 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent) checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); myGameInfoDialog = new GameInfoDialog(myOSystem, parent, this, x, y, w, h); +#ifdef CHEATCODE_SUPPORT w = 140; h = 40; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); myCheatCodeDialog = new CheatCodeDialog(myOSystem, parent, x, y, w, h); +#endif w = 255; h = 150; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); @@ -128,7 +140,9 @@ OptionsDialog::~OptionsDialog() delete myAudioDialog; delete myEventMappingDialog; delete myGameInfoDialog; +#ifdef CHEATCODE_SUPPORT delete myCheatCodeDialog; +#endif delete myHelpDialog; delete myAboutDialog; } @@ -165,9 +179,11 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd, parent()->addDialog(myGameInfoDialog); break; +#ifdef CHEATCODE_SUPPORT case kCheatCmd: parent()->addDialog(myCheatCodeDialog); break; +#endif case kHelpCmd: parent()->addDialog(myHelpDialog); @@ -189,5 +205,7 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void OptionsDialog::enterCheatMode() { +#ifdef CHEATCODE_SUPPORT parent()->addDialog(myCheatCodeDialog); +#endif } diff --git a/stella/src/gui/OptionsDialog.hxx b/stella/src/gui/OptionsDialog.hxx index cf043d28b..9d5e416ab 100644 --- a/stella/src/gui/OptionsDialog.hxx +++ b/stella/src/gui/OptionsDialog.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: OptionsDialog.hxx,v 1.14 2005-09-25 23:14:00 urchlay Exp $ +// $Id: OptionsDialog.hxx,v 1.15 2005-11-12 22:59:20 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -28,13 +28,14 @@ class DialogContainer; class VideoDialog; class AudioDialog; class EventMappingDialog; +class GameInfoDialog; +class CheatCodeDialog; class HelpDialog; class AboutDialog; #include "OSystem.hxx" #include "Dialog.hxx" #include "GameInfoDialog.hxx" -#include "CheatCodeDialog.hxx" #include "bspf.hxx" class OptionsDialog : public Dialog @@ -46,7 +47,7 @@ class OptionsDialog : public Dialog virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); void setGameProfile(Properties& props) { myGameInfoDialog->setGameProfile(props); } - void enterCheatMode(); + void enterCheatMode(); protected: VideoDialog* myVideoDialog; diff --git a/stella/src/gui/module.mk b/stella/src/gui/module.mk index d05aa6f91..be3fc1e9f 100644 --- a/stella/src/gui/module.mk +++ b/stella/src/gui/module.mk @@ -4,7 +4,6 @@ MODULE_OBJS := \ src/gui/AboutDialog.o \ src/gui/AudioDialog.o \ src/gui/BrowserDialog.o \ - src/gui/CheatCodeDialog.o \ src/gui/CommandDialog.o \ src/gui/CommandMenu.o \ src/gui/DialogContainer.o \