1
0
Fork 0

Make it possible to disable alsa. Fix various compiler and configure related bugs. Hopefully fixes 1677839, 1678736, 1693635,1697017 and the various email reports

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2855
This commit is contained in:
Peter Veenstra 2007-05-15 15:51:30 +00:00
parent 481d37adf6
commit 0911359ee9
4 changed files with 92 additions and 44 deletions

View file

@ -5,39 +5,13 @@
/*****************************************************************************/
// C++ SDLnet wrapper
// Socket inheritance
#if defined LINUX || defined OS2
#define CAPWORD (NETWRAPPER_TCP|NETWRAPPER_TCP_NATIVESOCKET)
#ifdef OS2
typedef int socklen_t;
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define SOCKET int
#elif defined WIN32
#define CAPWORD (NETWRAPPER_TCP|NETWRAPPER_TCP_NATIVESOCKET)
#include <winsock.h>
typedef int socklen_t;
#elif defined __APPLE__
#define CAPWORD (NETWRAPPER_TCP|NETWRAPPER_TCP_NATIVESOCKET)
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define SOCKET socklen_t
#else
#define CAPWORD NETWRAPPER_TCP
#endif
#include "misc_util.h"
struct _TCPsocketX {
int ready;
#ifdef NATIVESOCKETS
SOCKET channel;
#endif
IPaddress remoteAddress;
IPaddress localAddress;
int sflag;
@ -67,7 +41,7 @@ TCPClientSocket::TCPClientSocket(int platformsocket) {
// fill the SDL socket manually
((struct _TCPsocketX*)nativetcpstruct)->ready=0;
((struct _TCPsocketX*)nativetcpstruct)->sflag=0;
((struct _TCPsocketX*)nativetcpstruct)->channel=platformsocket;
((struct _TCPsocketX*)nativetcpstruct)->channel=(SOCKET) platformsocket;
sockaddr_in sa;
socklen_t sz;
sz=sizeof(sa);
@ -146,7 +120,8 @@ TCPClientSocket::TCPClientSocket(const char* destination, Bit16u port) {
listensocketset=0;
IPaddress openip;
if (!SDLNet_ResolveHost(&openip,destination,port)) {
//Ancient versions of SDL_net had this as char*. People still appear to be using this one.
if (!SDLNet_ResolveHost(&openip,const_cast<char*>(destination),port)) {
listensocketset = SDLNet_AllocSocketSet(1);
if(!listensocketset) return;
mysock = SDLNet_TCP_Open(&openip);

View file

@ -1,24 +1,48 @@
#ifndef SDLNETWRAPPER_H
#define SDLNETWRAPPER_H
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#if C_MODEM
#include "SDL_net.h"
# ifndef DOSBOX_SUPPORT_H
#include "support.h"
#if defined LINUX || defined OS2
#define NATIVESOCKETS
#elif defined WIN32
#define NATIVESOCKETS
#else
#endif
// Netwrapper Capabilities
#define NETWRAPPER_TCP 1
#define NETWRAPPER_TCP_NATIVESOCKET 2
#if defined WIN32
#define NATIVESOCKETS
#include <winsock2.h>
#include <ws2tcpip.h> //for socklen_t
//typedef int socklen_t;
//Tests for BSD/OS2/LINUX
#elif defined HAVE_STDLIB_H && defined HAVE_SYS_TYPES_H && defined HAVE_SYS_SOCKET_H && defined HAVE_NETINET_IN_H
#define NATIVESOCKETS
#define SOCKET int
#include <stdio.h> //darwin
#include <stdlib.h> //darwin
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
//socklen_t should be handled by configure
#endif
#ifdef NATIVESOCKETS
#define CAPWORD (NETWRAPPER_TCP|NETWRAPPER_TCP_NATIVESOCKET)
#else
#define CAPWORD NETWRAPPER_TCP
#endif
#include "SDL_net.h"
Bit32u Netwrapper_GetCapabilities();
@ -74,6 +98,6 @@ class TCPServerSocket {
};
#endif
#endif //C_MODEM
#endif //#if C_MODEM
#endif //# SDLNETWRAPPER_H

View file

@ -90,6 +90,7 @@ CNullModem::CNullModem(Bitu id, CommandLine* cmd):CSerial (id, cmd) {
}
// socket inheritance
if(getBituSubstring("inhsocket:", &bool_temp, cmd)) {
#ifdef NATIVESOCKETS
if(Netwrapper_GetCapabilities()&NETWRAPPER_TCP_NATIVESOCKET) {
if(bool_temp==1) {
int sock;
@ -128,6 +129,7 @@ CNullModem::CNullModem(Bitu id, CommandLine* cmd):CSerial (id, cmd) {
}
}
} else {
#endif
LOG_MSG("Serial%d: socket inheritance not supported on this platform.",
COMNUMBER);
return;