mirror of https://github.com/OpenTTD/OpenTTD
(svn r1236) MorphOS: added make release like in OSX (tokai)
MorphOS: cleaned up the code telling the difference between AmigaOS and MorphOS (tokai)release/0.4.5
parent
64e153fc34
commit
fb345e983e
32
Makefile
32
Makefile
|
@ -748,6 +748,38 @@ lang/%.lng: lang/%.txt $(STRGEN) lang/english.txt
|
|||
winres.o: ttd.rc
|
||||
windres -o $@ $<
|
||||
|
||||
ifdef MORPHOS
|
||||
release: all
|
||||
@rm -fr "/t/openttd-$(RELEASE)-morphos.lha"
|
||||
@mkdir -p "/t/"
|
||||
@mkdir -p "/t/openttd-$(RELEASE)-morphos"
|
||||
@mkdir -p "/t/openttd-$(RELEASE)-morphos/docs"
|
||||
@mkdir -p "/t/openttd-$(RELEASE)-morphos/data"
|
||||
@mkdir -p "/t/openttd-$(RELEASE)-morphos/lang"
|
||||
@cp -R $(TTD) "/t/openttd-$(RELEASE)-morphos/"
|
||||
@cp data/* "/t/openttd-$(RELEASE)-morphos/data/"
|
||||
@cp lang/*.lng "/t/openttd-$(RELEASE)-morphos/lang/"
|
||||
@cp readme.txt "/t/openttd-$(RELEASE)-morphos/docs/ReadMe"
|
||||
@cp docs/console.txt "/t/openttd-$(RELEASE)-morphos/docs/Console"
|
||||
@cp COPYING "/t/openttd-$(RELEASE)-morphos/docs/"
|
||||
@cp changelog.txt "/t/openttd-$(RELEASE)-morphos/docs/ChangeLog"
|
||||
@cp os/morphos/icons/openttd.info "/t/openttd-$(RELEASE)-morphos/$(TTD).info"
|
||||
@cp os/morphos/icons/docs.info "/t/openttd-$(RELEASE)-morphos/docs.info"
|
||||
@cp os/morphos/icons/drawer.info "/t/openttd-$(RELEASE)-morphos.info"
|
||||
@cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/ReadMe.info"
|
||||
@cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/Console.info"
|
||||
@cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/COPYING.info"
|
||||
@cp os/morphos/icons/document.info "/t/openttd-$(RELEASE)-morphos/docs/ChangeLog.info"
|
||||
@strip --strip-all --strip-unneeded --remove-section .comment "/t/openttd-$(RELEASE)-morphos/$(TTD)"
|
||||
@lha a -r "t:openttd-$(RELEASE)-morphos.lha" "t:openttd-$(RELEASE)-morphos"
|
||||
@lha a "t:openttd-$(RELEASE)-morphos.lha" "t:openttd-$(RELEASE)-morphos.info"
|
||||
@rm -fr "/t/openttd-$(RELEASE)-morphos"
|
||||
@rm -fr "/t/openttd-$(RELEASE)-morphos.info"
|
||||
@echo "Release archive can be found in RAM:t/ now."
|
||||
|
||||
.PHONY: release
|
||||
endif
|
||||
|
||||
ifdef OSX
|
||||
release: all
|
||||
@mkdir -p "OpenTTD $(RELEASE)"
|
||||
|
|
|
@ -20,6 +20,13 @@
|
|||
# include <signal.h>
|
||||
# define STDIN 0 /* file descriptor for standard input */
|
||||
#endif
|
||||
#ifdef __MORPHOS__
|
||||
/* voids the fork, option will be disabled for morphos build anyway, because MorphOS
|
||||
* doesn't support forking (could only implemented with lots of code changes here).
|
||||
*/
|
||||
int morphos_dummy_fork() { return -1; }
|
||||
#define fork morphos_dummy_fork
|
||||
#endif
|
||||
|
||||
// This file handles all dedicated-server in- and outputs
|
||||
|
||||
|
@ -167,7 +174,7 @@ static int DedicatedVideoMainLoop()
|
|||
next_tick = (tim.tv_usec / 1000) + 30 + (tim.tv_sec * 1000);
|
||||
#endif
|
||||
|
||||
/* Siganl handlers */
|
||||
/* Signal handlers */
|
||||
#ifdef UNIX
|
||||
signal(SIGTERM, DedicatedSignalHandler);
|
||||
signal(SIGINT, DedicatedSignalHandler);
|
||||
|
|
|
@ -198,7 +198,7 @@ static void AskAbandonGameWndProc(Window *w, WindowEvent *e) {
|
|||
SetDParam(0, STR_OSNAME_BEOS);
|
||||
#elif defined(__MORPHOS__)
|
||||
SetDParam(0, STR_OSNAME_MORPHOS);
|
||||
#elif defined(__AMIGA__) /* note: __AMIGA__ is defined under MorphOS too, so it must be after __MORPHOS__. */
|
||||
#elif defined(__AMIGA__)
|
||||
SetDParam(0, STR_OSNAME_AMIGAOS);
|
||||
#else
|
||||
SetDParam(0, STR_0134_UNIX);
|
||||
|
|
14
misc.c
14
misc.c
|
@ -107,14 +107,14 @@ void SetDate(uint date)
|
|||
|
||||
// multi os compatible sleep function
|
||||
|
||||
#if defined(__AMIGA__)
|
||||
#ifdef __AMIGA__
|
||||
// usleep() implementation
|
||||
# include <devices/timer.h>
|
||||
# include <dos/dos.h>
|
||||
|
||||
static struct Device *TimerBase = NULL;
|
||||
static struct MsgPort *TimerPort = NULL;
|
||||
static struct timerequest *TimerRequest = NULL;
|
||||
extern struct Device *TimerBase = NULL;
|
||||
extern struct MsgPort *TimerPort = NULL;
|
||||
extern struct timerequest *TimerRequest = NULL;
|
||||
#endif // __AMIGA__
|
||||
|
||||
void CSleep(int milliseconds)
|
||||
|
@ -123,13 +123,13 @@ void CSleep(int milliseconds)
|
|||
Sleep(milliseconds);
|
||||
#endif
|
||||
#if defined(UNIX)
|
||||
#if !defined(__BEOS__) && !defined(__AMIGAOS__)
|
||||
#if !defined(__BEOS__) && !defined(__AMIGA__)
|
||||
usleep(milliseconds * 1000);
|
||||
#endif
|
||||
#ifdef __BEOS__
|
||||
snooze(milliseconds * 1000);
|
||||
#endif
|
||||
#if defined(__AMIGAOS__) && !defined(__MORPHOS__)
|
||||
#if defined(__AMIGA__)
|
||||
{
|
||||
ULONG signals;
|
||||
ULONG TimerSigBit = 1 << TimerPort->mp_SigBit;
|
||||
|
@ -145,7 +145,7 @@ void CSleep(int milliseconds)
|
|||
}
|
||||
WaitIO((struct IORequest *)TimerRequest);
|
||||
}
|
||||
#endif // __AMIGAOS__ && !__MORPHOS__
|
||||
#endif // __AMIGA__
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
68
network.c
68
network.c
|
@ -23,6 +23,11 @@
|
|||
#include <stdarg.h> /* va_list */
|
||||
#include "md5.h"
|
||||
|
||||
#ifdef __MORPHOS__
|
||||
// the library base is required here
|
||||
struct Library *SocketBase = NULL;
|
||||
#endif
|
||||
|
||||
// The listen socket for the server
|
||||
static SOCKET _listensocket;
|
||||
|
||||
|
@ -1255,7 +1260,39 @@ static void NetworkGenerateUniqueId(void)
|
|||
void NetworkStartUp(void)
|
||||
{
|
||||
DEBUG(net, 3) ("[NET][Core] Starting network...");
|
||||
// Network is available
|
||||
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__)
|
||||
/*
|
||||
* IMPORTANT NOTE: SocketBase needs to be initialized before we use _any_
|
||||
* network related function, else: crash.
|
||||
*/
|
||||
{
|
||||
DEBUG(misc,3) ("[NET][Core] Loading bsd socket library");
|
||||
if (!(SocketBase = OpenLibrary("bsdsocket.library", 4))) {
|
||||
DEBUG(net, 0) ("[NET][Core] Error: couldn't open bsdsocket.library version 4. Network not available.");
|
||||
_network_available = false;
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(__AMIGA__)
|
||||
// for usleep() implementation (only required for legacy AmigaOS builds)
|
||||
if ( (TimerPort = CreateMsgPort()) ) {
|
||||
if ( (TimerRequest = (struct timerequest *) CreateIORequest(TimerPort, sizeof(struct timerequest))) ) {
|
||||
if ( OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest *) TimerRequest, 0) == 0 ) {
|
||||
if ( !(TimerBase = TimerRequest->tr_node.io_Device) ) {
|
||||
// free ressources...
|
||||
DEBUG(net, 0) ("[NET][Core] Error: couldn't initialize timer. Network not available.");
|
||||
_network_available = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // __AMIGA__
|
||||
}
|
||||
#endif // __MORPHOS__ / __AMIGA__
|
||||
|
||||
// Network is available
|
||||
_network_available = true;
|
||||
_network_dedicated = false;
|
||||
_network_last_advertise_date = 0;
|
||||
|
@ -1287,33 +1324,6 @@ void NetworkStartUp(void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__)
|
||||
{
|
||||
DEBUG(misc,3) ("[NET][Core] Loading bsd socket library");
|
||||
if (!(SocketBase = OpenLibrary("bsdsocket.library", 4))) {
|
||||
DEBUG(net, 0) ("[NET][Core] Error: couldn't open bsdsocket.library version 4. Network not available.");
|
||||
_network_available = false;
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(__AMIGA__)
|
||||
// for usleep() implementation (only required for legacy AmigaOS builds)
|
||||
if ( (TimerPort = CreateMsgPort()) ) {
|
||||
if ( (TimerRequest = (struct timerequest *) CreateIORequest(TimerPort, sizeof(struct timerequest))) ) {
|
||||
if ( OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest *) TimerRequest, 0) == 0 ) {
|
||||
if ( !(TimerBase = TimerRequest->tr_node.io_Device) ) {
|
||||
// free ressources...
|
||||
DEBUG(net, 0) ("[NET][Core] Error: couldn't initialize timer. Network not available.");
|
||||
_network_available = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // __AMIGA__
|
||||
}
|
||||
#endif // __MORPHOS__ / __AMIGA__
|
||||
#endif // WIN32
|
||||
|
||||
NetworkInitialize();
|
||||
|
@ -1331,7 +1341,7 @@ void NetworkShutDown(void)
|
|||
#if defined(__MORPHOS__) || defined(__AMIGA__)
|
||||
{
|
||||
// free allocated ressources
|
||||
#if !defined(__MORPHOS__)
|
||||
#if defined(__AMIGA__)
|
||||
if (TimerBase) { CloseDevice((struct IORequest *) TimerRequest); }
|
||||
if (TimerRequest) { DeleteIORequest(TimerRequest); }
|
||||
if (TimerPort) { DeleteMsgPort(TimerPort); }
|
||||
|
|
|
@ -52,7 +52,7 @@ typedef struct ifreq IFREQ;
|
|||
# include <netinet/tcp.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <net/if.h>
|
||||
# if !defined(SUNOS)
|
||||
# if !defined(SUNOS) && !defined(__MORPHOS__)
|
||||
# include <ifaddrs.h>
|
||||
// If for any reason ifaddrs.h does not exist on a system, remove define below
|
||||
// and an other system will be used to fetch ips from the system
|
||||
|
@ -71,7 +71,8 @@ typedef struct ifreq IFREQ;
|
|||
# include <exec/types.h>
|
||||
# include <proto/exec.h> // required for Open/CloseLibrary()
|
||||
# if defined(__MORPHOS__)
|
||||
# include <sys/filio.h> // FION#? defines
|
||||
# include <sys/filio.h> // FIO* defines
|
||||
# include <sys/sockio.h> // SIO* defines
|
||||
# else // __AMIGA__
|
||||
# include <proto/socket.h>
|
||||
# endif
|
||||
|
@ -80,8 +81,17 @@ typedef struct ifreq IFREQ;
|
|||
# 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
|
||||
|
||||
struct Library *SocketBase = NULL;
|
||||
typedef unsigned int in_addr_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__
|
||||
|
||||
#endif // NETWORK_CORE_H
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
23
stdafx.h
23
stdafx.h
|
@ -32,6 +32,27 @@
|
|||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
#ifdef __MORPHOS__
|
||||
// morphos defines certain amiga defines per default, we undefine them
|
||||
// here to make the rest of source less messy and more clear what is
|
||||
// required for morphos and what for amigaos
|
||||
# ifdef amigaos
|
||||
# undef amigaos
|
||||
# endif
|
||||
# ifdef __amigaos__
|
||||
# undef __amigaos__
|
||||
# endif
|
||||
# ifdef __AMIGA__
|
||||
# undef __AMIGA__
|
||||
# endif
|
||||
# ifdef AMIGA
|
||||
# undef AMIGA
|
||||
# endif
|
||||
# ifdef amiga
|
||||
# undef amiga
|
||||
# endif
|
||||
#endif /* __MORPHOS__ */
|
||||
|
||||
#define BSWAP32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | (((x) << 24) & 0xFF000000))
|
||||
#define BSWAP16(x) ((x) >> 8 | (x) << 8)
|
||||
|
||||
|
@ -182,7 +203,7 @@ assert_compile(sizeof(uint8) == 1);
|
|||
#define CloseConnection OTTD_CloseConnection
|
||||
#endif
|
||||
|
||||
#if !(defined(__AMIGA__) && !defined(__MORPHOS__))
|
||||
#ifdef __AMIGA__
|
||||
// it seems AmigaOS already have a Point declared
|
||||
#define Point OTTD_AMIGA_POINT
|
||||
#endif
|
||||
|
|
11
ttd.c
11
ttd.c
|
@ -314,7 +314,9 @@ static void showhelp()
|
|||
" -G seed = Set random seed\n"
|
||||
" -n [ip#player:port] = Start networkgame\n"
|
||||
" -D = Start dedicated server\n"
|
||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__)
|
||||
" -f = Fork into the background (dedicated only)\n"
|
||||
#endif
|
||||
" -i = Force to use the DOS palette (use this if you see a lot of pink)\n"
|
||||
" -p #player = Player as #player (deprecated) (network only)\n"
|
||||
);
|
||||
|
@ -526,6 +528,7 @@ int ttd_main(int argc, char* argv[])
|
|||
bool network = false;
|
||||
char *network_conn = NULL;
|
||||
char *language = NULL;
|
||||
char *optformat;
|
||||
char musicdriver[16], sounddriver[16], videodriver[16];
|
||||
int resolution[2] = {0,0};
|
||||
uint startdate = -1;
|
||||
|
@ -541,7 +544,13 @@ int ttd_main(int argc, char* argv[])
|
|||
// a letter means: it accepts that param (e.g.: -h)
|
||||
// a ':' behind it means: it need a param (e.g.: -m<driver>)
|
||||
// a '::' behind it means: it can optional have a param (e.g.: -d<debug>)
|
||||
MyGetOptInit(&mgo, argc-1, argv+1, "m:s:v:hDfn::l:eit:d::r:g::G:p:");
|
||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__)
|
||||
optformat = "m:s:v:hDfn::l:eit:d::r:g::G:p:";
|
||||
#else
|
||||
optformat = "m:s:v:hDn::l:eit:d::r:g::G:p:"; // no fork option
|
||||
#endif
|
||||
|
||||
MyGetOptInit(&mgo, argc-1, argv+1, optformat);
|
||||
while ((i = MyGetOpt(&mgo)) != -1) {
|
||||
switch(i) {
|
||||
case 'm': ttd_strlcpy(musicdriver, mgo.opt, sizeof(musicdriver)); break;
|
||||
|
|
5
unix.c
5
unix.c
|
@ -23,6 +23,11 @@
|
|||
ULONG __stack = (1024*1024)*2; // maybe not that much is needed actually ;)
|
||||
#endif /* __MORPHOS__ */
|
||||
|
||||
#ifdef __AMIGA__
|
||||
#warning add stack symbol to avoid that user needs to set stack manually (tokai)
|
||||
// ULONG __stack =
|
||||
#endif
|
||||
|
||||
static char *_fios_path;
|
||||
static char *_fios_save_path;
|
||||
static char *_fios_scn_path;
|
||||
|
|
Loading…
Reference in New Issue