Added Genesis controller UI to the debugger I/O tab.

Updated ROM properties for 'Gingerbread Man' homebrew ROM, which
uses the Genesis controller.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2341 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-01-07 17:05:18 +00:00
parent 177ebb09a9
commit f8c6693583
6 changed files with 176 additions and 2 deletions

View File

@ -0,0 +1,117 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2012 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#include "OSystem.hxx"
#include "EventHandler.hxx"
#include "GenesisWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GenesisWidget::GenesisWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, Controller& controller)
: ControllerWidget(boss, font, x, y, controller)
{
bool leftport = myController.jack() == Controller::Left;
const string& label = leftport ? "Left (Genesis):" : "Right (Genesis):";
const int fontHeight = font.getFontHeight();
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Genesis):");
StaticTextWidget* t;
t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
fontHeight, label, kTextAlignLeft);
xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 10;
myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd);
myPins[kJUp]->setID(kJUp);
myPins[kJUp]->setTarget(this);
ypos += myPins[kJUp]->getHeight() * 2 + 10;
myPins[kJDown] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd);
myPins[kJDown]->setID(kJDown);
myPins[kJDown]->setTarget(this);
xpos -= myPins[kJUp]->getWidth() + 5;
ypos -= myPins[kJUp]->getHeight() + 5;
myPins[kJLeft] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd);
myPins[kJLeft]->setID(kJLeft);
myPins[kJLeft]->setTarget(this);
xpos += (myPins[kJUp]->getWidth() + 5) * 2;
myPins[kJRight] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd);
myPins[kJRight]->setID(kJRight);
myPins[kJRight]->setTarget(this);
xpos -= (myPins[kJUp]->getWidth() + 5) * 2;
ypos = 20 + (myPins[kJUp]->getHeight() + 10) * 3;
myPins[kJBbtn] = new CheckboxWidget(boss, font, xpos, ypos, "B button", kCheckActionCmd);
myPins[kJBbtn]->setID(kJBbtn);
myPins[kJBbtn]->setTarget(this);
ypos += myPins[kJBbtn]->getHeight() + 5;
myPins[kJCbtn] = new CheckboxWidget(boss, font, xpos, ypos, "C button", kCheckActionCmd);
myPins[kJCbtn]->setID(kJCbtn);
myPins[kJCbtn]->setTarget(this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GenesisWidget::~GenesisWidget()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GenesisWidget::loadConfig()
{
myPins[kJUp]->setState(!myController.read(ourPinNo[kJUp]));
myPins[kJDown]->setState(!myController.read(ourPinNo[kJDown]));
myPins[kJLeft]->setState(!myController.read(ourPinNo[kJLeft]));
myPins[kJRight]->setState(!myController.read(ourPinNo[kJRight]));
myPins[kJBbtn]->setState(!myController.read(ourPinNo[kJBbtn]));
myPins[kJCbtn]->setState(
myController.read(Controller::Five) == Controller::maximumResistance);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GenesisWidget::handleCommand(
CommandSender* sender, int cmd, int data, int id)
{
if(cmd == kCheckActionCmd)
{
switch(id)
{
case kJUp:
case kJDown:
case kJLeft:
case kJRight:
case kJBbtn:
myController.set(ourPinNo[id], !myPins[id]->getState());
break;
case kJCbtn:
myController.set(Controller::Five,
myPins[id]->getState() ? Controller::maximumResistance :
Controller::minimumResistance);
break;
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Controller::DigitalPin GenesisWidget::ourPinNo[5] = {
Controller::One, Controller::Two, Controller::Three, Controller::Four,
Controller::Six
};

View File

@ -0,0 +1,44 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2012 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#ifndef GENESIS_WIDGET_HXX
#define GENESIS_WIDGET_HXX
#include "Control.hxx"
#include "Event.hxx"
#include "ControllerWidget.hxx"
class GenesisWidget : public ControllerWidget
{
public:
GenesisWidget(GuiObject* boss, const GUI::Font& font, int x, int y,
Controller& controller);
virtual ~GenesisWidget();
void loadConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
enum { kJUp = 0, kJDown, kJLeft, kJRight, kJBbtn, kJCbtn };
CheckboxWidget* myPins[6];
static Controller::DigitalPin ourPinNo[5];
};
#endif

View File

@ -34,6 +34,7 @@
#include "JoystickWidget.hxx"
#include "PaddleWidget.hxx"
#include "BoosterWidget.hxx"
#include "GenesisWidget.hxx"
#include "RiotWidget.hxx"
@ -345,6 +346,8 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font&
return new PaddleWidget(boss, font, x, y, controller);
case Controller::BoosterGrip:
return new BoosterWidget(boss, font, x, y, controller);
case Controller::Genesis:
return new GenesisWidget(boss, font, x, y, controller);
default:
return new NullControlWidget(boss, font, x, y, controller);
}

View File

@ -21,7 +21,8 @@ MODULE_OBJS := \
src/debugger/gui/ToggleWidget.o \
src/debugger/gui/JoystickWidget.o \
src/debugger/gui/PaddleWidget.o \
src/debugger/gui/BoosterWidget.o
src/debugger/gui/BoosterWidget.o \
src/debugger/gui/GenesisWidget.o
MODULE_DIRS += \
src/debugger/gui

View File

@ -27,7 +27,7 @@
regenerated and the application recompiled.
*/
#define DEF_PROPS_SIZE 3244
#define DEF_PROPS_SIZE 3245
static const char* DefProps[DEF_PROPS_SIZE][20] = {
{ "000509d1ed2b8d30a9d94be1b3b5febb", "Greg Zumwalt", "", "Jungle Jane (2003) (Greg Zumwalt) (Hack)", "Hack of Pitfall!", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -750,6 +750,7 @@ static const char* DefProps[DEF_PROPS_SIZE][20] = {
{ "378c118b3bda502c73e76190ca089eef", "Atari, Alan Miller", "CX2662P", "Hangman (1978) (Atari) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "37ab3affc7987995784b59fcd3fcbd31", "", "", "Sprite Test (29-11-2002) (Eric Ball)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "37b98344c8e0746c486caf5aaeec892a", "K-Tel Vision", "6", "Spider Maze (1982) (K-Tel Vision) (PAL)", "AKA Spider Kong", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "37e828675d556775ae8285c0caf7d11c", "AtariAge - Fred Quimby", "", "Gingerbread Man (Fred Quimby) (Genesis)", "Uses the Sega Genesis controller (left only)", "New Release", "", "", "", "", "", "", "GENESIS", "", "", "", "", "", "", "" },
{ "37f42ab50018497114f6b0f4f01aa9a1", "", "", "Droid Demo 2-M (David Conrad Schweinsberg) (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "37fd7fa52d358f66984948999f1213c5", "Rainbow Vision - Suntek", "SS-004", "Pyramid War (Rainbow Vision) (PAL) [a2]", "AKA Chopper Command", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "384db97670817103dd8c0bbdef132445", "Atari - Sears", "CX2626 - 6-99829, 49-75116", "Miniature Golf (1979) (Atari) (4K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },

View File

@ -19258,6 +19258,14 @@
"Cartridge.Rarity" "New Release"
""
"Cartridge.MD5" "37e828675d556775ae8285c0caf7d11c"
"Cartridge.Manufacturer" "AtariAge - Fred Quimby"
"Cartridge.Name" "Gingerbread Man (Fred Quimby) (Genesis)"
"Cartridge.Note" "Uses the Sega Genesis controller (left only)"
"Cartridge.Rarity" "New Release"
"Controller.Left" "GENESIS"
""
"Cartridge.MD5" "9c40bf810f761ffc9c1b69c4647a8b84"
"Cartridge.Name" "2 in 1 - Frostbite, River Raid (Unknown)"
"Cartridge.Type" "2IN1"