diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index ef802ab39..e82b44074 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.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: Console.cxx,v 1.45 2005-03-27 03:07:33 stephena Exp $ +// $Id: Console.cxx,v 1.46 2005-04-21 21:18:37 stephena Exp $ //============================================================================ #include @@ -289,6 +289,14 @@ void Console::togglePalette(const string& palette) myOSystem->frameBuffer().showMessage(message); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Console::toggleTIABit(TIA::TIABit bit, const string& bitname, bool show) +{ + bool result = ((TIA*)myMediaSource)->toggleBit(bit); + string message = bitname + (result ? " enabled" : " disabled"); + myOSystem->frameBuffer().showMessage(message); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::saveProperties(string filename, bool merge) { diff --git a/stella/src/emucore/Console.hxx b/stella/src/emucore/Console.hxx index d03bc3bdc..60f9ff97f 100644 --- a/stella/src/emucore/Console.hxx +++ b/stella/src/emucore/Console.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: Console.hxx,v 1.25 2005-03-14 04:08:14 stephena Exp $ +// $Id: Console.hxx,v 1.26 2005-04-21 21:18:37 stephena Exp $ //============================================================================ #ifndef CONSOLE_HXX @@ -31,12 +31,13 @@ class OSystem; #include "bspf.hxx" #include "Control.hxx" #include "Props.hxx" +#include "TIA.hxx" /** This class represents the entire game console. @author Bradford W. Mott - @version $Id: Console.hxx,v 1.25 2005-03-14 04:08:14 stephena Exp $ + @version $Id: Console.hxx,v 1.26 2005-04-21 21:18:37 stephena Exp $ */ class Console { @@ -133,6 +134,16 @@ class Console */ void togglePalette(const string& palette = ""); + /** + Toggles the TIA bit specified in the method name. + */ + void toggleP0Bit() { toggleTIABit(TIA::P0, "P0"); } + void toggleP1Bit() { toggleTIABit(TIA::P1, "P1"); } + void toggleM0Bit() { toggleTIABit(TIA::M0, "M0"); } + void toggleM1Bit() { toggleTIABit(TIA::M1, "M1"); } + void toggleBLBit() { toggleTIABit(TIA::BL, "BL"); } + void togglePFBit() { toggleTIABit(TIA::PF, "PF"); } + /** Save a copy of the current properties after any changes. @@ -177,6 +188,9 @@ class Console void changeHeight(const uInt32 direction); #endif + private: + void toggleTIABit(TIA::TIABit bit, const string& bitname, bool show = true); + private: // Pointer to the osystem object OSystem* myOSystem; diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 122a1ef63..f738786d8 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.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: EventHandler.cxx,v 1.43 2005-04-06 23:47:06 stephena Exp $ +// $Id: EventHandler.cxx,v 1.44 2005-04-21 21:18:37 stephena Exp $ //============================================================================ #include @@ -240,8 +240,37 @@ void EventHandler::handleKeyEvent(SDLKey key, SDLMod mod, uInt8 state) case S_EMULATE: // An attempt to speed up event processing // All SDL-specific event actions are accessed by either - // Control or Alt keys. So we quickly check for those. - if(mod & KMOD_ALT && state) + // Control and/or Alt keys. So we quickly check for those. + if((mod & KMOD_ALT) && (mod & KMOD_CTRL) && state) + { + switch(int(key)) + { + case SDLK_1: + myOSystem->console().toggleP0Bit(); + break; + + case SDLK_2: + myOSystem->console().toggleP1Bit(); + break; + + case SDLK_3: + myOSystem->console().toggleM0Bit(); + break; + + case SDLK_4: + myOSystem->console().toggleM1Bit(); + break; + + case SDLK_5: + myOSystem->console().toggleBLBit(); + break; + + case SDLK_6: + myOSystem->console().togglePFBit(); + break; + } + } + else if(mod & KMOD_ALT && state) { switch(int(key)) { diff --git a/stella/src/emucore/TIA.hxx b/stella/src/emucore/TIA.hxx index 9cd46db9f..16938e671 100644 --- a/stella/src/emucore/TIA.hxx +++ b/stella/src/emucore/TIA.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: TIA.hxx,v 1.17 2005-04-21 18:55:15 stephena Exp $ +// $Id: TIA.hxx,v 1.18 2005-04-21 21:18:37 stephena Exp $ //============================================================================ #ifndef TIA_HXX @@ -42,7 +42,7 @@ class Settings; be displayed on screen. @author Bradford W. Mott - @version $Id: TIA.hxx,v 1.17 2005-04-21 18:55:15 stephena Exp $ + @version $Id: TIA.hxx,v 1.18 2005-04-21 21:18:37 stephena Exp $ */ class TIA : public Device , public MediaSource { @@ -173,8 +173,8 @@ class TIA : public Device , public MediaSource enum TIABit { P0, // Descriptor for Player 0 Bit - M0, // Descriptor for Missle 0 Bit P1, // Descriptor for Player 1 Bit + M0, // Descriptor for Missle 0 Bit M1, // Descriptor for Missle 1 Bit BL, // Descriptor for Ball Bit PF // Descriptor for Playfield Bit