1
0
Fork 0
forked from len0rd/rockbox

sdl: Remove platform-specific code

Also nuke the Makefiles of Duke Nukem 3D (pun intended).

Change-Id: If2707cf079bfb9299347f9c5f980780134b6ecda
This commit is contained in:
Vencislav Atanasov 2019-07-28 23:31:50 +03:00
parent e19857e712
commit 183e45e8d0
No known key found for this signature in database
GPG key ID: 4B991E20465BE1F1
49 changed files with 53 additions and 2191 deletions

View file

@ -7,11 +7,8 @@
#ifndef _INCLUDE_BUILD_H_
#define _INCLUDE_BUILD_H_
#ifdef _WIN32
#include "windows/inttypes.h"
#else
#include <inttypes.h>
#endif
#include <inttypes.h>
#define MAXSECTORS 1024
#define MAXWALLS 8192
@ -223,12 +220,8 @@ SPRITE VARIABLES:
Example: if the linked lists look like the following:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Sector lists: Status lists: ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ Sector0: 4, 5, 8 Status0: 2, 0, 8 ³
³ Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9 ³
³ Sector2: 3, 9 ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
? Sector lists: Status lists: ? ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
? Sector0: 4, 5, 8 Status0: 2, 0, 8 ? ? Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9 ? ? Sector2: 3, 9 ? ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Notice that each number listed above is shown exactly once on both the
left and right side. This is because any sprite that exists must
be in some sector, and must have some kind of status that you define.

View file

