mirror of https://github.com/stella-emu/stella.git
Cleaned up the SerialPort API a little, and removed ability to change
bad, parity, stop bits, etc. Since the AVox is the only device using this, and I don't see any new devices making use of it any time soon, it doesn't make sense to over-engineer the class. Added '-avoxport' commandline argument and associated UI setting to set the serial port the AVox will use. I *was* thinking about auto-detecting this, but apparently it isn't supported on all platforms. Added AtariVox as a controller type selectable from the GameInfoDialog. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1465 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
de5a387f47
commit
fb3f6a347f
|
@ -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: AtariVox.cxx,v 1.12 2008-04-11 01:28:35 stephena Exp $
|
||||
// $Id: AtariVox.cxx,v 1.13 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef SPEAKJET_EMULATION
|
||||
|
@ -27,7 +27,8 @@
|
|||
#define DEBUG_ATARIVOX 0
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AtariVox::AtariVox(Jack jack, const Event& event, const SerialPort& port)
|
||||
AtariVox::AtariVox(Jack jack, const Event& event, const SerialPort& port,
|
||||
const string& device)
|
||||
: Controller(jack, event, Controller::AtariVox),
|
||||
mySerialPort((SerialPort*)&port),
|
||||
myPinState(0),
|
||||
|
@ -35,10 +36,15 @@ AtariVox::AtariVox(Jack jack, const Event& event, const SerialPort& port)
|
|||
myShiftRegister(0),
|
||||
myLastDataWriteCycle(0)
|
||||
{
|
||||
#ifdef SPEAKJET_EMULATION
|
||||
#ifndef SPEAKJET_EMULATION
|
||||
if(mySerialPort->openPort(device))
|
||||
myAboutString = " (using serial port \'" + device + "\')";
|
||||
else
|
||||
myAboutString = " (invalid serial port \'" + device + "\')";
|
||||
#else
|
||||
mySpeakJet = new SpeakJet();
|
||||
myAboutString = " (emulating SpeakJet device)";
|
||||
#endif
|
||||
mySerialPort->openPort("", -1, -1, -1, -1);
|
||||
|
||||
myDigitalPinState[One] = myDigitalPinState[Two] =
|
||||
myDigitalPinState[Three] = myDigitalPinState[Four] = true;
|
||||
|
@ -49,10 +55,11 @@ AtariVox::AtariVox(Jack jack, const Event& event, const SerialPort& port)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AtariVox::~AtariVox()
|
||||
{
|
||||
#ifdef SPEAKJET_EMULATION
|
||||
#ifndef SPEAKJET_EMULATION
|
||||
mySerialPort->closePort();
|
||||
#else
|
||||
delete mySpeakJet;
|
||||
#endif
|
||||
mySerialPort->closePort();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -72,7 +79,7 @@ void AtariVox::write(DigitalPin pin, bool value)
|
|||
|
||||
// Pin 2: SpeakJet READY
|
||||
case Two:
|
||||
// TODO - see how this is used
|
||||
// TODO - read READY signal from serial port
|
||||
break;
|
||||
|
||||
// Pin 3: EEPROM SDA
|
||||
|
@ -152,33 +159,35 @@ void AtariVox::clockDataIn(bool value)
|
|||
if(DEBUG_ATARIVOX)
|
||||
cerr << "cycle >= myLastDataWriteCycle + 62, shiftIn("
|
||||
<< value << ")" << endl;
|
||||
shiftIn(value);
|
||||
|
||||
myShiftRegister >>= 1;
|
||||
myShiftRegister |= (value << 15);
|
||||
if(++myShiftCount == 10)
|
||||
{
|
||||
myShiftCount = 0;
|
||||
myShiftRegister >>= 6;
|
||||
if(!(myShiftRegister & (1<<9)))
|
||||
cerr << "AtariVox: bad start bit" << endl;
|
||||
else if((myShiftRegister & 1))
|
||||
cerr << "AtariVox: bad stop bit" << endl;
|
||||
else
|
||||
{
|
||||
uInt8 data = ((myShiftRegister >> 1) & 0xff);
|
||||
#ifndef SPEAKJET_EMULATION
|
||||
mySerialPort->writeByte(&data);
|
||||
#else
|
||||
mySpeakJet->write(data);
|
||||
#endif
|
||||
}
|
||||
myShiftRegister = 0;
|
||||
}
|
||||
}
|
||||
|
||||
myLastDataWriteCycle = cycle;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void AtariVox::shiftIn(bool value)
|
||||
string AtariVox::about() const
|
||||
{
|
||||
myShiftRegister >>= 1;
|
||||
myShiftRegister |= (value << 15);
|
||||
if(++myShiftCount == 10)
|
||||
{
|
||||
myShiftCount = 0;
|
||||
myShiftRegister >>= 6;
|
||||
if(!(myShiftRegister & (1<<9)))
|
||||
cerr << "AtariVox: bad start bit" << endl;
|
||||
else if((myShiftRegister & 1))
|
||||
cerr << "AtariVox: bad stop bit" << endl;
|
||||
else
|
||||
{
|
||||
uInt8 data = ((myShiftRegister >> 1) & 0xff);
|
||||
#ifdef SPEAKJET_EMULATION
|
||||
mySpeakJet->write(data);
|
||||
#endif
|
||||
mySerialPort->writeByte(&data);
|
||||
}
|
||||
myShiftRegister = 0;
|
||||
}
|
||||
return Controller::about() + myAboutString;
|
||||
}
|
||||
|
|
|
@ -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: AtariVox.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $
|
||||
// $Id: AtariVox.hxx,v 1.11 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef ATARIVOX_HXX
|
||||
|
@ -32,7 +32,7 @@ class SpeakJet;
|
|||
driver code.
|
||||
|
||||
@author B. Watson
|
||||
@version $Id: AtariVox.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $
|
||||
@version $Id: AtariVox.hxx,v 1.11 2008-04-11 17:56:34 stephena Exp $
|
||||
*/
|
||||
class AtariVox : public Controller
|
||||
{
|
||||
|
@ -40,10 +40,13 @@ class AtariVox : public Controller
|
|||
/**
|
||||
Create a new AtariVox controller plugged into the specified jack
|
||||
|
||||
@param jack The jack the controller is plugged into
|
||||
@param event The event object to use for events
|
||||
@param jack The jack the controller is plugged into
|
||||
@param event The event object to use for events
|
||||
@param port The serial port object
|
||||
@param device Name of the port used for reading and writing
|
||||
*/
|
||||
AtariVox(Jack jack, const Event& event, const SerialPort& port);
|
||||
AtariVox(Jack jack, const Event& event, const SerialPort& port,
|
||||
const string& device);
|
||||
|
||||
/**
|
||||
Destructor
|
||||
|
@ -67,6 +70,8 @@ class AtariVox : public Controller
|
|||
*/
|
||||
virtual void update();
|
||||
|
||||
virtual string about() const;
|
||||
|
||||
#ifdef SPEAKJET_EMULATION
|
||||
SpeakJet* getSpeakJet() { return mySpeakJet; }
|
||||
#endif
|
||||
|
@ -108,6 +113,9 @@ class AtariVox : public Controller
|
|||
// driver code sends data at 62 CPU cycles per bit, which is
|
||||
// "close enough".
|
||||
uInt32 myLastDataWriteCycle;
|
||||
|
||||
// Holds information concerning serial port usage
|
||||
string myAboutString;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.135 2008-03-31 00:59:30 stephena Exp $
|
||||
// $Id: Console.cxx,v 1.136 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -150,7 +150,8 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
|||
else if(right == "ATARIVOX")
|
||||
{
|
||||
myControllers[rightPort] = myAVox =
|
||||
new AtariVox(Controller::Right, *myEvent, myOSystem->serialPort());
|
||||
new AtariVox(Controller::Right, *myEvent, myOSystem->serialPort(),
|
||||
myOSystem->settings().getString("avoxport"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -192,8 +193,10 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
|||
|
||||
// Query some info about this console
|
||||
ostringstream buf;
|
||||
buf << " Cart Name: " << myProperties.get(Cartridge_Name) << endl
|
||||
<< " Cart MD5: " << myProperties.get(Cartridge_MD5) << endl;
|
||||
buf << " Cart Name: " << myProperties.get(Cartridge_Name) << endl
|
||||
<< " Cart MD5: " << myProperties.get(Cartridge_MD5) << endl
|
||||
<< " Controller 0: " << myControllers[0]->about() << endl
|
||||
<< " Controller 1: " << myControllers[1]->about() << endl;
|
||||
|
||||
// Auto-detect NTSC/PAL mode if it's requested
|
||||
myDisplayFormat = myProperties.get(Display_Format);
|
||||
|
|
|
@ -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.cxx,v 1.8 2008-02-06 13:45:21 stephena Exp $
|
||||
// $Id: Control.cxx,v 1.9 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -157,6 +157,12 @@ string Controller::name() const
|
|||
return myName;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Controller::about() const
|
||||
{
|
||||
return name() + " in " + (myJack == Left ? "left port" : "right port");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Int32 Controller::maximumResistance = 0x7FFFFFFF;
|
||||
|
||||
|
|
|
@ -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.11 2008-02-06 13:45:21 stephena Exp $
|
||||
// $Id: Control.hxx,v 1.12 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CONTROLLER_HXX
|
||||
|
@ -57,7 +57,7 @@ class System;
|
|||
of the controller from the perspective of the controller's jack.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Control.hxx,v 1.11 2008-02-06 13:45:21 stephena Exp $
|
||||
@version $Id: Control.hxx,v 1.12 2008-04-11 17:56:34 stephena Exp $
|
||||
*/
|
||||
class Controller : public Serializable
|
||||
{
|
||||
|
@ -176,6 +176,11 @@ class Controller : public Serializable
|
|||
*/
|
||||
virtual string name() const;
|
||||
|
||||
/**
|
||||
Returns more detailed information about this controller.
|
||||
*/
|
||||
virtual string about() const;
|
||||
|
||||
public:
|
||||
/// Constant which represents maximum resistance for analog pins
|
||||
static const Int32 maximumResistance;
|
||||
|
|
|
@ -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.122 2008-04-11 00:29:15 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.123 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -441,7 +441,7 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum)
|
|||
myFrameBuffer->showMessage("New console created");
|
||||
if(mySettings->getBool("showinfo"))
|
||||
cout << "Game console created:" << endl
|
||||
<< " ROM file: " << myRomFile << endl
|
||||
<< " ROM file: " << myRomFile << endl << endl
|
||||
<< myConsole->about() << endl;
|
||||
|
||||
// Update the timing info for a new console run
|
||||
|
|
|
@ -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: SerialPort.hxx,v 1.3 2008-04-11 00:29:15 stephena Exp $
|
||||
// $Id: SerialPort.hxx,v 1.4 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SERIALPORT_HXX
|
||||
|
@ -23,11 +23,11 @@
|
|||
|
||||
/**
|
||||
This class provides an interface for a standard serial port.
|
||||
For now, this used when connecting a real AtariVox device,
|
||||
but it may be used for other devices in the future.
|
||||
For now, this is used when connecting a real AtariVox device,
|
||||
and as such it always uses 19200, 8n1, no flow control.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: SerialPort.hxx,v 1.3 2008-04-11 00:29:15 stephena Exp $
|
||||
@version $Id: SerialPort.hxx,v 1.4 2008-04-11 17:56:34 stephena Exp $
|
||||
*/
|
||||
class SerialPort
|
||||
{
|
||||
|
@ -39,15 +39,9 @@ class SerialPort
|
|||
Open the given serial port with the specified attributes.
|
||||
|
||||
@param device The name of the port
|
||||
@param baud Baud rate
|
||||
@param data Number of data bits
|
||||
@param stop Number of stop bits
|
||||
@param parity Type of parity bit (0=none, 1=odd, 2=even)
|
||||
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool openPort(const string& device, int baud, int data,
|
||||
int stop, int parity) { return false; }
|
||||
virtual bool openPort(const string& device) { return false; }
|
||||
|
||||
/**
|
||||
Close a previously opened serial port.
|
||||
|
|
|
@ -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: Settings.cxx,v 1.141 2008-03-30 15:47:10 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.142 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -99,6 +99,7 @@ Settings::Settings(OSystem* osystem)
|
|||
setInternal("autoslot", "false");
|
||||
setInternal("showinfo", "false");
|
||||
setInternal("tiafloat", "true");
|
||||
setInternal("avoxport", "");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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.52 2008-03-26 00:52:05 stephena Exp $
|
||||
// $Id: GameInfoDialog.cxx,v 1.53 2008-04-11 17:56:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -176,7 +176,7 @@ GameInfoDialog::GameInfoDialog(
|
|||
"P0 Controller:", kTextAlignLeft);
|
||||
myP0Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
|
||||
pwidth, lineHeight, "", 0, 0);
|
||||
for(i = 0; i < 5; ++i)
|
||||
for(i = 0; i < kNumControllerTypes; ++i)
|
||||
myP0Controller->appendEntry(ourControllerList[i][0], i+1);
|
||||
wid.push_back(myP0Controller);
|
||||
|
||||
|
@ -195,7 +195,7 @@ GameInfoDialog::GameInfoDialog(
|
|||
"P1 Controller:", kTextAlignLeft);
|
||||
myP1Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
|
||||
pwidth, lineHeight, "", 0, 0);
|
||||
for(i = 0; i < 5; ++i)
|
||||
for(i = 0; i < kNumControllerTypes; ++i)
|
||||
myP1Controller->appendEntry(ourControllerList[i][0], i+1);
|
||||
wid.push_back(myP1Controller);
|
||||
|
||||
|
@ -419,21 +419,21 @@ void GameInfoDialog::loadView()
|
|||
|
||||
// Controller properties
|
||||
s = myGameProperties.get(Controller_Left);
|
||||
for(i = 0; i < 5; ++i)
|
||||
for(i = 0; i < kNumControllerTypes; ++i)
|
||||
{
|
||||
if(s == ourControllerList[i][1])
|
||||
break;
|
||||
}
|
||||
i = (i == 5) ? 0: i + 1;
|
||||
i = (i == kNumControllerTypes) ? 0: i + 1;
|
||||
myP0Controller->setSelectedTag(i);
|
||||
|
||||
s = myGameProperties.get(Controller_Right);
|
||||
for(i = 0; i < 5; ++i)
|
||||
for(i = 0; i < kNumControllerTypes; ++i)
|
||||
{
|
||||
if(s == ourControllerList[i][1])
|
||||
break;
|
||||
}
|
||||
i = (i == 5) ? 0: i + 1;
|
||||
i = (i == kNumControllerTypes) ? 0: i + 1;
|
||||
myP1Controller->setSelectedTag(i);
|
||||
|
||||
s = myGameProperties.get(Controller_SwapPaddles);
|
||||
|
@ -672,6 +672,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const char* GameInfoDialog::ourControllerList[kNumControllerTypes][2] = {
|
||||
{ "AtariVox", "ATARIVOX" },
|
||||
{ "Booster-Grip", "BOOSTER-GRIP" },
|
||||
{ "Driving", "DRIVING" },
|
||||
{ "Keyboard", "KEYBOARD" },
|
||||
|
|
|
@ -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.30 2008-03-22 17:35:03 stephena Exp $
|
||||
// $Id: GameInfoDialog.hxx,v 1.31 2008-04-11 17:56:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -99,7 +99,7 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
kPhosphorChanged = 'PPch',
|
||||
kPPBlendChanged = 'PBch',
|
||||
kNumCartTypes = 25,
|
||||
kNumControllerTypes = 5
|
||||
kNumControllerTypes = 6
|
||||
};
|
||||
|
||||
/** Game properties for currently loaded ROM */
|
||||
|
|
|
@ -13,17 +13,18 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: InputDialog.cxx,v 1.30 2008-03-23 16:22:46 stephena Exp $
|
||||
// $Id: InputDialog.cxx,v 1.31 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
#include "Array.hxx"
|
||||
#include "EventMappingWidget.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "Paddles.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "EventMappingWidget.hxx"
|
||||
#include "EditTextWidget.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "TabWidget.hxx"
|
||||
#include "Widget.hxx"
|
||||
|
||||
|
@ -92,7 +93,8 @@ InputDialog::~InputDialog()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputDialog::addVDeviceTab(const GUI::Font& font)
|
||||
{
|
||||
const int lineHeight = font.getLineHeight();
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontHeight = font.getFontHeight();
|
||||
int xpos, ypos, lwidth, pwidth, tabID;
|
||||
WidgetArray wid;
|
||||
|
||||
|
@ -142,6 +144,15 @@ void InputDialog::addVDeviceTab(const GUI::Font& font)
|
|||
myPaddleLabel->setFlags(WIDGET_CLEARBG);
|
||||
wid.push_back(myPaddleSpeed);
|
||||
|
||||
// Add AtariVox serial port
|
||||
xpos = 5; ypos += 2*lineHeight;
|
||||
int fwidth = _w - xpos - lwidth - 20;
|
||||
new StaticTextWidget(myTab, font, xpos, ypos, lwidth, fontHeight,
|
||||
"AVox serial port:", kTextAlignLeft);
|
||||
myAVoxPort = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
|
||||
fwidth, fontHeight, "");
|
||||
wid.push_back(myAVoxPort);
|
||||
|
||||
// Add items for virtual device ports
|
||||
addToFocusList(wid, tabID);
|
||||
}
|
||||
|
@ -165,6 +176,9 @@ void InputDialog::loadConfig()
|
|||
myPaddleSpeed->setValue(instance()->settings().getInt("pspeed"));
|
||||
myPaddleLabel->setLabel(instance()->settings().getString("pspeed"));
|
||||
|
||||
// AtariVox serial port
|
||||
myAVoxPort->setEditString(instance()->settings().getString("avoxport"));
|
||||
|
||||
myTab->loadConfig();
|
||||
}
|
||||
|
||||
|
@ -172,8 +186,8 @@ void InputDialog::loadConfig()
|
|||
void InputDialog::saveConfig()
|
||||
{
|
||||
// Left & right ports
|
||||
string sa1 = myLeftPort->getSelectedTag() == 2 ? "right" : "left";
|
||||
string sa2 = myRightPort->getSelectedTag() == 2 ? "right" : "left";
|
||||
const string& sa1 = myLeftPort->getSelectedTag() == 2 ? "right" : "left";
|
||||
const string& sa2 = myRightPort->getSelectedTag() == 2 ? "right" : "left";
|
||||
instance()->eventHandler().mapStelladaptors(sa1, sa2);
|
||||
|
||||
// Paddle mode
|
||||
|
@ -183,6 +197,9 @@ void InputDialog::saveConfig()
|
|||
int speed = myPaddleSpeed->getValue();
|
||||
instance()->settings().setInt("pspeed", speed);
|
||||
Paddles::setDigitalSpeed(speed);
|
||||
|
||||
// AtariVox serial port
|
||||
instance()->settings().setString("avoxport", myAVoxPort->getEditString());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: InputDialog.hxx,v 1.16 2008-03-22 17:35:03 stephena Exp $
|
||||
// $Id: InputDialog.hxx,v 1.17 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef INPUT_DIALOG_HXX
|
||||
|
@ -24,6 +24,7 @@ class GuiObject;
|
|||
class TabWidget;
|
||||
class EventMappingWidget;
|
||||
class CheckBoxWidget;
|
||||
class EditTextWidget;
|
||||
class PopUpWidget;
|
||||
class SliderWidget;
|
||||
class StaticTextWidget;
|
||||
|
@ -71,6 +72,7 @@ class InputDialog : public Dialog
|
|||
StaticTextWidget* myPaddleModeLabel;
|
||||
SliderWidget* myPaddleSpeed;
|
||||
StaticTextWidget* myPaddleLabel;
|
||||
EditTextWidget* myAVoxPort;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: SerialPortUNIX.cxx,v 1.3 2008-04-11 01:28:35 stephena Exp $
|
||||
// $Id: SerialPortUNIX.cxx,v 1.4 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -39,10 +39,9 @@ SerialPortUNIX::~SerialPortUNIX()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SerialPortUNIX::openPort(const string& device, int baud, int data,
|
||||
int stop, int parity)
|
||||
bool SerialPortUNIX::openPort(const string& device)
|
||||
{
|
||||
myHandle = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NONBLOCK);
|
||||
myHandle = open(device.c_str(), O_RDWR | O_NOCTTY | O_NONBLOCK);
|
||||
if(myHandle <= 0)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -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: SerialPortUNIX.hxx,v 1.3 2008-04-11 01:28:35 stephena Exp $
|
||||
// $Id: SerialPortUNIX.hxx,v 1.4 2008-04-11 17:56:34 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SERIALPORT_UNIX_HXX
|
||||
|
@ -26,7 +26,7 @@
|
|||
it seems to be Linux-only, and reading isn't actually supported at all.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: SerialPortUNIX.hxx,v 1.3 2008-04-11 01:28:35 stephena Exp $
|
||||
@version $Id: SerialPortUNIX.hxx,v 1.4 2008-04-11 17:56:34 stephena Exp $
|
||||
*/
|
||||
class SerialPortUNIX : public SerialPort
|
||||
{
|
||||
|
@ -38,14 +38,9 @@ class SerialPortUNIX : public SerialPort
|
|||
Open the given serial port with the specified attributes.
|
||||
|
||||
@param device The name of the port
|
||||
@param baud Baud rate
|
||||
@param data Number of data bits
|
||||
@param stop Number of stop bits
|
||||
@param parity Type of parity bit (0=none, 1=odd, 2=even)
|
||||
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
bool openPort(const string& device, int baud, int data, int stop, int parity);
|
||||
bool openPort(const string& device);
|
||||
|
||||
/**
|
||||
Close a previously opened serial port.
|
||||
|
|
|
@ -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: SerialPortWin32.cxx,v 1.1 2008-04-11 00:29:15 stephena Exp $
|
||||
// $Id: SerialPortWin32.cxx,v 1.2 2008-04-11 17:56:35 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -33,8 +33,7 @@ SerialPortWin32::~SerialPortWin32()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SerialPortWin32::openPort(const string& device, int baud, int data,
|
||||
int stop, int parity)
|
||||
bool SerialPortWin32::openPort(const string& device)
|
||||
{
|
||||
if(!myHandle)
|
||||
{
|
||||
|
@ -43,7 +42,7 @@ bool SerialPortWin32::openPort(const string& device, int baud, int data,
|
|||
//
|
||||
// GetDlgItemText(IDC_CMB_PORTS, str);
|
||||
|
||||
myHandle = CreateFile("COM3", GENERIC_READ|GENERIC_WRITE, 0,
|
||||
myHandle = CreateFile(device.c_str(), GENERIC_READ|GENERIC_WRITE, 0,
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
||||
if(myHandle)
|
||||
|
|
|
@ -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: SerialPortWin32.hxx,v 1.1 2008-04-11 00:29:15 stephena Exp $
|
||||
// $Id: SerialPortWin32.hxx,v 1.2 2008-04-11 17:56:35 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SERIALPORT_WIN32_HXX
|
||||
|
@ -25,7 +25,7 @@
|
|||
Implement reading and writing from a serial port under Windows systems.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: SerialPortWin32.hxx,v 1.1 2008-04-11 00:29:15 stephena Exp $
|
||||
@version $Id: SerialPortWin32.hxx,v 1.2 2008-04-11 17:56:35 stephena Exp $
|
||||
*/
|
||||
class SerialPortWin32 : public SerialPort
|
||||
{
|
||||
|
@ -37,14 +37,9 @@ class SerialPortWin32 : public SerialPort
|
|||
Open the given serial port with the specified attributes.
|
||||
|
||||
@param device The name of the port
|
||||
@param baud Baud rate
|
||||
@param data Number of data bits
|
||||
@param stop Number of stop bits
|
||||
@param parity Type of parity bit (0=none, 1=odd, 2=even)
|
||||
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
bool openPort(const string& device, int baud, int data, int stop, int parity);
|
||||
bool openPort(const string& device);
|
||||
|
||||
/**
|
||||
Close a previously opened serial port.
|
||||
|
|
Loading…
Reference in New Issue