mirror of https://github.com/stella-emu/stella.git
Added infrastructure for 'smart' controllers, which need access to the
System object. Eventually, this will lead to more accurate emulation for Driving controllers, and hopefully support TrakBall/Amiga/ST mouse as well. Fixed snapshot bug where a snapshot included the CommandDialog UI when launched from that mode. Bumped version number to 2.3.6. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1318 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
0d7ee2f4d6
commit
8874d38323
|
@ -13,13 +13,13 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Version.hxx,v 1.25 2007-01-17 13:17:42 stephena Exp $
|
||||
// $Id: Version.hxx,v 1.26 2007-02-22 02:15:46 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef VERSION_HXX
|
||||
#define VERSION_HXX
|
||||
|
||||
#define STELLA_BASE_VERSION "2.3.5"
|
||||
#define STELLA_BASE_VERSION "2.3.6cvs"
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
#define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD
|
||||
|
|
|
@ -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: AtariVox.hxx,v 1.6 2007-01-01 18:04:44 stephena Exp $
|
||||
// $Id: AtariVox.hxx,v 1.7 2007-02-22 02:15:46 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef ATARIVOX_SUPPORT
|
||||
|
@ -22,8 +22,6 @@
|
|||
#ifndef ATARIVOX_HXX
|
||||
#define ATARIVOX_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "System.hxx"
|
||||
#include "Control.hxx"
|
||||
#include "SpeakJet.hxx"
|
||||
|
||||
|
@ -35,7 +33,7 @@
|
|||
driver code.
|
||||
|
||||
@author B. Watson
|
||||
@version $Id: AtariVox.hxx,v 1.6 2007-01-01 18:04:44 stephena Exp $
|
||||
@version $Id: AtariVox.hxx,v 1.7 2007-02-22 02:15:46 stephena Exp $
|
||||
*/
|
||||
class AtariVox : public Controller
|
||||
{
|
||||
|
@ -66,7 +64,7 @@ class AtariVox : public Controller
|
|||
Read the resistance at the specified analog pin for this controller.
|
||||
The returned value is the resistance measured in ohms.
|
||||
|
||||
The AtariVox doesn't use the analog pins.
|
||||
The AtariVox doesn't use the analog pins.
|
||||
|
||||
@param pin The pin of the controller jack to read
|
||||
@return The resistance at the specified pin
|
||||
|
@ -83,52 +81,42 @@ class AtariVox : public Controller
|
|||
*/
|
||||
virtual void write(DigitalPin pin, bool value);
|
||||
|
||||
void setSystem(System *system);
|
||||
|
||||
SpeakJet* getSpeakJet() { return mySpeakJet; }
|
||||
|
||||
private:
|
||||
void clockDataIn(bool value);
|
||||
void shiftIn(bool value);
|
||||
void clockDataIn(bool value);
|
||||
void shiftIn(bool value);
|
||||
|
||||
private:
|
||||
// How far off (in CPU cycles) can each write occur from when it's
|
||||
// supposed to happen? Eventually, this will become a user-settable
|
||||
// property... or it may turn out to be unnecessary.
|
||||
// property... or it may turn out to be unnecessary.
|
||||
enum { TIMING_SLOP = 0 };
|
||||
|
||||
private:
|
||||
// Instance of SpeakJet which will actually do the talking for us.
|
||||
// Instance of SpeakJet which will actually do the talking for us.
|
||||
// In the future, we'll support both real and emulated SpeakJet
|
||||
// chips; for now we only emulate it.
|
||||
SpeakJet *mySpeakJet;
|
||||
SpeakJet *mySpeakJet;
|
||||
|
||||
// Hang on to a reference to the system, for timing purposes. Data
|
||||
// bits are supposed to come in 62 CPU cycles apart (plus or minus
|
||||
// TIMING_SLOP), so we need to be able to call mySystem.cycles().
|
||||
System *mySystem;
|
||||
|
||||
private:
|
||||
// State of the output pins
|
||||
uInt8 myPinState;
|
||||
|
||||
// How many bits have been shifted into the shift register?
|
||||
uInt8 myShiftCount;
|
||||
// How many bits have been shifted into the shift register?
|
||||
uInt8 myShiftCount;
|
||||
|
||||
private:
|
||||
// Shift register. Data comes in serially:
|
||||
// 1 start bit, always 0
|
||||
// 8 data bits, LSB first
|
||||
// 1 stop bit, always 1
|
||||
uInt16 myShiftRegister;
|
||||
// Shift register. Data comes in serially:
|
||||
// 1 start bit, always 0
|
||||
// 8 data bits, LSB first
|
||||
// 1 stop bit, always 1
|
||||
uInt16 myShiftRegister;
|
||||
|
||||
private:
|
||||
// When did the last data write start, in CPU cycles?
|
||||
// The real SpeakJet chip reads data at 19200 bits/sec. Alex's
|
||||
// driver code sends data at 62 CPU cycles per bit, which is
|
||||
// "close enough".
|
||||
// The real SpeakJet chip reads data at 19200 bits/sec. Alex's
|
||||
// driver code sends data at 62 CPU cycles per bit, which is
|
||||
// "close enough".
|
||||
uInt32 myLastDataWriteCycle;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // ATARIVOX_SUPPORT
|
||||
|
|
|
@ -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.125 2007-02-06 23:34:31 stephena Exp $
|
||||
// $Id: Console.cxx,v 1.126 2007-02-22 02:15:46 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -77,8 +77,8 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
|||
loadUserPalette();
|
||||
|
||||
// Setup the controllers based on properties
|
||||
string left = myProperties.get(Controller_Left);
|
||||
string right = myProperties.get(Controller_Right);
|
||||
const string& left = myProperties.get(Controller_Left);
|
||||
const string& right = myProperties.get(Controller_Right);
|
||||
|
||||
// Swap the ports if necessary
|
||||
int leftPort, rightPort;
|
||||
|
@ -116,10 +116,6 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
|||
myControllers[leftPort] = new Joystick(Controller::Left, *myEvent);
|
||||
}
|
||||
|
||||
#ifdef ATARIVOX_SUPPORT
|
||||
vox = 0;
|
||||
#endif
|
||||
|
||||
// Construct right controller
|
||||
if(right == "BOOSTER-GRIP")
|
||||
{
|
||||
|
@ -137,10 +133,10 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
|||
{
|
||||
myControllers[rightPort] = new Paddles(Controller::Right, *myEvent, swapPaddles);
|
||||
}
|
||||
#ifdef ATARIVOX_SUPPORT
|
||||
#ifdef ATARIVOX_SUPPORT
|
||||
else if(right == "ATARIVOX")
|
||||
{
|
||||
myControllers[rightPort] = vox = new AtariVox(Controller::Right, *myEvent);
|
||||
myControllers[rightPort] = new AtariVox(Controller::Right, *myEvent);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
|
@ -154,12 +150,9 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
|||
// Now, we can construct the system and components
|
||||
mySystem = new System(13, 6);
|
||||
|
||||
// AtariVox is a smart peripheral; it needs access to the system
|
||||
// cycles counter, so it needs a reference to the System
|
||||
#ifdef ATARIVOX_SUPPORT
|
||||
if(vox)
|
||||
vox->setSystem(mySystem);
|
||||
#endif
|
||||
// Inform the controllers about the system
|
||||
myControllers[0]->setSystem(mySystem);
|
||||
myControllers[1]->setSystem(mySystem);
|
||||
|
||||
M6502* m6502;
|
||||
if(myOSystem->settings().getString("cpu") == "low")
|
||||
|
|
|
@ -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.8 2007-01-05 17:54:09 stephena Exp $
|
||||
// $Id: Control.hxx,v 1.9 2007-02-22 02:15:46 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CONTROLLER_HXX
|
||||
|
@ -21,6 +21,7 @@
|
|||
|
||||
class Controller;
|
||||
class Event;
|
||||
class System;
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
|
@ -55,7 +56,7 @@ class Event;
|
|||
of the controller from the perspective of the controller's jack.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Control.hxx,v 1.8 2007-01-05 17:54:09 stephena Exp $
|
||||
@version $Id: Control.hxx,v 1.9 2007-02-22 02:15:46 stephena Exp $
|
||||
*/
|
||||
class Controller
|
||||
{
|
||||
|
@ -97,6 +98,11 @@ class Controller
|
|||
*/
|
||||
const Type type();
|
||||
|
||||
/**
|
||||
Inform this controller about the current System.
|
||||
*/
|
||||
void setSystem(System* system) { mySystem = system; }
|
||||
|
||||
public:
|
||||
/**
|
||||
Enumeration of the digital pins of a controller port
|
||||
|
@ -159,6 +165,9 @@ class Controller
|
|||
/// Specifies which type of controller this is (defined by child classes)
|
||||
const Type myType;
|
||||
|
||||
/// Pointer to the System object (used for timing purposes)
|
||||
System* mySystem;
|
||||
|
||||
protected:
|
||||
// Copy constructor isn't supported by controllers so make it private
|
||||
Controller(const Controller&);
|
||||
|
|
|
@ -13,10 +13,11 @@
|
|||
// 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.10 2007-01-23 09:30:22 knakos Exp $
|
||||
// $Id: Driving.cxx,v 1.11 2007-02-22 02:15:46 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
|
||||
#include "Event.hxx"
|
||||
#include "Driving.hxx"
|
||||
#include "System.hxx"
|
||||
|
|
|
@ -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.201 2007-02-06 23:34:33 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.202 2007-02-22 02:15:46 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -1259,26 +1259,6 @@ bool EventHandler::eventStateChange(Event::Type type)
|
|||
return handled;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::createMouseMotionEvent(int x, int y)
|
||||
{
|
||||
SDL_WarpMouse(x, y);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::createMouseButtonEvent(int x, int y, int state)
|
||||
{
|
||||
// Synthesize an left mouse button press/release event
|
||||
SDL_MouseButtonEvent mouseEvent;
|
||||
mouseEvent.type = state ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP;
|
||||
mouseEvent.button = SDL_BUTTON_LEFT;
|
||||
mouseEvent.state = state ? SDL_PRESSED : SDL_RELEASED;
|
||||
mouseEvent.x = x;
|
||||
mouseEvent.y = y;
|
||||
|
||||
handleMouseButtonEvent((SDL_Event&)mouseEvent, state);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::setActionMappings(EventMode mode)
|
||||
{
|
||||
|
|
|
@ -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: EventHandler.hxx,v 1.101 2007-01-30 17:13:10 stephena Exp $
|
||||
// $Id: EventHandler.hxx,v 1.102 2007-02-22 02:15:46 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENTHANDLER_HXX
|
||||
|
@ -62,7 +62,7 @@ enum EventMode {
|
|||
mapping can take place.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: EventHandler.hxx,v 1.101 2007-01-30 17:13:10 stephena Exp $
|
||||
@version $Id: EventHandler.hxx,v 1.102 2007-02-22 02:15:46 stephena Exp $
|
||||
*/
|
||||
class EventHandler
|
||||
{
|
||||
|
@ -265,23 +265,6 @@ class EventHandler
|
|||
|
||||
inline bool frying() { return myFryingFlag; }
|
||||
|
||||
/**
|
||||
Create a synthetic SDL mouse motion event based on the given x,y values.
|
||||
|
||||
@param x The x coordinate of motion, scaled in value
|
||||
@param y The y coordinate of motion, scaled in value
|
||||
*/
|
||||
void createMouseMotionEvent(int x, int y);
|
||||
|
||||
/**
|
||||
Create a synthetic SDL mouse button event based on the given x,y values.
|
||||
|
||||
@param x The x coordinate of motion, scaled in value
|
||||
@param y The y coordinate of motion, scaled in value
|
||||
@param state The state of the button click (on or off)
|
||||
*/
|
||||
void createMouseButtonEvent(int x, int y, int state);
|
||||
|
||||
inline SDL_Joystick* getJoystick(int i) { return ourJoysticks[i].stick; }
|
||||
|
||||
StringList getActionList(EventMode mode);
|
||||
|
|
|
@ -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: TIA.hxx,v 1.41 2007-01-06 21:13:29 stephena Exp $
|
||||
// $Id: TIA.hxx,v 1.42 2007-02-22 02:15:46 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef TIA_HXX
|
||||
|
@ -42,7 +42,7 @@ class Settings;
|
|||
be displayed on screen.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: TIA.hxx,v 1.41 2007-01-06 21:13:29 stephena Exp $
|
||||
@version $Id: TIA.hxx,v 1.42 2007-02-22 02:15:46 stephena Exp $
|
||||
*/
|
||||
class TIA : public Device , public MediaSource
|
||||
{
|
||||
|
@ -165,14 +165,14 @@ class TIA : public Device , public MediaSource
|
|||
/**
|
||||
Answers the total number of scanlines the media source generated
|
||||
in producing the current frame buffer. For partial frames, this
|
||||
will be the current scanline.
|
||||
will be the current scanline.
|
||||
|
||||
@return The total number of scanlines generated
|
||||
*/
|
||||
uInt32 scanlines() const;
|
||||
|
||||
/**
|
||||
Answers the current color clock we've gotten to on this scanline.
|
||||
Answers the current color clock we've gotten to on this scanline.
|
||||
|
||||
@return The current color clock
|
||||
*/
|
||||
|
|
|
@ -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: CommandDialog.cxx,v 1.14 2007-01-01 19:55:56 stephena Exp $
|
||||
// $Id: CommandDialog.cxx,v 1.15 2007-02-22 02:15:46 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -177,7 +177,10 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
|
||||
case kSnapshotCmd:
|
||||
event = Event::TakeSnapshot;
|
||||
instance()->eventHandler().leaveMenuMode();
|
||||
instance()->eventHandler().refreshDisplay(true);
|
||||
instance()->eventHandler().handleEvent(Event::TakeSnapshot, 1);
|
||||
execute = false;
|
||||
break;
|
||||
|
||||
case kFormatCmd:
|
||||
|
|
Loading…
Reference in New Issue