diff --git a/stella/src/emucore/AtariVox.cxx b/stella/src/emucore/AtariVox.cxx index 52f4efc5d..0c2912bbe 100644 --- a/stella/src/emucore/AtariVox.cxx +++ b/stella/src/emucore/AtariVox.cxx @@ -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; } diff --git a/stella/src/emucore/AtariVox.hxx b/stella/src/emucore/AtariVox.hxx index ad5cd6b74..b7469b51a 100644 --- a/stella/src/emucore/AtariVox.hxx +++ b/stella/src/emucore/AtariVox.hxx @@ -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 diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index b0988ccc7..148538706 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.cxx @@ -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 @@ -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); diff --git a/stella/src/emucore/Control.cxx b/stella/src/emucore/Control.cxx index 6d6408bcc..d0ae42e76 100644 --- a/stella/src/emucore/Control.cxx +++ b/stella/src/emucore/Control.cxx @@ -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 @@ -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; diff --git a/stella/src/emucore/Control.hxx b/stella/src/emucore/Control.hxx index 4637fd57d..69e2c5f79 100644 --- a/stella/src/emucore/Control.hxx +++ b/stella/src/emucore/Control.hxx @@ -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; diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index 3b00fb439..e1c969433 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -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 @@ -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 diff --git a/stella/src/emucore/SerialPort.hxx b/stella/src/emucore/SerialPort.hxx index 4058ed2be..debdee887 100644 --- a/stella/src/emucore/SerialPort.hxx +++ b/stella/src/emucore/SerialPort.hxx @@ -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. diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 61052a4b1..be991de36 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.cxx @@ -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 @@ -99,6 +99,7 @@ Settings::Settings(OSystem* osystem) setInternal("autoslot", "false"); setInternal("showinfo", "false"); setInternal("tiafloat", "true"); + setInternal("avoxport", ""); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/GameInfoDialog.cxx b/stella/src/gui/GameInfoDialog.cxx index 4b71365c0..31400aa45 100644 --- a/stella/src/gui/GameInfoDialog.cxx +++ b/stella/src/gui/GameInfoDialog.cxx @@ -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" }, diff --git a/stella/src/gui/GameInfoDialog.hxx b/stella/src/gui/GameInfoDialog.hxx index f081dfa9f..1735b5c59 100644 --- a/stella/src/gui/GameInfoDialog.hxx +++ b/stella/src/gui/GameInfoDialog.hxx @@ -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 */ diff --git a/stella/src/gui/InputDialog.cxx b/stella/src/gui/InputDialog.cxx index 98d41e25a..bb8668850 100644 --- a/stella/src/gui/InputDialog.cxx +++ b/stella/src/gui/InputDialog.cxx @@ -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()); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/InputDialog.hxx b/stella/src/gui/InputDialog.hxx index accb93ab6..77b94b0d7 100644 --- a/stella/src/gui/InputDialog.hxx +++ b/stella/src/gui/InputDialog.hxx @@ -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 diff --git a/stella/src/unix/SerialPortUNIX.cxx b/stella/src/unix/SerialPortUNIX.cxx index d6dc4b1e6..4ce6d2b18 100644 --- a/stella/src/unix/SerialPortUNIX.cxx +++ b/stella/src/unix/SerialPortUNIX.cxx @@ -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 @@ -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; diff --git a/stella/src/unix/SerialPortUNIX.hxx b/stella/src/unix/SerialPortUNIX.hxx index 8e2886fe8..e6107da50 100644 --- a/stella/src/unix/SerialPortUNIX.hxx +++ b/stella/src/unix/SerialPortUNIX.hxx @@ -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. diff --git a/stella/src/win32/SerialPortWin32.cxx b/stella/src/win32/SerialPortWin32.cxx index 508c6f596..8809e71fe 100644 --- a/stella/src/win32/SerialPortWin32.cxx +++ b/stella/src/win32/SerialPortWin32.cxx @@ -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 @@ -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) diff --git a/stella/src/win32/SerialPortWin32.hxx b/stella/src/win32/SerialPortWin32.hxx index f7363a4c8..b7351d365 100644 --- a/stella/src/win32/SerialPortWin32.hxx +++ b/stella/src/win32/SerialPortWin32.hxx @@ -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.