Fixed errors in compilation when excluding cheatcode support. Also,

the executable will now be slightly smaller in this case.

Moved common 'type()' method from children of the Controller
base class back to the parent.  There was no need to have separate
methods for each different type.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@876 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-11-12 22:59:20 +00:00
parent 8c2eaadaa1
commit ec87b299d5
18 changed files with 73 additions and 94 deletions

View File

@ -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

View File

@ -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

View File

@ -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 \

View File

@ -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;
}

View File

@ -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

View File

@ -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 <assert.h>
@ -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;
}

View File

@ -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

View File

@ -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 <assert.h>
@ -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;
}

View File

@ -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;

View File

@ -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 <assert.h>
@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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 <assert.h>
@ -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;
}

View File

@ -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

View File

@ -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
}

View File

@ -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;

View File

@ -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 \