Added key bindings to enable/disable some registers in the TIA. These

key binding may change; I just wanted to see how it would work.  You can
do some funky stuff by changing those registers :)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@396 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-04-21 21:18:37 +00:00
parent 9fd0aded02
commit 5e88a64305
4 changed files with 60 additions and 9 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <assert.h> #include <assert.h>
@ -289,6 +289,14 @@ void Console::togglePalette(const string& palette)
myOSystem->frameBuffer().showMessage(message); 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) void Console::saveProperties(string filename, bool merge)
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef CONSOLE_HXX
@ -31,12 +31,13 @@ class OSystem;
#include "bspf.hxx" #include "bspf.hxx"
#include "Control.hxx" #include "Control.hxx"
#include "Props.hxx" #include "Props.hxx"
#include "TIA.hxx"
/** /**
This class represents the entire game console. This class represents the entire game console.
@author Bradford W. Mott @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 class Console
{ {
@ -133,6 +134,16 @@ class Console
*/ */
void togglePalette(const string& palette = ""); 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. Save a copy of the current properties after any changes.
@ -177,6 +188,9 @@ class Console
void changeHeight(const uInt32 direction); void changeHeight(const uInt32 direction);
#endif #endif
private:
void toggleTIABit(TIA::TIABit bit, const string& bitname, bool show = true);
private: private:
// Pointer to the osystem object // Pointer to the osystem object
OSystem* myOSystem; OSystem* myOSystem;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 <algorithm> #include <algorithm>
@ -240,8 +240,37 @@ void EventHandler::handleKeyEvent(SDLKey key, SDLMod mod, uInt8 state)
case S_EMULATE: case S_EMULATE:
// An attempt to speed up event processing // An attempt to speed up event processing
// All SDL-specific event actions are accessed by either // All SDL-specific event actions are accessed by either
// Control or Alt keys. So we quickly check for those. // Control and/or Alt keys. So we quickly check for those.
if(mod & KMOD_ALT && state) 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)) switch(int(key))
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef TIA_HXX
@ -42,7 +42,7 @@ class Settings;
be displayed on screen. be displayed on screen.
@author Bradford W. Mott @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 class TIA : public Device , public MediaSource
{ {
@ -173,8 +173,8 @@ class TIA : public Device , public MediaSource
enum TIABit { enum TIABit {
P0, // Descriptor for Player 0 Bit P0, // Descriptor for Player 0 Bit
M0, // Descriptor for Missle 0 Bit
P1, // Descriptor for Player 1 Bit P1, // Descriptor for Player 1 Bit
M0, // Descriptor for Missle 0 Bit
M1, // Descriptor for Missle 1 Bit M1, // Descriptor for Missle 1 Bit
BL, // Descriptor for Ball Bit BL, // Descriptor for Ball Bit
PF // Descriptor for Playfield Bit PF // Descriptor for Playfield Bit