@ -69,10 +69,6 @@ void TIMER_GetPlatformTicks(int64_t* t);
#if ((defined PLATFORM_WIN32))
#include <windows.h>
#endif
#include "draw.h"
#include "cache.h"
@ -763,12 +759,6 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
}
#ifdef __APPLE__
SDL_putenv("SDL_VIDEODRIVER=Quartz");
#endif
if (SDL_Init(SDL_INIT_VIDEO) == -1){
Error(EXIT_FAILURE, "BUILDSDL: SDL_Init() failed!\nBUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError());
}
@ -946,14 +936,11 @@ int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim)
SDL_Surface *image;
Uint32 colorkey;
// don't override higher-res app icon on OS X
#ifndef PLATFORM_MACOSX
// Install icon
image = SDL_LoadBMP_RW(SDL_RWFromMem(iconBMP, iconBMP_size), 1);
colorkey = 0; // index in this image to be transparent
SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey);
SDL_WM_SetIcon(image,NULL);
#endif
if (daxdim > MAXXDIM || daydim > MAXYDIM)
{
@ -1915,29 +1902,6 @@ void uninitkeys(void)
/* does nothing in SDL. Key input handling is set up elsewhere. */
}
//unsigned int32_t getticks(void)
//{
// return(SDL_GetTicks());
//} /* getticks */
//Timer on windows 98 used to be really poor but now it is very accurate
// We can just use what SDL uses, no need for QueryPerformanceFrequency or QueryPerformanceCounter
// (which I bet SDL is using anyway).
#if 0//PLATFORM_WIN32
int TIMER_GetPlatformTicksInOneSecond(int64_t* t)
{
QueryPerformanceFrequency((LARGE_INTEGER*)t);
return 1;
}
void TIMER_GetPlatformTicks(int64_t* t)
{
QueryPerformanceCounter((LARGE_INTEGER*)t);
}
#else
//FCS: Let's try to use SDL again: Maybe SDL library is accurate enough now.
int TIMER_GetPlatformTicksInOneSecond(int64_t* t)
{
*t = 1000;
@ -1948,6 +1912,5 @@ void TIMER_GetPlatformTicks(int64_t* t)
{
*t = SDL_GetTicks();
}
#endif
/* end of sdl_driver.c ... */

View file

@ -8,11 +8,7 @@
#ifndef _INCLUDE_A_H_
#define _INCLUDE_A_H_
#ifdef _WIN32
#include "windows/inttypes.h"
#else
#include <inttypes.h>
#endif
#include <inttypes.h>
//C++ linker friendly

View file

@ -3335,13 +3335,7 @@ int saveboard(char *filename, int32_t *daposx, int32_t *daposy,
walltype *w;
sectortype *sect;
#if ((defined PLATFORM_DOS) || (defined PLATFORM_WIN32))
permissions = S_IWRITE;
#elif (defined PLATFORM_UNIX)
permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
#elif (defined PLATFORM_ROCKBOX)
permissions = 0644;
#endif
if ((fil = rb->open(filename,
O_BINARY|O_TRUNC|O_CREAT|O_WRONLY,

View file

@ -42,8 +42,6 @@ void setGameDir(char* gameDir);
int32_t TCkopen4load(const char *filename, int32_t readfromGRP);
#if defined(__APPLE__) || defined(__linux__)
int32_t filelength(int32_t fd);
#endif
#endif

View file

@ -1,62 +0,0 @@
//
// macos_compat.h
// Duke3D
//
// Created by fabien sanglard on 12-12-12.
// Copyright (c) 2012 fabien sanglard. All rights reserved.
//
#ifndef Duke3D_macos_compat_h
#define Duke3D_macos_compat_h
#define PLATFORM_SUPPORTS_SDL
#include <stdlib.h>
#define kmalloc(x) malloc(x)
#define kkmalloc(x) malloc(x)
#define kfree(x) free(x)
#define kkfree(x) free(x)
#ifdef FP_OFF
#undef FP_OFF
#endif
// Horrible horrible macro: Watcom allowed memory pointer to be cast
// to a 32bits integer. The code is unfortunately stuffed with this :( !
#define FP_OFF(x) ((int32_t) (x))
#ifndef max
#define max(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef min
#define min(x, y) (((x) < (y)) ? (x) : (y))
#endif
#include <inttypes.h>
#define __int64 int64_t
#define O_BINARY 0
#define UDP_NETWORKING 1
#define PLATFORM_MACOSX 1
#define SOL_IP SOL_SOCKET
#define IP_RECVERR SO_BROADCAST
#define stricmp strcasecmp
#define strcmpi strcasecmp
#include <assert.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#define USER_DUMMY_NETWORK 1
#endif

View file

@ -557,49 +557,8 @@ void deinit_network_transport(gcomtype *gcom)
void unstable_callcommit(void){}
#elif (defined PLATFORM_DOS)
gcomtype *init_network_transport(char **ARGV, int argpos)
{
/*
* How to talk to COMMIT is passed as a pointer to a block of memory
* that COMMIT.EXE configures...
*/
return((gcomtype *)atol(ARGV[argpos])); /* UGH! --ryan. */
} /* init_network_transport */
static union REGS regs;
#pragma aux longcall =\
"call eax",\
parm [eax]
void callcommit(void)
{
if (gcom->intnum&0xff00)
longcall(gcom->longcalladdress);
else
int386(gcom->intnum,&regs,&regs);
}
void deinit_network_transport(gcomtype *gcom)
{
/* no-op, apparently. */
}
#elif UDP_NETWORKING
#if PLATFORM_WIN32
# include <winsock.h>
# define EAGAIN WSAEWOULDBLOCK
# define EWOULDBLOCK WSAEWOULDBLOCK
# define ECONNREFUSED WSAECONNRESET
# define socklen_t size_t
# define netstrerror() win32netstrerror()
# define neterrno() WSAGetLastError()
# define sockettype SOCKET
# define socketclose(x) closesocket(x)
#else
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
@ -618,7 +577,6 @@ void deinit_network_transport(gcomtype *gcom)
# ifndef MSG_ERRQUEUE /* legacy glibc header workaround... */
# define MSG_ERRQUEUE 0x2000
# endif
#endif
#define SOCKET_SHUTDOWN_BOTH 2
@ -650,47 +608,6 @@ static void siginthandler(int sigint)
ctrlc_pressed = 1;
}
#if PLATFORM_WIN32
/*
* Figure out what the last failing Win32 API call was, and
* generate a human-readable string for the error message.
*
* The return value is a static buffer that is overwritten with
* each call to this function.
*
* Code lifted from PhysicsFS: http://icculus.org/physfs/
*/
static const char *win32netstrerror(void)
{
static TCHAR msgbuf[255];
TCHAR *ptr = msgbuf;
FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
WSAGetLastError(), /*GetLastError(),*/
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
msgbuf,
sizeof (msgbuf) / sizeof (TCHAR),
NULL
);
/* chop off newlines. */
for (ptr = msgbuf; *ptr; ptr++)
{
if ((*ptr == '\n') || (*ptr == '\r'))
{
*ptr = ' ';
break;
} /* if */
} /* for */
return((const char *) msgbuf);
} /* win32strerror */
#endif
typedef enum
{
udpmode_peer,
@ -758,7 +675,6 @@ static int get_udp_packet(int *ip, short *_port, void *pkt, size_t pktsize)
if (rc == -1)
err = neterrno();
#if !PLATFORM_WIN32
/* !!! FIXME: Linux specific? */
if (rc == -1) /* fill in the addr structure on error... */
{
@ -766,7 +682,6 @@ static int get_udp_packet(int *ip, short *_port, void *pkt, size_t pktsize)
recvfrom(udpsocket, NULL, 0, MSG_ERRQUEUE,
(struct sockaddr *) &addr, &l);
}
#endif
*ip = ntohl(addr.sin_addr.s_addr);
port = ntohs(addr.sin_port);
@ -933,10 +848,6 @@ static int set_socket_blockmode(int onOrOff)
/* set socket to be (non-)blocking. */
#if PLATFORM_WIN32
flags = (onOrOff) ? 0 : 1;
rc = (ioctlsocket(udpsocket, FIONBIO, &flags) == 0);
#else
flags = fcntl(udpsocket, F_GETFL, 0);
if (flags != -1)
{
@ -946,7 +857,6 @@ static int set_socket_blockmode(int onOrOff)
flags |= O_NONBLOCK;
rc = (fcntl(udpsocket, F_SETFL, flags) == 0);
}
#endif
if (!rc)
{
@ -992,13 +902,11 @@ static int open_udp_socket(int ip, int port)
if (!set_socket_blockmode(0))
return(0);
#if !PLATFORM_WIN32
{
/* !!! FIXME: Might be Linux (not Unix, not BSD, not WinSock) specific. */
int flags = 1;
setsockopt(udpsocket, SOL_IP, IP_RECVERR, &flags, sizeof (flags));
}
#endif
memset(&addr, '\0', sizeof (addr));
addr.sin_family = AF_INET;
@ -1376,37 +1284,11 @@ static int parse_interface(char *str, int *ip, short *udpport)
static int initialize_sockets(void)
{
#if PLATFORM_WIN32
int rc;
WSADATA data;
printf("initializing WinSock...\n");
rc = WSAStartup(0x0101, &data);
if (rc != 0)
{
printf("WinSock failed to initialize! [err==%d].\n", rc);
return(0);
}
else
{
printf("WinSock initialized.\n");
printf(" - Caller uses version %d.%d, highest supported is %d.%d.\n",
data.wVersion >> 8, data.wVersion & 0xFF,
data.wHighVersion >> 8, data.wHighVersion & 0xFF);
printf(" - Implementation description: [%s].\n", data.szDescription);
printf(" - System status: [%s].\n", data.szSystemStatus);
printf(" - Max sockets: %d.\n", data.iMaxSockets);
printf(" - Max UDP datagram size: %d.\n", data.iMaxUdpDg);
}
#endif
return(1);
}
static void deinitialize_sockets(void)
{
#if PLATFORM_WIN32
WSACleanup();
#endif
}
static int parse_udp_config(const char *cfgfile, gcomtype *gcom)

View file

@ -46,39 +46,9 @@ long crctable[256];
//COM ONLY variables
long comnum, comvect, comspeed, comtemp, comi, comescape, comreset;
#ifdef PLATFORM_DOS // !!! this is a real mess. --ryan.
static void interrupt far comhandler(void);
static unsigned short orig_pm_sel, orig_rm_seg, orig_rm_off;
static unsigned long orig_pm_off;
#endif
volatile unsigned char *inbuf, *outbuf, *comerror, *incnt, *comtype;
volatile unsigned char *comresend;
volatile short *inbufplc, *inbufend, *outbufplc, *outbufend, *comport;
#ifdef PLATFORM_DOS // !!! this is a real mess. --ryan.
static char rmbuffer[COMCODEBYTES] = //See realcom.asm
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x50,0x53,0x66,0x51,0x52,0x2e,
0x8b,0x16,0x08,0x00,0x83,0xc2,0x02,0xec,0x24,0x07,
0x8a,0xe0,0x80,0xfc,0x02,0x74,0x08,0x80,0xfc,0x04,
0x74,0x62,0xe9,0x89,0x00,0x2e,0x8b,0x16,0x08,0x00,
0x2e,0x8a,0x0e,0x0a,0x00,0x80,0xe9,0x01,0x78,0x7a,
0x2e,0x80,0x3e,0x0c,0x00,0x01,0x7c,0x10,0x74,0x04,
0xb0,0x83,0xeb,0x02,0xb0,0x8f,0xee,0x2e,0xfe,0x0e,
0x0c,0x00,0xeb,0xe3,0x2e,0x80,0x3e,0x0b,0x00,0x01,
0x7c,0x12,0x74,0x04,0xb0,0x83,0xeb,0x04,0x2e,0xa0,
0x0d,0x00,0xee,0x2e,0xfe,0x0e,0x0b,0x00,0xeb,0xc9,
0x2e,0x8b,0x1e,0x04,0x00,0x2e,0x3b,0x1e,0x06,0x00,
0x74,0x3c,0x2e,0x8a,0x87,0x80,0x41,0xee,0x43,0x81,
0xe3,0xff,0x3f,0x2e,0x89,0x1e,0x04,0x00,0xeb,0xab,
0x2e,0x8b,0x16,0x08,0x00,0xec,0x2e,0x8b,0x1e,0x02,
0x00,0x2e,0x88,0x87,0x80,0x01,0x43,0x81,0xe3,0xff,
0x3f,0x2e,0x89,0x1e,0x02,0x00,0x2e,0x80,0x3e,0x0a,
0x00,0x10,0x75,0x08,0x83,0xc2,0x05,0xec,0xa8,0x01,
0x75,0xd6,0xf6,0xc4,0x01,0x0f,0x84,0x56,0xff,0xb0,
0x20,0xe6,0x20,0x5a,0x66,0x59,0x5b,0x58,0xcf,
};
#endif
//NET ONLY variables
short socket = 0x4949;
@ -106,80 +76,17 @@ static char rmnetbuffer[NETCODEBYTES] =
};
static long my7a = 0;
#ifdef PLATFORM_DOS
#pragma aux koutp =\
"out dx, al",\
parm [edx][eax]\
#pragma aux kinp =\
"in al, dx",\
parm [edx]
#endif
long convalloc32 (long size)
{
#ifdef PLATFORM_DOS
union REGS r;
r.x.eax = 0x0100; //DPMI allocate DOS memory
r.x.ebx = ((size+15)>>4); //Number of paragraphs requested
int386(0x31,&r,&r);
if (r.x.cflag != 0) return ((long)0); //Failed
return ((long)((r.x.eax&0xffff)<<4)); //Returns full 32-bit offset
#else
fprintf (stderr, "%s, line %d; convalloc32() called\n", __FILE__,
__LINE__);
return 0;
#endif
}
#ifdef PLATFORM_DOS
#pragma aux fixregistersaftersimulate =\
"cld",\
"push ds",\
"pop es",\
static struct rminfo
{
long EDI, ESI, EBP, ESP, EBX, EDX, ECX, EAX;
short flags, ES, DS, FS, GS, IP, CS, SP, SS;
} RMI;
#endif
long simulateint(char intnum, long daeax, long daebx, long daecx, long daedx, long daesi, long daedi)
{
#ifdef PLATFORM_DOS
union REGS regs;
struct SREGS sregs;
memset(&RMI,0,sizeof(RMI)); // Set up real-mode call structure
memset(&sregs,0,sizeof(sregs));
RMI.EAX = daeax;
RMI.EBX = daebx;
RMI.ECX = daecx;
RMI.EDX = daedx;
RMI.ESI = daesi-rmoffset32;
RMI.EDI = daedi-rmoffset32;
RMI.DS = rmsegment16;
RMI.ES = rmsegment16;
regs.w.ax = 0x0300; // Use DMPI call 300h to issue the DOS interrupt
regs.h.bl = intnum;
regs.h.bh = 0;
regs.w.cx = 0;
sregs.es = FP_SEG(&RMI);
regs.x.edi = FP_OFF(&RMI);
int386x(0x31,&regs,&regs,&sregs);
fixregistersaftersimulate();
return(RMI.EAX);
#else
fprintf(stderr, "%s line %d; simulateint() called\n",__FILE__,__LINE__);
return 0;
#endif
}
void initmultiplayers(char damultioption, char dacomrateoption, char dapriority)
@ -237,22 +144,6 @@ int neton(void)
long i, j;
if ((simulateint(0x2f,(long)0x7a00,0L,0L,0L,0L,0L)&255) != 255) return(-1);
if (*(long *)(0x7a<<2) == 0)
{
#ifdef PLATFORM_DOS
printf("Faking int 0x7a to call IPX entry at: %4x:%4x\n",RMI.ES,RMI.EDI&65535);
my7a = convalloc32(16L);
*(short *)((0x7a<<2)+0) = (my7a&15);
*(short *)((0x7a<<2)+2) = (my7a>>4);
*(char *)(my7a+0) = 0x2e; //call far ptr [L1]
*(char *)(my7a+1) = 0x9a;
*(long *)(my7a+2) = 7L;
*(char *)(my7a+6) = 0xcf; //iret
*(short *)(my7a+7) = (RMI.EDI&65535); //L1: ipxoff
*(short *)(my7a+9) = RMI.ES; // ipxseg
#endif
}
//Special stuff for WATCOM C
if ((rmoffset32 = convalloc32(1380L+NETCODEBYTES+COMBUFSIZ)) == 0)
@ -349,9 +240,6 @@ int comon()
// Baud-Setting,?,?,Parity O/E,Parity Off/On, Stop-1/2,Bits-5/6/7/8
// 0x0b is odd parity,1 stop bit, 8 bits
#ifdef PLATFORM_DOS
_disable();
#endif
koutp((*comport)+3,0x80); //enable latch registers
divisor = 115200 / comspeed;
koutp((*comport)+0,divisor&255); //# = 115200 / bps
@ -384,9 +272,6 @@ int comon()
comescape = 0; comreset = 0;
*comerror = 0; *comresend = 0;
#ifdef PLATFORM_DOS
_enable();
#endif
syncbufleng = 0;
@ -410,18 +295,12 @@ void comoff()
i--;
}
#ifdef PLATFORM_DOS
_disable();
#endif
koutp(0x21,kinp(0x21)|(1<<(comvect&7))); //Mask vector
if (hangup != 0)
{
koutp((*comport)+1,0);
koutp((*comport)+4,0);
}
#ifdef PLATFORM_DOS
_enable();
#endif
uninstallbicomhandlers();
}
@ -921,87 +800,14 @@ long getcrc(char *buffer, short bufleng)
void installbicomhandlers(void)
{
#ifdef PLATFORM_DOS
union REGS r;
struct SREGS sr;
long lowp;
void far *fh;
//Get old protected mode handler
r.x.eax = 0x3500+comvect; /* DOS get vector (INT 0Ch) */
sr.ds = sr.es = 0;
int386x(0x21,&r,&r,&sr);
orig_pm_sel = (unsigned short)sr.es;
orig_pm_off = r.x.ebx;
//Get old real mode handler
r.x.eax = 0x0200; /* DPMI get real mode vector */
r.h.bl = comvect;
int386(0x31,&r,&r);
orig_rm_seg = (unsigned short)r.x.ecx;
orig_rm_off = (unsigned short)r.x.edx;
//Allocate memory in low memory to store real mode handler
if ((lowp = convalloc32(COMCODEBYTES+(COMBUFSIZ<<1))) == 0)
{ printf("Can't allocate conventional memory.\n"); exit; }
inbufplc = (short *)(lowp+0);
inbufend = (short *)(lowp+2);
outbufplc = (short *)(lowp+4);
outbufend = (short *)(lowp+6);
comport = (short *)(lowp+8);
comtype = (char *)(lowp+10);
comerror = (char *)(lowp+11);
comresend = (char *)(lowp+12);
incnt = (char *)(lowp+13);
inbuf = (char *)(lowp+COMCODEBYTES);
outbuf = (char *)(lowp+COMCODEBYTES+COMBUFSIZ);
memcpy((void *)lowp,(void *)rmbuffer,COMCODEBYTES);
//Set new protected mode handler
r.x.eax = 0x2500+comvect; /* DOS set vector (INT 0Ch) */
fh = (void far *)comhandler;
r.x.edx = FP_OFF(fh);
sr.ds = FP_SEG(fh); //DS:EDX == &handler
sr.es = 0;
int386x(0x21,&r,&r,&sr);
//Set new real mode handler (must be after setting protected mode)
r.x.eax = 0x0201;
r.h.bl = comvect; //CX:DX == real mode &handler
r.x.ecx = ((lowp>>4)&0xffff); //D32realseg
r.x.edx = COMCODEOFFS; //D32realoff
int386(0x31,&r,&r);
#else
fprintf (stderr,"%s, line %d; installbicomhandlers() called\n",
__FILE__, __LINE__);
#endif
}
void uninstallbicomhandlers(void)
{
#ifdef PLATFORM_DOS
union REGS r;
struct SREGS sr;
//restore old protected mode handler
r.x.eax = 0x2500+comvect; /* DOS set vector (INT 0Ch) */
r.x.edx = orig_pm_off;
sr.ds = orig_pm_sel; /* DS:EDX == &handler */
sr.es = 0;
int386x(0x21,&r,&r,&sr);
//restore old real mode handler
r.x.eax = 0x0201; /* DPMI set real mode vector */
r.h.bl = comvect;
r.x.ecx = (unsigned long)orig_rm_seg; //CX:DX == real mode &handler
r.x.edx = (unsigned long)orig_rm_off;
int386(0x31,&r,&r);
#else
fprintf (stderr, "%s line %d; uninstallbicomhandlers() called\n",
__FILE__, __LINE__);
#endif
}
void processreservedmessage(short tempbufleng, char *datempbuf)

View file

@ -1,15 +1,7 @@
#ifndef _INCLUDE_PLATFORM_DUKE_H_
#define _INCLUDE_PLATFORM_DUKE_H_
#if (defined PLATFORM_WIN32)
#include "win32_compat.h"
#elif (defined PLATFORM_UNIX)
#include "unix_compat.h"
#elif (defined PLATFORM_DOS)
#include "doscmpat.h"
#elif (defined __APPLE__)
#include "macos_compat.h"
#elif (defined ROCKBOX)
#if (defined ROCKBOX)
#include "rockbox_compat.h"
#else
#error Define your platform!
@ -21,15 +13,9 @@
uint16_t _swap16(uint16_t D);
unsigned int _swap32(unsigned int D);
#if defined(PLATFORM_MACOSX) && defined(__ppc__)
#define PLATFORM_BIGENDIAN 1
#define BUILDSWAP_INTEL16(x) _swap16(x)
#define BUILDSWAP_INTEL32(x) _swap32(x)
#else
#define PLATFORM_LITTLEENDIAN 1
#define BUILDSWAP_INTEL16(x) (x)
#define BUILDSWAP_INTEL32(x) (x)
#endif
#endif /* !defined _INCLUDE_PLATFORM_H_ */

View file

@ -1,67 +0,0 @@
//
// unix_compat.h
// Duke3D
//
// Based on macos_compat.h
// Copyright Wed, Jul 31, 2013, Juan Manuel Borges Caño (GPLv3+)
//
#ifndef Duke3D_unix_compat_h
#define Duke3D_unix_compat_h
//#define BYTE_ORDER LITTLE_ENDIAN
#define PLATFORM_SUPPORTS_SDL
#include <stdlib.h>
#define kmalloc(x) malloc(x)
#define kkmalloc(x) malloc(x)
#define kfree(x) free(x)
#define kkfree(x) free(x)
#ifdef FP_OFF
#undef FP_OFF
#endif
// Horrible horrible macro: Watcom allowed memory pointer to be cast
// to a 32bits integer. The code is unfortunately stuffed with this :( !
#define FP_OFF(x) ((int32_t) (x))
#ifndef max
#define max(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef min
#define min(x, y) (((x) < (y)) ? (x) : (y))
#endif
#include <inttypes.h>
#define __int64 int64_t
#define O_BINARY 0
#define UDP_NETWORKING 1
#define PLATFORM_UNIX 1
/*
#define SOL_IP SOL_SOCKET
#define IP_RECVERR SO_BROADCAST
*/
#define stricmp strcasecmp
#define strcmpi strcasecmp
#define S_IREAD S_IRUSR
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include <string.h>
#define USER_DUMMY_NETWORK 1
#endif

View file

@ -1,106 +0,0 @@
/*
* win32 compatibility header. Takes care of some legacy code issues
* and incompatibilities at the source level.
*
* Written by Ryan C. Gordon (icculus@clutteredmind.org)
*
* Please do NOT harrass Ken Silverman about any code modifications
* (including this file) to BUILD.
*/
/*
* "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
* Ken Silverman's official web site: "http://www.advsys.net/ken"
* See the included license file "BUILDLIC.TXT" for license info.
* This file IS NOT A PART OF Ken Silverman's original release
*/
#ifndef _INCLUDE_WIN32_COMPAT_H_
#define _INCLUDE_WIN32_COMPAT_H_
#if (!defined PLATFORM_WIN32)
#error PLATFORM_WIN32 is not defined.
#endif
#define PLATFORM_SUPPORTS_SDL
#include <stdio.h>
#if (!defined _MSC_VER)
#include <unistd.h>
#else
#include <fcntl.h>
#include <SYS\STAT.H>
#endif
#include <stdlib.h>
#include <io.h>
#include <direct.h>
#include <conio.h>
#include <dos.h>
#include <assert.h>
#include <string.h>
#define kmalloc(x) malloc(x)
#define kkmalloc(x) malloc(x)
#define kfree(x) free(x)
#define kkfree(x) free(x)
#ifdef FP_OFF
#undef FP_OFF
#endif
#define FP_OFF(x) ((long) (x))
/* !!! This might be temporary. */
#define printext16 printext256
#define printext16_noupdate printext256_noupdate
#ifndef max
#define max(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef min
#define min(x, y) (((x) < (y)) ? (x) : (y))
#endif
#if (defined __WATCOMC__)
#define inline
#pragma intrinsic(min);
#pragma intrinsic(max);
#define __int64 long long
#endif
#if (defined _MSC_VER)
#if ((!defined _INTEGRAL_MAX_BITS) || (_INTEGRAL_MAX_BITS < 64))
#error __int64 type not supported
#endif
#define open _open
#define O_BINARY _O_BINARY
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_RDWR _O_RDWR
#define O_TRUNC _O_TRUNC
#define O_CREAT _O_CREAT
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#define S_IRDWR _S_IRDWR
#endif /* defined _MSC_VER */
#define snprintf _snprintf
#define strncasecmp strnicmp
//Damn you Microsoft, how hard would it REALLY be to support C99 ?!??!?!
#define inline
#include "windows/inttypes.h"
#endif
/* end of win32_compat.h ... */