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