mirror of https://github.com/stella-emu/stella.git
Added support for the Sega Genesis gamepad controller. This
controller uses the directional pad and button 'B' as a normal joystick, but can also use button 'C' as a second 2600 button (with the logic reversed). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1950 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
965787050a
commit
691c9b2e1d
|
@ -8,7 +8,7 @@
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2010 by Bradford W. Mott and the Stella team
|
// Copyright (c) 1995-2010 wby Bradford W. Mott and the Stella team
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "Joystick.hxx"
|
#include "Joystick.hxx"
|
||||||
#include "Keyboard.hxx"
|
#include "Keyboard.hxx"
|
||||||
#include "KidVid.hxx"
|
#include "KidVid.hxx"
|
||||||
|
#include "Genesis.hxx"
|
||||||
#include "M6502.hxx"
|
#include "M6502.hxx"
|
||||||
#include "M6532.hxx"
|
#include "M6532.hxx"
|
||||||
#include "Paddles.hxx"
|
#include "Paddles.hxx"
|
||||||
|
@ -621,6 +622,10 @@ void Console::setControllers(const string& rommd5)
|
||||||
myControllers[leftPort] = new TrackBall(Controller::Left, *myEvent, *mySystem,
|
myControllers[leftPort] = new TrackBall(Controller::Left, *myEvent, *mySystem,
|
||||||
Controller::AmigaMouse);
|
Controller::AmigaMouse);
|
||||||
}
|
}
|
||||||
|
else if(left == "GENESIS")
|
||||||
|
{
|
||||||
|
myControllers[leftPort] = new Genesis(Controller::Left, *myEvent, *mySystem);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myControllers[leftPort] = new Joystick(Controller::Left, *myEvent, *mySystem);
|
myControllers[leftPort] = new Joystick(Controller::Left, *myEvent, *mySystem);
|
||||||
|
@ -677,6 +682,10 @@ void Console::setControllers(const string& rommd5)
|
||||||
{
|
{
|
||||||
myControllers[rightPort] = new KidVid(Controller::Right, *myEvent, *mySystem, rommd5);
|
myControllers[rightPort] = new KidVid(Controller::Right, *myEvent, *mySystem, rommd5);
|
||||||
}
|
}
|
||||||
|
else if(right == "GENESIS")
|
||||||
|
{
|
||||||
|
myControllers[rightPort] = new Genesis(Controller::Right, *myEvent, *mySystem);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myControllers[rightPort] = new Joystick(Controller::Right, *myEvent, *mySystem);
|
myControllers[rightPort] = new Joystick(Controller::Right, *myEvent, *mySystem);
|
||||||
|
|
|
@ -73,6 +73,9 @@ Controller::Controller(Jack jack, const Event& event, const System& system,
|
||||||
case KidVid:
|
case KidVid:
|
||||||
myName = "KidVid";
|
myName = "KidVid";
|
||||||
break;
|
break;
|
||||||
|
case Genesis:
|
||||||
|
myName = "Genesis";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class Controller : public Serializable
|
||||||
{
|
{
|
||||||
BoosterGrip, Driving, Keyboard, Paddles, Joystick,
|
BoosterGrip, Driving, Keyboard, Paddles, Joystick,
|
||||||
TrackBall22, TrackBall80, AmigaMouse, AtariVox, SaveKey,
|
TrackBall22, TrackBall80, AmigaMouse, AtariVox, SaveKey,
|
||||||
KidVid
|
KidVid, Genesis
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// 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-2010 by Bradford W. Mott 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: Genesis.cxx 1921 2010-01-10 03:23:32Z stephena $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Event.hxx"
|
||||||
|
#include "Genesis.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Genesis::Genesis(Jack jack, const Event& event, const System& system)
|
||||||
|
: Controller(jack, event, system, Controller::Genesis)
|
||||||
|
{
|
||||||
|
if(myJack == Left)
|
||||||
|
{
|
||||||
|
myUpEvent = Event::JoystickZeroUp;
|
||||||
|
myDownEvent = Event::JoystickZeroDown;
|
||||||
|
myLeftEvent = Event::JoystickZeroLeft;
|
||||||
|
myRightEvent = Event::JoystickZeroRight;
|
||||||
|
myFire1Event = Event::JoystickZeroFire1;
|
||||||
|
myFire2Event = Event::JoystickZeroFire2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myUpEvent = Event::JoystickOneUp;
|
||||||
|
myDownEvent = Event::JoystickOneDown;
|
||||||
|
myLeftEvent = Event::JoystickOneLeft;
|
||||||
|
myRightEvent = Event::JoystickOneRight;
|
||||||
|
myFire1Event = Event::JoystickOneFire1;
|
||||||
|
myFire2Event = Event::JoystickOneFire2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Analog pin 9 is not connected to this controller at all
|
||||||
|
// Analog pin 5 corresponds to button 'C' on the gamepad
|
||||||
|
myAnalogPinValue[Five] = myAnalogPinValue[Nine] = maximumResistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Genesis::~Genesis()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Genesis::update()
|
||||||
|
{
|
||||||
|
// Digital events (from keyboard or joystick hats & buttons)
|
||||||
|
myDigitalPinState[One] = (myEvent.get(myUpEvent) == 0);
|
||||||
|
myDigitalPinState[Two] = (myEvent.get(myDownEvent) == 0);
|
||||||
|
myDigitalPinState[Three] = (myEvent.get(myLeftEvent) == 0);
|
||||||
|
myDigitalPinState[Four] = (myEvent.get(myRightEvent) == 0);
|
||||||
|
myDigitalPinState[Six] = (myEvent.get(myFire1Event) == 0);
|
||||||
|
|
||||||
|
// The Genesis has one more button (C) that can be read by the 2600
|
||||||
|
// However, it seems to work opposite to the BoosterGrip controller,
|
||||||
|
// in that the logic is inverted
|
||||||
|
myAnalogPinValue[Five] = (myEvent.get(myFire2Event) == 0) ?
|
||||||
|
minimumResistance : maximumResistance;
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// 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-2010 by Bradford W. Mott 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: Booster.hxx 1921 2010-01-10 03:23:32Z stephena $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef GENESIS_HXX
|
||||||
|
#define GENESIS_HXX
|
||||||
|
|
||||||
|
#include "bspf.hxx"
|
||||||
|
#include "Control.hxx"
|
||||||
|
#include "Event.hxx"
|
||||||
|
|
||||||
|
/**
|
||||||
|
The standard Sega Genesis controller works with the 2600 console for
|
||||||
|
joystick directions and some of the buttons. Button 'B' corresponds to
|
||||||
|
the normal fire button (joy0fire), while button 'C' is read through
|
||||||
|
INPT1 (analog pin 5), which is normally mapped to the BoosterGrip trigger.
|
||||||
|
|
||||||
|
@author Stephen Anthony
|
||||||
|
*/
|
||||||
|
class Genesis : public Controller
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Create a new Genesis gamepad plugged into the specified jack
|
||||||
|
|
||||||
|
@param jack The jack the controller is plugged into
|
||||||
|
@param event The event object to use for events
|
||||||
|
@param system The system using this controller
|
||||||
|
*/
|
||||||
|
Genesis(Jack jack, const Event& event, const System& system);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destructor
|
||||||
|
*/
|
||||||
|
virtual ~Genesis();
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Update the entire digital and analog pin state according to the
|
||||||
|
events currently set.
|
||||||
|
*/
|
||||||
|
virtual void update();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Pre-compute the events we care about based on given port
|
||||||
|
// This will eliminate test for left or right port in update()
|
||||||
|
Event::Type myUpEvent, myDownEvent, myLeftEvent, myRightEvent,
|
||||||
|
myFire1Event, myFire2Event;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -38,6 +38,7 @@ MODULE_OBJS := \
|
||||||
src/emucore/EventHandler.o \
|
src/emucore/EventHandler.o \
|
||||||
src/emucore/FrameBuffer.o \
|
src/emucore/FrameBuffer.o \
|
||||||
src/emucore/FSNode.o \
|
src/emucore/FSNode.o \
|
||||||
|
src/emucore/Genesis.o \
|
||||||
src/emucore/Joystick.o \
|
src/emucore/Joystick.o \
|
||||||
src/emucore/Keyboard.o \
|
src/emucore/Keyboard.o \
|
||||||
src/emucore/KidVid.o \
|
src/emucore/KidVid.o \
|
||||||
|
|
|
@ -230,6 +230,7 @@ GameInfoDialog::GameInfoDialog(
|
||||||
ctrls.push_back("AmigaMouse", "AMIGAMOUSE" );
|
ctrls.push_back("AmigaMouse", "AMIGAMOUSE" );
|
||||||
ctrls.push_back("AtariVox", "ATARIVOX" );
|
ctrls.push_back("AtariVox", "ATARIVOX" );
|
||||||
ctrls.push_back("SaveKey", "SAVEKEY" );
|
ctrls.push_back("SaveKey", "SAVEKEY" );
|
||||||
|
ctrls.push_back("Sega Genesis", "GENESIS" );
|
||||||
//FIXME ctrls.push_back("KidVid", "KIDVID" );
|
//FIXME ctrls.push_back("KidVid", "KIDVID" );
|
||||||
myP0Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
|
myP0Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
|
||||||
pwidth, lineHeight, ctrls, "", 0, 0);
|
pwidth, lineHeight, ctrls, "", 0, 0);
|
||||||
|
|
|
@ -308,6 +308,8 @@
|
||||||
DCC527DB10B9DA6A005E1287 /* bspf.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC527D810B9DA6A005E1287 /* bspf.hxx */; };
|
DCC527DB10B9DA6A005E1287 /* bspf.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC527D810B9DA6A005E1287 /* bspf.hxx */; };
|
||||||
DCC527DC10B9DA6A005E1287 /* Snapshot.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCC527D910B9DA6A005E1287 /* Snapshot.cxx */; };
|
DCC527DC10B9DA6A005E1287 /* Snapshot.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCC527D910B9DA6A005E1287 /* Snapshot.cxx */; };
|
||||||
DCC527DD10B9DA6A005E1287 /* Snapshot.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC527DA10B9DA6A005E1287 /* Snapshot.hxx */; };
|
DCC527DD10B9DA6A005E1287 /* Snapshot.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCC527DA10B9DA6A005E1287 /* Snapshot.hxx */; };
|
||||||
|
DCD3F7C511340AAF00DBA3AE /* Genesis.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCD3F7C311340AAF00DBA3AE /* Genesis.cxx */; };
|
||||||
|
DCD3F7C611340AAF00DBA3AE /* Genesis.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCD3F7C411340AAF00DBA3AE /* Genesis.hxx */; };
|
||||||
DCD56D380B247D920092F9F8 /* Cart4A50.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCD56D360B247D920092F9F8 /* Cart4A50.cxx */; };
|
DCD56D380B247D920092F9F8 /* Cart4A50.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCD56D360B247D920092F9F8 /* Cart4A50.cxx */; };
|
||||||
DCD56D390B247D920092F9F8 /* Cart4A50.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCD56D370B247D920092F9F8 /* Cart4A50.hxx */; };
|
DCD56D390B247D920092F9F8 /* Cart4A50.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCD56D370B247D920092F9F8 /* Cart4A50.hxx */; };
|
||||||
DCD56D3C0B247DB40092F9F8 /* RectList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCD56D3A0B247DB40092F9F8 /* RectList.cxx */; };
|
DCD56D3C0B247DB40092F9F8 /* RectList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCD56D3A0B247DB40092F9F8 /* RectList.cxx */; };
|
||||||
|
@ -687,6 +689,8 @@
|
||||||
DCC527D810B9DA6A005E1287 /* bspf.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = bspf.hxx; path = ../common/bspf.hxx; sourceTree = SOURCE_ROOT; };
|
DCC527D810B9DA6A005E1287 /* bspf.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = bspf.hxx; path = ../common/bspf.hxx; sourceTree = SOURCE_ROOT; };
|
||||||
DCC527D910B9DA6A005E1287 /* Snapshot.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Snapshot.cxx; path = ../common/Snapshot.cxx; sourceTree = SOURCE_ROOT; };
|
DCC527D910B9DA6A005E1287 /* Snapshot.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Snapshot.cxx; path = ../common/Snapshot.cxx; sourceTree = SOURCE_ROOT; };
|
||||||
DCC527DA10B9DA6A005E1287 /* Snapshot.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Snapshot.hxx; path = ../common/Snapshot.hxx; sourceTree = SOURCE_ROOT; };
|
DCC527DA10B9DA6A005E1287 /* Snapshot.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Snapshot.hxx; path = ../common/Snapshot.hxx; sourceTree = SOURCE_ROOT; };
|
||||||
|
DCD3F7C311340AAF00DBA3AE /* Genesis.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Genesis.cxx; path = ../emucore/Genesis.cxx; sourceTree = SOURCE_ROOT; };
|
||||||
|
DCD3F7C411340AAF00DBA3AE /* Genesis.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Genesis.hxx; path = ../emucore/Genesis.hxx; sourceTree = SOURCE_ROOT; };
|
||||||
DCD56D360B247D920092F9F8 /* Cart4A50.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Cart4A50.cxx; path = ../emucore/Cart4A50.cxx; sourceTree = SOURCE_ROOT; };
|
DCD56D360B247D920092F9F8 /* Cart4A50.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Cart4A50.cxx; path = ../emucore/Cart4A50.cxx; sourceTree = SOURCE_ROOT; };
|
||||||
DCD56D370B247D920092F9F8 /* Cart4A50.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Cart4A50.hxx; path = ../emucore/Cart4A50.hxx; sourceTree = SOURCE_ROOT; };
|
DCD56D370B247D920092F9F8 /* Cart4A50.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Cart4A50.hxx; path = ../emucore/Cart4A50.hxx; sourceTree = SOURCE_ROOT; };
|
||||||
DCD56D3A0B247DB40092F9F8 /* RectList.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = RectList.cxx; path = ../common/RectList.cxx; sourceTree = SOURCE_ROOT; };
|
DCD56D3A0B247DB40092F9F8 /* RectList.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = RectList.cxx; path = ../common/RectList.cxx; sourceTree = SOURCE_ROOT; };
|
||||||
|
@ -917,6 +921,8 @@
|
||||||
2D6050CC0898776500C6DE89 /* emucore */ = {
|
2D6050CC0898776500C6DE89 /* emucore */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
DCD3F7C311340AAF00DBA3AE /* Genesis.cxx */,
|
||||||
|
DCD3F7C411340AAF00DBA3AE /* Genesis.hxx */,
|
||||||
DCC527C810B9DA19005E1287 /* Device.cxx */,
|
DCC527C810B9DA19005E1287 /* Device.cxx */,
|
||||||
DCC527C910B9DA19005E1287 /* Device.hxx */,
|
DCC527C910B9DA19005E1287 /* Device.hxx */,
|
||||||
DCC527CA10B9DA19005E1287 /* M6502.cxx */,
|
DCC527CA10B9DA19005E1287 /* M6502.cxx */,
|
||||||
|
@ -1369,6 +1375,7 @@
|
||||||
DCC527DD10B9DA6A005E1287 /* Snapshot.hxx in Headers */,
|
DCC527DD10B9DA6A005E1287 /* Snapshot.hxx in Headers */,
|
||||||
DC6B2BA511037FF200F199A7 /* CartDebug.hxx in Headers */,
|
DC6B2BA511037FF200F199A7 /* CartDebug.hxx in Headers */,
|
||||||
DC6B2BA711037FF200F199A7 /* DiStella.hxx in Headers */,
|
DC6B2BA711037FF200F199A7 /* DiStella.hxx in Headers */,
|
||||||
|
DCD3F7C611340AAF00DBA3AE /* Genesis.hxx in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -1605,6 +1612,7 @@
|
||||||
DCC527DC10B9DA6A005E1287 /* Snapshot.cxx in Sources */,
|
DCC527DC10B9DA6A005E1287 /* Snapshot.cxx in Sources */,
|
||||||
DC6B2BA411037FF200F199A7 /* CartDebug.cxx in Sources */,
|
DC6B2BA411037FF200F199A7 /* CartDebug.cxx in Sources */,
|
||||||
DC6B2BA611037FF200F199A7 /* DiStella.cxx in Sources */,
|
DC6B2BA611037FF200F199A7 /* DiStella.cxx in Sources */,
|
||||||
|
DCD3F7C511340AAF00DBA3AE /* Genesis.cxx in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue