Update directserial to new configclass. Thanks h-a-l-9000
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3181
This commit is contained in:
parent
d044321864
commit
4dbecf269c
2 changed files with 23 additions and 36 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: directserial_win32.cpp,v 1.5 2007-01-13 08:35:49 qbix79 Exp $ */
|
||||
/* $Id: directserial_win32.cpp,v 1.6 2008-07-14 20:06:19 qbix79 Exp $ */
|
||||
|
||||
#include "dosbox.h"
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
|||
CDirectSerial::CDirectSerial (Bitu id, CommandLine* cmd)
|
||||
:CSerial (id, cmd) {
|
||||
InstallationSuccessful = false;
|
||||
|
||||
hCom = INVALID_HANDLE_VALUE; // else destructor may close an invalid handle
|
||||
rx_retry = 0;
|
||||
rx_retry_max = 0;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: serialport.cpp,v 1.8 2007-12-06 17:44:19 qbix79 Exp $ */
|
||||
/* $Id: serialport.cpp,v 1.9 2008-07-14 20:06:19 qbix79 Exp $ */
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -1166,68 +1166,55 @@ bool CSerial::Putchar(Bit8u data, bool wait_dsr, bool wait_cts, Bitu timeout) {
|
|||
class SERIALPORTS:public Module_base {
|
||||
public:
|
||||
SERIALPORTS (Section * configuration):Module_base (configuration) {
|
||||
|
||||
Bit16u biosParameter[4] = { 0, 0, 0, 0 };
|
||||
Section_prop *section = static_cast <Section_prop*>(configuration);
|
||||
|
||||
const char *configstrings[4] = {
|
||||
section->Get_string ("serial1"),
|
||||
section->Get_string ("serial2"),
|
||||
section->Get_string ("serial3"),
|
||||
section->Get_string ("serial4")
|
||||
};
|
||||
// iterate through all 4 com ports
|
||||
for (Bitu i = 0; i < 4; i++) {
|
||||
biosParameter[i] = serial_baseaddr[i];
|
||||
|
||||
CommandLine* cmd;
|
||||
std::string str;
|
||||
cmd=new CommandLine(0,configstrings[i]);
|
||||
cmd->FindCommand(1,str);
|
||||
char s_property[] = "serialx";
|
||||
for(Bitu i = 0; i < 4; i++) {
|
||||
// get the configuration property
|
||||
s_property[6] = '1' + i;
|
||||
Prop_multival* p = section->Get_multival(s_property);
|
||||
std::string type = p->GetSection()->Get_string("type");
|
||||
CommandLine cmd(0,p->GetSection()->Get_string("parameters"));
|
||||
|
||||
if(!str.compare("dummy")) {
|
||||
serialports[i] = new CSerialDummy (i, cmd);
|
||||
// detect the type
|
||||
if (type=="dummy") {
|
||||
serialports[i] = new CSerialDummy (i, &cmd);
|
||||
}
|
||||
#ifdef DIRECTSERIAL_AVAILIBLE
|
||||
else if(!str.compare("directserial")) {
|
||||
serialports[i] = new CDirectSerial (i, cmd);
|
||||
else if (type=="directserial") {
|
||||
serialports[i] = new CDirectSerial (i, &cmd);
|
||||
if (!serialports[i]->InstallationSuccessful) {
|
||||
// serial port name was wrong or already in use
|
||||
delete serialports[i];
|
||||
serialports[i] = NULL;
|
||||
biosParameter[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if C_MODEM
|
||||
else if(!str.compare("modem")) {
|
||||
serialports[i] = new CSerialModem (i, cmd);
|
||||
else if(type=="modem") {
|
||||
serialports[i] = new CSerialModem (i, &cmd);
|
||||
if (!serialports[i]->InstallationSuccessful) {
|
||||
delete serialports[i];
|
||||
serialports[i] = NULL;
|
||||
biosParameter[i] = 0;
|
||||
}
|
||||
}
|
||||
else if(!str.compare("nullmodem")) {
|
||||
serialports[i] = new CNullModem (i, cmd);
|
||||
else if(type=="nullmodem") {
|
||||
serialports[i] = new CNullModem (i, &cmd);
|
||||
if (!serialports[i]->InstallationSuccessful) {
|
||||
delete serialports[i];
|
||||
serialports[i] = NULL;
|
||||
biosParameter[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if(!str.compare("disabled")) {
|
||||
else if(type=="disabled") {
|
||||
serialports[i] = NULL;
|
||||
biosParameter[i] = 0;
|
||||
} else {
|
||||
LOG_MSG ("Invalid type for COM%d.", i + 1);
|
||||
serialports[i] = NULL;
|
||||
biosParameter[i] = 0;
|
||||
LOG_MSG("Invalid type for serial%d",i+1);
|
||||
}
|
||||
delete cmd;
|
||||
} // for
|
||||
if(serialports[i]) biosParameter[i] = serial_baseaddr[i];
|
||||
} // for 1-4
|
||||
BIOS_SetComPorts (biosParameter);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue