Removed specific events for BoosterGrip buttons, and instead made them

generic joystick buttons.

Added complete keyboard/joystick support for all 4 paddles.  Associated
paddle resistance decrease/increase/fire to joystick events in the
'spirit' of z26 (ie, joy0 left/right/fire is paddle 0, joy1 left/right/fire
is paddle 2, etc).  These events can still be remapped independently
of joystick events, of course.

First real attempt at adding 4A50 bankswitch support, which is currently
being modelled on the E0 scheme (they're somewhat similar).  The code
still doesn't work, of course.

Fixed bug in FASC scheme whereby reading from a write port didn't generate
an associated write as a side-effect.  Thanks to Kroko of AtariAge for
the advice and partial code.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1388 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-10-09 23:56:57 +00:00
parent ffbc2a18f8
commit 2ad8f1efac
18 changed files with 563 additions and 397 deletions

View File

@ -952,9 +952,9 @@
<a href="#Remapping">Event Remapping</a></b>). The tables below show the default
settings.</p>
<p><b>Console Controls</b></p>
<p><b>Console Controls (can be remapped)</b></p>
<table BORDER=2>
<table BORDER=2 cellpadding=5>
<tr>
<th>Function</th>
<th>Key (Standard)</th>
@ -1071,17 +1071,17 @@
</table>
<p><b>Joystick Controller</b></p>
<p><b>Joystick / Booster-Grip Controller (can be remapped)</b></p>
<table BORDER=2>
<tr>
<th>Left Joystick</th>
<th>Right Joystick</th>
<th>Left Joystick (Joy0)</th>
<th>Right Joystick (Joy1)</th>
</tr>
<tr>
<td>
<table BORDER=1>
<table BORDER=1 cellpadding=5>
<tr>
<th>Function</th>
<th>Key</th>
@ -1111,11 +1111,21 @@
<td>Fire Button</td>
<td>Space</td>
</tr>
<tr>
<td>Trigger Button</td>
<td>4</td>
</tr>
<tr>
<td>Booster Button</td>
<td>5</td>
</tr>
</table>
</td>
<td>
<table BORDER=1>
<table BORDER=1 cellpadding=5>
<tr>
<th>Function</th>
<th>Key</th>
@ -1145,95 +1155,6 @@
<td>Fire Button</td>
<td>F</td>
</tr>
</table>
</td>
</tr>
</table>
<p><b>Booster-Grip Controller</b></p>
<table BORDER=2>
<tr>
<th>Left Booster-Grip</th>
<th>Right Booster-Grip</th>
</tr>
<tr>
<td>
<table BORDER=1>
<tr>
<th>Function</th>
<th>Key</th>
</tr>
<tr>
<td>Booster-Grip Up</td>
<td>Same as left joystick</td>
</tr>
<tr>
<td>Booster-Grip Down</td>
<td>Same as left joystick</td>
</tr>
<tr>
<td>Booster-Grip Left</td>
<td>Same as left joystick</td>
</tr>
<tr>
<td>Booster-Grip Right</td>
<td>Same as left joystick</td>
</tr>
<tr>
<td>Fire Button</td>
<td>Same as left joystick</td>
</tr>
<tr>
<td>Trigger Button</td>
<td>4</td>
</tr>
<tr>
<td>Booster Button</td>
<td>5</td>
</tr>
</table>
</td>
<td>
<table BORDER=1>
<tr>
<th>Function</th>
<th>Key</th>
</tr>
<tr>
<td>Booster-Grip Up</td>
<td>Same as right joystick</td>
</tr>
<tr>
<td>Booster-Grip Down</td>
<td>Same as right joystick</td>
</tr>
<tr>
<td>Booster-Grip Left</td>
<td>Same as right joystick</td>
</tr>
<tr>
<td>Booster-Grip Right</td>
<td>Same as right joystick</td>
</tr>
<tr>
<td>Fire Button</td>
<td>Same as right joystick</td>
</tr>
<tr>
<td>Trigger Button</td>
@ -1249,7 +1170,96 @@
</tr>
</table>
<p><b>Driving Controller</b></p>
<p><b>Paddle Controller digital emulation (can be remapped independently of joystick controller)</b></p>
<table BORDER=2>
<tr>
<th>Left Paddles</th>
<th>Right Paddles</th>
</tr>
<tr>
<td>
<table BORDER=1 cellpadding=5>
<tr>
<th>Function</th>
<th>Key</th>
</tr>
<tr>
<td>Paddle 0 decrease</td>
<td>Same as 'Joy0 Left'</td>
</tr>
<tr>
<td>Paddle 0 increase</td>
<td>Same as 'Joy0 Right'</td>
</tr>
<tr>
<td>Paddle 0 Fire</td>
<td>Same as 'Joy0 Fire'</td>
</tr>
<tr>
<td>Paddle 1 decrease</td>
<td>Same as 'Joy0 Up'</td>
</tr>
<tr>
<td>Paddle 1 increase</td>
<td>Same as 'Joy0 Down'</td>
</tr>
<tr>
<td>Paddle 1 Fire</td>
<td>Same as 'Joy0 Booster'</td>
</tr>
</table>
</td>
<td>
<table BORDER=1 cellpadding=5>
<tr>
<th>Function</th>
<th>Key</th>
</tr>
<tr>
<td>Paddle 2 decrease</td>
<td>Same as 'Joy1 Left'</td>
</tr>
<tr>
<td>Paddle 2 increase</td>
<td>Same as 'Joy1 Right'</td>
</tr>
<tr>
<td>Paddle 2 Fire</td>
<td>Same as 'Joy1 Fire'</td>
</tr>
<tr>
<td>Paddle 3 decrease</td>
<td>Same as 'Joy1 Up'</td>
</tr>
<tr>
<td>Paddle 3 increase</td>
<td>Same as 'Joy1 Down'</td>
</tr>
<tr>
<td>Paddle 3 Fire</td>
<td>Same as 'Joy1 Booster'</td>
</tr>
</table>
</td>
</tr>
</table>
<p><b>Driving Controller (cannot be remapped, always associated with joystick controller)</b></p>
<table BORDER=2>
<tr>
@ -1259,7 +1269,7 @@
<tr>
<td>
<table BORDER=1>
<table BORDER=1 cellpadding=5>
<tr>
<th>Function</th>
<th>Key</th>
@ -1267,23 +1277,23 @@
<tr>
<td>Left Direction</td>
<td>Insert</td>
<td>Same as 'Joy0 Left'</td>
</tr>
<tr>
<td>Right Direction</td>
<td>Page Up</td>
<td>Same as 'Joy0 Right'</td>
</tr>
<tr>
<td>Fire Button</td>
<td>Home</td>
<td>Same as 'Joy0 Fire'</td>
</tr>
</table>
</td>
<td>
<table BORDER=1>
<table BORDER=1 cellpadding=5>
<tr>
<th>Function</th>
<th>Key</th>
@ -1291,24 +1301,24 @@
<tr>
<td>Left Direction</td>
<td>Delete</td>
<td>Same as 'Joy1 Left'</td>
</tr>
<tr>
<td>Right Direction</td>
<td>Page Down</td>
<td>Same as 'Joy1 Right'</td>
</tr>
<tr>
<td>Fire Button</td>
<td>End</td>
<td>Same as 'Joy1 Fire'</td>
</tr>
</table>
</td>
</tr>
</table>
<p><b>Keypad Controller</b></p>
<p><b>Keypad Controller (can be remapped)</b></p>
<table BORDER=2>
<tr>
@ -1318,7 +1328,7 @@
<tr>
<td>
<table BORDER=1>
<table BORDER=1 cellpadding=5>
<tr>
<th>Pad Button</th>
<th>Key</th>
@ -1387,7 +1397,7 @@
</td>
<td>
<table BORDER=1>
<table BORDER=1 cellpadding=5>
<tr>
<th>Pad Button</th>
<th>Key</th>
@ -1457,9 +1467,9 @@
</tr>
</table>
<p><b>Developer Keys (can't be remapped)</b></p>
<p><b>Developer Keys (cannot be remapped)</b></p>
<table BORDER=2>
<table BORDER=2 cellpadding=5>
<tr>
<th>Function</th>
<th>Key (Standard)</th>
@ -1491,9 +1501,9 @@
</tr>
</table>
<p><b>Other Keys (can't be remapped)</b></p>
<p><b>Other Keys (cannot be remapped, except those marked with '*')</b></p>
<table BORDER=2>
<table BORDER=2 cellpadding=5>
<tr>
<th>Function</th>
<th>Key (Standard)</th>
@ -1526,15 +1536,15 @@
</tr>
-->
<tr>
<td>Increase volume</td>
<td>Alt + ]</td>
<td>Shift-Cmd + ]</td>
<td>Decrease volume (*)</td>
<td>Alt + [</td>
<td>Shift-Cmd + [</td>
</tr>
<tr>
<td>Decrease volume</td>
<td>Alt + [</td>
<td>Shift-Cmd + [</td>
<td>Increase volume (*)</td>
<td>Alt + ]</td>
<td>Shift-Cmd + ]</td>
</tr>
<tr>
@ -1544,7 +1554,7 @@
</tr>
<tr>
<td>Toggle display format between <i>NTSC/PAL/PAL60/SECAM</i></td>
<td>Toggle display palette (<i>NTSC/PAL/SECAM</i>)</td>
<td>Control + f</td>
<td>Cmd + f</td>
</tr>
@ -1619,12 +1629,12 @@
<p>This version of Stella has event remapping. Almost every event in the emulator
can be remapped to another key on the keyboard or to buttons on up to eight
joysticks/gamepads (see <b>Section 7 - <a href="#Keyboard">Keyboard Layout</a></b>
for those event which can/cannot be remapped).</p>
for those events which can/cannot be remapped).</p>
<p>Note that there are currently two separate event modes in Stella; emulation
mode and user-interface (UI) mode. Each mode has separate mappings, so (for example)
while in emulation mode, the left arrow could mean 'joystick 0 left', while in UI
mode it could mean 'move cursor to left'. Emulation mode occurs whenever you're
mode it could mean 'move cursor left'. Emulation mode occurs whenever you're
actually playing a game. UI mode occurs whenever a user interface is present
(ROM launcher, debugger, settings menu, etc). Because of these different modes,
there are two separate mapping areas.

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: mainSDL.cxx,v 1.78 2007-10-08 01:59:20 stephena Exp $
// $Id: mainSDL.cxx,v 1.79 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include <SDL.h>
@ -173,7 +173,7 @@ int main(int argc, char* argv[])
theOSystem->eventHandler().handleEvent(Event::ConsoleSelect, 1);
if(theOSystem->settings().getBool("holdbutton0"))
theOSystem->eventHandler().handleEvent(Event::JoystickZeroFire, 1);
theOSystem->eventHandler().handleEvent(Event::JoystickZeroFire1, 1);
#ifdef DEBUGGER_SUPPORT
Debugger& dbg = theOSystem->debugger();

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.9 2007-10-03 21:41:17 stephena Exp $
// $Id: Booster.cxx,v 1.10 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include "Event.hxx"
@ -29,9 +29,9 @@ BoosterGrip::BoosterGrip(Jack jack, const Event& event)
myDownEvent = Event::JoystickZeroDown;
myLeftEvent = Event::JoystickZeroLeft;
myRightEvent = Event::JoystickZeroRight;
myFireEvent = Event::JoystickZeroFire;
myBoosterEvent = Event::BoosterGripZeroBooster;
myTriggerEvent = Event::BoosterGripZeroTrigger;
myFireEvent = Event::JoystickZeroFire1;
myTriggerEvent = Event::JoystickZeroFire2;
myBoosterEvent = Event::JoystickZeroFire3;
}
else
{
@ -39,9 +39,9 @@ BoosterGrip::BoosterGrip(Jack jack, const Event& event)
myDownEvent = Event::JoystickOneDown;
myLeftEvent = Event::JoystickOneLeft;
myRightEvent = Event::JoystickOneRight;
myFireEvent = Event::JoystickOneFire;
myBoosterEvent = Event::BoosterGripOneBooster;
myTriggerEvent = Event::BoosterGripOneTrigger;
myFireEvent = Event::JoystickOneFire1;
myTriggerEvent = Event::JoystickOneFire2;
myBoosterEvent = Event::JoystickOneFire3;
}
}

