mirror of https://github.com/stella-emu/stella.git
converting MAC EOLs (CR,CR) to DOS (CR,LF). The vs2005 wince compiler complains about this.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1300 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
83f6670d20
commit
6a75af29d8
|
@ -1,135 +1,135 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
// 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-2007 by Bradford W. Mott and the Stella team
|
// Copyright (c) 1995-2007 by 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.
|
||||||
//
|
//
|
||||||
// $Id: Driving.cxx,v 1.9 2007-01-05 17:54:14 stephena Exp $
|
// $Id: Driving.cxx,v 1.10 2007-01-23 09:30:22 knakos Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "Event.hxx"
|
#include "Event.hxx"
|
||||||
#include "Driving.hxx"
|
#include "Driving.hxx"
|
||||||
#include "System.hxx"
|
#include "System.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Driving::Driving(Jack jack, const Event& event)
|
Driving::Driving(Jack jack, const Event& event)
|
||||||
: Controller(jack, event, Controller::Driving),
|
: Controller(jack, event, Controller::Driving),
|
||||||
myCounter(0)
|
myCounter(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Driving::~Driving()
|
Driving::~Driving()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Driving::read(DigitalPin pin)
|
bool Driving::read(DigitalPin pin)
|
||||||
{
|
{
|
||||||
// Gray codes for clockwise rotation
|
// Gray codes for clockwise rotation
|
||||||
static const uInt8 clockwise[] = { 0x03, 0x01, 0x00, 0x02 };
|
static const uInt8 clockwise[] = { 0x03, 0x01, 0x00, 0x02 };
|
||||||
|
|
||||||
// Gray codes for counter-clockwise rotation
|
// Gray codes for counter-clockwise rotation
|
||||||
static const uInt8 counterclockwise[] = { 0x03, 0x02, 0x00, 0x01 };
|
static const uInt8 counterclockwise[] = { 0x03, 0x02, 0x00, 0x01 };
|
||||||
|
|
||||||
// Delay used for moving through the gray code tables
|
// Delay used for moving through the gray code tables
|
||||||
const uInt32 delay = 20;
|
const uInt32 delay = 20;
|
||||||
|
|
||||||
switch(pin)
|
switch(pin)
|
||||||
{
|
{
|
||||||
case One:
|
case One:
|
||||||
++myCounter;
|
++myCounter;
|
||||||
|
|
||||||
if(myJack == Left)
|
if(myJack == Left)
|
||||||
{
|
{
|
||||||
if(myEvent.get(Event::DrivingZeroCounterClockwise) != 0)
|
if(myEvent.get(Event::DrivingZeroCounterClockwise) != 0)
|
||||||
{
|
{
|
||||||
return (counterclockwise[(myCounter / delay) & 0x03] & 0x01) != 0;
|
return (counterclockwise[(myCounter / delay) & 0x03] & 0x01) != 0;
|
||||||
}
|
}
|
||||||
else if(myEvent.get(Event::DrivingZeroClockwise) != 0)
|
else if(myEvent.get(Event::DrivingZeroClockwise) != 0)
|
||||||
{
|
{
|
||||||
return (clockwise[(myCounter / delay) & 0x03] & 0x01) != 0;
|
return (clockwise[(myCounter / delay) & 0x03] & 0x01) != 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return(myEvent.get(Event::DrivingZeroValue) & 0x01);
|
return(myEvent.get(Event::DrivingZeroValue) & 0x01);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(myEvent.get(Event::DrivingOneCounterClockwise) != 0)
|
if(myEvent.get(Event::DrivingOneCounterClockwise) != 0)
|
||||||
{
|
{
|
||||||
return (counterclockwise[(myCounter / delay) & 0x03] & 0x01) != 0;
|
return (counterclockwise[(myCounter / delay) & 0x03] & 0x01) != 0;
|
||||||
}
|
}
|
||||||
else if(myEvent.get(Event::DrivingOneClockwise) != 0)
|
else if(myEvent.get(Event::DrivingOneClockwise) != 0)
|
||||||
{
|
{
|
||||||
return (clockwise[(myCounter / delay) & 0x03] & 0x01) != 0;
|
return (clockwise[(myCounter / delay) & 0x03] & 0x01) != 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return(myEvent.get(Event::DrivingOneValue) & 0x01);
|
return(myEvent.get(Event::DrivingOneValue) & 0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
case Two:
|
case Two:
|
||||||
if(myJack == Left)
|
if(myJack == Left)
|
||||||
{
|
{
|
||||||
if(myEvent.get(Event::DrivingZeroCounterClockwise) != 0)
|
if(myEvent.get(Event::DrivingZeroCounterClockwise) != 0)
|
||||||
{
|
{
|
||||||
return (counterclockwise[(myCounter / delay) & 0x03] & 0x02) != 0;
|
return (counterclockwise[(myCounter / delay) & 0x03] & 0x02) != 0;
|
||||||
}
|
}
|
||||||
else if(myEvent.get(Event::DrivingZeroClockwise) != 0)
|
else if(myEvent.get(Event::DrivingZeroClockwise) != 0)
|
||||||
{
|
{
|
||||||
return (clockwise[(myCounter / delay) & 0x03] & 0x02) != 0;
|
return (clockwise[(myCounter / delay) & 0x03] & 0x02) != 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return(myEvent.get(Event::DrivingZeroValue) & 0x02);
|
return(myEvent.get(Event::DrivingZeroValue) & 0x02);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(myEvent.get(Event::DrivingOneCounterClockwise) != 0)
|
if(myEvent.get(Event::DrivingOneCounterClockwise) != 0)
|
||||||
{
|
{
|
||||||
return (counterclockwise[(myCounter / delay) & 0x03] & 0x02) != 0;
|
return (counterclockwise[(myCounter / delay) & 0x03] & 0x02) != 0;
|
||||||
}
|
}
|
||||||
else if(myEvent.get(Event::DrivingOneClockwise) != 0)
|
else if(myEvent.get(Event::DrivingOneClockwise) != 0)
|
||||||
{
|
{
|
||||||
return (clockwise[(myCounter / delay) & 0x03] & 0x02) != 0;
|
return (clockwise[(myCounter / delay) & 0x03] & 0x02) != 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return(myEvent.get(Event::DrivingOneValue) & 0x02);
|
return(myEvent.get(Event::DrivingOneValue) & 0x02);
|
||||||
}
|
}
|
||||||
|
|
||||||
case Three:
|
case Three:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Four:
|
case Four:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Six:
|
case Six:
|
||||||
return (myJack == Left) ? (myEvent.get(Event::DrivingZeroFire) == 0) :
|
return (myJack == Left) ? (myEvent.get(Event::DrivingZeroFire) == 0) :
|
||||||
(myEvent.get(Event::DrivingOneFire) == 0);
|
(myEvent.get(Event::DrivingOneFire) == 0);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Int32 Driving::read(AnalogPin)
|
Int32 Driving::read(AnalogPin)
|
||||||
{
|
{
|
||||||
// Analog pins are not connect in driving controller so we have
|
// Analog pins are not connect in driving controller so we have
|
||||||
// infinite resistance
|
// infinite resistance
|
||||||
return maximumResistance;
|
return maximumResistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Driving::write(DigitalPin, bool)
|
void Driving::write(DigitalPin, bool)
|
||||||
{
|
{
|
||||||
// Writing doesn't do anything to the driving controller...
|
// Writing doesn't do anything to the driving controller...
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,127 +1,127 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
// SSSS tt lll lll
|
// SSSS tt lll lll
|
||||||
// SS SS tt ll ll
|
// SS SS tt ll ll
|
||||||
// SS tttttt eeee ll ll aaaa
|
// SS tttttt eeee ll ll aaaa
|
||||||
// SSSS tt ee ee ll ll aa
|
// SSSS tt ee ee ll ll aa
|
||||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
// 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-2007 by Bradford W. Mott and the Stella team
|
// Copyright (c) 1995-2007 by 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.
|
||||||
//
|
//
|
||||||
// $Id: Event.hxx,v 1.25 2007-01-01 18:04:47 stephena Exp $
|
// $Id: Event.hxx,v 1.26 2007-01-23 09:30:22 knakos Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef EVENT_HXX
|
#ifndef EVENT_HXX
|
||||||
#define EVENT_HXX
|
#define EVENT_HXX
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
class Event;
|
class Event;
|
||||||
class EventStreamer;
|
class EventStreamer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: Event.hxx,v 1.25 2007-01-01 18:04:47 stephena Exp $
|
@version $Id: Event.hxx,v 1.26 2007-01-23 09:30:22 knakos Exp $
|
||||||
*/
|
*/
|
||||||
class Event
|
class Event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Enumeration of all possible events in Stella, including both
|
Enumeration of all possible events in Stella, including both
|
||||||
console and controller event types as well as events that aren't
|
console and controller event types as well as events that aren't
|
||||||
technically part of the emulation core
|
technically part of the emulation core
|
||||||
*/
|
*/
|
||||||
enum Type
|
enum Type
|
||||||
{
|
{
|
||||||
NoType,
|
NoType,
|
||||||
ConsoleOn, ConsoleOff, ConsoleColor, ConsoleBlackWhite,
|
ConsoleOn, ConsoleOff, ConsoleColor, ConsoleBlackWhite,
|
||||||
ConsoleLeftDifficultyA, ConsoleLeftDifficultyB,
|
ConsoleLeftDifficultyA, ConsoleLeftDifficultyB,
|
||||||
ConsoleRightDifficultyA, ConsoleRightDifficultyB,
|
ConsoleRightDifficultyA, ConsoleRightDifficultyB,
|
||||||
ConsoleSelect, ConsoleReset,
|
ConsoleSelect, ConsoleReset,
|
||||||
|
|
||||||
JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft,
|
JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft,
|
||||||
JoystickZeroRight, JoystickZeroFire,
|
JoystickZeroRight, JoystickZeroFire,
|
||||||
JoystickOneUp, JoystickOneDown, JoystickOneLeft,
|
JoystickOneUp, JoystickOneDown, JoystickOneLeft,
|
||||||
JoystickOneRight, JoystickOneFire,
|
JoystickOneRight, JoystickOneFire,
|
||||||
|
|
||||||
BoosterGripZeroTrigger, BoosterGripZeroBooster,
|
BoosterGripZeroTrigger, BoosterGripZeroBooster,
|
||||||
BoosterGripOneTrigger, BoosterGripOneBooster,
|
BoosterGripOneTrigger, BoosterGripOneBooster,
|
||||||
|
|
||||||
PaddleZeroResistance, PaddleZeroFire,
|
PaddleZeroResistance, PaddleZeroFire,
|
||||||
PaddleZeroDecrease, PaddleZeroIncrease, PaddleZeroAnalog,
|
PaddleZeroDecrease, PaddleZeroIncrease, PaddleZeroAnalog,
|
||||||
PaddleOneResistance, PaddleOneFire,
|
PaddleOneResistance, PaddleOneFire,
|
||||||
PaddleOneDecrease, PaddleOneIncrease, PaddleOneAnalog,
|
PaddleOneDecrease, PaddleOneIncrease, PaddleOneAnalog,
|
||||||
PaddleTwoResistance, PaddleTwoFire,
|
PaddleTwoResistance, PaddleTwoFire,
|
||||||
PaddleTwoDecrease, PaddleTwoIncrease, PaddleTwoAnalog,
|
PaddleTwoDecrease, PaddleTwoIncrease, PaddleTwoAnalog,
|
||||||
PaddleThreeResistance, PaddleThreeFire,
|
PaddleThreeResistance, PaddleThreeFire,
|
||||||
PaddleThreeDecrease, PaddleThreeIncrease, PaddleThreeAnalog,
|
PaddleThreeDecrease, PaddleThreeIncrease, PaddleThreeAnalog,
|
||||||
|
|
||||||
KeyboardZero1, KeyboardZero2, KeyboardZero3,
|
KeyboardZero1, KeyboardZero2, KeyboardZero3,
|
||||||
KeyboardZero4, KeyboardZero5, KeyboardZero6,
|
KeyboardZero4, KeyboardZero5, KeyboardZero6,
|
||||||
KeyboardZero7, KeyboardZero8, KeyboardZero9,
|
KeyboardZero7, KeyboardZero8, KeyboardZero9,
|
||||||
KeyboardZeroStar, KeyboardZero0, KeyboardZeroPound,
|
KeyboardZeroStar, KeyboardZero0, KeyboardZeroPound,
|
||||||
|
|
||||||
KeyboardOne1, KeyboardOne2, KeyboardOne3,
|
KeyboardOne1, KeyboardOne2, KeyboardOne3,
|
||||||
KeyboardOne4, KeyboardOne5, KeyboardOne6,
|
KeyboardOne4, KeyboardOne5, KeyboardOne6,
|
||||||
KeyboardOne7, KeyboardOne8, KeyboardOne9,
|
KeyboardOne7, KeyboardOne8, KeyboardOne9,
|
||||||
KeyboardOneStar, KeyboardOne0, KeyboardOnePound,
|
KeyboardOneStar, KeyboardOne0, KeyboardOnePound,
|
||||||
|
|
||||||
DrivingZeroClockwise, DrivingZeroCounterClockwise, DrivingZeroValue,
|
DrivingZeroClockwise, DrivingZeroCounterClockwise, DrivingZeroValue,
|
||||||
DrivingZeroFire,
|
DrivingZeroFire,
|
||||||
DrivingOneClockwise, DrivingOneCounterClockwise, DrivingOneValue,
|
DrivingOneClockwise, DrivingOneCounterClockwise, DrivingOneValue,
|
||||||
DrivingOneFire,
|
DrivingOneFire,
|
||||||
|
|
||||||
ChangeState, LoadState, SaveState, TakeSnapshot, Quit,
|
ChangeState, LoadState, SaveState, TakeSnapshot, Quit,
|
||||||
MenuMode, CmdMenuMode, DebuggerMode, LauncherMode, Fry,
|
MenuMode, CmdMenuMode, DebuggerMode, LauncherMode, Fry,
|
||||||
VolumeDecrease, VolumeIncrease,
|
VolumeDecrease, VolumeIncrease,
|
||||||
|
|
||||||
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
|
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
|
||||||
UISelect, UINavPrev, UINavNext, UITabPrev, UITabNext, UIOK, UICancel,
|
UISelect, UINavPrev, UINavNext, UITabPrev, UITabNext, UIOK, UICancel,
|
||||||
|
|
||||||
LastType
|
LastType
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Create a new event object and use the given eventstreamer
|
Create a new event object and use the given eventstreamer
|
||||||
*/
|
*/
|
||||||
Event(EventStreamer* ev);
|
Event(EventStreamer* ev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor
|
Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~Event();
|
virtual ~Event();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Get the value associated with the event of the specified type
|
Get the value associated with the event of the specified type
|
||||||
*/
|
*/
|
||||||
virtual Int32 get(Type type) const;
|
virtual Int32 get(Type type) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the value associated with the event of the specified type
|
Set the value associated with the event of the specified type
|
||||||
*/
|
*/
|
||||||
virtual void set(Type type, Int32 value);
|
virtual void set(Type type, Int32 value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clears the event array (resets to initial state)
|
Clears the event array (resets to initial state)
|
||||||
*/
|
*/
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Number of event types there are
|
// Number of event types there are
|
||||||
const Int32 myNumberOfTypes;
|
const Int32 myNumberOfTypes;
|
||||||
|
|
||||||
// Array of values associated with each event type
|
// Array of values associated with each event type
|
||||||
Int32 myValues[LastType];
|
Int32 myValues[LastType];
|
||||||
|
|
||||||
// The eventstreamer to record events to
|
// The eventstreamer to record events to
|
||||||
EventStreamer* myEventStreamer;
|
EventStreamer* myEventStreamer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue