diff options
Diffstat (limited to 'apps/plugins/sdl/progs')
45 files changed, 54 insertions, 2157 deletions
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/build.h b/apps/plugins/sdl/progs/duke3d/Engine/src/build.h index f0389e54e2..c2934b62dd 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/build.h +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/build.h | |||
@@ -7,11 +7,8 @@ | |||
7 | 7 | ||
8 | #ifndef _INCLUDE_BUILD_H_ | 8 | #ifndef _INCLUDE_BUILD_H_ |
9 | #define _INCLUDE_BUILD_H_ | 9 | #define _INCLUDE_BUILD_H_ |
10 | #ifdef _WIN32 | 10 | |
11 | #include "windows/inttypes.h" | 11 | #include <inttypes.h> |
12 | #else | ||
13 | #include <inttypes.h> | ||
14 | #endif | ||
15 | 12 | ||
16 | #define MAXSECTORS 1024 | 13 | #define MAXSECTORS 1024 |
17 | #define MAXWALLS 8192 | 14 | #define MAXWALLS 8192 |
@@ -223,12 +220,8 @@ SPRITE VARIABLES: | |||
223 | 220 | ||
224 | Example: if the linked lists look like the following: | 221 | Example: if the linked lists look like the following: |
225 | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | 222 | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ |
226 | ³ Sector lists: Status lists: ³ | 223 | ? Sector lists: Status lists: ? ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ |
227 | ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | 224 | ? Sector0: 4, 5, 8 Status0: 2, 0, 8 ? ? Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9 ? ? Sector2: 3, 9 ? ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ |
228 | ³ Sector0: 4, 5, 8 Status0: 2, 0, 8 ³ | ||
229 | ³ Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9 ³ | ||
230 | ³ Sector2: 3, 9 ³ | ||
231 | ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
232 | Notice that each number listed above is shown exactly once on both the | 225 | Notice that each number listed above is shown exactly once on both the |
233 | left and right side. This is because any sprite that exists must | 226 | left and right side. This is because any sprite that exists must |
234 | be in some sector, and must have some kind of status that you define. | 227 | be in some sector, and must have some kind of status that you define. |
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/display.c b/apps/plugins/sdl/progs/duke3d/Engine/src/display.c index 501ffa411c..c16c8fb25c 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/display.c +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/display.c | |||
@@ -69,10 +69,6 @@ void TIMER_GetPlatformTicks(int64_t* t); | |||
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | #if ((defined PLATFORM_WIN32)) | ||
73 | #include <windows.h> | ||
74 | #endif | ||
75 | |||
76 | #include "draw.h" | 72 | #include "draw.h" |
77 | #include "cache.h" | 73 | #include "cache.h" |
78 | 74 | ||
@@ -763,12 +759,6 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico | |||
763 | } | 759 | } |
764 | 760 | ||
765 | 761 | ||
766 | |||
767 | #ifdef __APPLE__ | ||
768 | SDL_putenv("SDL_VIDEODRIVER=Quartz"); | ||
769 | #endif | ||
770 | |||
771 | |||
772 | if (SDL_Init(SDL_INIT_VIDEO) == -1){ | 762 | if (SDL_Init(SDL_INIT_VIDEO) == -1){ |
773 | Error(EXIT_FAILURE, "BUILDSDL: SDL_Init() failed!\nBUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError()); | 763 | Error(EXIT_FAILURE, "BUILDSDL: SDL_Init() failed!\nBUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError()); |
774 | } | 764 | } |
@@ -946,14 +936,11 @@ int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim) | |||
946 | SDL_Surface *image; | 936 | SDL_Surface *image; |
947 | Uint32 colorkey; | 937 | Uint32 colorkey; |
948 | 938 | ||
949 | // don't override higher-res app icon on OS X | ||
950 | #ifndef PLATFORM_MACOSX | ||
951 | // Install icon | 939 | // Install icon |
952 | image = SDL_LoadBMP_RW(SDL_RWFromMem(iconBMP, iconBMP_size), 1); | 940 | image = SDL_LoadBMP_RW(SDL_RWFromMem(iconBMP, iconBMP_size), 1); |
953 | colorkey = 0; // index in this image to be transparent | 941 | colorkey = 0; // index in this image to be transparent |
954 | SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey); | 942 | SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey); |
955 | SDL_WM_SetIcon(image,NULL); | 943 | SDL_WM_SetIcon(image,NULL); |
956 | #endif | ||
957 | 944 | ||
958 | if (daxdim > MAXXDIM || daydim > MAXYDIM) | 945 | if (daxdim > MAXXDIM || daydim > MAXYDIM) |
959 | { | 946 | { |
@@ -1915,29 +1902,6 @@ void uninitkeys(void) | |||
1915 | /* does nothing in SDL. Key input handling is set up elsewhere. */ | 1902 | /* does nothing in SDL. Key input handling is set up elsewhere. */ |
1916 | } | 1903 | } |
1917 | 1904 | ||
1918 | |||
1919 | //unsigned int32_t getticks(void) | ||
1920 | //{ | ||
1921 | // return(SDL_GetTicks()); | ||
1922 | //} /* getticks */ | ||
1923 | |||
1924 | |||
1925 | //Timer on windows 98 used to be really poor but now it is very accurate | ||
1926 | // We can just use what SDL uses, no need for QueryPerformanceFrequency or QueryPerformanceCounter | ||
1927 | // (which I bet SDL is using anyway). | ||
1928 | #if 0//PLATFORM_WIN32 | ||
1929 | int TIMER_GetPlatformTicksInOneSecond(int64_t* t) | ||
1930 | { | ||
1931 | QueryPerformanceFrequency((LARGE_INTEGER*)t); | ||
1932 | return 1; | ||
1933 | } | ||
1934 | |||
1935 | void TIMER_GetPlatformTicks(int64_t* t) | ||
1936 | { | ||
1937 | QueryPerformanceCounter((LARGE_INTEGER*)t); | ||
1938 | } | ||
1939 | #else | ||
1940 | //FCS: Let's try to use SDL again: Maybe SDL library is accurate enough now. | ||
1941 | int TIMER_GetPlatformTicksInOneSecond(int64_t* t) | 1905 | int TIMER_GetPlatformTicksInOneSecond(int64_t* t) |
1942 | { | 1906 | { |
1943 | *t = 1000; | 1907 | *t = 1000; |
@@ -1948,6 +1912,5 @@ void TIMER_GetPlatformTicks(int64_t* t) | |||
1948 | { | 1912 | { |
1949 | *t = SDL_GetTicks(); | 1913 | *t = SDL_GetTicks(); |
1950 | } | 1914 | } |
1951 | #endif | ||
1952 | /* end of sdl_driver.c ... */ | 1915 | /* end of sdl_driver.c ... */ |
1953 | 1916 | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/draw.h b/apps/plugins/sdl/progs/duke3d/Engine/src/draw.h index 0f2a656b6a..eff82c9e0d 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/draw.h +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/draw.h | |||
@@ -8,11 +8,7 @@ | |||
8 | #ifndef _INCLUDE_A_H_ | 8 | #ifndef _INCLUDE_A_H_ |
9 | #define _INCLUDE_A_H_ | 9 | #define _INCLUDE_A_H_ |
10 | 10 | ||
11 | #ifdef _WIN32 | 11 | #include <inttypes.h> |
12 | #include "windows/inttypes.h" | ||
13 | #else | ||
14 | #include <inttypes.h> | ||
15 | #endif | ||
16 | 12 | ||
17 | 13 | ||
18 | //C++ linker friendly | 14 | //C++ linker friendly |
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/engine.c b/apps/plugins/sdl/progs/duke3d/Engine/src/engine.c index c0a7390882..b3b807d706 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/engine.c +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/engine.c | |||
@@ -3335,13 +3335,7 @@ int saveboard(char *filename, int32_t *daposx, int32_t *daposy, | |||
3335 | walltype *w; | 3335 | walltype *w; |
3336 | sectortype *sect; | 3336 | sectortype *sect; |
3337 | 3337 | ||
3338 | #if ((defined PLATFORM_DOS) || (defined PLATFORM_WIN32)) | ||
3339 | permissions = S_IWRITE; | ||
3340 | #elif (defined PLATFORM_UNIX) | ||
3341 | permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; | ||
3342 | #elif (defined PLATFORM_ROCKBOX) | ||
3343 | permissions = 0644; | 3338 | permissions = 0644; |
3344 | #endif | ||
3345 | 3339 | ||
3346 | if ((fil = rb->open(filename, | 3340 | if ((fil = rb->open(filename, |
3347 | O_BINARY|O_TRUNC|O_CREAT|O_WRONLY, | 3341 | O_BINARY|O_TRUNC|O_CREAT|O_WRONLY, |
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/filesystem.h b/apps/plugins/sdl/progs/duke3d/Engine/src/filesystem.h index 59e0e9e530..fe172072b5 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/filesystem.h +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/filesystem.h | |||
@@ -42,8 +42,6 @@ void setGameDir(char* gameDir); | |||
42 | 42 | ||
43 | int32_t TCkopen4load(const char *filename, int32_t readfromGRP); | 43 | int32_t TCkopen4load(const char *filename, int32_t readfromGRP); |
44 | 44 | ||
45 | #if defined(__APPLE__) || defined(__linux__) | ||
46 | int32_t filelength(int32_t fd); | 45 | int32_t filelength(int32_t fd); |
47 | #endif | ||
48 | 46 | ||
49 | #endif | 47 | #endif |
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/macos_compat.h b/apps/plugins/sdl/progs/duke3d/Engine/src/macos_compat.h deleted file mode 100644 index 7eb205daa6..0000000000 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/macos_compat.h +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | // | ||
2 | // macos_compat.h | ||
3 | // Duke3D | ||
4 | // | ||
5 | // Created by fabien sanglard on 12-12-12. | ||
6 | // Copyright (c) 2012 fabien sanglard. All rights reserved. | ||
7 | // | ||
8 | |||
9 | #ifndef Duke3D_macos_compat_h | ||
10 | #define Duke3D_macos_compat_h | ||
11 | |||
12 | #define PLATFORM_SUPPORTS_SDL | ||
13 | |||
14 | #include <stdlib.h> | ||
15 | |||
16 | #define kmalloc(x) malloc(x) | ||
17 | #define kkmalloc(x) malloc(x) | ||
18 | #define kfree(x) free(x) | ||
19 | #define kkfree(x) free(x) | ||
20 | |||
21 | #ifdef FP_OFF | ||
22 | #undef FP_OFF | ||
23 | #endif | ||
24 | |||
25 | // Horrible horrible macro: Watcom allowed memory pointer to be cast | ||
26 | // to a 32bits integer. The code is unfortunately stuffed with this :( ! | ||
27 | #define FP_OFF(x) ((int32_t) (x)) | ||
28 | |||
29 | #ifndef max | ||
30 | #define max(x, y) (((x) > (y)) ? (x) : (y)) | ||
31 | #endif | ||
32 | |||
33 | #ifndef min | ||
34 | #define min(x, y) (((x) < (y)) ? (x) : (y)) | ||
35 | #endif | ||
36 | |||
37 | #include <inttypes.h> | ||
38 | #define __int64 int64_t | ||
39 | |||
40 | #define O_BINARY 0 | ||
41 | |||
42 | #define UDP_NETWORKING 1 | ||
43 | |||
44 | #define PLATFORM_MACOSX 1 | ||
45 | |||
46 | #define SOL_IP SOL_SOCKET | ||
47 | #define IP_RECVERR SO_BROADCAST | ||
48 | |||
49 | #define stricmp strcasecmp | ||
50 | #define strcmpi strcasecmp | ||
51 | |||
52 | #include <assert.h> | ||
53 | #include <sys/stat.h> | ||
54 | #include <sys/types.h> | ||
55 | #include <sys/uio.h> | ||
56 | #include <unistd.h> | ||
57 | #include <fcntl.h> | ||
58 | #include <string.h> | ||
59 | |||
60 | #define USER_DUMMY_NETWORK 1 | ||
61 | |||
62 | #endif | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c b/apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c index dea2b7d35c..9d2afe9d33 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/mmulti.c | |||
@@ -557,49 +557,8 @@ void deinit_network_transport(gcomtype *gcom) | |||
557 | 557 | ||
558 | void unstable_callcommit(void){} | 558 | void unstable_callcommit(void){} |
559 | 559 | ||
560 | #elif (defined PLATFORM_DOS) | ||
561 | gcomtype *init_network_transport(char **ARGV, int argpos) | ||
562 | { | ||
563 | /* | ||
564 | * How to talk to COMMIT is passed as a pointer to a block of memory | ||
565 | * that COMMIT.EXE configures... | ||
566 | */ | ||
567 | return((gcomtype *)atol(ARGV[argpos])); /* UGH! --ryan. */ | ||
568 | } /* init_network_transport */ | ||
569 | |||
570 | static union REGS regs; | ||
571 | |||
572 | #pragma aux longcall =\ | ||
573 | "call eax",\ | ||
574 | parm [eax] | ||
575 | |||
576 | void callcommit(void) | ||
577 | { | ||
578 | if (gcom->intnum&0xff00) | ||
579 | longcall(gcom->longcalladdress); | ||
580 | else | ||
581 | int386(gcom->intnum,®s,®s); | ||
582 | } | ||
583 | |||
584 | void deinit_network_transport(gcomtype *gcom) | ||
585 | { | ||
586 | /* no-op, apparently. */ | ||
587 | } | ||
588 | |||
589 | |||
590 | #elif UDP_NETWORKING | 560 | #elif UDP_NETWORKING |
591 | 561 | ||
592 | #if PLATFORM_WIN32 | ||
593 | # include <winsock.h> | ||
594 | # define EAGAIN WSAEWOULDBLOCK | ||
595 | # define EWOULDBLOCK WSAEWOULDBLOCK | ||
596 | # define ECONNREFUSED WSAECONNRESET | ||
597 | # define socklen_t size_t | ||
598 | # define netstrerror() win32netstrerror() | ||
599 | # define neterrno() WSAGetLastError() | ||
600 | # define sockettype SOCKET | ||
601 | # define socketclose(x) closesocket(x) | ||
602 | #else | ||
603 | # include <sys/types.h> | 562 | # include <sys/types.h> |
604 | # include <sys/socket.h> | 563 | # include <sys/socket.h> |
605 | # include <netinet/in.h> | 564 | # include <netinet/in.h> |
@@ -618,7 +577,6 @@ void deinit_network_transport(gcomtype *gcom) | |||
618 | # ifndef MSG_ERRQUEUE /* legacy glibc header workaround... */ | 577 | # ifndef MSG_ERRQUEUE /* legacy glibc header workaround... */ |
619 | # define MSG_ERRQUEUE 0x2000 | 578 | # define MSG_ERRQUEUE 0x2000 |
620 | # endif | 579 | # endif |
621 | #endif | ||
622 | 580 | ||
623 | #define SOCKET_SHUTDOWN_BOTH 2 | 581 | #define SOCKET_SHUTDOWN_BOTH 2 |
624 | 582 | ||
@@ -650,47 +608,6 @@ static void siginthandler(int sigint) | |||
650 | ctrlc_pressed = 1; | 608 | ctrlc_pressed = 1; |
651 | } | 609 | } |
652 | 610 | ||
653 | #if PLATFORM_WIN32 | ||
654 | /* | ||
655 | * Figure out what the last failing Win32 API call was, and | ||
656 | * generate a human-readable string for the error message. | ||
657 | * | ||
658 | * The return value is a static buffer that is overwritten with | ||
659 | * each call to this function. | ||
660 | * | ||
661 | * Code lifted from PhysicsFS: http://icculus.org/physfs/ | ||
662 | */ | ||
663 | static const char *win32netstrerror(void) | ||
664 | { | ||
665 | static TCHAR msgbuf[255]; | ||
666 | TCHAR *ptr = msgbuf; | ||
667 | |||
668 | FormatMessage( | ||
669 | FORMAT_MESSAGE_FROM_SYSTEM | | ||
670 | FORMAT_MESSAGE_IGNORE_INSERTS, | ||
671 | NULL, | ||
672 | WSAGetLastError(), /*GetLastError(),*/ | ||
673 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ | ||
674 | msgbuf, | ||
675 | sizeof (msgbuf) / sizeof (TCHAR), | ||
676 | NULL | ||
677 | ); | ||
678 | |||
679 | /* chop off newlines. */ | ||
680 | for (ptr = msgbuf; *ptr; ptr++) | ||
681 | { | ||
682 | if ((*ptr == '\n') || (*ptr == '\r')) | ||
683 | { | ||
684 | *ptr = ' '; | ||
685 | break; | ||
686 | } /* if */ | ||
687 | } /* for */ | ||
688 | |||
689 | return((const char *) msgbuf); | ||
690 | } /* win32strerror */ | ||
691 | #endif | ||
692 | |||
693 | |||
694 | typedef enum | 611 | typedef enum |
695 | { | 612 | { |
696 | udpmode_peer, | 613 | udpmode_peer, |
@@ -758,7 +675,6 @@ static int get_udp_packet(int *ip, short *_port, void *pkt, size_t pktsize) | |||
758 | if (rc == -1) | 675 | if (rc == -1) |
759 | err = neterrno(); | 676 | err = neterrno(); |
760 | 677 | ||
761 | #if !PLATFORM_WIN32 | ||
762 | /* !!! FIXME: Linux specific? */ | 678 | /* !!! FIXME: Linux specific? */ |
763 | if (rc == -1) /* fill in the addr structure on error... */ | 679 | if (rc == -1) /* fill in the addr structure on error... */ |
764 | { | 680 | { |
@@ -766,7 +682,6 @@ static int get_udp_packet(int *ip, short *_port, void *pkt, size_t pktsize) | |||
766 | recvfrom(udpsocket, NULL, 0, MSG_ERRQUEUE, | 682 | recvfrom(udpsocket, NULL, 0, MSG_ERRQUEUE, |
767 | (struct sockaddr *) &addr, &l); | 683 | (struct sockaddr *) &addr, &l); |
768 | } | 684 | } |
769 | #endif | ||
770 | 685 | ||
771 | *ip = ntohl(addr.sin_addr.s_addr); | 686 | *ip = ntohl(addr.sin_addr.s_addr); |
772 | port = ntohs(addr.sin_port); | 687 | port = ntohs(addr.sin_port); |
@@ -933,10 +848,6 @@ static int set_socket_blockmode(int onOrOff) | |||
933 | 848 | ||
934 | /* set socket to be (non-)blocking. */ | 849 | /* set socket to be (non-)blocking. */ |
935 | 850 | ||
936 | #if PLATFORM_WIN32 | ||
937 | flags = (onOrOff) ? 0 : 1; | ||
938 | rc = (ioctlsocket(udpsocket, FIONBIO, &flags) == 0); | ||
939 | #else | ||
940 | flags = fcntl(udpsocket, F_GETFL, 0); | 851 | flags = fcntl(udpsocket, F_GETFL, 0); |
941 | if (flags != -1) | 852 | if (flags != -1) |
942 | { | 853 | { |
@@ -946,7 +857,6 @@ static int set_socket_blockmode(int onOrOff) | |||
946 | flags |= O_NONBLOCK; | 857 | flags |= O_NONBLOCK; |
947 | rc = (fcntl(udpsocket, F_SETFL, flags) == 0); | 858 | rc = (fcntl(udpsocket, F_SETFL, flags) == 0); |
948 | } | 859 | } |
949 | #endif | ||
950 | 860 | ||
951 | if (!rc) | 861 | if (!rc) |
952 | { | 862 | { |
@@ -992,13 +902,11 @@ static int open_udp_socket(int ip, int port) | |||
992 | if (!set_socket_blockmode(0)) | 902 | if (!set_socket_blockmode(0)) |
993 | return(0); | 903 | return(0); |
994 | 904 | ||
995 | #if !PLATFORM_WIN32 | ||
996 | { | 905 | { |
997 | /* !!! FIXME: Might be Linux (not Unix, not BSD, not WinSock) specific. */ | 906 | /* !!! FIXME: Might be Linux (not Unix, not BSD, not WinSock) specific. */ |
998 | int flags = 1; | 907 | int flags = 1; |
999 | setsockopt(udpsocket, SOL_IP, IP_RECVERR, &flags, sizeof (flags)); | 908 | setsockopt(udpsocket, SOL_IP, IP_RECVERR, &flags, sizeof (flags)); |
1000 | } | 909 | } |
1001 | #endif | ||
1002 | 910 | ||
1003 | memset(&addr, '\0', sizeof (addr)); | 911 | memset(&addr, '\0', sizeof (addr)); |
1004 | addr.sin_family = AF_INET; | 912 | addr.sin_family = AF_INET; |
@@ -1376,37 +1284,11 @@ static int parse_interface(char *str, int *ip, short *udpport) | |||
1376 | 1284 | ||
1377 | static int initialize_sockets(void) | 1285 | static int initialize_sockets(void) |
1378 | { | 1286 | { |
1379 | #if PLATFORM_WIN32 | ||
1380 | int rc; | ||
1381 | WSADATA data; | ||
1382 | printf("initializing WinSock...\n"); | ||
1383 | rc = WSAStartup(0x0101, &data); | ||
1384 | if (rc != 0) | ||
1385 | { | ||
1386 | printf("WinSock failed to initialize! [err==%d].\n", rc); | ||
1387 | return(0); | ||
1388 | } | ||
1389 | else | ||
1390 | { | ||
1391 | printf("WinSock initialized.\n"); | ||
1392 | printf(" - Caller uses version %d.%d, highest supported is %d.%d.\n", | ||
1393 | data.wVersion >> 8, data.wVersion & 0xFF, | ||
1394 | data.wHighVersion >> 8, data.wHighVersion & 0xFF); | ||
1395 | printf(" - Implementation description: [%s].\n", data.szDescription); | ||
1396 | printf(" - System status: [%s].\n", data.szSystemStatus); | ||
1397 | printf(" - Max sockets: %d.\n", data.iMaxSockets); | ||
1398 | printf(" - Max UDP datagram size: %d.\n", data.iMaxUdpDg); | ||
1399 | } | ||
1400 | #endif | ||
1401 | |||
1402 | return(1); | 1287 | return(1); |
1403 | } | 1288 | } |
1404 | 1289 | ||
1405 | static void deinitialize_sockets(void) | 1290 | static void deinitialize_sockets(void) |
1406 | { | 1291 | { |
1407 | #if PLATFORM_WIN32 | ||
1408 | WSACleanup(); | ||
1409 | #endif | ||
1410 | } | 1292 | } |
1411 | 1293 | ||
1412 | static int parse_udp_config(const char *cfgfile, gcomtype *gcom) | 1294 | static int parse_udp_config(const char *cfgfile, gcomtype *gcom) |
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/multi.c b/apps/plugins/sdl/progs/duke3d/Engine/src/multi.c index c2ded00914..b23481bc08 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/multi.c +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/multi.c | |||
@@ -46,39 +46,9 @@ long crctable[256]; | |||
46 | 46 | ||
47 | //COM ONLY variables | 47 | //COM ONLY variables |
48 | long comnum, comvect, comspeed, comtemp, comi, comescape, comreset; | 48 | long comnum, comvect, comspeed, comtemp, comi, comescape, comreset; |
49 | #ifdef PLATFORM_DOS // !!! this is a real mess. --ryan. | ||
50 | static void interrupt far comhandler(void); | ||
51 | static unsigned short orig_pm_sel, orig_rm_seg, orig_rm_off; | ||
52 | static unsigned long orig_pm_off; | ||
53 | #endif | ||
54 | volatile unsigned char *inbuf, *outbuf, *comerror, *incnt, *comtype; | 49 | volatile unsigned char *inbuf, *outbuf, *comerror, *incnt, *comtype; |
55 | volatile unsigned char *comresend; | 50 | volatile unsigned char *comresend; |
56 | volatile short *inbufplc, *inbufend, *outbufplc, *outbufend, *comport; | 51 | volatile short *inbufplc, *inbufend, *outbufplc, *outbufend, *comport; |
57 | #ifdef PLATFORM_DOS // !!! this is a real mess. --ryan. | ||
58 | static char rmbuffer[COMCODEBYTES] = //See realcom.asm | ||
59 | { | ||
60 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
61 | 0x00,0x00,0x00,0x00,0x50,0x53,0x66,0x51,0x52,0x2e, | ||
62 | 0x8b,0x16,0x08,0x00,0x83,0xc2,0x02,0xec,0x24,0x07, | ||
63 | 0x8a,0xe0,0x80,0xfc,0x02,0x74,0x08,0x80,0xfc,0x04, | ||
64 | 0x74,0x62,0xe9,0x89,0x00,0x2e,0x8b,0x16,0x08,0x00, | ||
65 | 0x2e,0x8a,0x0e,0x0a,0x00,0x80,0xe9,0x01,0x78,0x7a, | ||
66 | 0x2e,0x80,0x3e,0x0c,0x00,0x01,0x7c,0x10,0x74,0x04, | ||
67 | 0xb0,0x83,0xeb,0x02,0xb0,0x8f,0xee,0x2e,0xfe,0x0e, | ||
68 | 0x0c,0x00,0xeb,0xe3,0x2e,0x80,0x3e,0x0b,0x00,0x01, | ||
69 | 0x7c,0x12,0x74,0x04,0xb0,0x83,0xeb,0x04,0x2e,0xa0, | ||
70 | 0x0d,0x00,0xee,0x2e,0xfe,0x0e,0x0b,0x00,0xeb,0xc9, | ||
71 | 0x2e,0x8b,0x1e,0x04,0x00,0x2e,0x3b,0x1e,0x06,0x00, | ||
72 | 0x74,0x3c,0x2e,0x8a,0x87,0x80,0x41,0xee,0x43,0x81, | ||
73 | 0xe3,0xff,0x3f,0x2e,0x89,0x1e,0x04,0x00,0xeb,0xab, | ||
74 | 0x2e,0x8b,0x16,0x08,0x00,0xec,0x2e,0x8b,0x1e,0x02, | ||
75 | 0x00,0x2e,0x88,0x87,0x80,0x01,0x43,0x81,0xe3,0xff, | ||
76 | 0x3f,0x2e,0x89,0x1e,0x02,0x00,0x2e,0x80,0x3e,0x0a, | ||
77 | 0x00,0x10,0x75,0x08,0x83,0xc2,0x05,0xec,0xa8,0x01, | ||
78 | 0x75,0xd6,0xf6,0xc4,0x01,0x0f,0x84,0x56,0xff,0xb0, | ||
79 | 0x20,0xe6,0x20,0x5a,0x66,0x59,0x5b,0x58,0xcf, | ||
80 | }; | ||
81 | #endif | ||
82 | 52 | ||
83 | //NET ONLY variables | 53 | //NET ONLY variables |
84 | short socket = 0x4949; | 54 | short socket = 0x4949; |
@@ -106,80 +76,17 @@ static char rmnetbuffer[NETCODEBYTES] = | |||
106 | }; | 76 | }; |
107 | static long my7a = 0; | 77 | static long my7a = 0; |
108 | 78 | ||
109 | #ifdef PLATFORM_DOS | ||
110 | #pragma aux koutp =\ | ||
111 | "out dx, al",\ | ||
112 | parm [edx][eax]\ | ||
113 | |||
114 | #pragma aux kinp =\ | ||
115 | "in al, dx",\ | ||
116 | parm [edx] | ||
117 | #endif | ||
118 | |||
119 | long convalloc32 (long size) | 79 | long convalloc32 (long size) |
120 | { | 80 | { |
121 | #ifdef PLATFORM_DOS | ||
122 | union REGS r; | ||
123 | |||
124 | r.x.eax = 0x0100; //DPMI allocate DOS memory | ||
125 | r.x.ebx = ((size+15)>>4); //Number of paragraphs requested | ||
126 | int386(0x31,&r,&r); | ||
127 | |||
128 | if (r.x.cflag != 0) return ((long)0); //Failed | ||
129 | return ((long)((r.x.eax&0xffff)<<4)); //Returns full 32-bit offset | ||
130 | #else | ||
131 | fprintf (stderr, "%s, line %d; convalloc32() called\n", __FILE__, | 81 | fprintf (stderr, "%s, line %d; convalloc32() called\n", __FILE__, |
132 | __LINE__); | 82 | __LINE__); |
133 | return 0; | 83 | return 0; |
134 | #endif | ||
135 | } | 84 | } |
136 | 85 | ||
137 | #ifdef PLATFORM_DOS | ||
138 | #pragma aux fixregistersaftersimulate =\ | ||
139 | "cld",\ | ||
140 | "push ds",\ | ||
141 | "pop es",\ | ||
142 | |||
143 | static struct rminfo | ||
144 | { | ||
145 | long EDI, ESI, EBP, ESP, EBX, EDX, ECX, EAX; | ||
146 | short flags, ES, DS, FS, GS, IP, CS, SP, SS; | ||
147 | } RMI; | ||
148 | #endif | ||
149 | |||
150 | long simulateint(char intnum, long daeax, long daebx, long daecx, long daedx, long daesi, long daedi) | 86 | long simulateint(char intnum, long daeax, long daebx, long daecx, long daedx, long daesi, long daedi) |
151 | { | 87 | { |
152 | #ifdef PLATFORM_DOS | ||
153 | union REGS regs; | ||
154 | struct SREGS sregs; | ||
155 | |||
156 | memset(&RMI,0,sizeof(RMI)); // Set up real-mode call structure | ||
157 | memset(&sregs,0,sizeof(sregs)); | ||
158 | |||
159 | RMI.EAX = daeax; | ||
160 | RMI.EBX = daebx; | ||
161 | RMI.ECX = daecx; | ||
162 | RMI.EDX = daedx; | ||
163 | RMI.ESI = daesi-rmoffset32; | ||
164 | RMI.EDI = daedi-rmoffset32; | ||
165 | RMI.DS = rmsegment16; | ||
166 | RMI.ES = rmsegment16; | ||
167 | |||
168 | regs.w.ax = 0x0300; // Use DMPI call 300h to issue the DOS interrupt | ||
169 | regs.h.bl = intnum; | ||
170 | regs.h.bh = 0; | ||
171 | regs.w.cx = 0; | ||
172 | sregs.es = FP_SEG(&RMI); | ||
173 | regs.x.edi = FP_OFF(&RMI); | ||
174 | int386x(0x31,®s,®s,&sregs); | ||
175 | |||
176 | fixregistersaftersimulate(); | ||
177 | |||
178 | return(RMI.EAX); | ||
179 | #else | ||
180 | fprintf(stderr, "%s line %d; simulateint() called\n",__FILE__,__LINE__); | 88 | fprintf(stderr, "%s line %d; simulateint() called\n",__FILE__,__LINE__); |
181 | return 0; | 89 | return 0; |
182 | #endif | ||
183 | } | 90 | } |
184 | 91 | ||
185 | void initmultiplayers(char damultioption, char dacomrateoption, char dapriority) | 92 | void initmultiplayers(char damultioption, char dacomrateoption, char dapriority) |
@@ -237,22 +144,6 @@ int neton(void) | |||
237 | long i, j; | 144 | long i, j; |
238 | 145 | ||
239 | if ((simulateint(0x2f,(long)0x7a00,0L,0L,0L,0L,0L)&255) != 255) return(-1); | 146 | if ((simulateint(0x2f,(long)0x7a00,0L,0L,0L,0L,0L)&255) != 255) return(-1); |
240 | if (*(long *)(0x7a<<2) == 0) | ||
241 | { | ||
242 | #ifdef PLATFORM_DOS | ||
243 | printf("Faking int 0x7a to call IPX entry at: %4x:%4x\n",RMI.ES,RMI.EDI&65535); | ||
244 | my7a = convalloc32(16L); | ||
245 | *(short *)((0x7a<<2)+0) = (my7a&15); | ||
246 | *(short *)((0x7a<<2)+2) = (my7a>>4); | ||
247 | |||
248 | *(char *)(my7a+0) = 0x2e; //call far ptr [L1] | ||
249 | *(char *)(my7a+1) = 0x9a; | ||
250 | *(long *)(my7a+2) = 7L; | ||
251 | *(char *)(my7a+6) = 0xcf; //iret | ||
252 | *(short *)(my7a+7) = (RMI.EDI&65535); //L1: ipxoff | ||
253 | *(short *)(my7a+9) = RMI.ES; // ipxseg | ||
254 | #endif | ||
255 | } | ||
256 | 147 | ||
257 | //Special stuff for WATCOM C | 148 | //Special stuff for WATCOM C |
258 | if ((rmoffset32 = convalloc32(1380L+NETCODEBYTES+COMBUFSIZ)) == 0) | 149 | if ((rmoffset32 = convalloc32(1380L+NETCODEBYTES+COMBUFSIZ)) == 0) |
@@ -349,9 +240,6 @@ int comon() | |||
349 | // Baud-Setting,?,?,Parity O/E,Parity Off/On, Stop-1/2,Bits-5/6/7/8 | 240 | // Baud-Setting,?,?,Parity O/E,Parity Off/On, Stop-1/2,Bits-5/6/7/8 |
350 | // 0x0b is odd parity,1 stop bit, 8 bits | 241 | // 0x0b is odd parity,1 stop bit, 8 bits |
351 | 242 | ||
352 | #ifdef PLATFORM_DOS | ||
353 | _disable(); | ||
354 | #endif | ||
355 | koutp((*comport)+3,0x80); //enable latch registers | 243 | koutp((*comport)+3,0x80); //enable latch registers |
356 | divisor = 115200 / comspeed; | 244 | divisor = 115200 / comspeed; |
357 | koutp((*comport)+0,divisor&255); //# = 115200 / bps | 245 | koutp((*comport)+0,divisor&255); //# = 115200 / bps |
@@ -384,9 +272,6 @@ int comon() | |||
384 | 272 | ||
385 | comescape = 0; comreset = 0; | 273 | comescape = 0; comreset = 0; |
386 | *comerror = 0; *comresend = 0; | 274 | *comerror = 0; *comresend = 0; |
387 | #ifdef PLATFORM_DOS | ||
388 | _enable(); | ||
389 | #endif | ||
390 | 275 | ||
391 | syncbufleng = 0; | 276 | syncbufleng = 0; |
392 | 277 | ||
@@ -410,18 +295,12 @@ void comoff() | |||
410 | i--; | 295 | i--; |
411 | } | 296 | } |
412 | 297 | ||
413 | #ifdef PLATFORM_DOS | ||
414 | _disable(); | ||
415 | #endif | ||
416 | koutp(0x21,kinp(0x21)|(1<<(comvect&7))); //Mask vector | 298 | koutp(0x21,kinp(0x21)|(1<<(comvect&7))); //Mask vector |
417 | if (hangup != 0) | 299 | if (hangup != 0) |
418 | { | 300 | { |
419 | koutp((*comport)+1,0); | 301 | koutp((*comport)+1,0); |
420 | koutp((*comport)+4,0); | 302 | koutp((*comport)+4,0); |
421 | } | 303 | } |
422 | #ifdef PLATFORM_DOS | ||
423 | _enable(); | ||
424 | #endif | ||
425 | uninstallbicomhandlers(); | 304 | uninstallbicomhandlers(); |
426 | } | 305 | } |
427 | 306 | ||
@@ -921,87 +800,14 @@ long getcrc(char *buffer, short bufleng) | |||
921 | 800 | ||
922 | void installbicomhandlers(void) | 801 | void installbicomhandlers(void) |
923 | { | 802 | { |
924 | #ifdef PLATFORM_DOS | ||
925 | union REGS r; | ||
926 | struct SREGS sr; | ||
927 | long lowp; | ||
928 | void far *fh; | ||
929 | |||
930 | //Get old protected mode handler | ||
931 | r.x.eax = 0x3500+comvect; /* DOS get vector (INT 0Ch) */ | ||
932 | sr.ds = sr.es = 0; | ||
933 | int386x(0x21,&r,&r,&sr); | ||
934 | orig_pm_sel = (unsigned short)sr.es; | ||
935 | orig_pm_off = r.x.ebx; | ||
936 | |||
937 | //Get old real mode handler | ||
938 | r.x.eax = 0x0200; /* DPMI get real mode vector */ | ||
939 | r.h.bl = comvect; | ||
940 | int386(0x31,&r,&r); | ||
941 | orig_rm_seg = (unsigned short)r.x.ecx; | ||
942 | orig_rm_off = (unsigned short)r.x.edx; | ||
943 | |||
944 | //Allocate memory in low memory to store real mode handler | ||
945 | if ((lowp = convalloc32(COMCODEBYTES+(COMBUFSIZ<<1))) == 0) | ||
946 | { printf("Can't allocate conventional memory.\n"); exit; } | ||
947 | |||
948 | inbufplc = (short *)(lowp+0); | ||
949 | inbufend = (short *)(lowp+2); | ||
950 | outbufplc = (short *)(lowp+4); | ||
951 | outbufend = (short *)(lowp+6); | ||
952 | comport = (short *)(lowp+8); | ||
953 | comtype = (char *)(lowp+10); | ||
954 | comerror = (char *)(lowp+11); | ||
955 | comresend = (char *)(lowp+12); | ||
956 | incnt = (char *)(lowp+13); | ||
957 | inbuf = (char *)(lowp+COMCODEBYTES); | ||
958 | outbuf = (char *)(lowp+COMCODEBYTES+COMBUFSIZ); | ||
959 | |||
960 | memcpy((void *)lowp,(void *)rmbuffer,COMCODEBYTES); | ||
961 | |||
962 | //Set new protected mode handler | ||
963 | r.x.eax = 0x2500+comvect; /* DOS set vector (INT 0Ch) */ | ||
964 | fh = (void far *)comhandler; | ||
965 | r.x.edx = FP_OFF(fh); | ||
966 | sr.ds = FP_SEG(fh); //DS:EDX == &handler | ||
967 | sr.es = 0; | ||
968 | int386x(0x21,&r,&r,&sr); | ||
969 | |||
970 | //Set new real mode handler (must be after setting protected mode) | ||
971 | r.x.eax = 0x0201; | ||
972 | r.h.bl = comvect; //CX:DX == real mode &handler | ||
973 | r.x.ecx = ((lowp>>4)&0xffff); //D32realseg | ||
974 | r.x.edx = COMCODEOFFS; //D32realoff | ||
975 | int386(0x31,&r,&r); | ||
976 | #else | ||
977 | fprintf (stderr,"%s, line %d; installbicomhandlers() called\n", | 803 | fprintf (stderr,"%s, line %d; installbicomhandlers() called\n", |
978 | __FILE__, __LINE__); | 804 | __FILE__, __LINE__); |
979 | #endif | ||
980 | } | 805 | } |
981 | 806 | ||
982 | void uninstallbicomhandlers(void) | 807 | void uninstallbicomhandlers(void) |
983 | { | 808 | { |
984 | #ifdef PLATFORM_DOS | ||
985 | union REGS r; | ||
986 | struct SREGS sr; | ||
987 | |||
988 | //restore old protected mode handler | ||
989 | r.x.eax = 0x2500+comvect; /* DOS set vector (INT 0Ch) */ | ||
990 | r.x.edx = orig_pm_off; | ||
991 | sr.ds = orig_pm_sel; /* DS:EDX == &handler */ | ||
992 | sr.es = 0; | ||
993 | int386x(0x21,&r,&r,&sr); | ||
994 | |||
995 | //restore old real mode handler | ||
996 | r.x.eax = 0x0201; /* DPMI set real mode vector */ | ||
997 | r.h.bl = comvect; | ||
998 | r.x.ecx = (unsigned long)orig_rm_seg; //CX:DX == real mode &handler | ||
999 | r.x.edx = (unsigned long)orig_rm_off; | ||
1000 | int386(0x31,&r,&r); | ||
1001 | #else | ||
1002 | fprintf (stderr, "%s line %d; uninstallbicomhandlers() called\n", | 809 | fprintf (stderr, "%s line %d; uninstallbicomhandlers() called\n", |
1003 | __FILE__, __LINE__); | 810 | __FILE__, __LINE__); |
1004 | #endif | ||
1005 | } | 811 | } |
1006 | 812 | ||
1007 | void processreservedmessage(short tempbufleng, char *datempbuf) | 813 | void processreservedmessage(short tempbufleng, char *datempbuf) |
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/platform.h b/apps/plugins/sdl/progs/duke3d/Engine/src/platform.h index a8cfe1843e..6d91d25530 100644 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/platform.h +++ b/apps/plugins/sdl/progs/duke3d/Engine/src/platform.h | |||
@@ -1,15 +1,7 @@ | |||
1 | #ifndef _INCLUDE_PLATFORM_DUKE_H_ | 1 | #ifndef _INCLUDE_PLATFORM_DUKE_H_ |
2 | #define _INCLUDE_PLATFORM_DUKE_H_ | 2 | #define _INCLUDE_PLATFORM_DUKE_H_ |
3 | 3 | ||
4 | #if (defined PLATFORM_WIN32) | 4 | #if (defined ROCKBOX) |
5 | #include "win32_compat.h" | ||
6 | #elif (defined PLATFORM_UNIX) | ||
7 | #include "unix_compat.h" | ||
8 | #elif (defined PLATFORM_DOS) | ||
9 | #include "doscmpat.h" | ||
10 | #elif (defined __APPLE__) | ||
11 | #include "macos_compat.h" | ||
12 | #elif (defined ROCKBOX) | ||
13 | #include "rockbox_compat.h" | 5 | #include "rockbox_compat.h" |
14 | #else | 6 | #else |
15 | #error Define your platform! | 7 | #error Define your platform! |
@@ -21,15 +13,9 @@ | |||
21 | 13 | ||
22 | uint16_t _swap16(uint16_t D); | 14 | uint16_t _swap16(uint16_t D); |
23 | unsigned int _swap32(unsigned int D); | 15 | unsigned int _swap32(unsigned int D); |
24 | #if defined(PLATFORM_MACOSX) && defined(__ppc__) | ||
25 | #define PLATFORM_BIGENDIAN 1 | ||
26 | #define BUILDSWAP_INTEL16(x) _swap16(x) | ||
27 | #define BUILDSWAP_INTEL32(x) _swap32(x) | ||
28 | #else | ||
29 | #define PLATFORM_LITTLEENDIAN 1 | 16 | #define PLATFORM_LITTLEENDIAN 1 |
30 | #define BUILDSWAP_INTEL16(x) (x) | 17 | #define BUILDSWAP_INTEL16(x) (x) |
31 | #define BUILDSWAP_INTEL32(x) (x) | 18 | #define BUILDSWAP_INTEL32(x) (x) |
32 | #endif | ||
33 | 19 | ||
34 | #endif /* !defined _INCLUDE_PLATFORM_H_ */ | 20 | #endif /* !defined _INCLUDE_PLATFORM_H_ */ |
35 | 21 | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/unix_compat.h b/apps/plugins/sdl/progs/duke3d/Engine/src/unix_compat.h deleted file mode 100644 index 811e99ea08..0000000000 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/unix_compat.h +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | // | ||
2 | // unix_compat.h | ||
3 | // Duke3D | ||
4 | // | ||
5 | // Based on macos_compat.h | ||
6 | // Copyright Wed, Jul 31, 2013, Juan Manuel Borges Caño (GPLv3+) | ||
7 | // | ||
8 | |||
9 | #ifndef Duke3D_unix_compat_h | ||
10 | #define Duke3D_unix_compat_h | ||
11 | |||
12 | //#define BYTE_ORDER LITTLE_ENDIAN | ||
13 | #define PLATFORM_SUPPORTS_SDL | ||
14 | |||
15 | #include <stdlib.h> | ||
16 | |||
17 | #define kmalloc(x) malloc(x) | ||
18 | #define kkmalloc(x) malloc(x) | ||
19 | #define kfree(x) free(x) | ||
20 | #define kkfree(x) free(x) | ||
21 | |||
22 | #ifdef FP_OFF | ||
23 | #undef FP_OFF | ||
24 | #endif | ||
25 | |||
26 | // Horrible horrible macro: Watcom allowed memory pointer to be cast | ||
27 | // to a 32bits integer. The code is unfortunately stuffed with this :( ! | ||
28 | #define FP_OFF(x) ((int32_t) (x)) | ||
29 | |||
30 | #ifndef max | ||
31 | #define max(x, y) (((x) > (y)) ? (x) : (y)) | ||
32 | #endif | ||
33 | |||
34 | #ifndef min | ||
35 | #define min(x, y) (((x) < (y)) ? (x) : (y)) | ||
36 | #endif | ||
37 | |||
38 | #include <inttypes.h> | ||
39 | #define __int64 int64_t | ||
40 | |||
41 | #define O_BINARY 0 | ||
42 | |||
43 | #define UDP_NETWORKING 1 | ||
44 | |||
45 | #define PLATFORM_UNIX 1 | ||
46 | |||
47 | /* | ||
48 | #define SOL_IP SOL_SOCKET | ||
49 | #define IP_RECVERR SO_BROADCAST | ||
50 | */ | ||
51 | |||
52 | #define stricmp strcasecmp | ||
53 | #define strcmpi strcasecmp | ||
54 | |||
55 | #define S_IREAD S_IRUSR | ||
56 | #include <assert.h> | ||
57 | #include <sys/types.h> | ||
58 | #include <sys/stat.h> | ||
59 | #include <sys/uio.h> | ||
60 | #include <unistd.h> | ||
61 | #include <fcntl.h> | ||
62 | #include <dirent.h> | ||
63 | #include <string.h> | ||
64 | |||
65 | #define USER_DUMMY_NETWORK 1 | ||
66 | |||
67 | #endif | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/win32_compat.h b/apps/plugins/sdl/progs/duke3d/Engine/src/win32_compat.h deleted file mode 100644 index e509e9bf37..0000000000 --- a/apps/plugins/sdl/progs/duke3d/Engine/src/win32_compat.h +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
1 | /* | ||
2 | * win32 compatibility header. Takes care of some legacy code issues | ||
3 | * and incompatibilities at the source level. | ||
4 | * | ||
5 | * Written by Ryan C. Gordon (icculus@clutteredmind.org) | ||
6 | * | ||
7 | * Please do NOT harrass Ken Silverman about any code modifications | ||
8 | * (including this file) to BUILD. | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman | ||
13 | * Ken Silverman's official web site: "http://www.advsys.net/ken" | ||
14 | * See the included license file "BUILDLIC.TXT" for license info. | ||
15 | * This file IS NOT A PART OF Ken Silverman's original release | ||
16 | */ | ||
17 | |||
18 | |||
19 | |||
20 | #ifndef _INCLUDE_WIN32_COMPAT_H_ | ||
21 | #define _INCLUDE_WIN32_COMPAT_H_ | ||
22 | |||
23 | #if (!defined PLATFORM_WIN32) | ||
24 | #error PLATFORM_WIN32 is not defined. | ||
25 | #endif | ||
26 | |||
27 | #define PLATFORM_SUPPORTS_SDL | ||
28 | |||
29 | #include <stdio.h> | ||
30 | |||
31 | #if (!defined _MSC_VER) | ||
32 | #include <unistd.h> | ||
33 | #else | ||
34 | #include <fcntl.h> | ||
35 | #include <SYS\STAT.H> | ||
36 | #endif | ||
37 | |||
38 | #include <stdlib.h> | ||
39 | #include <io.h> | ||
40 | #include <direct.h> | ||
41 | #include <conio.h> | ||
42 | #include <dos.h> | ||
43 | #include <assert.h> | ||
44 | #include <string.h> | ||
45 | |||
46 | #define kmalloc(x) malloc(x) | ||
47 | #define kkmalloc(x) malloc(x) | ||
48 | #define kfree(x) free(x) | ||
49 | #define kkfree(x) free(x) | ||
50 | |||
51 | #ifdef FP_OFF | ||
52 | #undef FP_OFF | ||
53 | #endif | ||
54 | |||
55 | #define FP_OFF(x) ((long) (x)) | ||
56 | |||
57 | /* !!! This might be temporary. */ | ||
58 | #define printext16 printext256 | ||
59 | #define printext16_noupdate printext256_noupdate | ||
60 | |||
61 | #ifndef max | ||
62 | #define max(x, y) (((x) > (y)) ? (x) : (y)) | ||
63 | #endif | ||
64 | |||
65 | #ifndef min | ||
66 | #define min(x, y) (((x) < (y)) ? (x) : (y)) | ||
67 | #endif | ||
68 | |||
69 | #if (defined __WATCOMC__) | ||
70 | #define inline | ||
71 | #pragma intrinsic(min); | ||
72 | #pragma intrinsic(max); | ||
73 | #define __int64 long long | ||
74 | #endif | ||
75 | |||
76 | #if (defined _MSC_VER) | ||
77 | #if ((!defined _INTEGRAL_MAX_BITS) || (_INTEGRAL_MAX_BITS < 64)) | ||
78 | #error __int64 type not supported | ||
79 | #endif | ||
80 | |||
81 | #define open _open | ||
82 | #define O_BINARY _O_BINARY | ||
83 | #define O_RDONLY _O_RDONLY | ||
84 | #define O_WRONLY _O_WRONLY | ||
85 | #define O_RDWR _O_RDWR | ||
86 | #define O_TRUNC _O_TRUNC | ||
87 | #define O_CREAT _O_CREAT | ||
88 | #define S_IREAD _S_IREAD | ||
89 | #define S_IWRITE _S_IWRITE | ||
90 | #define S_IRDWR _S_IRDWR | ||
91 | #endif /* defined _MSC_VER */ | ||
92 | |||
93 | #define snprintf _snprintf | ||
94 | |||
95 | #define strncasecmp strnicmp | ||
96 | |||
97 | //Damn you Microsoft, how hard would it REALLY be to support C99 ?!??!?! | ||
98 | #define inline | ||
99 | #include "windows/inttypes.h" | ||
100 | |||
101 | #endif | ||
102 | |||
103 | /* end of win32_compat.h ... */ | ||
104 | |||
105 | |||
106 | |||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/dpmi.h b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/dpmi.h index 0ca6b93a6a..adfb216f03 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/dpmi.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/dpmi.h | |||
@@ -33,11 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
33 | 33 | ||
34 | #include "SDL.h" | 34 | #include "SDL.h" |
35 | 35 | ||
36 | #ifdef _WIN32 | ||
37 | #include "../../../Engine/src/windows/inttypes.h" | ||
38 | #else | ||
39 | #include <inttypes.h> | 36 | #include <inttypes.h> |
40 | #endif | ||
41 | 37 | ||
42 | enum DPMI_Errors | 38 | enum DPMI_Errors |
43 | { | 39 | { |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/fx_man.h b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/fx_man.h index c8361716e3..9e74a381e4 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/fx_man.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/fx_man.h | |||
@@ -32,11 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
32 | #define __FX_MAN_H | 32 | #define __FX_MAN_H |
33 | 33 | ||
34 | #include "sndcards.h" | 34 | #include "sndcards.h" |
35 | #ifdef _WIN32 | 35 | #include <inttypes.h> |
36 | #include "../../Engine/src/windows/inttypes.h" | ||
37 | #else | ||
38 | #include <inttypes.h> | ||
39 | #endif | ||
40 | 36 | ||
41 | typedef struct | 37 | typedef struct |
42 | { | 38 | { |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/task_man.c b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/task_man.c index c39135fedb..c6e2cd6e9e 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/task_man.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/task_man.c | |||
@@ -856,121 +856,3 @@ int TS_LockMemory | |||
856 | } | 856 | } |
857 | 857 | ||
858 | #endif | 858 | #endif |
859 | |||
860 | /* | ||
861 | // Converts a hex byte to an integer | ||
862 | |||
863 | static int btoi | ||
864 | ( | ||
865 | unsigned char bcd | ||
866 | ) | ||
867 | |||
868 | { | ||
869 | unsigned b; | ||
870 | unsigned c; | ||
871 | unsigned d; | ||
872 | |||
873 | b = bcd / 16; | ||
874 | c = bcd - b * 16; | ||
875 | d = b * 10 + c; | ||
876 | return( d ); | ||
877 | } | ||
878 | |||
879 | |||
880 | static void RestoreRealTimeClock | ||
881 | ( | ||
882 | void | ||
883 | ) | ||
884 | |||
885 | { | ||
886 | int read; | ||
887 | int i; | ||
888 | int hr; | ||
889 | int min; | ||
890 | int sec; | ||
891 | int cent; | ||
892 | int yr; | ||
893 | int mo; | ||
894 | int day; | ||
895 | int year; | ||
896 | union REGS inregs; | ||
897 | |||
898 | // Read Real Time Clock Time. | ||
899 | read = FALSE; | ||
900 | inregs.h.ah = 0x02; | ||
901 | for( i = 1; i <= 3; i++ ) | ||
902 | { | ||
903 | int386( 0x1A, &inregs, &inregs ); | ||
904 | if ( inregs.x.cflag == 0 ) | ||
905 | { | ||
906 | read = TRUE; | ||
907 | } | ||
908 | } | ||
909 | |||
910 | if ( read ) | ||
911 | { | ||
912 | //and convert BCD to integer format | ||
913 | hr = btoi( inregs.h.ch ); | ||
914 | min = btoi( inregs.h.cl ); | ||
915 | sec = btoi( inregs.h.dh ); | ||
916 | |||
917 | // Read Real Time Clock Date. | ||
918 | inregs.h.ah = 0x04; | ||
919 | int386( 0x1A, &inregs, &inregs ); | ||
920 | if ( inregs.x.cflag == 0 ) | ||
921 | { | ||
922 | //and convert BCD to integer format | ||
923 | cent = btoi( inregs.h.ch ); | ||
924 | yr = btoi( inregs.h.cl ); | ||
925 | mo = btoi( inregs.h.dh ); | ||
926 | day = btoi( inregs.h.dl ); | ||
927 | year = cent * 100 + yr; | ||
928 | |||
929 | // Set System Time. | ||
930 | inregs.h.ch = hr; | ||
931 | inregs.h.cl = min; | ||
932 | inregs.h.dh = sec; | ||
933 | inregs.h.dl = 0; | ||
934 | inregs.h.ah = 0x2D; | ||
935 | int386( 0x21, &inregs, &inregs ); | ||
936 | |||
937 | // Set System Date. | ||
938 | inregs.w.cx = year; | ||
939 | inregs.h.dh = mo; | ||
940 | inregs.h.dl = day; | ||
941 | inregs.h.ah = 0x2B; | ||
942 | int386( 0x21, &inregs, &inregs ); | ||
943 | } | ||
944 | } | ||
945 | } | ||
946 | */ | ||
947 | /* | ||
948 | struct dostime_t time; | ||
949 | struct dosdate_t date; | ||
950 | |||
951 | outp(0x70,0); | ||
952 | time.second=inp(0x71); | ||
953 | outp(0x70,2); | ||
954 | time.minute=inp(0x71); | ||
955 | outp(0x70,4); | ||
956 | time.hour=inp(0x71); | ||
957 | |||
958 | outp(0x70,7); | ||
959 | date.day=inp(0x71); | ||
960 | outp(0x70,8); | ||
961 | date.month=inp(0x71); | ||
962 | outp(0x70,9); | ||
963 | date.year=inp(0x71); | ||
964 | |||
965 | time.second=(time.second&0x0f)+((time.second>>4)*10); | ||
966 | time.minute=(time.minute&0x0f)+((time.minute>>4)*10); | ||
967 | time.hour=(time.hour&0x0f)+((time.hour>>4)*10); | ||
968 | |||
969 | date.day=(date.day&0x0f)+((date.day>>4)*10); | ||
970 | date.month=(date.month&0x0f)+((date.month>>4)*10); | ||
971 | date.year=(date.year&0x0f)+((date.year>>4)*10); | ||
972 | |||
973 | _dos_settime(&time); | ||
974 | _dos_setdate(&date); | ||
975 | |||
976 | */ | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/config.c b/apps/plugins/sdl/progs/duke3d/Game/src/config.c index 1649c40b07..f3d05d093c 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/config.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/config.c | |||
@@ -24,11 +24,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
24 | */ | 24 | */ |
25 | //------------------------------------------------------------------------- | 25 | //------------------------------------------------------------------------- |
26 | 26 | ||
27 | #if PLATFORM_DOS | ||
28 | #include <conio.h> | ||
29 | #include <dos.h> | ||
30 | #endif | ||
31 | |||
32 | #include <stdio.h> | 27 | #include <stdio.h> |
33 | #include <string.h> | 28 | #include <string.h> |
34 | #include <stdlib.h> | 29 | #include <stdlib.h> |
@@ -698,18 +693,11 @@ void CONFIG_ReadSetup( void ) | |||
698 | } | 693 | } |
699 | SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXDevice",&FXDevice); | 694 | SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXDevice",&FXDevice); |
700 | 695 | ||
701 | #if !PLATFORM_DOS // reimplementation of ASS expects a "SoundScape". | ||
702 | if (FXDevice != NumSoundCards) | 696 | if (FXDevice != NumSoundCards) |
703 | FXDevice = SoundScape; | 697 | FXDevice = SoundScape; |
704 | #endif | ||
705 | 698 | ||
706 | SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicDevice",&MusicDevice); | 699 | SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicDevice",&MusicDevice); |
707 | 700 | ||
708 | //#if !PLATFORM_DOS // reimplementation of ASS expects a "SoundScape". | ||
709 | // if (MusicDevice != NumSoundCards) | ||
710 | // MusicDevice = SoundScape; | ||
711 | //#endif | ||
712 | |||
713 | // FIX_00015: Forced NumVoices=8, NumChannels=2, NumBits=16, MixRate=44100, ScreenMode = x( | 701 | // FIX_00015: Forced NumVoices=8, NumChannels=2, NumBits=16, MixRate=44100, ScreenMode = x( |
714 | // (ScreenMode has no meaning anymore) | 702 | // (ScreenMode has no meaning anymore) |
715 | 703 | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h b/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h index 054cb96914..1e6319c807 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h | |||
@@ -1,11 +1,7 @@ | |||
1 | #ifndef _CVARDEFS_H_ | 1 | #ifndef _CVARDEFS_H_ |
2 | #define _CVARDEFS_H_ | 2 | #define _CVARDEFS_H_ |
3 | 3 | ||
4 | #ifdef _WIN32 | 4 | #include <inttypes.h> |
5 | #include "../../Engine/src/windows/inttypes.h" | ||
6 | #else | ||
7 | #include <inttypes.h> | ||
8 | #endif | ||
9 | 5 | ||
10 | void CVARDEFS_Init(); | 6 | void CVARDEFS_Init(); |
11 | void CVARDEFS_Render(); | 7 | void CVARDEFS_Render(); |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h b/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h index 2ad341e58e..206e16a9c4 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h | |||
@@ -4,11 +4,7 @@ | |||
4 | #define REGCONVAR(varname, varhelp, variable, function) CVAR_RegisterCvar(varname, varhelp, &variable, &function) | 4 | #define REGCONVAR(varname, varhelp, variable, function) CVAR_RegisterCvar(varname, varhelp, &variable, &function) |
5 | #define REGCONFUNC(varname, varhelp, function) CVAR_RegisterCvar(varname, varhelp, NULL, &function) | 5 | #define REGCONFUNC(varname, varhelp, function) CVAR_RegisterCvar(varname, varhelp, NULL, &function) |
6 | 6 | ||
7 | #ifdef _WIN32 | 7 | #include <inttypes.h> |
8 | #include "../../Engine/src/windows/inttypes.h" | ||
9 | #else | ||
10 | #include <inttypes.h> | ||
11 | #endif | ||
12 | 8 | ||
13 | typedef void (*function_t) (void* binding); | 9 | typedef void (*function_t) (void* binding); |
14 | 10 | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/duke3d.h b/apps/plugins/sdl/progs/duke3d/Game/src/duke3d.h index fee94d961a..02c88a42c7 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/duke3d.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/duke3d.h | |||
@@ -28,11 +28,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
28 | 28 | ||
29 | #include "platform.h" | 29 | #include "platform.h" |
30 | 30 | ||
31 | #ifdef _WIN32 | ||
32 | #include "../../Engine/src/windows/inttypes.h" | ||
33 | #else | ||
34 | #include <inttypes.h> | 31 | #include <inttypes.h> |
35 | #endif | ||
36 | 32 | ||
37 | #include <fcntl.h> | 33 | #include <fcntl.h> |
38 | #include <time.h> | 34 | #include <time.h> |
@@ -50,26 +46,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
50 | #endif | 46 | #endif |
51 | #endif | 47 | #endif |
52 | 48 | ||
53 | #if PLATFORM_DOS | ||
54 | #include <dos.h> | ||
55 | #include <bios.h> | ||
56 | #include <io.h> | ||
57 | #define PATH_SEP_CHAR '\\' | ||
58 | #define PATH_SEP_STR "\\" | ||
59 | #endif | ||
60 | |||
61 | #if PLATFORM_UNIX && !defined(ROCKBOX) | ||
62 | #include "dukeunix.h" | ||
63 | #endif | ||
64 | |||
65 | #if PLATFORM_MACOSX | ||
66 | #include "dukeunix.h" | ||
67 | #endif | ||
68 | |||
69 | #if PLATFORM_WIN32 | ||
70 | #include "dukewin.h" | ||
71 | #endif | ||
72 | |||
73 | #ifdef ROCKBOX | 49 | #ifdef ROCKBOX |
74 | #define PLATFORM_ROCKBOX 1 | 50 | #define PLATFORM_ROCKBOX 1 |
75 | #endif | 51 | #endif |
@@ -524,11 +500,6 @@ extern struct player_struct ps[MAXPLAYERS]; | |||
524 | extern struct player_orig po[MAXPLAYERS]; | 500 | extern struct player_orig po[MAXPLAYERS]; |
525 | extern struct user_defs ud; | 501 | extern struct user_defs ud; |
526 | 502 | ||
527 | // ported build engine has this, too. --ryan. | ||
528 | #if PLATFORM_DOS | ||
529 | extern short int moustat; | ||
530 | #endif | ||
531 | |||
532 | extern short int global_random; | 503 | extern short int global_random; |
533 | extern int32_t scaredfallz; | 504 | extern int32_t scaredfallz; |
534 | extern char buf[80]; //My own generic input buffer | 505 | extern char buf[80]; //My own generic input buffer |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/dukerockbox.h b/apps/plugins/sdl/progs/duke3d/Game/src/dukerockbox.h index 9035336b8a..a5806b14b9 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/dukerockbox.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/dukerockbox.h | |||
@@ -32,25 +32,6 @@ | |||
32 | #define O_BINARY 0 | 32 | #define O_BINARY 0 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | struct find_t | ||
36 | { | ||
37 | DIR *dir; | ||
38 | char pattern[MAX_PATH]; | ||
39 | char name[MAX_PATH]; | ||
40 | }; | ||
41 | int _dos_findfirst(char *filename, int x, struct find_t *f); | ||
42 | int _dos_findnext(struct find_t *f); | ||
43 | |||
44 | struct dosdate_t | ||
45 | { | ||
46 | uint8_t day; | ||
47 | uint8_t month; | ||
48 | unsigned int year; | ||
49 | uint8_t dayofweek; | ||
50 | }; | ||
51 | |||
52 | void _dos_getdate(struct dosdate_t *date); | ||
53 | |||
54 | #ifndef min | 35 | #ifndef min |
55 | #define min(x, y) ((x) < (y) ? (x) : (y)) | 36 | #define min(x, y) ((x) < (y) ? (x) : (y)) |
56 | #endif | 37 | #endif |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/dukeunix.h b/apps/plugins/sdl/progs/duke3d/Game/src/dukeunix.h deleted file mode 100644 index 451d174785..0000000000 --- a/apps/plugins/sdl/progs/duke3d/Game/src/dukeunix.h +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | // | ||
2 | // dukeunix.h | ||
3 | // Duke3D | ||
4 | // | ||
5 | // Created by fabien sanglard on 12-12-12. | ||
6 | // Copyright (c) 2012 fabien sanglard. All rights reserved. | ||
7 | // | ||
8 | |||
9 | #ifndef Duke3D_dukeunix_h | ||
10 | #define Duke3D_dukeunix_h | ||
11 | |||
12 | |||
13 | #define cdecl | ||
14 | #define __far | ||
15 | #define __interrupt | ||
16 | |||
17 | |||
18 | //#define STUBBED(x) | ||
19 | #ifdef __SUNPRO_C | ||
20 | #define STUBBED(x) fprintf(stderr,"STUB: %s (??? %s:%d)\n",x,__FILE__,__LINE__) | ||
21 | #else | ||
22 | #define STUBBED(x) fprintf(stderr,"STUB: %s (%s, %s:%d)\n",x,__FUNCTION__,__FILE__,__LINE__) | ||
23 | #endif | ||
24 | |||
25 | #define PATH_SEP_CHAR '/' | ||
26 | #define PATH_SEP_STR "/" | ||
27 | #define ROOTDIR "/" | ||
28 | #define CURDIR "./" | ||
29 | |||
30 | #ifndef O_BINARY | ||
31 | #define O_BINARY 0 | ||
32 | #endif | ||
33 | |||
34 | #include <unistd.h> | ||
35 | #include <fcntl.h> | ||
36 | #include <sys/stat.h> | ||
37 | #include <sys/types.h> | ||
38 | #include <dirent.h> | ||
39 | #include <assert.h> | ||
40 | |||
41 | struct find_t | ||
42 | { | ||
43 | DIR *dir; | ||
44 | char pattern[MAX_PATH]; | ||
45 | char name[MAX_PATH]; | ||
46 | }; | ||
47 | int _dos_findfirst(char *filename, int x, struct find_t *f); | ||
48 | int _dos_findnext(struct find_t *f); | ||
49 | |||
50 | struct dosdate_t | ||
51 | { | ||
52 | uint8_t day; | ||
53 | uint8_t month; | ||
54 | unsigned int year; | ||
55 | uint8_t dayofweek; | ||
56 | }; | ||
57 | |||
58 | void _dos_getdate(struct dosdate_t *date); | ||
59 | |||
60 | #ifndef min | ||
61 | #define min(x, y) ((x) < (y) ? (x) : (y)) | ||
62 | #endif | ||
63 | |||
64 | #ifndef max | ||
65 | #define max(x, y) ((x) > (y) ? (x) : (y)) | ||
66 | #endif | ||
67 | |||
68 | |||
69 | |||
70 | #ifndef strcmpi | ||
71 | #define strcmpi(x, y) strcasecmp(x, y) | ||
72 | #endif | ||
73 | |||
74 | #ifdef DC | ||
75 | #undef stderr | ||
76 | #undef stdout | ||
77 | #undef getchar | ||
78 | /* kos compat */ | ||
79 | #define stderr ((FILE*)2) | ||
80 | #define stdout ((FILE*)2) | ||
81 | #define Z_AvailHeap() ((10 * 1024) * 1024) | ||
82 | #else | ||
83 | // 64 megs should be enough for anybody. :) --ryan. | ||
84 | #define Z_AvailHeap() ((64 * 1024) * 1024) | ||
85 | #endif | ||
86 | |||
87 | #define printchrasm(x,y,ch) printf("%c", (uint8_t ) (ch & 0xFF)) | ||
88 | |||
89 | #ifdef __GNUC__ | ||
90 | #define GCC_PACK1_EXT __attribute__((packed,aligned(1))) | ||
91 | #endif | ||
92 | |||
93 | |||
94 | // FCS: Game.c features calls to mkdir without the proper flags. | ||
95 | // Giving all access is ugly but it is just game OK ! | ||
96 | #define mkdir(X) mkdir(X,0777) | ||
97 | |||
98 | #define getch getchar | ||
99 | |||
100 | #endif | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/dukewin.h b/apps/plugins/sdl/progs/duke3d/Game/src/dukewin.h deleted file mode 100644 index f35becb401..0000000000 --- a/apps/plugins/sdl/progs/duke3d/Game/src/dukewin.h +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | #ifndef _INCL_DUKEWIN_H_ | ||
2 | #define _INCL_DUKEWIN_H_ 1 | ||
3 | |||
4 | #ifndef _MSC_VER /* might need this. */ | ||
5 | typedef int32_t int32_t __int64; | ||
6 | #endif | ||
7 | |||
8 | #pragma warning(disable:4761) | ||
9 | |||
10 | #if USE_SDL | ||
11 | #include "SDL.h" | ||
12 | #endif | ||
13 | |||
14 | #ifdef _DEBUG | ||
15 | #define STUBBED(x) printf("STUB: %s in %s:%d\n", x, __FILE__, __LINE__) | ||
16 | #else | ||
17 | #define STUBBED(x) | ||
18 | #endif | ||
19 | |||
20 | #define PATH_SEP_CHAR '\\' | ||
21 | #define PATH_SEP_STR "\\" | ||
22 | |||
23 | #include <sys/stat.h> | ||
24 | #include <io.h> | ||
25 | #include <assert.h> | ||
26 | |||
27 | struct find_t | ||
28 | { | ||
29 | int32_t handle; | ||
30 | struct _finddata_t data; | ||
31 | uint8_t name[MAX_PATH]; | ||
32 | }; | ||
33 | int _dos_findfirst(uint8_t *filename, int x, struct find_t *f); | ||
34 | int _dos_findnext(struct find_t *f); | ||
35 | |||
36 | struct dosdate_t | ||
37 | { | ||
38 | uint8_t day; | ||
39 | uint8_t month; | ||
40 | unsigned int year; | ||
41 | uint8_t dayofweek; | ||
42 | }; | ||
43 | |||
44 | void _dos_getdate(struct dosdate_t *date); | ||
45 | |||
46 | #ifndef min | ||
47 | #define min(x, y) ((x) < (y) ? (x) : (y)) | ||
48 | #endif | ||
49 | |||
50 | #ifndef max | ||
51 | #define max(x, y) ((x) > (y) ? (x) : (y)) | ||
52 | #endif | ||
53 | |||
54 | #ifdef FP_OFF | ||
55 | #undef FP_OFF | ||
56 | #endif | ||
57 | #define FP_OFF(x) ((int32_t) (x)) | ||
58 | |||
59 | // 64 megs should be enough for anybody. :) --ryan. | ||
60 | #define Z_AvailHeap() ((64 * 1024) * 1024) | ||
61 | |||
62 | #define printchrasm(x,y,ch) printf("%c", (uint8_t ) (ch & 0xFF)) | ||
63 | |||
64 | #define cdecl | ||
65 | |||
66 | #define open _open | ||
67 | #define O_BINARY _O_BINARY | ||
68 | #define O_RDONLY _O_RDONLY | ||
69 | #define O_WRONLY _O_WRONLY | ||
70 | #define O_RDWR _O_RDWR | ||
71 | #define O_TRUNC _O_TRUNC | ||
72 | #define O_CREAT _O_CREAT | ||
73 | #define S_IREAD _S_IREAD | ||
74 | #define S_IWRITE _S_IWRITE | ||
75 | #define S_IRDWR _S_IRDWR | ||
76 | |||
77 | #define S_IRUSR S_IREAD | ||
78 | #define S_IWUSR S_IWRITE | ||
79 | #define S_IRGRP 0 | ||
80 | #define S_IWGRP 0 | ||
81 | |||
82 | #define F_OK 0 | ||
83 | |||
84 | #define HAVE_PRAGMA_PACK 1 | ||
85 | |||
86 | #endif | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/game.c b/apps/plugins/sdl/progs/duke3d/Game/src/game.c index 0cb1d95b86..8b2c0e959f 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/game.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/game.c | |||
@@ -24,11 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | //------------------------------------------------------------------------- | 25 | //------------------------------------------------------------------------- |
26 | 26 | ||
27 | #ifdef _WIN32 | ||
28 | #include <windows.h> | ||
29 | #else | ||
30 | #include "SDL.h" | 27 | #include "SDL.h" |
31 | #endif | ||
32 | 28 | ||
33 | #include "types.h" | 29 | #include "types.h" |
34 | 30 | ||
@@ -113,38 +109,12 @@ void pitch_test( void ); | |||
113 | uint8_t restorepalette,screencapt,nomorelogohack; | 109 | uint8_t restorepalette,screencapt,nomorelogohack; |
114 | int sendmessagecommand = -1; | 110 | int sendmessagecommand = -1; |
115 | 111 | ||
116 | #if PLATFORM_DOS | ||
117 | task *TimerPtr=NULL; | ||
118 | #endif | ||
119 | |||
120 | extern int32_t lastvisinc; | 112 | extern int32_t lastvisinc; |
121 | 113 | ||
122 | // Build Engine port implements this. --ryan. | ||
123 | #if PLATFORM_DOS | ||
124 | static void timerhandler(task *unused) | ||
125 | { | ||
126 | totalclock++; | ||
127 | } | ||
128 | |||
129 | void inittimer() | ||
130 | { | ||
131 | TimerPtr = TS_ScheduleTask( timerhandler,TICRATE, 1, NULL ); | ||
132 | TS_Dispatch(); | ||
133 | } | ||
134 | |||
135 | void uninittimer(void) | ||
136 | { | ||
137 | if (TimerPtr) | ||
138 | TS_Terminate( TimerPtr ); | ||
139 | TimerPtr = NULL; | ||
140 | TS_Shutdown(); | ||
141 | } | ||
142 | #else | ||
143 | void timerhandler(void) | 114 | void timerhandler(void) |
144 | { | 115 | { |
145 | totalclock++; | 116 | totalclock++; |
146 | } | 117 | } |
147 | #endif | ||
148 | 118 | ||
149 | int gametext(int x,int y,char *t,uint8_t s,short dabits) | 119 | int gametext(int x,int y,char *t,uint8_t s,short dabits) |
150 | { | 120 | { |
@@ -2471,11 +2441,7 @@ GOTOHERE: | |||
2471 | if(true) | 2441 | if(true) |
2472 | { | 2442 | { |
2473 | if(*t == ' ' && *(t+1) == 0) *t = 0; | 2443 | if(*t == ' ' && *(t+1) == 0) *t = 0; |
2474 | #if PLATFORM_DOS // Is there a good reason for this? --ryan. | ||
2475 | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); | ||
2476 | #else | ||
2477 | printf("\n%s\n",t); | 2444 | printf("\n%s\n",t); |
2478 | #endif | ||
2479 | } | 2445 | } |
2480 | // CTW END - MODIFICATION | 2446 | // CTW END - MODIFICATION |
2481 | } | 2447 | } |
@@ -7818,18 +7784,11 @@ void Startup(void) | |||
7818 | if(networkmode == 255) | 7784 | if(networkmode == 255) |
7819 | networkmode = 1; | 7785 | networkmode = 1; |
7820 | 7786 | ||
7821 | #ifdef PLATFORM_DOS | ||
7822 | puts("Checking music inits."); | ||
7823 | MusicStartup(); | ||
7824 | puts("Checking sound inits."); | ||
7825 | SoundStartup(); | ||
7826 | #else | ||
7827 | /* SBF - wasn't sure if swapping them would harm anything. */ | 7787 | /* SBF - wasn't sure if swapping them would harm anything. */ |
7828 | puts("Checking sound inits."); | 7788 | puts("Checking sound inits."); |
7829 | SoundStartup(); | 7789 | SoundStartup(); |
7830 | puts("Checking music inits."); | 7790 | puts("Checking music inits."); |
7831 | MusicStartup(); | 7791 | MusicStartup(); |
7832 | #endif | ||
7833 | 7792 | ||
7834 | // AutoAim | 7793 | // AutoAim |
7835 | if(nHostForceDisableAutoaim) | 7794 | if(nHostForceDisableAutoaim) |
@@ -8019,64 +7978,6 @@ void getnames(void) | |||
8019 | 7978 | ||
8020 | 7979 | ||
8021 | const char* const baseDir="duke3d*.grp"; | 7980 | const char* const baseDir="duke3d*.grp"; |
8022 | #ifdef _WIN32 | ||
8023 | |||
8024 | void findGRPToUse(uint8_t * groupfilefullpath) | ||
8025 | { | ||
8026 | WIN32_FIND_DATA FindFileData; | ||
8027 | HANDLE hFind = INVALID_HANDLE_VALUE; | ||
8028 | int i=0,kbdKey ; | ||
8029 | char groupfile[9][512]; | ||
8030 | int grpID ; | ||
8031 | |||
8032 | if(getGameDir()[0] != '\0') | ||
8033 | { | ||
8034 | sprintf(groupfilefullpath, "%s\\%s", getGameDir(), baseDir); | ||
8035 | hFind = FindFirstFile(groupfilefullpath, &FindFileData); | ||
8036 | if (hFind == INVALID_HANDLE_VALUE) | ||
8037 | { | ||
8038 | sprintf(groupfilefullpath, "%s", baseDir); | ||
8039 | } | ||
8040 | else | ||
8041 | FindClose(hFind); | ||
8042 | } | ||
8043 | else | ||
8044 | sprintf(groupfilefullpath, "%s", baseDir); | ||
8045 | |||
8046 | printf("Searching '%d':\n\n",groupfilefullpath); | ||
8047 | hFind = FindFirstFile(groupfilefullpath,&FindFileData); | ||
8048 | |||
8049 | if ( hFind==INVALID_HANDLE_VALUE ) | ||
8050 | Error(EXIT_SUCCESS, "Can't find '%s'\n", groupfilefullpath); | ||
8051 | |||
8052 | do | ||
8053 | { | ||
8054 | i++; | ||
8055 | sprintf(groupfile[i-1], "%s", FindFileData.cFileName); | ||
8056 | printf("Found GRP #%d:\t%d Bytes\t %s \n", i, FindFileData.nFileSizeLow, groupfile[i-1]); | ||
8057 | } while ( FindNextFile(hFind, &FindFileData) && i < 9 ); | ||
8058 | |||
8059 | if(i==1) | ||
8060 | grpID = 0; | ||
8061 | else | ||
8062 | { | ||
8063 | printf("\n-> Choose a base GRP file from 1 to %c: ",'0' + i); | ||
8064 | do | ||
8065 | kbdKey = getch(); | ||
8066 | while(kbdKey < '1' || kbdKey > ('0' + i)); | ||
8067 | printf("%c\n", kbdKey); | ||
8068 | grpID = groupfile[kbdKey-'1']; | ||
8069 | |||
8070 | } | ||
8071 | |||
8072 | FindClose(hFind); | ||
8073 | if (strlen(getGameDir()) == 0) | ||
8074 | sprintf(groupfilefullpath, "./%s", groupfile[grpID]); | ||
8075 | else | ||
8076 | sprintf(groupfilefullpath, "%s//%s", getGameDir(), groupfile[grpID]); | ||
8077 | } | ||
8078 | |||
8079 | #else | ||
8080 | 7981 | ||
8081 | int dukeGRP_Match(char* filename,int length) | 7982 | int dukeGRP_Match(char* filename,int length) |
8082 | { | 7983 | { |
@@ -8126,8 +8027,6 @@ void findGRPToUse(char * groupfilefullpath){ | |||
8126 | } | 8027 | } |
8127 | } | 8028 | } |
8128 | 8029 | ||
8129 | #endif | ||
8130 | |||
8131 | static int load_duke3d_groupfile(void) | 8030 | static int load_duke3d_groupfile(void) |
8132 | { | 8031 | { |
8133 | // FIX_00032: Added multi base GRP manager. Use duke3d*.grp to handle multiple grp. | 8032 | // FIX_00032: Added multi base GRP manager. Use duke3d*.grp to handle multiple grp. |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/gamedef.c b/apps/plugins/sdl/progs/duke3d/Game/src/gamedef.c index 52e2abaed6..af58c45deb 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/gamedef.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/gamedef.c | |||
@@ -1155,11 +1155,7 @@ uint8_t parsecommand(int readfromGRP) | |||
1155 | break; | 1155 | break; |
1156 | } | 1156 | } |
1157 | } | 1157 | } |
1158 | #ifdef PLATFORM_UNIX | ||
1159 | volume_names[j][i] = '\0'; | 1158 | volume_names[j][i] = '\0'; |
1160 | #else | ||
1161 | volume_names[j][i-1] = '\0'; | ||
1162 | #endif | ||
1163 | return 0; | 1159 | return 0; |
1164 | case 108: | 1160 | case 108: |
1165 | scriptptr--; | 1161 | scriptptr--; |
@@ -1182,11 +1178,7 @@ uint8_t parsecommand(int readfromGRP) | |||
1182 | break; | 1178 | break; |
1183 | } | 1179 | } |
1184 | } | 1180 | } |
1185 | #if defined(PLATFORM_UNIX) || defined(PLATFORM_ROCKBOX) | ||
1186 | skill_names[j][i] = '\0'; | 1181 | skill_names[j][i] = '\0'; |
1187 | #else | ||
1188 | skill_names[j][i-1] = '\0'; | ||
1189 | #endif | ||
1190 | return 0; | 1182 | return 0; |
1191 | 1183 | ||
1192 | case 0: | 1184 | case 0: |
@@ -1212,11 +1204,7 @@ uint8_t parsecommand(int readfromGRP) | |||
1212 | break; | 1204 | break; |
1213 | } | 1205 | } |
1214 | } | 1206 | } |
1215 | #if defined(PLATFORM_UNIX) || defined(PLATFORM_ROCKBOX) | ||
1216 | level_names[j*11+k][i] = '\0'; | 1207 | level_names[j*11+k][i] = '\0'; |
1217 | #else | ||
1218 | level_names[j*11+k][i-1] = '\0'; | ||
1219 | #endif | ||
1220 | while( *textptr == ' ' ) textptr++; | 1208 | while( *textptr == ' ' ) textptr++; |
1221 | 1209 | ||
1222 | partime[j*11+k] = | 1210 | partime[j*11+k] = |
@@ -1247,11 +1235,7 @@ uint8_t parsecommand(int readfromGRP) | |||
1247 | break; | 1235 | break; |
1248 | } | 1236 | } |
1249 | } | 1237 | } |
1250 | #ifdef PLATFORM_UNIX | ||
1251 | level_names[j*11+k][i] = '\0'; | 1238 | level_names[j*11+k][i] = '\0'; |
1252 | #else | ||
1253 | level_names[j*11+k][i-1] = '\0'; | ||
1254 | #endif | ||
1255 | return 0; | 1239 | return 0; |
1256 | 1240 | ||
1257 | case 79: | 1241 | case 79: |
@@ -1570,11 +1554,7 @@ void loadefs(char *filenam, char *mptr, int readfromGRP) | |||
1570 | //ud.conCRC[0] = crc32_update((uint8_t *)textptr, fs, ud.conCRC[0]); | 1554 | //ud.conCRC[0] = crc32_update((uint8_t *)textptr, fs, ud.conCRC[0]); |
1571 | } | 1555 | } |
1572 | 1556 | ||
1573 | #ifdef PLATFORM_UNIX | ||
1574 | textptr[fs - 1] = 0; | 1557 | textptr[fs - 1] = 0; |
1575 | #else | ||
1576 | textptr[fs - 2] = 0; | ||
1577 | #endif | ||
1578 | 1558 | ||
1579 | clearbuf(actorscrptr,MAXSPRITES,0L); | 1559 | clearbuf(actorscrptr,MAXSPRITES,0L); |
1580 | clearbufbyte(actortype,MAXSPRITES,0L); | 1560 | clearbufbyte(actortype,MAXSPRITES,0L); |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/global.c b/apps/plugins/sdl/progs/duke3d/Game/src/global.c index 57c561edd6..b0f4442d32 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/global.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/global.c | |||
@@ -76,11 +76,6 @@ int32_t gc,neartaghitdist,lockclock,max_player_health,max_armour_amount,max_ammo | |||
76 | struct weaponhit hittype[MAXSPRITES]; | 76 | struct weaponhit hittype[MAXSPRITES]; |
77 | short spriteq[1024],spriteqloc,spriteqamount=64; | 77 | short spriteq[1024],spriteqloc,spriteqamount=64; |
78 | 78 | ||
79 | // ported build engine has this, too. --ryan. | ||
80 | #if PLATFORM_DOS | ||
81 | short moustat = 0; | ||
82 | #endif | ||
83 | |||
84 | struct animwalltype animwall[MAXANIMWALLS]; | 79 | struct animwalltype animwall[MAXANIMWALLS]; |
85 | short numanimwalls; | 80 | short numanimwalls; |
86 | int32_t *animateptr[MAXANIMATES], animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt; | 81 | int32_t *animateptr[MAXANIMATES], animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt; |
@@ -232,7 +227,6 @@ int32_t *curipos[MAXINTERPOLATIONS]; | |||
232 | 227 | ||
233 | void FixFilePath(char *filename) | 228 | void FixFilePath(char *filename) |
234 | { | 229 | { |
235 | #if PLATFORM_UNIX || PLATFORM_ROCKBOX | ||
236 | uint8_t *ptr; | 230 | uint8_t *ptr; |
237 | uint8_t *lastsep = filename; | 231 | uint8_t *lastsep = filename; |
238 | 232 | ||
@@ -304,74 +298,8 @@ void FixFilePath(char *filename) | |||
304 | return; | 298 | return; |
305 | } | 299 | } |
306 | } | 300 | } |
307 | #endif | ||
308 | } | ||
309 | |||
310 | |||
311 | #if PLATFORM_DOS | ||
312 | /* no-op. */ | ||
313 | |||
314 | #elif PLATFORM_WIN32 | ||
315 | int _dos_findfirst(uint8_t *filename, int x, struct find_t *f) | ||
316 | { | ||
317 | int32_t rc = _findfirst(filename, &f->data); | ||
318 | f->handle = rc; | ||
319 | if (rc != -1) | ||
320 | { | ||
321 | strncpy(f->name, f->data.name, sizeof (f->name) - 1); | ||
322 | f->name[sizeof (f->name) - 1] = '\0'; | ||
323 | return(0); | ||
324 | } | ||
325 | return(1); | ||
326 | } | ||
327 | |||
328 | int _dos_findnext(struct find_t *f) | ||
329 | { | ||
330 | int rc = 0; | ||
331 | if (f->handle == -1) | ||
332 | return(1); /* invalid handle. */ | ||
333 | |||
334 | rc = _findnext(f->handle, &f->data); | ||
335 | if (rc == -1) | ||
336 | { | ||
337 | _findclose(f->handle); | ||
338 | f->handle = -1; | ||
339 | return(1); | ||
340 | } | ||
341 | |||
342 | strncpy(f->name, f->data.name, sizeof (f->name) - 1); | ||
343 | f->name[sizeof (f->name) - 1] = '\0'; | ||
344 | return(0); | ||
345 | } | ||
346 | |||
347 | #elif defined(PLATFORM_UNIX) || defined(PLATFORM_MACOSX) || defined(PLATFORM_ROCKBOX) | ||
348 | int _dos_findfirst(char *filename, int x, struct find_t *f) | ||
349 | { | ||
350 | char *ptr; | ||
351 | |||
352 | if (strlen(filename) >= sizeof (f->pattern)) | ||
353 | return(1); | ||
354 | |||
355 | strcpy(f->pattern, filename); | ||
356 | FixFilePath(f->pattern); | ||
357 | ptr = strrchr(f->pattern, PATH_SEP_CHAR); | ||
358 | |||
359 | if (ptr == NULL) | ||
360 | { | ||
361 | ptr = filename; | ||
362 | f->dir = opendir(CURDIR); | ||
363 | } | ||
364 | else | ||
365 | { | ||
366 | *ptr = '\0'; | ||
367 | f->dir = opendir(f->pattern); | ||
368 | memmove(f->pattern, ptr + 1, strlen(ptr + 1) + 1); | ||
369 | } | ||
370 | |||
371 | return(_dos_findnext(f)); | ||
372 | } | 301 | } |
373 | 302 | ||
374 | |||
375 | static int check_pattern_nocase(const char *x, const char *y) | 303 | static int check_pattern_nocase(const char *x, const char *y) |
376 | { | 304 | { |
377 | if ((x == NULL) || (y == NULL)) | 305 | if ((x == NULL) || (y == NULL)) |
@@ -409,53 +337,6 @@ static int check_pattern_nocase(const char *x, const char *y) | |||
409 | return(*x == *y); /* it's a match (both should be EOS). */ | 337 | return(*x == *y); /* it's a match (both should be EOS). */ |
410 | } | 338 | } |
411 | 339 | ||
412 | int _dos_findnext(struct find_t *f) | ||
413 | { | ||
414 | struct dirent *dent; | ||
415 | |||
416 | if (f->dir == NULL) | ||
417 | return(1); /* no such dir or we're just done searching. */ | ||
418 | |||
419 | while ((dent = readdir(f->dir)) != NULL) | ||
420 | { | ||
421 | if (check_pattern_nocase(f->pattern, dent->d_name)) | ||
422 | { | ||
423 | if (strlen(dent->d_name) < sizeof (f->name)) | ||
424 | { | ||
425 | strcpy(f->name, dent->d_name); | ||
426 | return(0); /* match. */ | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | |||
431 | closedir(f->dir); | ||
432 | f->dir = NULL; | ||
433 | return(1); /* no match in whole directory. */ | ||
434 | } | ||
435 | #else | ||
436 | #error please define for your platform. | ||
437 | #endif | ||
438 | |||
439 | |||
440 | #if !PLATFORM_DOS | ||
441 | void _dos_getdate(struct dosdate_t *date) | ||
442 | { | ||
443 | time_t curtime = time(NULL); | ||
444 | |||
445 | if (date == NULL) { | ||
446 | return; | ||
447 | } | ||
448 | |||
449 | memset(date, 0, sizeof(struct dosdate_t)); | ||
450 | |||
451 | date->day = 1; | ||
452 | date->month = 1; | ||
453 | date->year = 1970; | ||
454 | date->dayofweek = 4; | ||
455 | } | ||
456 | #endif | ||
457 | |||
458 | |||
459 | int FindDistance2D(int ix, int iy) | 340 | int FindDistance2D(int ix, int iy) |
460 | { | 341 | { |
461 | int t; | 342 | int t; |
@@ -560,11 +441,7 @@ int32 SafeOpenAppend (const char *_filename, int32 filetype) | |||
560 | filename[sizeof (filename) - 1] = '\0'; | 441 | filename[sizeof (filename) - 1] = '\0'; |
561 | FixFilePath(filename); | 442 | FixFilePath(filename); |
562 | 443 | ||
563 | #if (defined PLATFORM_WIN32) | ||
564 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND ); | ||
565 | #else | ||
566 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND , 0666); | 444 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND , 0666); |
567 | #endif | ||
568 | 445 | ||
569 | if (handle == -1) | 446 | if (handle == -1) |
570 | Error (EXIT_FAILURE, "Error opening for append %s: %s",filename,strerror(errno)); | 447 | Error (EXIT_FAILURE, "Error opening for append %s: %s",filename,strerror(errno)); |
@@ -579,11 +456,7 @@ boolean SafeFileExists ( const char * _filename ) | |||
579 | filename[sizeof (filename) - 1] = '\0'; | 456 | filename[sizeof (filename) - 1] = '\0'; |
580 | FixFilePath(filename); | 457 | FixFilePath(filename); |
581 | 458 | ||
582 | #if( defined PLATFORM_WIN32) | 459 | return(rb->file_exists(filename)); |
583 | return(access(filename, 6) == 0); | ||
584 | #else | ||
585 | return(rb->file_exists(filename)); | ||
586 | #endif | ||
587 | } | 460 | } |
588 | 461 | ||
589 | 462 | ||
@@ -595,12 +468,8 @@ int32 SafeOpenWrite (const char *_filename, int32 filetype) | |||
595 | filename[sizeof (filename) - 1] = '\0'; | 468 | filename[sizeof (filename) - 1] = '\0'; |
596 | FixFilePath(filename); | 469 | FixFilePath(filename); |
597 | 470 | ||
598 | #if (defined PLATFORM_WIN32) | ||
599 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC ); | ||
600 | #else | ||
601 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC | 471 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC |
602 | , 0666); | 472 | , 0666); |
603 | #endif | ||
604 | 473 | ||
605 | if (handle == -1) | 474 | if (handle == -1) |
606 | Error (EXIT_FAILURE, "Error opening %s: %s",filename,strerror(errno)); | 475 | Error (EXIT_FAILURE, "Error opening %s: %s",filename,strerror(errno)); |
@@ -783,7 +652,6 @@ void SwapIntelShortArray(short *s, int num) | |||
783 | Stolen for Duke3D, too. | 652 | Stolen for Duke3D, too. |
784 | */ | 653 | */ |
785 | 654 | ||
786 | #if PLATFORM_UNIX | ||
787 | uint8_t *strlwr(uint8_t *s) | 655 | uint8_t *strlwr(uint8_t *s) |
788 | { | 656 | { |
789 | uint8_t *p = s; | 657 | uint8_t *p = s; |
@@ -858,13 +726,11 @@ uint8_t *ultoa(uint32_t value, uint8_t *string, int radix) | |||
858 | 726 | ||
859 | return string; | 727 | return string; |
860 | } | 728 | } |
861 | #endif | ||
862 | 729 | ||
863 | char ApogeePath[256]; | 730 | char ApogeePath[256]; |
864 | 731 | ||
865 | int setup_homedir (void) | 732 | int setup_homedir (void) |
866 | { | 733 | { |
867 | #if PLATFORM_UNIX | ||
868 | int err; | 734 | int err; |
869 | 735 | ||
870 | snprintf (ApogeePath, sizeof (ApogeePath), "%s/.duke3d/", getenv ("HOME")); | 736 | snprintf (ApogeePath, sizeof (ApogeePath), "%s/.duke3d/", getenv ("HOME")); |
@@ -877,9 +743,6 @@ int setup_homedir (void) | |||
877 | strerror (errno)); | 743 | strerror (errno)); |
878 | return -1; | 744 | return -1; |
879 | } | 745 | } |
880 | #else | ||
881 | sprintf(ApogeePath, ".%s", PATH_SEP_STR); | ||
882 | #endif | ||
883 | 746 | ||
884 | return 0; | 747 | return 0; |
885 | } | 748 | } |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/global.h b/apps/plugins/sdl/progs/duke3d/Game/src/global.h index e0be16f500..ab7d6eb634 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/global.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/global.h | |||
@@ -18,23 +18,11 @@ int FindDistance3D(int ix, int iy, int iz); | |||
18 | void Shutdown(void); | 18 | void Shutdown(void); |
19 | 19 | ||
20 | #ifndef LITTLE_ENDIAN | 20 | #ifndef LITTLE_ENDIAN |
21 | #ifdef __APPLE__ | 21 | #define LITTLE_ENDIAN 1234 |
22 | #else | ||
23 | #define LITTLE_ENDIAN 1234 | ||
24 | #endif | ||
25 | #endif | 22 | #endif |
26 | 23 | ||
27 | #ifndef BIG_ENDIAN | 24 | #ifndef BIG_ENDIAN |
28 | #ifdef __APPLE__ | 25 | #define BIG_ENDIAN 4321 |
29 | #else | ||
30 | #define BIG_ENDIAN 4321 | ||
31 | #endif | ||
32 | #endif | ||
33 | |||
34 | #if PLATFORM_WIN32 | ||
35 | #ifndef BYTE_ORDER | ||
36 | #define BYTE_ORDER LITTLE_ENDIAN | ||
37 | #endif | ||
38 | #endif | 26 | #endif |
39 | 27 | ||
40 | #ifdef ROCKBOX | 28 | #ifdef ROCKBOX |
@@ -45,15 +33,6 @@ void Shutdown(void); | |||
45 | #endif | 33 | #endif |
46 | #endif | 34 | #endif |
47 | 35 | ||
48 | #ifdef __APPLE__ | ||
49 | #if __powerpc__ | ||
50 | #define BYTE_ORDER BIG_ENDIAN | ||
51 | #else | ||
52 | // Defined in endian.h | ||
53 | // #define BYTE_ORDER LITTLE_ENDIAN | ||
54 | #endif | ||
55 | #endif | ||
56 | |||
57 | #ifndef BYTE_ORDER | 36 | #ifndef BYTE_ORDER |
58 | #error Please define your platform. | 37 | #error Please define your platform. |
59 | #endif | 38 | #endif |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/menues.c b/apps/plugins/sdl/progs/duke3d/Game/src/menues.c index 3585600f43..66ce4123bf 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/menues.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/menues.c | |||
@@ -1245,83 +1245,10 @@ void dispnames(void) | |||
1245 | 1245 | ||
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | |||
1249 | // This is the same thing as was in build.c ... | ||
1250 | // We DO have a _dos_findfirst implementation now...maybe use that instead? | ||
1251 | // --ryan. | ||
1252 | #if ORIGINAL_DUKE3D_GETFILENAMES | ||
1253 | int getfilenames(uint8_t kind[6]) | ||
1254 | { | ||
1255 | short type; | ||
1256 | struct find_t fileinfo; | ||
1257 | |||
1258 | if (strcmp(kind,"SUBD") == 0) | ||
1259 | { | ||
1260 | strcpy(kind,"*.*"); | ||
1261 | if (_dos_findfirst(kind,_A_SUBDIR,&fileinfo) != 0) | ||
1262 | return(-1); | ||
1263 | type = 1; | ||
1264 | } | ||
1265 | else | ||
1266 | { | ||
1267 | if (_dos_findfirst(kind,_A_NORMAL,&fileinfo) != 0) | ||
1268 | return(-1); | ||
1269 | type = 0; | ||
1270 | } | ||
1271 | do | ||
1272 | { | ||
1273 | if ((type == 0) || ((fileinfo.attrib&16) > 0)) | ||
1274 | if ((fileinfo.name[0] != '.') || (fileinfo.name[1] != 0)) | ||
1275 | { | ||
1276 | strcpy(menuname[menunamecnt],fileinfo.name); | ||
1277 | menuname[menunamecnt][16] = type; | ||
1278 | menunamecnt++; | ||
1279 | } | ||
1280 | } | ||
1281 | while (_dos_findnext(&fileinfo) == 0); | ||
1282 | |||
1283 | return(0); | ||
1284 | } | ||
1285 | |||
1286 | #else | ||
1287 | |||
1288 | int getfilenames(char kind[6]) | 1248 | int getfilenames(char kind[6]) |
1289 | { | 1249 | { |
1290 | /* !!! FIXME: Visual C? */ | ||
1291 | #if (defined __WATCOMC__) | ||
1292 | short type; | ||
1293 | struct find_t fileinfo; | ||
1294 | |||
1295 | if (strcmp(kind,"SUBD") == 0) | ||
1296 | { | ||
1297 | strcpy(kind,"*.*"); | ||
1298 | if (_dos_findfirst(kind,_A_SUBDIR,&fileinfo) != 0) | ||
1299 | return(-1); | ||
1300 | type = 1; | ||
1301 | } | ||
1302 | else | ||
1303 | { | ||
1304 | if (_dos_findfirst(kind,_A_NORMAL,&fileinfo) != 0) | ||
1305 | return(-1); | ||
1306 | type = 0; | ||
1307 | } | ||
1308 | do | ||
1309 | { | ||
1310 | if ((type == 0) || ((fileinfo.attrib&16) > 0)) | ||
1311 | if ((fileinfo.name[0] != '.') || (fileinfo.name[1] != 0)) | ||
1312 | { | ||
1313 | strcpy(menuname[menunamecnt],fileinfo.name); | ||
1314 | menuname[menunamecnt][16] = type; | ||
1315 | menunamecnt++; | ||
1316 | } | ||
1317 | } | ||
1318 | while (_dos_findnext(&fileinfo) == 0); | ||
1319 | |||
1320 | #elif (defined PLATFORM_UNIX) | ||
1321 | |||
1322 | DIR *dir; | 1250 | DIR *dir; |
1323 | struct dirent *dent; | 1251 | struct dirent *dent; |
1324 | struct stat statbuf; | ||
1325 | int add_this; | 1252 | int add_this; |
1326 | uint8_t *ptr = NULL; | 1253 | uint8_t *ptr = NULL; |
1327 | int len = 0; | 1254 | int len = 0; |
@@ -1330,7 +1257,7 @@ int getfilenames(char kind[6]) | |||
1330 | if (strcmp(kind,"SUBD") == 0) | 1257 | if (strcmp(kind,"SUBD") == 0) |
1331 | subdirs = 1; | 1258 | subdirs = 1; |
1332 | 1259 | ||
1333 | dir = opendir(getGamedir()); | 1260 | dir = opendir(getGameDir()); |
1334 | if (dir == NULL) | 1261 | if (dir == NULL) |
1335 | return(-1); | 1262 | return(-1); |
1336 | 1263 | ||
@@ -1340,46 +1267,39 @@ int getfilenames(char kind[6]) | |||
1340 | dent = readdir(dir); | 1267 | dent = readdir(dir); |
1341 | if (dent != NULL) | 1268 | if (dent != NULL) |
1342 | { | 1269 | { |
1343 | if (stat(dent->d_name, &statbuf) == 0) | 1270 | if (subdirs) |
1344 | { | 1271 | { |
1345 | if (subdirs) | 1272 | if (rb->dir_exists(dent->d_name)) |
1346 | { | 1273 | add_this = 1; |
1347 | if (S_ISDIR(statbuf.st_mode)) | 1274 | } /* if */ |
1348 | add_this = 1; | 1275 | else |
1349 | } /* if */ | 1276 | { |
1350 | else | 1277 | /* need to expand support if this assertion ever fails. */ |
1351 | { | 1278 | assert(stricmp(kind, "*.MAP") == 0); |
1352 | /* need to expand support if this assertion ever fails. */ | 1279 | len = strlen(dent->d_name); |
1353 | assert(stricmp(kind, "*.MAP") == 0); | 1280 | if (len >= 5) |
1354 | len = strlen(dent->d_name); | 1281 | { |
1355 | if (len >= 5) | 1282 | ptr = ((uint8_t *) dent->d_name) + len; |
1356 | { | 1283 | ptr += strlen(ptr) - 4; |
1357 | ptr = ((uint8_t *) dent->d_name) + len; | 1284 | if (stricmp(ptr, ".MAP") == 0) |
1358 | ptr += strlen(ptr) - 4; | 1285 | add_this = 1; |
1359 | if (stricmp(ptr, ".MAP") == 0) | 1286 | } /* if */ |
1360 | add_this = 1; | 1287 | } /* else */ |
1361 | } /* if */ | 1288 | |
1362 | } /* else */ | 1289 | if (add_this) |
1363 | 1290 | { | |
1364 | if (add_this) | 1291 | strcpy(menuname[menunamecnt],dent->d_name); |
1365 | { | 1292 | menuname[menunamecnt][16] = subdirs; |
1366 | strcpy(menuname[menunamecnt],dent->d_name); | 1293 | menunamecnt++; |
1367 | menuname[menunamecnt][16] = subdirs; | 1294 | } /* if */ |
1368 | menunamecnt++; | ||
1369 | } /* if */ | ||
1370 | } /* if */ | ||
1371 | } /* if */ | 1295 | } /* if */ |
1372 | } while (dent != NULL); | 1296 | } while (dent != NULL); |
1373 | 1297 | ||
1374 | closedir(dir); | 1298 | closedir(dir); |
1375 | 1299 | ||
1376 | #endif | ||
1377 | return(0); | 1300 | return(0); |
1378 | } | 1301 | } |
1379 | 1302 | ||
1380 | #endif | ||
1381 | |||
1382 | |||
1383 | void sortfilenames() | 1303 | void sortfilenames() |
1384 | { | 1304 | { |
1385 | uint8_t sortbuffer[17]; | 1305 | uint8_t sortbuffer[17]; |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/sounds.c b/apps/plugins/sdl/progs/duke3d/Game/src/sounds.c index 0e3c8f6fa9..14d705bb5c 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/sounds.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/sounds.c | |||
@@ -24,10 +24,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
24 | */ | 24 | */ |
25 | //------------------------------------------------------------------------- | 25 | //------------------------------------------------------------------------- |
26 | 26 | ||
27 | #if PLATFORM_DOS | ||
28 | #include <conio.h> | ||
29 | #endif | ||
30 | |||
31 | #include <stdio.h> | 27 | #include <stdio.h> |
32 | #include <string.h> | 28 | #include <string.h> |
33 | #include "../../Game/src/types.h" | 29 | #include "../../Game/src/types.h" |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/types.h b/apps/plugins/sdl/progs/duke3d/Game/src/types.h index 017c851a18..93d6f80c86 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/types.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/types.h | |||
@@ -27,11 +27,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
27 | #ifndef _types_public | 27 | #ifndef _types_public |
28 | #define _types_public | 28 | #define _types_public |
29 | 29 | ||
30 | #ifdef _WIN32 | 30 | #include <inttypes.h> |
31 | #include "../../Engine/src/windows/inttypes.h" | ||
32 | #else | ||
33 | #include <inttypes.h> | ||
34 | #endif | ||
35 | 31 | ||
36 | #ifdef __cplusplus | 32 | #ifdef __cplusplus |
37 | extern "C" { | 33 | extern "C" { |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h b/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h index bf9e22d2a6..6519331b77 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h | |||
@@ -30,11 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
30 | // | 30 | // |
31 | //*************************************************************************** | 31 | //*************************************************************************** |
32 | 32 | ||
33 | #ifdef _WIN32 | 33 | #include <inttypes.h> |
34 | #include "../../Engine/src/windows/inttypes.h" | ||
35 | #else | ||
36 | #include <inttypes.h> | ||
37 | #endif | ||
38 | 34 | ||
39 | #ifndef _util_lib_public | 35 | #ifndef _util_lib_public |
40 | #define _util_lib_public | 36 | #define _util_lib_public |
diff --git a/apps/plugins/sdl/progs/quake/cl_parse.c b/apps/plugins/sdl/progs/quake/cl_parse.c index c79ca47545..6a2856709e 100644 --- a/apps/plugins/sdl/progs/quake/cl_parse.c +++ b/apps/plugins/sdl/progs/quake/cl_parse.c | |||
@@ -884,16 +884,10 @@ void CL_ParseServerMessage (void) | |||
884 | if (cl.paused) | 884 | if (cl.paused) |
885 | { | 885 | { |
886 | CDAudio_Pause (); | 886 | CDAudio_Pause (); |
887 | #ifdef _WIN32 | ||
888 | VID_HandlePause (true); | ||
889 | #endif | ||
890 | } | 887 | } |
891 | else | 888 | else |
892 | { | 889 | { |
893 | CDAudio_Resume (); | 890 | CDAudio_Resume (); |
894 | #ifdef _WIN32 | ||
895 | VID_HandlePause (false); | ||
896 | #endif | ||
897 | } | 891 | } |
898 | } | 892 | } |
899 | break; | 893 | break; |
diff --git a/apps/plugins/sdl/progs/quake/common.c b/apps/plugins/sdl/progs/quake/common.c index 5191af8c36..881c01e22e 100644 --- a/apps/plugins/sdl/progs/quake/common.c +++ b/apps/plugins/sdl/progs/quake/common.c | |||
@@ -1508,14 +1508,7 @@ int COM_FindFile (char *filename, int *handle, FILE **file) | |||
1508 | strcpy (cachepath, netpath); | 1508 | strcpy (cachepath, netpath); |
1509 | else | 1509 | else |
1510 | { | 1510 | { |
1511 | #if defined(_WIN32) | ||
1512 | if ((strlen(netpath) < 2) || (netpath[1] != ':')) | ||
1513 | sprintf (cachepath,"%s%s", com_cachedir, netpath); | ||
1514 | else | ||
1515 | sprintf (cachepath,"%s%s", com_cachedir, netpath+2); | ||
1516 | #else | ||
1517 | sprintf (cachepath,"%s/%s", com_cachedir, netpath); | 1511 | sprintf (cachepath,"%s/%s", com_cachedir, netpath); |
1518 | #endif | ||
1519 | 1512 | ||
1520 | cachetime = Sys_FileTime (cachepath); | 1513 | cachetime = Sys_FileTime (cachepath); |
1521 | 1514 | ||
diff --git a/apps/plugins/sdl/progs/quake/host.c b/apps/plugins/sdl/progs/quake/host.c index 9a5f7c29d6..6e30503d77 100644 --- a/apps/plugins/sdl/progs/quake/host.c +++ b/apps/plugins/sdl/progs/quake/host.c | |||
@@ -896,32 +896,22 @@ void Host_Init (quakeparms_t *parms) | |||
896 | if (!host_colormap) | 896 | if (!host_colormap) |
897 | Sys_Error ("Couldn't load gfx/colormap.lmp"); | 897 | Sys_Error ("Couldn't load gfx/colormap.lmp"); |
898 | 898 | ||
899 | #ifndef _WIN32 // on non win32, mouse comes before video for security reasons | ||
900 | IN_Init (); | 899 | IN_Init (); |
901 | #endif | ||
902 | VID_Init (host_basepal); | 900 | VID_Init (host_basepal); |
903 | 901 | ||
904 | Draw_Init (); | 902 | Draw_Init (); |
905 | SCR_Init (); | 903 | SCR_Init (); |
906 | R_Init (); | 904 | R_Init (); |
907 | #ifndef _WIN32 | ||
908 | // on Win32, sound initialization has to come before video initialization, so we | ||
909 | // can put up a popup if the sound hardware is in use | ||
910 | S_Init (); | 905 | S_Init (); |
911 | #else | ||
912 | 906 | ||
913 | #ifdef GLQUAKE | 907 | #ifdef GLQUAKE |
914 | // FIXME: doesn't use the new one-window approach yet | 908 | // FIXME: doesn't use the new one-window approach yet |
915 | S_Init (); | 909 | S_Init (); |
916 | #endif | 910 | #endif |
917 | 911 | ||
918 | #endif // _WIN32 | ||
919 | CDAudio_Init (); | 912 | CDAudio_Init (); |
920 | Sbar_Init (); | 913 | Sbar_Init (); |
921 | CL_Init (); | 914 | CL_Init (); |
922 | #ifdef _WIN32 // on non win32, mouse comes before video for security reasons | ||
923 | IN_Init (); | ||
924 | #endif | ||
925 | } | 915 | } |
926 | 916 | ||
927 | Cbuf_InsertText ("exec quake.rc\n"); | 917 | Cbuf_InsertText ("exec quake.rc\n"); |
diff --git a/apps/plugins/sdl/progs/quake/mathlib.c b/apps/plugins/sdl/progs/quake/mathlib.c index ddd5435089..a949a39a51 100644 --- a/apps/plugins/sdl/progs/quake/mathlib.c +++ b/apps/plugins/sdl/progs/quake/mathlib.c | |||
@@ -85,10 +85,6 @@ void PerpendicularVector( vec3_t dst, const vec3_t src ) | |||
85 | VectorNormalizeNoRet( dst ); | 85 | VectorNormalizeNoRet( dst ); |
86 | } | 86 | } |
87 | 87 | ||
88 | #ifdef _WIN32 | ||
89 | #pragma optimize( "", off ) | ||
90 | #endif | ||
91 | |||
92 | 88 | ||
93 | void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ) | 89 | void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ) |
94 | { | 90 | { |
@@ -145,10 +141,6 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, | |||
145 | } | 141 | } |
146 | } | 142 | } |
147 | 143 | ||
148 | #ifdef _WIN32 | ||
149 | #pragma optimize( "", on ) | ||
150 | #endif | ||
151 | |||
152 | /*-----------------------------------------------------------------*/ | 144 | /*-----------------------------------------------------------------*/ |
153 | 145 | ||
154 | 146 | ||
diff --git a/apps/plugins/sdl/progs/quake/menu.c b/apps/plugins/sdl/progs/quake/menu.c index 8c67c8672d..2a3229559b 100644 --- a/apps/plugins/sdl/progs/quake/menu.c +++ b/apps/plugins/sdl/progs/quake/menu.c | |||
@@ -19,10 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
19 | */ | 19 | */ |
20 | #include "quakedef.h" | 20 | #include "quakedef.h" |
21 | 21 | ||
22 | #ifdef _WIN32 | ||
23 | #include "winquake.h" | ||
24 | #endif | ||
25 | |||
26 | void (*vid_menudrawfn)(void); | 22 | void (*vid_menudrawfn)(void); |
27 | void (*vid_menukeyfn)(int key); | 23 | void (*vid_menukeyfn)(int key); |
28 | 24 | ||
@@ -913,11 +909,7 @@ void M_Net_Draw (void) | |||
913 | } | 909 | } |
914 | else | 910 | else |
915 | { | 911 | { |
916 | #ifdef _WIN32 | ||
917 | p = NULL; | ||
918 | #else | ||
919 | p = Draw_CachePic ("gfx/dim_modm.lmp"); | 912 | p = Draw_CachePic ("gfx/dim_modm.lmp"); |
920 | #endif | ||
921 | } | 913 | } |
922 | 914 | ||
923 | if (p) | 915 | if (p) |
@@ -931,11 +923,7 @@ void M_Net_Draw (void) | |||
931 | } | 923 | } |
932 | else | 924 | else |
933 | { | 925 | { |
934 | #ifdef _WIN32 | ||
935 | p = NULL; | ||
936 | #else | ||
937 | p = Draw_CachePic ("gfx/dim_drct.lmp"); | 926 | p = Draw_CachePic ("gfx/dim_drct.lmp"); |
938 | #endif | ||
939 | } | 927 | } |
940 | 928 | ||
941 | if (p) | 929 | if (p) |
@@ -1036,12 +1024,7 @@ again: | |||
1036 | //============================================================================= | 1024 | //============================================================================= |
1037 | /* OPTIONS MENU */ | 1025 | /* OPTIONS MENU */ |
1038 | 1026 | ||
1039 | #ifdef _WIN32 | ||
1040 | #define OPTIONS_ITEMS 14 | ||
1041 | #else | ||
1042 | #define OPTIONS_ITEMS 13 | 1027 | #define OPTIONS_ITEMS 13 |
1043 | #endif | ||
1044 | |||
1045 | #define SLIDER_RANGE 10 | 1028 | #define SLIDER_RANGE 10 |
1046 | 1029 | ||
1047 | int options_cursor; | 1030 | int options_cursor; |
@@ -1051,13 +1034,6 @@ void M_Menu_Options_f (void) | |||
1051 | key_dest = key_menu; | 1034 | key_dest = key_menu; |
1052 | m_state = m_options; | 1035 | m_state = m_options; |
1053 | m_entersound = true; | 1036 | m_entersound = true; |
1054 | |||
1055 | #ifdef _WIN32 | ||
1056 | if ((options_cursor == 13) && (modestate != MS_WINDOWED)) | ||
1057 | { | ||
1058 | options_cursor = 0; | ||
1059 | } | ||
1060 | #endif | ||
1061 | } | 1037 | } |
1062 | 1038 | ||
1063 | 1039 | ||
@@ -1092,11 +1068,7 @@ void M_AdjustSliders (int dir) | |||
1092 | Cvar_SetValue ("sensitivity", sensitivity.value); | 1068 | Cvar_SetValue ("sensitivity", sensitivity.value); |
1093 | break; | 1069 | break; |
1094 | case 6: // music volume | 1070 | case 6: // music volume |
1095 | #ifdef _WIN32 | ||
1096 | bgmvolume.value += dir * 1.0; | ||
1097 | #else | ||
1098 | bgmvolume.value += dir * 0.1; | 1071 | bgmvolume.value += dir * 0.1; |
1099 | #endif | ||
1100 | if (bgmvolume.value < 0) | 1072 | if (bgmvolume.value < 0) |
1101 | bgmvolume.value = 0; | 1073 | bgmvolume.value = 0; |
1102 | if (bgmvolume.value > 1) | 1074 | if (bgmvolume.value > 1) |
@@ -1136,12 +1108,6 @@ void M_AdjustSliders (int dir) | |||
1136 | case 11: // lookstrafe | 1108 | case 11: // lookstrafe |
1137 | Cvar_SetValue ("lookstrafe", !lookstrafe.value); | 1109 | Cvar_SetValue ("lookstrafe", !lookstrafe.value); |
1138 | break; | 1110 | break; |
1139 | |||
1140 | #ifdef _WIN32 | ||
1141 | case 13: // _windowed_mouse | ||
1142 | Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value); | ||
1143 | break; | ||
1144 | #endif | ||
1145 | } | 1111 | } |
1146 | } | 1112 | } |
1147 | 1113 | ||
@@ -1223,14 +1189,6 @@ void M_Options_Draw (void) | |||
1223 | if (vid_menudrawfn) | 1189 | if (vid_menudrawfn) |
1224 | M_Print (16, 128, " Video Options"); | 1190 | M_Print (16, 128, " Video Options"); |
1225 | 1191 | ||
1226 | #ifdef _WIN32 | ||
1227 | if (modestate == MS_WINDOWED) | ||
1228 | { | ||
1229 | M_Print (16, 136, " Use Mouse"); | ||
1230 | M_DrawCheckbox (220, 136, _windowed_mouse.value); | ||
1231 | } | ||
1232 | #endif | ||
1233 | |||
1234 | // cursor | 1192 | // cursor |
1235 | M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1)); | 1193 | M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1)); |
1236 | } | 1194 | } |
@@ -1297,16 +1255,6 @@ void M_Options_Key (int k) | |||
1297 | else | 1255 | else |
1298 | options_cursor = 0; | 1256 | options_cursor = 0; |
1299 | } | 1257 | } |
1300 | |||
1301 | #ifdef _WIN32 | ||
1302 | if ((options_cursor == 13) && (modestate != MS_WINDOWED)) | ||
1303 | { | ||
1304 | if (k == K_UPARROW) | ||
1305 | options_cursor = 12; | ||
1306 | else | ||
1307 | options_cursor = 0; | ||
1308 | } | ||
1309 | #endif | ||
1310 | } | 1258 | } |
1311 | 1259 | ||
1312 | //============================================================================= | 1260 | //============================================================================= |
@@ -1582,7 +1530,6 @@ int msgNumber; | |||
1582 | int m_quit_prevstate; | 1530 | int m_quit_prevstate; |
1583 | qboolean wasInMenus; | 1531 | qboolean wasInMenus; |
1584 | 1532 | ||
1585 | #ifndef _WIN32 | ||
1586 | char *quitMessage [] = | 1533 | char *quitMessage [] = |
1587 | { | 1534 | { |
1588 | /* .........1.........2.... */ | 1535 | /* .........1.........2.... */ |
@@ -1626,7 +1573,6 @@ char *quitMessage [] = | |||
1626 | " for you next time! ", | 1573 | " for you next time! ", |
1627 | " " | 1574 | " " |
1628 | }; | 1575 | }; |
1629 | #endif | ||
1630 | 1576 | ||
1631 | void M_Menu_Quit_f (void) | 1577 | void M_Menu_Quit_f (void) |
1632 | { | 1578 | { |
@@ -1684,36 +1630,11 @@ void M_Quit_Draw (void) | |||
1684 | m_state = m_quit; | 1630 | m_state = m_quit; |
1685 | } | 1631 | } |
1686 | 1632 | ||
1687 | #ifdef _WIN32 | ||
1688 | M_DrawTextBox (0, 0, 38, 23); | ||
1689 | M_PrintWhite (16, 12, " Quake version 1.09 by id Software\n\n"); | ||
1690 | M_PrintWhite (16, 28, "Programming Art \n"); | ||
1691 | M_Print (16, 36, " John Carmack Adrian Carmack\n"); | ||
1692 | M_Print (16, 44, " Michael Abrash Kevin Cloud\n"); | ||
1693 | M_Print (16, 52, " John Cash Paul Steed\n"); | ||
1694 | M_Print (16, 60, " Dave 'Zoid' Kirsch\n"); | ||
1695 | M_PrintWhite (16, 68, "Design Biz\n"); | ||
1696 | M_Print (16, 76, " John Romero Jay Wilbur\n"); | ||
1697 | M_Print (16, 84, " Sandy Petersen Mike Wilson\n"); | ||
1698 | M_Print (16, 92, " American McGee Donna Jackson\n"); | ||
1699 | M_Print (16, 100, " Tim Willits Todd Hollenshead\n"); | ||
1700 | M_PrintWhite (16, 108, "Support Projects\n"); | ||
1701 | M_Print (16, 116, " Barrett Alexander Shawn Green\n"); | ||
1702 | M_PrintWhite (16, 124, "Sound Effects\n"); | ||
1703 | M_Print (16, 132, " Trent Reznor and Nine Inch Nails\n\n"); | ||
1704 | M_PrintWhite (16, 140, "Quake is a trademark of Id Software,\n"); | ||
1705 | M_PrintWhite (16, 148, "inc., (c)1996 Id Software, inc. All\n"); | ||
1706 | M_PrintWhite (16, 156, "rights reserved. NIN logo is a\n"); | ||
1707 | M_PrintWhite (16, 164, "registered trademark licensed to\n"); | ||
1708 | M_PrintWhite (16, 172, "Nothing Interactive, Inc. All rights\n"); | ||
1709 | M_PrintWhite (16, 180, "reserved. Press y to exit\n"); | ||
1710 | #else | ||
1711 | M_DrawTextBox (56, 76, 24, 4); | 1633 | M_DrawTextBox (56, 76, 24, 4); |
1712 | M_Print (64, 84, quitMessage[msgNumber*4+0]); | 1634 | M_Print (64, 84, quitMessage[msgNumber*4+0]); |
1713 | M_Print (64, 92, quitMessage[msgNumber*4+1]); | 1635 | M_Print (64, 92, quitMessage[msgNumber*4+1]); |
1714 | M_Print (64, 100, quitMessage[msgNumber*4+2]); | 1636 | M_Print (64, 100, quitMessage[msgNumber*4+2]); |
1715 | M_Print (64, 108, quitMessage[msgNumber*4+3]); | 1637 | M_Print (64, 108, quitMessage[msgNumber*4+3]); |
1716 | #endif | ||
1717 | } | 1638 | } |
1718 | 1639 | ||
1719 | //============================================================================= | 1640 | //============================================================================= |
diff --git a/apps/plugins/sdl/progs/quake/net.h b/apps/plugins/sdl/progs/quake/net.h index af461256b6..813472c0c6 100644 --- a/apps/plugins/sdl/progs/quake/net.h +++ b/apps/plugins/sdl/progs/quake/net.h | |||
@@ -238,7 +238,7 @@ typedef struct | |||
238 | extern int hostCacheCount; | 238 | extern int hostCacheCount; |
239 | extern hostcache_t hostcache[HOSTCACHESIZE]; | 239 | extern hostcache_t hostcache[HOSTCACHESIZE]; |
240 | 240 | ||
241 | #if !defined(_WIN32 ) && !defined (__linux__) && !defined (__sun__) | 241 | #if !defined (__linux__) && !defined (__sun__) |
242 | #ifndef htonl | 242 | #ifndef htonl |
243 | extern unsigned long htonl (unsigned long hostlong); | 243 | extern unsigned long htonl (unsigned long hostlong); |
244 | #endif | 244 | #endif |
diff --git a/apps/plugins/sdl/progs/quake/net_dgrm.c b/apps/plugins/sdl/progs/quake/net_dgrm.c index a293b77b9f..bead46f8d1 100644 --- a/apps/plugins/sdl/progs/quake/net_dgrm.c +++ b/apps/plugins/sdl/progs/quake/net_dgrm.c | |||
@@ -23,9 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
23 | #define BAN_TEST | 23 | #define BAN_TEST |
24 | 24 | ||
25 | #ifdef BAN_TEST | 25 | #ifdef BAN_TEST |
26 | #if defined(_WIN32) | 26 | #if defined (NeXT) |
27 | #include <windows.h> | ||
28 | #elif defined (NeXT) | ||
29 | #include <sys/socket.h> | 27 | #include <sys/socket.h> |
30 | #include <arpa/inet.h> | 28 | #include <arpa/inet.h> |
31 | #else | 29 | #else |
diff --git a/apps/plugins/sdl/progs/quake/quakeasm.h b/apps/plugins/sdl/progs/quake/quakeasm.h index 303853944e..fe58bfeb95 100644 --- a/apps/plugins/sdl/progs/quake/quakeasm.h +++ b/apps/plugins/sdl/progs/quake/quakeasm.h | |||
@@ -23,14 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
23 | 23 | ||
24 | //#define GLQUAKE 1 | 24 | //#define GLQUAKE 1 |
25 | 25 | ||
26 | #if defined(_WIN32) && !defined(WINDED) | ||
27 | |||
28 | #if defined(_M_IX86) | ||
29 | #define __i386__ 1 | ||
30 | #endif | ||
31 | |||
32 | #endif | ||
33 | |||
34 | #if defined(__i386__) && defined(USE_ASM) | 26 | #if defined(__i386__) && defined(USE_ASM) |
35 | #define id386 1 | 27 | #define id386 1 |
36 | #else | 28 | #else |
diff --git a/apps/plugins/sdl/progs/quake/quakedef.h b/apps/plugins/sdl/progs/quake/quakedef.h index e676b7c9e7..b16d9b72f3 100644 --- a/apps/plugins/sdl/progs/quake/quakedef.h +++ b/apps/plugins/sdl/progs/quake/quakedef.h | |||
@@ -43,22 +43,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
43 | #define GAMENAME "id1" | 43 | #define GAMENAME "id1" |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #if defined(_WIN32) && !defined(WINDED) | ||
47 | |||
48 | #if defined(_M_IX86) | ||
49 | #define __i386__ 1 | ||
50 | #endif | ||
51 | |||
52 | void VID_LockBuffer (void); | ||
53 | void VID_UnlockBuffer (void); | ||
54 | |||
55 | #else | ||
56 | |||
57 | #define VID_LockBuffer() | 46 | #define VID_LockBuffer() |
58 | #define VID_UnlockBuffer() | 47 | #define VID_UnlockBuffer() |
59 | 48 | ||
60 | #endif | ||
61 | |||
62 | #if defined(__i386__) && defined(USE_ASM) | 49 | #if defined(__i386__) && defined(USE_ASM) |
63 | #define id386 1 | 50 | #define id386 1 |
64 | #else | 51 | #else |
diff --git a/apps/plugins/sdl/progs/quake/snd_dma.c b/apps/plugins/sdl/progs/quake/snd_dma.c index 4c42f32d49..3789381552 100644 --- a/apps/plugins/sdl/progs/quake/snd_dma.c +++ b/apps/plugins/sdl/progs/quake/snd_dma.c | |||
@@ -21,10 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
21 | 21 | ||
22 | #include "quakedef.h" | 22 | #include "quakedef.h" |
23 | 23 | ||
24 | #ifdef _WIN32 | ||
25 | #include "winquake.h" | ||
26 | #endif | ||
27 | |||
28 | void S_Play(void); | 24 | void S_Play(void); |
29 | void S_PlayVol(void); | 25 | void S_PlayVol(void); |
30 | void S_SoundList(void); | 26 | void S_SoundList(void); |
@@ -148,9 +144,7 @@ void S_Startup (void) | |||
148 | 144 | ||
149 | if (!rc) | 145 | if (!rc) |
150 | { | 146 | { |
151 | #ifndef _WIN32 | ||
152 | Con_Printf("S_Startup: SNDDMA_Init failed.\n"); | 147 | Con_Printf("S_Startup: SNDDMA_Init failed.\n"); |
153 | #endif | ||
154 | sound_started = 0; | 148 | sound_started = 0; |
155 | return; | 149 | return; |
156 | } | 150 | } |
@@ -561,11 +555,7 @@ void S_ClearBuffer (void) | |||
561 | { | 555 | { |
562 | int clear; | 556 | int clear; |
563 | 557 | ||
564 | #ifdef _WIN32 | ||
565 | if (!sound_started || !shm || (!shm->buffer && !pDSBuf)) | ||
566 | #else | ||
567 | if (!sound_started || !shm || !shm->buffer) | 558 | if (!sound_started || !shm || !shm->buffer) |
568 | #endif | ||
569 | return; | 559 | return; |
570 | 560 | ||
571 | if (shm->samplebits == 8) | 561 | if (shm->samplebits == 8) |
@@ -573,43 +563,7 @@ void S_ClearBuffer (void) | |||
573 | else | 563 | else |
574 | clear = 0; | 564 | clear = 0; |
575 | 565 | ||
576 | #ifdef _WIN32 | 566 | Q_memset(shm->buffer, clear, shm->samples * shm->samplebits/8); |
577 | if (pDSBuf) | ||
578 | { | ||
579 | DWORD dwSize; | ||
580 | DWORD *pData; | ||
581 | int reps; | ||
582 | HRESULT hresult; | ||
583 | |||
584 | reps = 0; | ||
585 | |||
586 | while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pData, &dwSize, NULL, NULL, 0)) != DS_OK) | ||
587 | { | ||
588 | if (hresult != DSERR_BUFFERLOST) | ||
589 | { | ||
590 | Con_Printf ("S_ClearBuffer: DS::Lock Sound Buffer Failed\n"); | ||
591 | S_Shutdown (); | ||
592 | return; | ||
593 | } | ||
594 | |||
595 | if (++reps > 10000) | ||
596 | { | ||
597 | Con_Printf ("S_ClearBuffer: DS: couldn't restore buffer\n"); | ||
598 | S_Shutdown (); | ||
599 | return; | ||
600 | } | ||
601 | } | ||
602 | |||
603 | Q_memset(pData, clear, shm->samples * shm->samplebits/8); | ||
604 | |||
605 | pDSBuf->lpVtbl->Unlock(pDSBuf, pData, dwSize, NULL, 0); | ||
606 | |||
607 | } | ||
608 | else | ||
609 | #endif | ||
610 | { | ||
611 | Q_memset(shm->buffer, clear, shm->samples * shm->samplebits/8); | ||
612 | } | ||
613 | } | 567 | } |
614 | 568 | ||
615 | 569 | ||
@@ -844,11 +798,6 @@ void GetSoundtime(void) | |||
844 | 798 | ||
845 | void S_ExtraUpdate (void) | 799 | void S_ExtraUpdate (void) |
846 | { | 800 | { |
847 | |||
848 | #ifdef _WIN32 | ||
849 | IN_Accumulate (); | ||
850 | #endif | ||
851 | |||
852 | if (snd_noextraupdate.value) | 801 | if (snd_noextraupdate.value) |
853 | return; // don't pollute timings | 802 | return; // don't pollute timings |
854 | S_Update_(); | 803 | S_Update_(); |
@@ -880,25 +829,6 @@ void S_Update_(void) | |||
880 | if (endtime - soundtime > samps) | 829 | if (endtime - soundtime > samps) |
881 | endtime = soundtime + samps; | 830 | endtime = soundtime + samps; |
882 | 831 | ||
883 | #ifdef _WIN32 | ||
884 | // if the buffer was lost or stopped, restore it and/or restart it | ||
885 | { | ||
886 | DWORD dwStatus; | ||
887 | |||
888 | if (pDSBuf) | ||
889 | { | ||
890 | if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DD_OK) | ||
891 | Con_Printf ("Couldn't get sound buffer status\n"); | ||
892 | |||
893 | if (dwStatus & DSBSTATUS_BUFFERLOST) | ||
894 | pDSBuf->lpVtbl->Restore (pDSBuf); | ||
895 | |||
896 | if (!(dwStatus & DSBSTATUS_PLAYING)) | ||
897 | pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING); | ||
898 | } | ||
899 | } | ||
900 | #endif | ||
901 | |||
902 | S_PaintChannels (endtime); | 832 | S_PaintChannels (endtime); |
903 | 833 | ||
904 | SNDDMA_Submit (); | 834 | SNDDMA_Submit (); |
diff --git a/apps/plugins/sdl/progs/quake/vid.h b/apps/plugins/sdl/progs/quake/vid.h index 1708ba825f..73c2ac7b4c 100644 --- a/apps/plugins/sdl/progs/quake/vid.h +++ b/apps/plugins/sdl/progs/quake/vid.h | |||
@@ -79,7 +79,3 @@ void VID_Update (vrect_t *rects); | |||
79 | int VID_SetMode (int modenum, unsigned char *palette); | 79 | int VID_SetMode (int modenum, unsigned char *palette); |
80 | // sets the mode; only used by the Quake engine for resetting to mode 0 (the | 80 | // sets the mode; only used by the Quake engine for resetting to mode 0 (the |
81 | // base mode) on memory allocation failures | 81 | // base mode) on memory allocation failures |
82 | |||
83 | void VID_HandlePause (qboolean pause); | ||
84 | // called only on Win32, when pause happens, so the mouse can be released | ||
85 | |||
diff --git a/apps/plugins/sdl/progs/quake/winquake.h b/apps/plugins/sdl/progs/quake/winquake.h deleted file mode 100644 index a956984fe6..0000000000 --- a/apps/plugins/sdl/progs/quake/winquake.h +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (C) 1996-1997 Id Software, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU General Public License | ||
6 | as published by the Free Software Foundation; either version 2 | ||
7 | of the License, or (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | |||
13 | See the GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | */ | ||
20 | // winquake.h: Win32-specific Quake header file | ||
21 | |||
22 | #pragma warning( disable : 4229 ) // mgraph gets this | ||
23 | |||
24 | #include <windows.h> | ||
25 | #define WM_MOUSEWHEEL 0x020A | ||
26 | |||
27 | #ifndef SERVERONLY | ||
28 | #include <ddraw.h> | ||
29 | #include <dsound.h> | ||
30 | #ifndef GLQUAKE | ||
31 | #include <mgraph.h> | ||
32 | #endif | ||
33 | #endif | ||
34 | |||
35 | extern HINSTANCE global_hInstance; | ||
36 | extern int global_nCmdShow; | ||
37 | |||
38 | #ifndef SERVERONLY | ||
39 | |||
40 | extern LPDIRECTDRAW lpDD; | ||
41 | extern qboolean DDActive; | ||
42 | extern LPDIRECTDRAWSURFACE lpPrimary; | ||
43 | extern LPDIRECTDRAWSURFACE lpFrontBuffer; | ||
44 | extern LPDIRECTDRAWSURFACE lpBackBuffer; | ||
45 | extern LPDIRECTDRAWPALETTE lpDDPal; | ||
46 | extern LPDIRECTSOUND pDS; | ||
47 | extern LPDIRECTSOUNDBUFFER pDSBuf; | ||
48 | |||
49 | extern DWORD gSndBufSize; | ||
50 | //#define SNDBUFSIZE 65536 | ||
51 | |||
52 | void VID_LockBuffer (void); | ||
53 | void VID_UnlockBuffer (void); | ||
54 | |||
55 | #endif | ||
56 | |||
57 | typedef int modestate_t; | ||
58 | enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT}; | ||
59 | |||
60 | extern modestate_t modestate; | ||
61 | |||
62 | extern HWND mainwindow; | ||
63 | extern qboolean ActiveApp, Minimized; | ||
64 | |||
65 | extern qboolean WinNT; | ||
66 | |||
67 | int VID_ForceUnlockedAndReturnState (void); | ||
68 | void VID_ForceLockState (int lk); | ||
69 | |||
70 | void IN_ShowMouse (void); | ||
71 | void IN_DeactivateMouse (void); | ||
72 | void IN_HideMouse (void); | ||
73 | void IN_ActivateMouse (void); | ||
74 | void IN_RestoreOriginalMouseState (void); | ||
75 | void IN_SetQuakeMouseState (void); | ||
76 | void IN_MouseEvent (int mstate); | ||
77 | |||
78 | extern qboolean winsock_lib_initialized; | ||
79 | |||
80 | extern cvar_t _windowed_mouse; | ||
81 | |||
82 | extern int window_center_x, window_center_y; | ||
83 | extern RECT window_rect; | ||
84 | |||
85 | extern qboolean mouseinitialized; | ||
86 | extern HWND hwnd_dialog; | ||
87 | |||
88 | extern HANDLE hinput, houtput; | ||
89 | |||
90 | void IN_UpdateClipCursor (void); | ||
91 | void CenterWindow(HWND hWndCenter, int width, int height, BOOL lefttopjustify); | ||
92 | |||
93 | void S_BlockSound (void); | ||
94 | void S_UnblockSound (void); | ||
95 | |||
96 | void VID_SetDefaultMode (void); | ||
97 | |||
98 | int (PASCAL FAR *pWSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData); | ||
99 | int (PASCAL FAR *pWSACleanup)(void); | ||
100 | int (PASCAL FAR *pWSAGetLastError)(void); | ||
101 | SOCKET (PASCAL FAR *psocket)(int af, int type, int protocol); | ||
102 | int (PASCAL FAR *pioctlsocket)(SOCKET s, long cmd, u_long FAR *argp); | ||
103 | int (PASCAL FAR *psetsockopt)(SOCKET s, int level, int optname, | ||
104 | const char FAR * optval, int optlen); | ||
105 | int (PASCAL FAR *precvfrom)(SOCKET s, char FAR * buf, int len, int flags, | ||
106 | struct sockaddr FAR *from, int FAR * fromlen); | ||
107 | int (PASCAL FAR *psendto)(SOCKET s, const char FAR * buf, int len, int flags, | ||
108 | const struct sockaddr FAR *to, int tolen); | ||
109 | int (PASCAL FAR *pclosesocket)(SOCKET s); | ||
110 | int (PASCAL FAR *pgethostname)(char FAR * name, int namelen); | ||
111 | struct hostent FAR * (PASCAL FAR *pgethostbyname)(const char FAR * name); | ||
112 | struct hostent FAR * (PASCAL FAR *pgethostbyaddr)(const char FAR * addr, | ||
113 | int len, int type); | ||
114 | int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name, | ||
115 | int FAR * namelen); | ||
diff --git a/apps/plugins/sdl/progs/wolf3d/sdl_winmain.c b/apps/plugins/sdl/progs/wolf3d/sdl_winmain.c deleted file mode 100644 index 366616d5ff..0000000000 --- a/apps/plugins/sdl/progs/wolf3d/sdl_winmain.c +++ /dev/null | |||
@@ -1,378 +0,0 @@ | |||
1 | #ifdef _WIN32 | ||
2 | |||
3 | /* | ||
4 | SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98 | ||
5 | |||
6 | Modified to write stdout/stderr to a message box at shutdown by Ripper 2007-12-27 | ||
7 | |||
8 | The WinMain function -- calls your program's main() function | ||
9 | */ | ||
10 | |||
11 | #include <stdio.h> | ||
12 | #include <stdlib.h> | ||
13 | |||
14 | #define WIN32_LEAN_AND_MEAN | ||
15 | #include <windows.h> | ||
16 | |||
17 | #ifdef _WIN32_WCE | ||
18 | # define DIR_SEPERATOR TEXT("\\") | ||
19 | # undef _getcwd | ||
20 | # define _getcwd(str,len) wcscpy(str,TEXT("")) | ||
21 | # define setbuf(f,b) | ||
22 | # define setvbuf(w,x,y,z) | ||
23 | # define fopen _wfopen | ||
24 | # define freopen _wfreopen | ||
25 | # define remove(x) DeleteFile(x) | ||
26 | #else | ||
27 | # define DIR_SEPERATOR TEXT("/") | ||
28 | # include <direct.h> | ||
29 | #endif | ||
30 | |||
31 | /* Include the SDL main definition header */ | ||
32 | #include "SDL.h" | ||
33 | #include "SDL_main.h" | ||
34 | |||
35 | #ifdef main | ||
36 | # ifndef _WIN32_WCE_EMULATION | ||
37 | # undef main | ||
38 | # endif /* _WIN32_WCE_EMULATION */ | ||
39 | #endif /* main */ | ||
40 | |||
41 | /* The standard output files */ | ||
42 | #define STDOUT_FILE TEXT("stdout.txt") | ||
43 | #define STDERR_FILE TEXT("stderr.txt") | ||
44 | |||
45 | #ifndef NO_STDIO_REDIRECT | ||
46 | # ifdef _WIN32_WCE | ||
47 | static wchar_t stdoutPath[MAX_PATH]; | ||
48 | static wchar_t stderrPath[MAX_PATH]; | ||
49 | # else | ||
50 | static char stdoutPath[MAX_PATH]; | ||
51 | static char stderrPath[MAX_PATH]; | ||
52 | # endif | ||
53 | #endif | ||
54 | |||
55 | #if defined(_WIN32_WCE) && _WIN32_WCE < 300 | ||
56 | /* seems to be undefined in Win CE although in online help */ | ||
57 | #define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t')) | ||
58 | #endif /* _WIN32_WCE < 300 */ | ||
59 | |||
60 | /* Parse a command line buffer into arguments */ | ||
61 | static int ParseCommandLine(char *cmdline, char **argv) | ||
62 | { | ||
63 | char *bufp; | ||
64 | int argc; | ||
65 | |||
66 | argc = 0; | ||
67 | for ( bufp = cmdline; *bufp; ) { | ||
68 | /* Skip leading whitespace */ | ||
69 | while ( isspace(*bufp) ) { | ||
70 | ++bufp; | ||
71 | } | ||
72 | /* Skip over argument */ | ||
73 | if ( *bufp == '"' ) { | ||
74 | ++bufp; | ||
75 | if ( *bufp ) { | ||
76 | if ( argv ) { | ||
77 | argv[argc] = bufp; | ||
78 | } | ||
79 | ++argc; | ||
80 | } | ||
81 | /* Skip over word */ | ||
82 | while ( *bufp && (*bufp != '"') ) { | ||
83 | ++bufp; | ||
84 | } | ||
85 | } else { | ||
86 | if ( *bufp ) { | ||
87 | if ( argv ) { | ||
88 | argv[argc] = bufp; | ||
89 | } | ||
90 | ++argc; | ||
91 | } | ||
92 | /* Skip over word */ | ||
93 | while ( *bufp && ! isspace(*bufp) ) { | ||
94 | ++bufp; | ||
95 | } | ||
96 | } | ||
97 | if ( *bufp ) { | ||
98 | if ( argv ) { | ||
99 | *bufp = '\0'; | ||
100 | } | ||
101 | ++bufp; | ||
102 | } | ||
103 | } | ||
104 | if ( argv ) { | ||
105 | argv[argc] = NULL; | ||
106 | } | ||
107 | return(argc); | ||
108 | } | ||
109 | |||
110 | /* Show an error message */ | ||
111 | static void ShowError(const char *title, const char *message) | ||
112 | { | ||
113 | /* If USE_MESSAGEBOX is defined, you need to link with user32.lib */ | ||
114 | #ifdef USE_MESSAGEBOX | ||
115 | MessageBox(NULL, message, title, MB_ICONEXCLAMATION|MB_OK); | ||
116 | #else | ||
117 | fprintf(stderr, "%s: %s\n", title, message); | ||
118 | #endif | ||
119 | } | ||
120 | |||
121 | /* Pop up an out of memory message, returns to Windows */ | ||
122 | static bool OutOfMemory(void) | ||
123 | { | ||
124 | ShowError("Fatal Error", "Out of memory - aborting"); | ||
125 | return FALSE; | ||
126 | } | ||
127 | |||
128 | /* SDL_Quit() shouldn't be used with atexit() directly because | ||
129 | calling conventions may differ... */ | ||
130 | static void cleanup(void) | ||
131 | { | ||
132 | SDL_Quit(); | ||
133 | } | ||
134 | |||
135 | /* Remove the output files if there was no output written */ | ||
136 | static void cleanup_output(void) | ||
137 | { | ||
138 | #if 1 | ||
139 | #ifndef NO_STDIO_REDIRECT | ||
140 | FILE *file; | ||
141 | #endif | ||
142 | #endif | ||
143 | |||
144 | /* Flush the output in case anything is queued */ | ||
145 | fclose(stdout); | ||
146 | fclose(stderr); | ||
147 | |||
148 | #if 1 | ||
149 | #ifndef NO_STDIO_REDIRECT | ||
150 | /* See if the files have any output in them */ | ||
151 | if ( stdoutPath[0] ) { | ||
152 | file = fopen(stdoutPath, TEXT("r")); | ||
153 | if ( file ) { | ||
154 | char buf[16384]; | ||
155 | size_t readbytes = fread(buf, 1, 16383, file); | ||
156 | fclose(file); | ||
157 | |||
158 | if(readbytes != 0) | ||
159 | { | ||
160 | buf[readbytes] = 0; // cut after last byte (<=16383) | ||
161 | MessageBox(NULL, buf, "Wolf4SDL", MB_OK); | ||
162 | } | ||
163 | else | ||
164 | remove(stdoutPath); // remove empty file | ||
165 | } | ||
166 | } | ||
167 | if ( stderrPath[0] ) { | ||
168 | file = fopen(stderrPath, TEXT("rb")); | ||
169 | if ( file ) { | ||
170 | char buf[16384]; | ||
171 | size_t readbytes = fread(buf, 1, 16383, file); | ||
172 | fclose(file); | ||
173 | |||
174 | if(readbytes != 0) | ||
175 | { | ||
176 | buf[readbytes] = 0; // cut after last byte (<=16383) | ||
177 | MessageBox(NULL, buf, "Wolf4SDL", MB_OK); | ||
178 | } | ||
179 | else | ||
180 | remove(stderrPath); // remove empty file | ||
181 | } | ||
182 | } | ||
183 | #endif | ||
184 | #endif | ||
185 | } | ||
186 | |||
187 | //#if defined(_MSC_VER) && !defined(_WIN32_WCE) | ||
188 | ///* The VC++ compiler needs main defined */ | ||
189 | //#define console_main main | ||
190 | //#endif | ||
191 | |||
192 | /* This is where execution begins [console apps] */ | ||
193 | int console_main(int argc, char *argv[]) | ||
194 | { | ||
195 | size_t n; | ||
196 | char *bufp, *appname; | ||
197 | int status; | ||
198 | |||
199 | /* Get the class name from argv[0] */ | ||
200 | appname = argv[0]; | ||
201 | if ( (bufp=SDL_strrchr(argv[0], '\\')) != NULL ) { | ||
202 | appname = bufp+1; | ||
203 | } else | ||
204 | if ( (bufp=SDL_strrchr(argv[0], '/')) != NULL ) { | ||
205 | appname = bufp+1; | ||
206 | } | ||
207 | |||
208 | if ( (bufp=SDL_strrchr(appname, '.')) == NULL ) | ||
209 | n = SDL_strlen(appname); | ||
210 | else | ||
211 | n = (bufp-appname); | ||
212 | |||
213 | bufp = SDL_stack_alloc(char, n+1); | ||
214 | if ( bufp == NULL ) { | ||
215 | return OutOfMemory(); | ||
216 | } | ||
217 | SDL_strlcpy(bufp, appname, n+1); | ||
218 | appname = bufp; | ||
219 | |||
220 | /* Load SDL dynamic link library */ | ||
221 | if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) { | ||
222 | ShowError("WinMain() error", SDL_GetError()); | ||
223 | return(FALSE); | ||
224 | } | ||
225 | atexit(cleanup_output); | ||
226 | atexit(cleanup); | ||
227 | |||
228 | /* Sam: | ||
229 | We still need to pass in the application handle so that | ||
230 | DirectInput will initialize properly when SDL_RegisterApp() | ||
231 | is called later in the video initialization. | ||
232 | */ | ||
233 | SDL_SetModuleHandle(GetModuleHandle(NULL)); | ||
234 | |||
235 | /* Run the application main() code */ | ||
236 | status = SDL_main(argc, argv); | ||
237 | |||
238 | /* Exit cleanly, calling atexit() functions */ | ||
239 | exit(status); | ||
240 | |||
241 | /* Hush little compiler, don't you cry... */ | ||
242 | return 0; | ||
243 | } | ||
244 | |||
245 | /* This is where execution begins [windowed apps] */ | ||
246 | #ifdef _WIN32_WCE | ||
247 | int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw) | ||
248 | #else | ||
249 | int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) | ||
250 | #endif | ||
251 | { | ||
252 | HINSTANCE handle; | ||
253 | char **argv; | ||
254 | int argc; | ||
255 | char *cmdline; | ||
256 | #ifdef _WIN32_WCE | ||
257 | wchar_t *bufp; | ||
258 | int nLen; | ||
259 | #else | ||
260 | char *bufp; | ||
261 | size_t nLen; | ||
262 | #endif | ||
263 | #ifndef NO_STDIO_REDIRECT | ||
264 | DWORD pathlen; | ||
265 | #ifdef _WIN32_WCE | ||
266 | wchar_t path[MAX_PATH]; | ||
267 | #else | ||
268 | char path[MAX_PATH]; | ||
269 | #endif | ||
270 | FILE *newfp; | ||
271 | #endif | ||
272 | |||
273 | /* Start up DDHELP.EXE before opening any files, so DDHELP doesn't | ||
274 | keep them open. This is a hack.. hopefully it will be fixed | ||
275 | someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded. | ||
276 | */ | ||
277 | handle = LoadLibrary(TEXT("DDRAW.DLL")); | ||
278 | if ( handle != NULL ) { | ||
279 | FreeLibrary(handle); | ||
280 | } | ||
281 | |||
282 | #ifndef NO_STDIO_REDIRECT | ||
283 | pathlen = GetModuleFileName(NULL, path, SDL_arraysize(path)); | ||
284 | while ( pathlen > 0 && path[pathlen] != '\\' ) { | ||
285 | --pathlen; | ||
286 | } | ||
287 | path[pathlen] = '\0'; | ||
288 | |||
289 | #ifdef _WIN32_WCE | ||
290 | wcsncpy( stdoutPath, path, SDL_arraysize(stdoutPath) ); | ||
291 | wcsncat( stdoutPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) ); | ||
292 | #else | ||
293 | SDL_strlcpy( stdoutPath, path, SDL_arraysize(stdoutPath) ); | ||
294 | SDL_strlcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) ); | ||
295 | #endif | ||
296 | |||
297 | /* Redirect standard input and standard output */ | ||
298 | newfp = freopen(stdoutPath, TEXT("w"), stdout); | ||
299 | |||
300 | #ifndef _WIN32_WCE | ||
301 | if ( newfp == NULL ) { /* This happens on NT */ | ||
302 | #if !defined(stdout) | ||
303 | stdout = fopen(stdoutPath, TEXT("w")); | ||
304 | #else | ||
305 | newfp = fopen(stdoutPath, TEXT("w")); | ||
306 | if ( newfp ) { | ||
307 | *stdout = *newfp; | ||
308 | } | ||
309 | #endif | ||
310 | } | ||
311 | #endif /* _WIN32_WCE */ | ||
312 | |||
313 | #ifdef _WIN32_WCE | ||
314 | wcsncpy( stderrPath, path, SDL_arraysize(stdoutPath) ); | ||
315 | wcsncat( stderrPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) ); | ||
316 | #else | ||
317 | SDL_strlcpy( stderrPath, path, SDL_arraysize(stderrPath) ); | ||
318 | SDL_strlcat( stderrPath, DIR_SEPERATOR STDERR_FILE, SDL_arraysize(stderrPath) ); | ||
319 | #endif | ||
320 | |||
321 | newfp = freopen(stderrPath, TEXT("w"), stderr); | ||
322 | #ifndef _WIN32_WCE | ||
323 | if ( newfp == NULL ) { /* This happens on NT */ | ||
324 | #if !defined(stderr) | ||
325 | stderr = fopen(stderrPath, TEXT("w")); | ||
326 | #else | ||
327 | newfp = fopen(stderrPath, TEXT("w")); | ||
328 | if ( newfp ) { | ||
329 | *stderr = *newfp; | ||
330 | } | ||
331 | #endif | ||
332 | } | ||
333 | #endif /* _WIN32_WCE */ | ||
334 | |||
335 | setvbuf(stdout, NULL, _IOLBF, BUFSIZ); /* Line buffered */ | ||
336 | setbuf(stderr, NULL); /* No buffering */ | ||
337 | #endif /* !NO_STDIO_REDIRECT */ | ||
338 | |||
339 | #ifdef _WIN32_WCE | ||
340 | nLen = wcslen(szCmdLine)+128+1; | ||
341 | bufp = SDL_stack_alloc(wchar_t, nLen*2); | ||
342 | wcscpy (bufp, TEXT("\"")); | ||
343 | GetModuleFileName(NULL, bufp+1, 128-3); | ||
344 | wcscpy (bufp+wcslen(bufp), TEXT("\" ")); | ||
345 | wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp)); | ||
346 | nLen = wcslen(bufp)+1; | ||
347 | cmdline = SDL_stack_alloc(char, nLen); | ||
348 | if ( cmdline == NULL ) { | ||
349 | return OutOfMemory(); | ||
350 | } | ||
351 | WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL); | ||
352 | #else | ||
353 | /* Grab the command line */ | ||
354 | bufp = GetCommandLine(); | ||
355 | nLen = SDL_strlen(bufp)+1; | ||
356 | cmdline = SDL_stack_alloc(char, nLen); | ||
357 | if ( cmdline == NULL ) { | ||
358 | return OutOfMemory(); | ||
359 | } | ||
360 | SDL_strlcpy(cmdline, bufp, nLen); | ||
361 | #endif | ||
362 | |||
363 | /* Parse it into argv and argc */ | ||
364 | argc = ParseCommandLine(cmdline, NULL); | ||
365 | argv = SDL_stack_alloc(char*, argc+1); | ||
366 | if ( argv == NULL ) { | ||
367 | return OutOfMemory(); | ||
368 | } | ||
369 | ParseCommandLine(cmdline, argv); | ||
370 | |||
371 | /* Run the main program (after a little SDL initialization) */ | ||
372 | console_main(argc, argv); | ||
373 | |||
374 | /* Hush little compiler, don't you cry... */ | ||
375 | return 0; | ||
376 | } | ||
377 | |||
378 | #endif // _WIN32 | ||
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_def.h b/apps/plugins/sdl/progs/wolf3d/wl_def.h index 1b8670ffb6..13ec77cf70 100644 --- a/apps/plugins/sdl/progs/wolf3d/wl_def.h +++ b/apps/plugins/sdl/progs/wolf3d/wl_def.h | |||
@@ -1392,23 +1392,17 @@ static fixed FixedMul(fixed a, fixed b) | |||
1392 | 1392 | ||
1393 | #define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__) | 1393 | #define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__) |
1394 | 1394 | ||
1395 | #ifdef _WIN32 | 1395 | static char* itoa(int value, char* string, int radix) |
1396 | #define strcasecmp stricmp | 1396 | { |
1397 | #define strncasecmp strnicmp | 1397 | sprintf(string, "%d", value); |
1398 | #define snprintf _snprintf | 1398 | return string; |
1399 | #else | 1399 | } |
1400 | static char* itoa(int value, char* string, int radix) | ||
1401 | { | ||
1402 | sprintf(string, "%d", value); | ||
1403 | return string; | ||
1404 | } | ||
1405 | 1400 | ||
1406 | static char* ltoa(long value, char* string, int radix) | 1401 | static char* ltoa(long value, char* string, int radix) |
1407 | { | 1402 | { |
1408 | sprintf(string, "%ld", value); | 1403 | sprintf(string, "%ld", value); |
1409 | return string; | 1404 | return string; |
1410 | } | 1405 | } |
1411 | #endif | ||
1412 | 1406 | ||
1413 | #define lengthof(x) (sizeof(x) / sizeof(*(x))) | 1407 | #define lengthof(x) (sizeof(x) / sizeof(*(x))) |
1414 | #define endof(x) ((x) + lengthof(x)) | 1408 | #define endof(x) ((x) + lengthof(x)) |
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_main.c b/apps/plugins/sdl/progs/wolf3d/wl_main.c index 634196498a..8808cd0883 100644 --- a/apps/plugins/sdl/progs/wolf3d/wl_main.c +++ b/apps/plugins/sdl/progs/wolf3d/wl_main.c | |||
@@ -1191,9 +1191,6 @@ static void InitGame() | |||
1191 | #endif | 1191 | #endif |
1192 | 1192 | ||
1193 | // initialize SDL | 1193 | // initialize SDL |
1194 | #if defined _WIN32 | ||
1195 | putenv("SDL_VIDEODRIVER=directx"); | ||
1196 | #endif | ||
1197 | if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) | 1194 | if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) |
1198 | { | 1195 | { |
1199 | printf("Unable to init SDL: %s\n", SDL_GetError()); | 1196 | printf("Unable to init SDL: %s\n", SDL_GetError()); |
@@ -1217,23 +1214,7 @@ static void InitGame() | |||
1217 | #endif | 1214 | #endif |
1218 | 1215 | ||
1219 | SignonScreen (); | 1216 | SignonScreen (); |
1220 | 1217 | ||
1221 | #if defined _WIN32 | ||
1222 | if(!fullscreen) | ||
1223 | { | ||
1224 | struct SDL_SysWMinfo wmInfo; | ||
1225 | SDL_VERSION(&wmInfo.version); | ||
1226 | |||
1227 | if(SDL_GetWMInfo(&wmInfo) != -1) | ||
1228 | { | ||
1229 | HWND hwndSDL = wmInfo.window; | ||
1230 | DWORD style = GetWindowLong(hwndSDL, GWL_STYLE) & ~WS_SYSMENU; | ||
1231 | SetWindowLong(hwndSDL, GWL_STYLE, style); | ||
1232 | SetWindowPos(hwndSDL, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); | ||
1233 | } | ||
1234 | } | ||
1235 | #endif | ||
1236 | |||
1237 | VH_Startup (); | 1218 | VH_Startup (); |
1238 | IN_Startup (); | 1219 | IN_Startup (); |
1239 | PM_Startup (); | 1220 | PM_Startup (); |
@@ -1911,11 +1892,7 @@ void CheckParameters(int argc, char *argv[]) | |||
1911 | " --ignorenumchunks Ignores the number of chunks in VGAHEAD.*\n" | 1892 | " --ignorenumchunks Ignores the number of chunks in VGAHEAD.*\n" |
1912 | " (may be useful for some broken mods)\n" | 1893 | " (may be useful for some broken mods)\n" |
1913 | " --configdir <dir> Directory where config file and save games are stored\n" | 1894 | " --configdir <dir> Directory where config file and save games are stored\n" |
1914 | #if defined(_arch_dreamcast) || defined(_WIN32) | ||
1915 | " (default: current directory)\n" | ||
1916 | #else | ||
1917 | " (default: $HOME/.wolf4sdl)\n" | 1895 | " (default: $HOME/.wolf4sdl)\n" |
1918 | #endif | ||
1919 | #if defined(SPEAR) && !defined(SPEARDEMO) | 1896 | #if defined(SPEAR) && !defined(SPEARDEMO) |
1920 | " --mission <mission> Mission number to play (0-3)\n" | 1897 | " --mission <mission> Mission number to play (0-3)\n" |
1921 | " (default: 0 -> .sod, 1-3 -> .sd*)\n" | 1898 | " (default: 0 -> .sod, 1-3 -> .sd*)\n" |
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_menu.c b/apps/plugins/sdl/progs/wolf3d/wl_menu.c index d72f0733c2..cdbc70aad1 100644 --- a/apps/plugins/sdl/progs/wolf3d/wl_menu.c +++ b/apps/plugins/sdl/progs/wolf3d/wl_menu.c | |||
@@ -3992,7 +3992,6 @@ CheckForEpisodes (void) | |||
3992 | int statbuf; | 3992 | int statbuf; |
3993 | 3993 | ||
3994 | // On Linux like systems, the configdir defaults to $HOME/.wolf4sdl | 3994 | // On Linux like systems, the configdir defaults to $HOME/.wolf4sdl |
3995 | #if !defined(_WIN32) && !defined(_arch_dreamcast) | ||
3996 | if(configdir[0] == 0) | 3995 | if(configdir[0] == 0) |
3997 | { | 3996 | { |
3998 | // Set config location to home directory for multi-user support | 3997 | // Set config location to home directory for multi-user support |
@@ -4008,18 +4007,13 @@ CheckForEpisodes (void) | |||
4008 | } | 4007 | } |
4009 | snprintf(configdir, sizeof(configdir), "%s" WOLFDIR, homedir); | 4008 | snprintf(configdir, sizeof(configdir), "%s" WOLFDIR, homedir); |
4010 | } | 4009 | } |
4011 | #endif | ||
4012 | 4010 | ||
4013 | if(configdir[0] != 0) | 4011 | if(configdir[0] != 0) |
4014 | { | 4012 | { |
4015 | // Ensure config directory exists and create if necessary | 4013 | // Ensure config directory exists and create if necessary |
4016 | if(stat(configdir, &statbuf) != 0) | 4014 | if(stat(configdir, &statbuf) != 0) |
4017 | { | 4015 | { |
4018 | #ifdef _WIN32 | ||
4019 | if(_mkdir(configdir) != 0) | ||
4020 | #else | ||
4021 | if(mkdir(configdir) != 0) | 4016 | if(mkdir(configdir) != 0) |
4022 | #endif | ||
4023 | { | 4017 | { |
4024 | Quit("The configuration directory \"%s\" could not be created.", configdir); | 4018 | Quit("The configuration directory \"%s\" could not be created.", configdir); |
4025 | } | 4019 | } |