Files
@ r5857:4b1b2f7c805d
Branch filter:
Location: cpp/openttd-patchpack/source/src/network/core/core.cpp - annotation
r5857:4b1b2f7c805d
2.2 KiB
text/x-c
(svn r8431) -Update: WebTranslator2 update to 2007-01-27 19:34:37
catalan - 4 fixed by arnaullv (4)
danish - 4 fixed, 2 changed by MiR (6)
dutch - 4 fixed by habell (4)
french - 4 fixed by glx (4)
german - 4 fixed by Neonox (4)
hungarian - 4 fixed by miham (4)
korean - 4 fixed, 4 changed by Nios (4), leejaeuk5 (4)
lithuanian - 2 changed by Domas (2)
polish - 4 fixed by meush (4)
portuguese - 4 fixed by izhirahider (4)
simplified_chinese - 4 fixed by Fishingsnow (4)
slovenian - 4 fixed, 410 changed by Necrolyte (414)
ukrainian - 34 fixed, 49 changed by mad (79), znikoz (4)
catalan - 4 fixed by arnaullv (4)
danish - 4 fixed, 2 changed by MiR (6)
dutch - 4 fixed by habell (4)
french - 4 fixed by glx (4)
german - 4 fixed by Neonox (4)
hungarian - 4 fixed by miham (4)
korean - 4 fixed, 4 changed by Nios (4), leejaeuk5 (4)
lithuanian - 2 changed by Domas (2)
polish - 4 fixed by meush (4)
portuguese - 4 fixed by izhirahider (4)
simplified_chinese - 4 fixed by Fishingsnow (4)
slovenian - 4 fixed, 410 changed by Necrolyte (414)
ukrainian - 34 fixed, 49 changed by mad (79), znikoz (4)
r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 | /* $Id$ */
#ifdef ENABLE_NETWORK
#include "../../stdafx.h"
#include "../../debug.h"
#include "os_abstraction.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
*/
bool NetworkCoreInitialize(void)
{
#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 ressources... */
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
{
WSADATA wsa;
DEBUG(net, 3, "[core] loading windows socket library");
if (WSAStartup(MAKEWORD(2, 0), &wsa) != 0) {
DEBUG(net, 0, "[core] WSAStartup failed, network unavailable");
return false;
}
}
#endif /* WIN32 */
return true;
}
/**
* Shuts down the network core (as that is needed for some platforms
*/
void NetworkCoreShutdown(void)
{
#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
}
#endif /* ENABLE_NETWORK */
|