player: amiga-support

Proper Amiga-suport is supplied by using the AmiTCP stack when
USE_AMITCP is enabled. Add explicit OpenLibrary/CloseLibrary
calls, for those people who don't link against auto-opening
libs ala VBCC's auto.s.

Add a typedef for uint32_t (needed for network communication)
for Motorola 68k platforms.

Also add a SAS/C support for the 'inline' keyword.

Thanks to Aske Simon Christensen for help with the SAS/C support.
This commit is contained in:
Erik Faye-Lund 2011-03-17 00:42:23 +01:00
parent dbe3cc7dcf
commit b3825514b2
2 changed files with 29 additions and 1 deletions

View File

@ -7,7 +7,7 @@
/* configure inline keyword */
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
#if defined(_MSC_VER) || defined(__GNUC__)
#if defined(_MSC_VER) || defined(__GNUC__) || defined(__SASC)
#define inline __inline
#else
/* compiler does not support inline, make function static instead */
@ -23,6 +23,8 @@
typedef unsigned int uint32_t;
#elif defined(__GNUC__)
#include <stdint.h>
#elif defined(M68000)
typedef unsigned int uint32_t;
#endif
/* configure socket-stack */
@ -31,6 +33,15 @@
#define NOMINMAX
#include <winsock2.h>
#include <windows.h>
#elif defined(USE_AMITCP)
#include <sys/socket.h>
#include <proto/exec.h>
#include <proto/socket.h>
#include <netdb.h>
#define SOCKET int
#define INVALID_SOCKET -1
#define select(n,r,w,e,t) WaitSelect(n,r,w,e,t,0)
#define closesocket(x) CloseSocket(x)
#else
#include <sys/socket.h>
#include <sys/time.h>

View File

@ -21,6 +21,10 @@ static const char *sync_track_path(const char *base, const char *name)
#ifndef SYNC_PLAYER
#ifdef USE_AMITCP
static struct Library *socket_base = NULL;
#endif
static SOCKET server_connect(const char *host, unsigned short nport)
{
struct hostent *he;
@ -36,6 +40,12 @@ static SOCKET server_connect(const char *host, unsigned short nport)
return INVALID_SOCKET;
need_init = 0;
}
#elif defined(USE_AMITCP)
if (!socket_base) {
socket_base = OpenLibrary("bsdsocket.library", 4);
if (!socket_base)
return INVALID_SOCKET;
}
#endif
he = gethostbyname(host);
@ -101,6 +111,13 @@ void sync_destroy_device(struct sync_device *d)
free(d->base);
sync_data_deinit(&d->data);
free(d);
#if defined(USE_AMITCP) && !defined(SYNC_PLAYER)
if (socket_base) {
CloseLibrary(socket_base);
socket_base = NULL;
}
#endif
}
#ifdef SYNC_PLAYER