mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-19 12:39:11 +00:00
Remove: MorphOS / AmigaOS support
In 10 years there is no commit to change how MorphOS works, and we have no active maintainer for it. It is unlikely it works in its current state (but not impossible). With the arrival of SDL2 (and removal of SDL), MorphOS is no longer support. There is an SDL2 port for MorphOS, but it is not maintained by upstream SDL2, and nobody can currently test it out. If anyone wants to re-add MorphOS, please do (revert this patch, fix the problems, and create a Pull Request). If you need any help doing so, let us know! It is not that we don't like MorphOS, it is that we don't have anyone fixing the problems :(
This commit is contained in:
@@ -21,48 +21,12 @@
|
||||
#include "../../safeguards.h"
|
||||
|
||||
|
||||
#ifdef __MORPHOS__
|
||||
/* the library base is required here */
|
||||
struct Library *SocketBase = NULL;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initializes the network core (as that is needed for some platforms
|
||||
* @return true if the core has been initialized, false otherwise
|
||||
*/
|
||||
bool NetworkCoreInitialize()
|
||||
{
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__)
|
||||
/*
|
||||
* IMPORTANT NOTE: SocketBase needs to be initialized before we use _any_
|
||||
* network related function, else: crash.
|
||||
*/
|
||||
DEBUG(net, 3, "[core] loading bsd socket library");
|
||||
SocketBase = OpenLibrary("bsdsocket.library", 4);
|
||||
if (SocketBase == NULL) {
|
||||
DEBUG(net, 0, "[core] can't open bsdsocket.library version 4, network unavailable");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__AMIGA__)
|
||||
/* for usleep() implementation (only required for legacy AmigaOS builds) */
|
||||
TimerPort = CreateMsgPort();
|
||||
if (TimerPort != NULL) {
|
||||
TimerRequest = (struct timerequest*)CreateIORequest(TimerPort, sizeof(struct timerequest);
|
||||
if (TimerRequest != NULL) {
|
||||
if (OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest*)TimerRequest, 0) == 0) {
|
||||
TimerBase = TimerRequest->tr_node.io_Device;
|
||||
if (TimerBase == NULL) {
|
||||
/* free resources... */
|
||||
DEBUG(net, 0, "[core] can't initialize timer, network unavailable");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* __AMIGA__ */
|
||||
#endif /* __MORPHOS__ / __AMIGA__ */
|
||||
|
||||
/* Let's load the network in windows */
|
||||
#ifdef _WIN32
|
||||
{
|
||||
@@ -83,17 +47,6 @@ bool NetworkCoreInitialize()
|
||||
*/
|
||||
void NetworkCoreShutdown()
|
||||
{
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__)
|
||||
/* free allocated resources */
|
||||
#if defined(__AMIGA__)
|
||||
if (TimerBase != NULL) CloseDevice((struct IORequest*)TimerRequest); // XXX This smells wrong
|
||||
if (TimerRequest != NULL) DeleteIORequest(TimerRequest);
|
||||
if (TimerPort != NULL) DeleteMsgPort(TimerPort);
|
||||
#endif
|
||||
|
||||
if (SocketBase != NULL) CloseLibrary(SocketBase);
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
WSACleanup();
|
||||
#endif
|
||||
|
@@ -48,13 +48,11 @@ typedef unsigned long in_addr_t;
|
||||
# endif
|
||||
# define SOCKET int
|
||||
# define INVALID_SOCKET -1
|
||||
# if !defined(__MORPHOS__) && !defined(__AMIGA__)
|
||||
# define ioctlsocket ioctl
|
||||
# define ioctlsocket ioctl
|
||||
# if !defined(BEOS_NET_SERVER)
|
||||
# define closesocket close
|
||||
# endif
|
||||
# define GET_LAST_ERROR() (errno)
|
||||
# endif
|
||||
# define GET_LAST_ERROR() (errno)
|
||||
/* Need this for FIONREAD on solaris */
|
||||
# define BSD_COMP
|
||||
|
||||
@@ -74,7 +72,7 @@ typedef unsigned long in_addr_t;
|
||||
# include <arpa/inet.h>
|
||||
# include <net/if.h>
|
||||
/* According to glibc/NEWS, <ifaddrs.h> appeared in glibc-2.3. */
|
||||
# if !defined(__sgi__) && !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \
|
||||
# if !defined(__sgi__) && !defined(SUNOS) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \
|
||||
&& !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX)
|
||||
/* If for any reason ifaddrs.h does not exist on your system, comment out
|
||||
* the following two lines and an alternative way will be used to fetch
|
||||
@@ -164,39 +162,6 @@ typedef unsigned long in_addr_t;
|
||||
|
||||
#endif /* OS/2 */
|
||||
|
||||
/* MorphOS and Amiga stuff */
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__)
|
||||
# include <exec/types.h>
|
||||
# include <proto/exec.h> /* required for Open/CloseLibrary() */
|
||||
/* MorphOS defines his network functions with UBYTE arrays while we
|
||||
* use char arrays. This gives tons of unneeded warnings */
|
||||
# define UBYTE char
|
||||
# if defined(__MORPHOS__)
|
||||
# include <sys/filio.h> /* FIO* defines */
|
||||
# include <sys/sockio.h> /* SIO* defines */
|
||||
# include <netinet/in.h>
|
||||
# else /* __AMIGA__ */
|
||||
# include <proto/socket.h>
|
||||
# endif
|
||||
|
||||
/* Make the names compatible */
|
||||
# define closesocket(s) CloseSocket(s)
|
||||
# define GET_LAST_ERROR() Errno()
|
||||
# define ioctlsocket(s, request, status) IoctlSocket((LONG)s, (ULONG)request, (char*)status)
|
||||
# define ioctl ioctlsocket
|
||||
|
||||
typedef unsigned int in_addr_t;
|
||||
typedef long socklen_t;
|
||||
extern struct Library *SocketBase;
|
||||
|
||||
# ifdef __AMIGA__
|
||||
/* for usleep() implementation */
|
||||
extern struct Device *TimerBase;
|
||||
extern struct MsgPort *TimerPort;
|
||||
extern struct timerequest *TimerRequest;
|
||||
# endif
|
||||
#endif /* __MORPHOS__ || __AMIGA__ */
|
||||
|
||||
/**
|
||||
* Try to set the socket into non-blocking mode.
|
||||
* @param d The socket to set the non-blocking more for.
|
||||
|
@@ -238,11 +238,7 @@ bool NetworkTCPSocketHandler::CanSendReceive()
|
||||
FD_SET(this->sock, &write_fd);
|
||||
|
||||
tv.tv_sec = tv.tv_usec = 0; // don't block at all.
|
||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__)
|
||||
if (select(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv) < 0) return false;
|
||||
#else
|
||||
if (WaitSelect(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv, NULL) < 0) return false;
|
||||
#endif
|
||||
|
||||
this->writable = !!FD_ISSET(this->sock, &write_fd);
|
||||
return FD_ISSET(this->sock, &read_fd) != 0;
|
||||
|
@@ -310,11 +310,7 @@ int NetworkHTTPSocketHandler::Receive()
|
||||
}
|
||||
|
||||
tv.tv_sec = tv.tv_usec = 0; // don't block at all.
|
||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__)
|
||||
int n = select(FD_SETSIZE, &read_fd, NULL, NULL, &tv);
|
||||
#else
|
||||
int n = WaitSelect(FD_SETSIZE, &read_fd, NULL, NULL, &tv, NULL);
|
||||
#endif
|
||||
if (n == -1) return;
|
||||
|
||||
for (NetworkHTTPSocketHandler **iter = _http_connections.Begin(); iter < _http_connections.End(); /* nothing */) {
|
||||
|
@@ -118,11 +118,7 @@ public:
|
||||
}
|
||||
|
||||
tv.tv_sec = tv.tv_usec = 0; // don't block at all.
|
||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__)
|
||||
if (select(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv) < 0) return false;
|
||||
#else
|
||||
if (WaitSelect(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv, NULL) < 0) return false;
|
||||
#endif
|
||||
|
||||
/* accept clients.. */
|
||||
for (SocketList::iterator s = sockets.Begin(); s != sockets.End(); s++) {
|
||||
|
Reference in New Issue
Block a user