View File

@ -13,17 +13,30 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Cart4A50.cxx,v 1.5 2007-10-03 21:41:17 stephena Exp $
// $Id: Cart4A50.cxx,v 1.6 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include <cassert>
#include "Random.hxx"
#include "System.hxx"
#include "Cart4A50.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge4A50::Cartridge4A50(const uInt8* image)
{
// Copy the ROM image into my buffer
for(uInt32 addr = 0; addr < 65536; ++addr)
{
myImage[addr] = image[addr];
}
// Initialize RAM with random values
class Random random;
for(uInt32 i = 0; i < 32768; ++i)
{
myRAM[i] = random.next();
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -34,24 +47,170 @@ Cartridge4A50::~Cartridge4A50()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::reset()
{
/*
// Setup segments to some default slices
segmentZero(4);
segmentOne(5);
segmentTwo(6);
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::install(System& system)
{
/*
mySystem = &system;
uInt16 shift = mySystem->pageShift();
uInt16 mask = mySystem->pageMask();
// Make sure the system we're being installed in has a page size that'll work
assert(((0x1000 & mask) == 0) && ((0x1400 & mask) == 0) &&
((0x1800 & mask) == 0) && ((0x1C00 & mask) == 0));
// Set the page acessing methods for the first part of the last segment
System::PageAccess access;
access.directPokeBase = 0;
access.device = this;
for(uInt32 i = 0x1C00; i < (0x1FE0U & ~mask); i += (1 << shift))
{
access.directPeekBase = &myImage[7168 + (i & 0x03FF)];
mySystem->setPageAccess(i >> shift, access);
}
myCurrentSlice[3] = 7;
// Set the page accessing methods for the hot spots in the last segment
access.directPeekBase = 0;
access.directPokeBase = 0;
access.device = this;
for(uInt32 j = (0x1FE0 & ~mask); j < 0x2000; j += (1 << shift))
{
mySystem->setPageAccess(j >> shift, access);
}
// Install some default slices for the other segments
segmentZero(4);
segmentOne(5);
segmentTwo(6);
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 Cartridge4A50::peek(uInt16 address)
{
/*
address = address & 0x0FFF;
if(!bankLocked) {
// Switch banks if necessary
if((address >= 0x0FE0) && (address <= 0x0FE7))
{
segmentZero(address & 0x0007);
}
else if((address >= 0x0FE8) && (address <= 0x0FEF))
{
segmentOne(address & 0x0007);
}
else if((address >= 0x0FF0) && (address <= 0x0FF7))
{
segmentTwo(address & 0x0007);
}
}
return myImage[(myCurrentSlice[address >> 10] << 10) + (address & 0x03FF)];
*/
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::poke(uInt16, uInt8)
{
/*
address = address & 0x0FFF;
if(!bankLocked) {
// Switch banks if necessary
if((address >= 0x0FE0) && (address <= 0x0FE7))
{
segmentZero(address & 0x0007);
}
else if((address >= 0x0FE8) && (address <= 0x0FEF))
{
segmentOne(address & 0x0007);
}
else if((address >= 0x0FF0) && (address <= 0x0FF7))
{
segmentTwo(address & 0x0007);
}
}
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::segmentZero(uInt16 slice)
{
/*
// Remember the new slice
myCurrentSlice[0] = slice;
uInt16 offset = slice << 10;
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access;
access.device = this;
access.directPokeBase = 0;
for(uInt32 address = 0x1000; address < 0x1400; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> shift, access);
}
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::segmentOne(uInt16 slice)
{
/*
// Remember the new slice
myCurrentSlice[1] = slice;
uInt16 offset = slice << 10;
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access;
access.device = this;
access.directPokeBase = 0;
for(uInt32 address = 0x1400; address < 0x1800; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> shift, access);
}
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::segmentTwo(uInt16 slice)
{
/*
// Remember the new slice
myCurrentSlice[2] = slice;
uInt16 offset = slice << 10;
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access;
access.device = this;
access.directPokeBase = 0;
for(uInt32 address = 0x1800; address < 0x1C00; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> shift, access);
}
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::bank(uInt16 b)
{
@ -86,11 +245,11 @@ uInt8* Cartridge4A50::getImage(int& size)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4A50::save(Serializer& out) const
{
return false;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4A50::load(Deserializer& in)
{
return false;
return true;
}

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: Cart4A50.hxx,v 1.6 2007-10-03 21:41:17 stephena Exp $
// $Id: Cart4A50.hxx,v 1.7 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#ifndef CARTRIDGE4A50_HXX
@ -25,11 +25,19 @@ class System;
#include "Cart.hxx"
/**
This is the standard Atari 4K cartridge. These cartridges are
not bankswitched.
Bankswitching method as defined/created by John Payson (aka Supercat),
documented at http://www.casperkitty.com/stella/cartfmt.htm.
@author Bradford W. Mott
@version $Id: Cart4A50.hxx,v 1.6 2007-10-03 21:41:17 stephena Exp $
In this bankswitching scheme the 2600's 4K cartridge address space
is broken into four segments. The first 2K segment accesses any 2K
region of RAM, or of the first 32K of ROM. The second 1.5K segment
accesses the first 1.5K of any 2K region of RAM, or of the last 32K
of ROM. The 3rd 256 byte segment points to any 256 byte page of
RAM or ROM. The last 256 byte segment always points to the last 256
bytes of ROM.
@author Stephen Anthony
@version $Id: Cart4A50.hxx,v 1.7 2007-10-09 23:56:57 stephena Exp $
*/
class Cartridge4A50 : public Cartridge
{
@ -134,6 +142,38 @@ class Cartridge4A50 : public Cartridge
@param value The value to be stored at the address
*/
virtual void poke(uInt16 address, uInt8 value);
private:
/**
Install the specified slice for segment zero
@param slice The slice to map into the segment
*/
void segmentZero(uInt16 slice);
/**
Install the specified slice for segment one
@param slice The slice to map into the segment
*/
void segmentOne(uInt16 slice);
/**
Install the specified slice for segment two
@param slice The slice to map into the segment
*/
void segmentTwo(uInt16 slice);
private:
// Indicates the slice mapped into each of the four segments
uInt16 myCurrentSlice[4];
// The 64K ROM image of the cartridge
uInt8 myImage[65536];
// The 32K of RAM on the cartridge
uInt8 myRAM[32768];
};
#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: CartFASC.cxx,v 1.13 2007-10-03 21:41:17 stephena Exp $
// $Id: CartFASC.cxx,v 1.14 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include <cassert>
@ -120,10 +120,16 @@ uInt8 CartridgeFASC::peek(uInt16 address)
break;
}
// NOTE: This does not handle accessing RAM, however, this function
// should never be called for RAM because of the way page accessing
// has been setup
return myImage[myCurrentBank * 4096 + address];
// Reading from the write port triggers an unwanted write
// Thanks to Kroko of AtariAge for this advice and code idea
if(address < 0x0100) // Write port is at 0xF000 - 0xF100 (256 bytes)
{
return myRAM[address & 0x00FF] = 0;
}
else
{
return myImage[myCurrentBank * 4096 + address];
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: Console.cxx,v 1.130 2007-10-03 21:41:17 stephena Exp $
// $Id: Console.cxx,v 1.131 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include <cassert>
@ -141,6 +141,10 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
{
myControllers[rightPort] = new Paddles(Controller::Right, *myEvent, swapPaddles);
}
else if(right == "TRACKBALL22")
{
myControllers[rightPort] = new TrackBall22(Controller::Right, *myEvent);
}
#ifdef ATARIVOX_SUPPORT
else if(right == "ATARIVOX")
{

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.12 2007-10-03 21:41:17 stephena Exp $
// $Id: Driving.cxx,v 1.13 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include "Event.hxx"
@ -30,14 +30,14 @@ Driving::Driving(Jack jack, const Event& event)
{
myCCWEvent = Event::JoystickZeroLeft;
myCWEvent = Event::JoystickZeroRight;
myFireEvent = Event::JoystickZeroFire;
myFireEvent = Event::JoystickZeroFire1;
myValueEvent = Event::DrivingZeroValue;
}
else
{
myCCWEvent = Event::JoystickOneLeft;
myCWEvent = Event::JoystickOneRight;
myFireEvent = Event::JoystickOneFire;
myFireEvent = Event::JoystickOneFire1;
myValueEvent = Event::DrivingOneValue;
}

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: Event.hxx,v 1.30 2007-10-03 21:41:17 stephena Exp $
// $Id: Event.hxx,v 1.31 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#ifndef EVENT_HXX
@ -25,7 +25,7 @@ class Event;
/**
@author Bradford W. Mott
@version $Id: Event.hxx,v 1.30 2007-10-03 21:41:17 stephena Exp $
@version $Id: Event.hxx,v 1.31 2007-10-09 23:56:57 stephena Exp $
*/
class Event
{
@ -43,16 +43,12 @@ class Event
ConsoleRightDifficultyA, ConsoleRightDifficultyB,
ConsoleSelect, ConsoleReset,
JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft,
JoystickZeroRight, JoystickZeroFire,
JoystickOneUp, JoystickOneDown, JoystickOneLeft,
JoystickOneRight, JoystickOneFire,
JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft, JoystickZeroRight,
JoystickZeroFire1, JoystickZeroFire2, JoystickZeroFire3,
JoystickOneUp, JoystickOneDown, JoystickOneLeft, JoystickOneRight,
JoystickOneFire1, JoystickOneFire2, JoystickOneFire3,
BoosterGripZeroTrigger, BoosterGripZeroBooster,
BoosterGripOneTrigger, BoosterGripOneBooster,
DrivingZeroValue,
DrivingOneValue,
DrivingZeroValue, DrivingOneValue,
PaddleZeroResistance, PaddleZeroFire,
PaddleZeroDecrease, PaddleZeroIncrease, PaddleZeroAnalog,

View File

@ -14,7 +14,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.212 2007-10-03 21:41:17 stephena Exp $
// $Id: EventHandler.cxx,v 1.213 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include <sstream>
@ -1004,137 +1004,59 @@ void EventHandler::handleEvent(Event::Type event, int state)
{
// Take care of special events that aren't part of the emulation core
// or need to be preprocessed before passing them on
switch((int)event)
switch(event)
{
////////////////////////////////////////////////////////////////////////
// Preprocess joystick events, converting them to events from whichever
// controller is plugged into the corresponding virtual port.
// This duplicates z26 behaviour, whereby the joystick can be used
// for almost all types of input.
// Yes, this is messy, but it's also as fast as possible ...
// Preprocess joystick events into equivalent paddle events.
// To speed processing, we won't care which type of controller
// is connected; we just set the events and let the controller
// decide how to interpret it.
case Event::JoystickZeroUp:
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickZeroDown, 0);
handleEvent(Event::PaddleOneDecrease, state);
break;
case Event::JoystickZeroDown:
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickZeroUp, 0);
handleEvent(Event::PaddleOneIncrease, state);
break;
case Event::JoystickZeroLeft:
switch((int)myController[0])
{
case Controller::Joystick:
case Controller::BoosterGrip:
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickZeroRight, 0);
myEvent->set(Event::JoystickZeroLeft, state);
return;
case Controller::Paddles:
handleEvent(Event::PaddleZeroDecrease, state);
return;
/*
case Controller::Driving:
myEvent->set(Event::DrivingZeroCounterClockwise, state);
return;
*/
}
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickZeroRight, 0);
handleEvent(Event::PaddleZeroDecrease, state);
break;
case Event::JoystickZeroRight:
switch((int)myController[0])
{
case Controller::Joystick:
case Controller::BoosterGrip:
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickZeroLeft, 0);
myEvent->set(Event::JoystickZeroRight, state);
return;
case Controller::Paddles:
handleEvent(Event::PaddleZeroIncrease, state);
return;
/*
case Controller::Driving:
myEvent->set(Event::DrivingZeroClockwise, state);
return;
*/
}
break;
case Event::JoystickZeroFire:
switch((int)myController[0])
{
case Controller::Joystick:
myEvent->set(Event::JoystickZeroFire, state);
return;
case Controller::Paddles:
myEvent->set(Event::PaddleZeroFire, state);
return;
/*
case Controller::Driving:
myEvent->set(Event::DrivingZeroFire, state);
return;
*/
}
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickZeroLeft, 0);
handleEvent(Event::PaddleZeroIncrease, state);
break;
case Event::JoystickOneUp:
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickOneDown, 0);
handleEvent(Event::PaddleThreeDecrease, state);
break;
case Event::JoystickOneDown:
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickOneUp, 0);
handleEvent(Event::PaddleThreeIncrease, state);
break;
case Event::JoystickOneLeft:
switch((int)myController[1])
{
case Controller::Joystick:
case Controller::BoosterGrip:
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickOneRight, 0);
myEvent->set(Event::JoystickOneLeft, state);
return;
case Controller::Paddles:
handleEvent(Event::PaddleOneDecrease, state);
return;
/*
case Controller::Driving:
myEvent->set(Event::DrivingOneCounterClockwise, state);
return;
*/
}
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickOneRight, 0);
handleEvent(Event::PaddleTwoDecrease, state);
break;
case Event::JoystickOneRight:
switch((int)myController[1])
{
case Controller::Joystick:
case Controller::BoosterGrip:
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickOneLeft, 0);
myEvent->set(Event::JoystickOneRight, state);
return;
case Controller::Paddles:
handleEvent(Event::PaddleZeroIncrease, state);
return;
/*
case Controller::Driving:
myEvent->set(Event::DrivingOneClockwise, state);
return;
*/
}
break;
case Event::JoystickOneFire:
switch((int)myController[1])
{
case Controller::Joystick:
myEvent->set(Event::JoystickOneFire, state);
return;
case Controller::Paddles:
myEvent->set(Event::PaddleOneFire, state);
return;
/*
case Controller::Driving:
myEvent->set(Event::DrivingOneFire, state);
return;
*/
}
if(!myAllowAllDirectionsFlag && state)
myEvent->set(Event::JoystickOneLeft, 0);
handleEvent(Event::PaddleTwoIncrease, state);
break;
////////////////////////////////////////////////////////////////////////
@ -1221,6 +1143,9 @@ void EventHandler::handleEvent(Event::Type event, int state)
myOSystem->quit();
}
return;
default:
break;
}
if(state && ourMessageTable[event] != "")
@ -1724,18 +1649,18 @@ void EventHandler::setDefaultKeymap(EventMode mode)
myKeyTable[ SDLK_DOWN ][mode] = Event::JoystickZeroDown;
myKeyTable[ SDLK_LEFT ][mode] = Event::JoystickZeroLeft;
myKeyTable[ SDLK_RIGHT ][mode] = Event::JoystickZeroRight;
myKeyTable[ SDLK_SPACE ][mode] = Event::JoystickZeroFire;
myKeyTable[ SDLK_LCTRL ][mode] = Event::JoystickZeroFire;
myKeyTable[ SDLK_4 ][mode] = Event::BoosterGripZeroTrigger;
myKeyTable[ SDLK_5 ][mode] = Event::BoosterGripZeroBooster;
myKeyTable[ SDLK_SPACE ][mode] = Event::JoystickZeroFire1;
myKeyTable[ SDLK_LCTRL ][mode] = Event::JoystickZeroFire1;
myKeyTable[ SDLK_4 ][mode] = Event::JoystickZeroFire2;
myKeyTable[ SDLK_5 ][mode] = Event::JoystickZeroFire3;
myKeyTable[ SDLK_y ][mode] = Event::JoystickOneUp;
myKeyTable[ SDLK_h ][mode] = Event::JoystickOneDown;
myKeyTable[ SDLK_g ][mode] = Event::JoystickOneLeft;
myKeyTable[ SDLK_j ][mode] = Event::JoystickOneRight;
myKeyTable[ SDLK_f ][mode] = Event::JoystickOneFire;
myKeyTable[ SDLK_6 ][mode] = Event::BoosterGripOneTrigger;
myKeyTable[ SDLK_7 ][mode] = Event::BoosterGripOneBooster;
myKeyTable[ SDLK_f ][mode] = Event::JoystickOneFire1;
myKeyTable[ SDLK_6 ][mode] = Event::JoystickOneFire2;
myKeyTable[ SDLK_7 ][mode] = Event::JoystickOneFire3;
myKeyTable[ SDLK_F1 ][mode] = Event::ConsoleSelect;
myKeyTable[ SDLK_F2 ][mode] = Event::ConsoleReset;
@ -2456,99 +2381,89 @@ void EventHandler::setSDLMappings()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandler::ActionList EventHandler::ourEmulActionList[kEmulActionListSize] = {
{ Event::ConsoleSelect, "Select", 0 },
{ Event::ConsoleReset, "Reset", 0 },
{ Event::ConsoleColor, "Color TV", 0 },
{ Event::ConsoleBlackWhite, "Black & White TV", 0 },
{ Event::ConsoleLeftDifficultyA, "P0 Difficulty A", 0 },
{ Event::ConsoleLeftDifficultyB, "P0 Difficulty B", 0 },
{ Event::ConsoleRightDifficultyA, "P1 Difficulty A", 0 },
{ Event::ConsoleRightDifficultyB, "P1 Difficulty B", 0 },
{ Event::SaveState, "Save State", 0 },
{ Event::ChangeState, "Change State", 0 },
{ Event::LoadState, "Load State", 0 },
{ Event::TakeSnapshot, "Snapshot", 0 },
{ Event::Fry, "Fry cartridge", 0 },
{ Event::VolumeDecrease, "Decrease volume", 0 },
{ Event::VolumeIncrease, "Increase volume", 0 },
{ Event::PauseMode, "Pause", 0 },
{ Event::MenuMode, "Enter options menu mode", 0 },
{ Event::CmdMenuMode, "Toggle command menu mode", 0 },
{ Event::DebuggerMode, "Toggle debugger mode", 0 },
{ Event::LauncherMode, "Enter ROM launcher", 0 },
{ Event::Quit, "Quit", 0 },
{ Event::ConsoleSelect, "Select", 0 },
{ Event::ConsoleReset, "Reset", 0 },
{ Event::ConsoleColor, "Color TV", 0 },
{ Event::ConsoleBlackWhite, "Black & White TV", 0 },
{ Event::ConsoleLeftDifficultyA, "P0 Difficulty A", 0 },
{ Event::ConsoleLeftDifficultyB, "P0 Difficulty B", 0 },
{ Event::ConsoleRightDifficultyA, "P1 Difficulty A", 0 },
{ Event::ConsoleRightDifficultyB, "P1 Difficulty B", 0 },
{ Event::SaveState, "Save State", 0 },
{ Event::ChangeState, "Change State", 0 },
{ Event::LoadState, "Load State", 0 },
{ Event::TakeSnapshot, "Snapshot", 0 },
{ Event::Fry, "Fry cartridge", 0 },
{ Event::VolumeDecrease, "Decrease volume", 0 },
{ Event::VolumeIncrease, "Increase volume", 0 },
{ Event::PauseMode, "Pause", 0 },
{ Event::MenuMode, "Enter options menu mode", 0 },
{ Event::CmdMenuMode, "Toggle command menu mode", 0 },
{ Event::DebuggerMode, "Toggle debugger mode", 0 },
{ Event::LauncherMode, "Enter ROM launcher", 0 },
{ Event::Quit, "Quit", 0 },
{ Event::JoystickZeroUp, "P0 Joystick Up", 0 },
{ Event::JoystickZeroDown, "P0 Joystick Down", 0 },
{ Event::JoystickZeroLeft, "P0 Joystick Left", 0 },
{ Event::JoystickZeroRight, "P0 Joystick Right", 0 },
{ Event::JoystickZeroFire, "P0 Joystick Fire", 0 },
{ Event::JoystickZeroUp, "P0 Joystick Up", 0 },
{ Event::JoystickZeroDown, "P0 Joystick Down", 0 },
{ Event::JoystickZeroLeft, "P0 Joystick Left", 0 },
{ Event::JoystickZeroRight, "P0 Joystick Right", 0 },
{ Event::JoystickZeroFire1, "P0 Joystick Fire", 0 },
{ Event::JoystickZeroFire2, "P0 Booster-Grip Trigger", 0 },
{ Event::JoystickZeroFire3, "P0 Booster-Grip Booster", 0 },
{ Event::JoystickOneUp, "P1 Joystick Up", 0 },
{ Event::JoystickOneDown, "P1 Joystick Down", 0 },
{ Event::JoystickOneLeft, "P1 Joystick Left", 0 },
{ Event::JoystickOneRight, "P1 Joystick Right", 0 },
{ Event::JoystickOneFire, "P1 Joystick Fire", 0 },
{ Event::JoystickOneUp, "P1 Joystick Up", 0 },
{ Event::JoystickOneDown, "P1 Joystick Down", 0 },
{ Event::JoystickOneLeft, "P1 Joystick Left", 0 },
{ Event::JoystickOneRight, "P1 Joystick Right", 0 },
{ Event::JoystickOneFire1, "P1 Joystick Fire", 0 },
{ Event::JoystickOneFire2, "P1 Booster-Grip Trigger", 0 },
{ Event::JoystickOneFire3, "P1 Booster-Grip Booster", 0 },
{ Event::PaddleZeroAnalog, "Paddle 0 Analog", 0 },
{ Event::PaddleZeroDecrease, "Paddle 0 Decrease", 0 },
{ Event::PaddleZeroIncrease, "Paddle 0 Increase", 0 },
{ Event::PaddleZeroFire, "Paddle 0 Fire", 0 },
{ Event::PaddleZeroAnalog, "Paddle 0 Analog", 0 },
{ Event::PaddleZeroDecrease, "Paddle 0 Decrease", 0 },
{ Event::PaddleZeroIncrease, "Paddle 0 Increase", 0 },
{ Event::PaddleZeroFire, "Paddle 0 Fire", 0 },
{ Event::PaddleOneAnalog, "Paddle 1 Analog", 0 },
{ Event::PaddleOneDecrease, "Paddle 1 Decrease", 0 },
{ Event::PaddleOneIncrease, "Paddle 1 Increase", 0 },
{ Event::PaddleOneFire, "Paddle 1 Fire", 0 },
{ Event::PaddleOneAnalog, "Paddle 1 Analog", 0 },
{ Event::PaddleOneDecrease, "Paddle 1 Decrease", 0 },
{ Event::PaddleOneIncrease, "Paddle 1 Increase", 0 },
{ Event::PaddleOneFire, "Paddle 1 Fire", 0 },
{ Event::PaddleTwoAnalog, "Paddle 2 Analog", 0 },
{ Event::PaddleTwoDecrease, "Paddle 2 Decrease", 0 },
{ Event::PaddleTwoIncrease, "Paddle 2 Increase", 0 },
{ Event::PaddleTwoFire, "Paddle 2 Fire", 0 },
{ Event::PaddleTwoAnalog, "Paddle 2 Analog", 0 },
{ Event::PaddleTwoDecrease, "Paddle 2 Decrease", 0 },
{ Event::PaddleTwoIncrease, "Paddle 2 Increase", 0 },
{ Event::PaddleTwoFire, "Paddle 2 Fire", 0 },
{ Event::PaddleThreeAnalog, "Paddle 3 Analog", 0 },
{ Event::PaddleThreeDecrease, "Paddle 3 Decrease", 0 },
{ Event::PaddleThreeIncrease, "Paddle 3 Increase", 0 },
{ Event::PaddleThreeFire, "Paddle 3 Fire", 0 },
{ Event::PaddleThreeAnalog, "Paddle 3 Analog", 0 },
{ Event::PaddleThreeDecrease, "Paddle 3 Decrease", 0 },
{ Event::PaddleThreeIncrease, "Paddle 3 Increase", 0 },
{ Event::PaddleThreeFire, "Paddle 3 Fire", 0 },
{ Event::BoosterGripZeroTrigger, "P0 Booster-Grip Trigger", 0 },
{ Event::BoosterGripZeroBooster, "P0 Booster-Grip Booster", 0 },
{ Event::KeyboardZero1, "P0 Keyboard 1", 0 },
{ Event::KeyboardZero2, "P0 Keyboard 2", 0 },
{ Event::KeyboardZero3, "P0 Keyboard 3", 0 },
{ Event::KeyboardZero4, "P0 Keyboard 4", 0 },
{ Event::KeyboardZero5, "P0 Keyboard 5", 0 },
{ Event::KeyboardZero6, "P0 Keyboard 6", 0 },
{ Event::KeyboardZero7, "P0 Keyboard 7", 0 },
{ Event::KeyboardZero8, "P0 Keyboard 8", 0 },
{ Event::KeyboardZero9, "P0 Keyboard 9", 0 },
{ Event::KeyboardZeroStar, "P0 Keyboard *", 0 },
{ Event::KeyboardZero0, "P0 Keyboard 0", 0 },
{ Event::KeyboardZeroPound, "P0 Keyboard #", 0 },
{ Event::BoosterGripOneTrigger, "P1 Booster-Grip Trigger", 0 },
{ Event::BoosterGripOneBooster, "P1 Booster-Grip Booster", 0 },
// { Event::DrivingZeroCounterClockwise, "P0 Driving Controller Left", 0 },
// { Event::DrivingZeroClockwise, "P0 Driving Controller Right", 0 },
// { Event::DrivingZeroFire, "P0 Driving Controller Fire", 0 },
// { Event::DrivingOneCounterClockwise, "P1 Driving Controller Left", 0 },
// { Event::DrivingOneClockwise, "P1 Driving Controller Right", 0 },
// { Event::DrivingOneFire, "P1 Driving Controller Fire", 0 },
{ Event::KeyboardZero1, "P0 Keyboard 1", 0 },
{ Event::KeyboardZero2, "P0 Keyboard 2", 0 },
{ Event::KeyboardZero3, "P0 Keyboard 3", 0 },
{ Event::KeyboardZero4, "P0 Keyboard 4", 0 },
{ Event::KeyboardZero5, "P0 Keyboard 5", 0 },
{ Event::KeyboardZero6, "P0 Keyboard 6", 0 },
{ Event::KeyboardZero7, "P0 Keyboard 7", 0 },
{ Event::KeyboardZero8, "P0 Keyboard 8", 0 },
{ Event::KeyboardZero9, "P0 Keyboard 9", 0 },
{ Event::KeyboardZeroStar, "P0 Keyboard *", 0 },
{ Event::KeyboardZero0, "P0 Keyboard 0", 0 },
{ Event::KeyboardZeroPound, "P0 Keyboard #", 0 },
{ Event::KeyboardOne1, "P1 Keyboard 1", 0 },
{ Event::KeyboardOne2, "P1 Keyboard 2", 0 },
{ Event::KeyboardOne3, "P1 Keyboard 3", 0 },
{ Event::KeyboardOne4, "P1 Keyboard 4", 0 },
{ Event::KeyboardOne5, "P1 Keyboard 5", 0 },
{ Event::KeyboardOne6, "P1 Keyboard 6", 0 },
{ Event::KeyboardOne7, "P1 Keyboard 7", 0 },
{ Event::KeyboardOne8, "P1 Keyboard 8", 0 },
{ Event::KeyboardOne9, "P1 Keyboard 9", 0 },
{ Event::KeyboardOneStar, "P1 Keyboard *", 0 },
{ Event::KeyboardOne0, "P1 Keyboard 0", 0 },
{ Event::KeyboardOnePound, "P1 Keyboard #", 0 }
{ Event::KeyboardOne1, "P1 Keyboard 1", 0 },
{ Event::KeyboardOne2, "P1 Keyboard 2", 0 },
{ Event::KeyboardOne3, "P1 Keyboard 3", 0 },
{ Event::KeyboardOne4, "P1 Keyboard 4", 0 },
{ Event::KeyboardOne5, "P1 Keyboard 5", 0 },
{ Event::KeyboardOne6, "P1 Keyboard 6", 0 },
{ Event::KeyboardOne7, "P1 Keyboard 7", 0 },
{ Event::KeyboardOne8, "P1 Keyboard 8", 0 },
{ Event::KeyboardOne9, "P1 Keyboard 9", 0 },
{ Event::KeyboardOneStar, "P1 Keyboard *", 0 },
{ Event::KeyboardOne0, "P1 Keyboard 0", 0 },
{ Event::KeyboardOnePound, "P1 Keyboard #", 0 }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2597,10 +2512,10 @@ const Event::Type EventHandler::SA_Axis[2][2][3] = {
// Used by the Stelladaptor to map button presses to joystick or paddles
// (driving controllers are considered the same as joysticks)
const Event::Type EventHandler::SA_Button[2][2][2] = {
{ {Event::JoystickZeroFire, Event::PaddleZeroFire },
{Event::NoType, Event::PaddleOneFire } },
{ {Event::JoystickOneFire, Event::PaddleTwoFire },
{Event::NoType, Event::PaddleThreeFire } }
{ {Event::JoystickZeroFire1, Event::PaddleZeroFire },
{Event::NoType, Event::PaddleOneFire } },
{ {Event::JoystickOneFire1, Event::PaddleTwoFire },
{Event::NoType, Event::PaddleThreeFire } }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.8 2007-10-03 21:41:18 stephena Exp $
// $Id: Joystick.cxx,v 1.9 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include "Event.hxx"
@ -29,7 +29,7 @@ Joystick::Joystick(Jack jack, const Event& event)
myDownEvent = Event::JoystickZeroDown;
myLeftEvent = Event::JoystickZeroLeft;
myRightEvent = Event::JoystickZeroRight;
myFireEvent = Event::JoystickZeroFire;
myFireEvent = Event::JoystickZeroFire1;
}
else
{
@ -37,7 +37,7 @@ Joystick::Joystick(Jack jack, const Event& event)
myDownEvent = Event::JoystickOneDown;
myLeftEvent = Event::JoystickOneLeft;
myRightEvent = Event::JoystickOneRight;
myFireEvent = Event::JoystickOneFire;
myFireEvent = Event::JoystickOneFire1;
}
// Analog pins are never used by the 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: OSystem.cxx,v 1.111 2007-09-23 17:04:17 stephena Exp $
// $Id: OSystem.cxx,v 1.112 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include <cassert>
@ -686,9 +686,9 @@ void OSystem::setDefaultJoymap()
mode = kEmulationMode; // Default emulation events
// Left joystick (assume joystick zero, button zero)
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroFire, mode, 0, 0);
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroFire1, mode, 0, 0);
// Right joystick (assume joystick one, button zero)
myEventHandler->setDefaultJoyMapping(Event::JoystickOneFire, mode, 1, 0);
myEventHandler->setDefaultJoyMapping(Event::JoystickOneFire1, mode, 1, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.9 2007-10-03 21:41:18 stephena Exp $
// $Id: Paddles.cxx,v 1.10 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include "Event.hxx"
@ -27,21 +27,49 @@ Paddles::Paddles(Jack jack, const Event& event, bool swap)
// Also consider whether this is the left or right port
if(myJack == Left)
{
myP1ResEvent =
swap ? Event::PaddleZeroResistance : Event::PaddleOneResistance;
myP2ResEvent =
swap ? Event::PaddleOneResistance : Event::PaddleZeroResistance;
myP1FireEvent = swap ? Event::PaddleZeroFire : Event::PaddleOneFire;
myP2FireEvent = swap ? Event::PaddleOneFire : Event::PaddleZeroFire;
if(swap)
{
myP0ResEvent = Event::PaddleZeroResistance;
myP0FireEvent1 = Event::PaddleZeroFire;
myP0FireEvent2 = Event::JoystickZeroFire1;
myP1ResEvent = Event::PaddleOneResistance;
myP1FireEvent1 = Event::PaddleOneFire;
myP1FireEvent2 = Event::JoystickZeroFire3;
}
else
{
myP0ResEvent = Event::PaddleOneResistance;
myP0FireEvent1 = Event::PaddleOneFire;
myP0FireEvent2 = Event::JoystickZeroFire3;
myP1ResEvent = Event::PaddleZeroResistance;
myP1FireEvent1 = Event::PaddleZeroFire;
myP1FireEvent2 = Event::JoystickZeroFire1;
}
}
else
{
myP1ResEvent =
swap ? Event::PaddleTwoResistance : Event::PaddleThreeResistance;
myP2ResEvent =
swap ? Event::PaddleThreeResistance : Event::PaddleTwoResistance;
myP1FireEvent = swap ? Event::PaddleTwoFire : Event::PaddleThreeFire;
myP2FireEvent = swap ? Event::PaddleThreeFire : Event::PaddleTwoFire;
if(swap)
{
myP0ResEvent = Event::PaddleTwoResistance;
myP0FireEvent1 = Event::PaddleTwoFire;
myP0FireEvent2 = Event::JoystickOneFire1;
myP1ResEvent = Event::PaddleThreeResistance;
myP1FireEvent1 = Event::PaddleThreeFire;
myP1FireEvent2 = Event::JoystickOneFire3;
}
else
{
myP0ResEvent = Event::PaddleThreeResistance;
myP0FireEvent1 = Event::PaddleThreeFire;
myP0FireEvent2 = Event::JoystickOneFire3;
myP1ResEvent = Event::PaddleTwoResistance;
myP1FireEvent1 = Event::PaddleTwoFire;
myP1FireEvent2 = Event::JoystickOneFire1;
}
}
// Digital pins 1, 2 and 6 are not connected
@ -58,9 +86,11 @@ Paddles::~Paddles()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::update()
{
myDigitalPinState[Three] = (myEvent.get(myP1FireEvent) == 0);
myDigitalPinState[Four] = (myEvent.get(myP2FireEvent) == 0);
myDigitalPinState[Three] =
(myEvent.get(myP0FireEvent1) == 0 && myEvent.get(myP0FireEvent2) == 0);
myDigitalPinState[Four] =
(myEvent.get(myP1FireEvent1) == 0 && myEvent.get(myP1FireEvent2) == 0);
myAnalogPinValue[Five] = myEvent.get(myP1ResEvent);
myAnalogPinValue[Nine] = myEvent.get(myP2ResEvent);
myAnalogPinValue[Five] = myEvent.get(myP0ResEvent);
myAnalogPinValue[Nine] = myEvent.get(myP1ResEvent);
}

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.8 2007-10-03 21:41:18 stephena Exp $
// $Id: Paddles.hxx,v 1.9 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#ifndef PADDLES_HXX
@ -27,7 +27,7 @@
The standard Atari 2600 pair of paddle controllers.
@author Bradford W. Mott
@version $Id: Paddles.hxx,v 1.8 2007-10-03 21:41:18 stephena Exp $
@version $Id: Paddles.hxx,v 1.9 2007-10-09 23:56:57 stephena Exp $
*/
class Paddles : public Controller
{
@ -56,7 +56,8 @@ class Paddles : public Controller
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 myP1ResEvent, myP2ResEvent, myP1FireEvent, myP2FireEvent;
Event::Type myP0ResEvent, myP1ResEvent, myP0FireEvent1, myP0FireEvent2,
myP1FireEvent1, myP1FireEvent2;
};
#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: StateManager.hxx,v 1.2 2007-10-03 21:41:18 stephena Exp $
// $Id: StateManager.hxx,v 1.3 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#ifndef STATE_MANAGER_HXX
@ -30,7 +30,7 @@ class OSystem;
played back.
@author Stephen Anthony
@version $Id: StateManager.hxx,v 1.2 2007-10-03 21:41:18 stephena Exp $
@version $Id: StateManager.hxx,v 1.3 2007-10-09 23:56:57 stephena Exp $
*/
class StateManager
{
@ -99,6 +99,10 @@ class StateManager
kRewindRecordMode
};
enum {
kVersion = 001
};
// The parent OSystem object
OSystem* myOSystem;

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: TrackBall22.cxx,v 1.1 2007-10-03 21:41:18 stephena Exp $
// $Id: TrackBall22.cxx,v 1.2 2007-10-09 23:56:57 stephena Exp $
//============================================================================
#include "Event.hxx"
@ -31,7 +31,7 @@ TrackBall22::TrackBall22(Jack jack, const Event& event)
myDownEvent = Event::JoystickZeroDown;
myLeftEvent = Event::JoystickZeroLeft;
myRightEvent = Event::JoystickZeroRight;
myFireEvent = Event::JoystickZeroFire;
myFireEvent = Event::JoystickZeroFire1;
}
else
{
@ -39,7 +39,7 @@ TrackBall22::TrackBall22(Jack jack, const Event& event)
myDownEvent = Event::JoystickOneDown;
myLeftEvent = Event::JoystickOneLeft;
myRightEvent = Event::JoystickOneRight;
myFireEvent = Event::JoystickOneFire;
myFireEvent = Event::JoystickOneFire1;
}
// Analog pins are never used by the CX-22

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: GameInfoDialog.cxx,v 1.43 2007-09-10 15:46:59 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.44 2007-10-09 23:56:57 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -119,7 +119,7 @@ GameInfoDialog::GameInfoDialog(
pwidth = font.getStringWidth("CV (Commavid extra ram)");
myType = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
for(i = 0; i < 21; ++i)
for(i = 0; i < 22; ++i)
myType->appendEntry(ourCartridgeList[i][0], i+1);
wid.push_back(myType);
@ -681,11 +681,12 @@ const char* GameInfoDialog::ourControllerList[5][2] = {
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* GameInfoDialog::ourCartridgeList[21][2] = {
const char* GameInfoDialog::ourCartridgeList[22][2] = {
{ "Auto-detect", "AUTO-DETECT" },
{ "2K (2K Atari)", "2K" },
{ "3E (32K Tigervision)", "3E" },
{ "3F (512K Tigervision)", "3F" },
{ "4A50 (64K 4A50 + ram)", "4A50" },
{ "4K (4K Atari)", "4K" },
{ "AR (Supercharger)", "AR" },
{ "CV (Commavid extra ram)", "CV" },

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: GameInfoDialog.hxx,v 1.24 2007-09-06 02:15:00 stephena Exp $
// $Id: GameInfoDialog.hxx,v 1.25 2007-10-09 23:56:57 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -107,7 +107,7 @@ class GameInfoDialog : public Dialog, public CommandSender
bool myDefaultsSelected;
/** Holds static strings for Cartridge type */
static const char* ourCartridgeList[21][2];
static const char* ourCartridgeList[22][2];
/** Holds static strings for Controller type */
static const char* ourControllerList[5][2];