From 5e58832acfcdb5b0f52e3c9191b1940241cd8946 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 26 Mar 2017 23:03:02 +0000 Subject: [PATCH] Try to clean up a few things in the hopes of making Eukara's efforts easier. That or just to give him conflicts. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5081 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 4 +- engine/client/net_master.c | 16 --- engine/client/sys_xdk.c | 221 +++++++++++++++++++++++++++++++++- engine/client/winquake.h | 1 - engine/common/bothdefs.h | 63 ++++++++-- engine/common/netinc.h | 108 +++++++++-------- engine/common/plugin.c | 6 - engine/common/pr_bgcmd.c | 10 +- engine/common/sys.h | 2 +- engine/gl/glquake.h | 36 ++---- engine/http/iweb.h | 7 -- engine/http/iwebiface.c | 1 + engine/server/pr_q1qvm.c | 4 +- plugins/jabber/jabberclient.c | 11 +- 14 files changed, 360 insertions(+), 130 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index a0198160..9571a626 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -4838,7 +4838,7 @@ void Host_DoRunFile(hrf_t *f) qboolean Host_RunFile(const char *fname, int nlen, vfsfile_t *file) { hrf_t *f; -#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT) +#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT) && !defined(_XBOX) //win32 file urls are basically fucked, so defer to the windows api. char utf8[MAX_OSPATH*3]; if (nlen >= 7 && !strncmp(fname, "file://", 7)) @@ -5664,7 +5664,7 @@ void Host_FinishLoading(void) "\n" "See the GNU General Public License for more details.\n"); - #if defined(_WIN32) && !defined(FTE_SDL) && defined(WEBCLIENT) + #if defined(_WIN32) && !defined(FTE_SDL) && !defined(_XBOX) && defined(WEBCLIENT) if (Sys_RunInstaller()) Sys_Quit(); #endif diff --git a/engine/client/net_master.c b/engine/client/net_master.c index fac51301..748a59a3 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -562,24 +562,8 @@ void SV_Master_Shutdown (void) //remove dead servers. //master was polled a minute ago and server was not on list - server on multiple masters would be awkward. -#ifdef _WIN32 -#include "winquake.h" -#else -typedef int SOCKET; -#endif - #include "netinc.h" -#ifdef AF_IPX -#define USEIPX -#endif - -#if defined(_XBOX) - #undef TCPCONNECT - #undef IPPROTO_IPV6 - #undef USEIPX -#endif - //the number of servers should be limited only by memory. cvar_t slist_cacheinfo = CVAR("slist_cacheinfo", "0"); //this proves dangerous, memory wise. diff --git a/engine/client/sys_xdk.c b/engine/client/sys_xdk.c index d03d0ef6..8d72a784 100644 --- a/engine/client/sys_xdk.c +++ b/engine/client/sys_xdk.c @@ -1,7 +1,178 @@ +#include "quakedef.h" #include -#include "quakedef.h" -void main( int argc, char **argv) { + +/*Timers, supposedly xbox supports QueryPerformanceCounter stuff*/ +double Sys_DoubleTime (void) +{ + static int first = 1; + static LARGE_INTEGER qpcfreq; + LARGE_INTEGER PerformanceCount; + static LONGLONG oldcall; + static LONGLONG firsttime; + LONGLONG diff; + + QueryPerformanceCounter (&PerformanceCount); + if (first) + { + first = 0; + QueryPerformanceFrequency(&qpcfreq); + firsttime = PerformanceCount.QuadPart; + diff = 0; + } + else + diff = PerformanceCount.QuadPart - oldcall; + if (diff >= 0) + oldcall = PerformanceCount.QuadPart; + return (oldcall - firsttime) / (double)qpcfreq.QuadPart; +} +unsigned int Sys_Milliseconds (void) +{ + return Sys_DoubleTime()*1000; +} + +NORETURN void VARGS Sys_Error (const char *error, ...) +{ + //FIXME: panic! everyone panic! + //you might want to figure out some way to display the message... + for(;;) + ; +} + +void Sys_Sleep(double seconds) +{ //yields to other processes/threads for a bit. +} + +void Sys_Quit (void) +{ +#if 0 + Host_Shutdown (); + //successful execution. + //should go back to the system menu or something, or possibly longjmp out of the main loop. + for (;;) + ; + exit(1); +#endif +} + +void Sys_Shutdown(void) +{ +} +void Sys_Init(void) +{ //register system-specific cvars here +} + +/*prints to dedicated server console or debug output*/ +void VARGS Sys_Printf (char *fmt, ...) +{ + va_list argptr; + char msg[MAXPRINTMSG]; + + va_start (argptr,fmt); + _vsnprintf (msg,sizeof(msg)-1, fmt,argptr); + msg[sizeof(msg)-1] = 0; //_vsnprintf sucks. + va_end (argptr); + + //no idea what the stdout is hooked up to, lets try it anyway. + printf("%s", msg); +} + +/*returns the system video mode settings, ish*/ +qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate) +{ + //FIXME: use XGetVideoStandard or XGetVideoFlags or something + *width = 640; + *height = 480; + *bpp = 32; + *refreshrate = 60; + return true; +} + +/*dedicated server type stuff*/ +qboolean Sys_InitTerminal(void) +{ + return false; //failure +} +void Sys_CloseTerminal (void) +{ +} +char *Sys_ConsoleInput (void) +{ //returns any text typed on the stdin, when acting as a dedicated server. + //this includes debugger commands if we're integrated with fteqccgui + return NULL; +} + +/*various system notifications*/ +void Sys_ServerActivity(void) +{ //player joined the server or said something. would normally flash the app in the system tray. +} + +/*check any system message queues here*/ +void Sys_SendKeyEvents(void) +{ +} + +qboolean Sys_RandomBytes(qbyte *string, int len) +{ + //FIXME: should return some cryptographically strong random number data from some proper crypto library. C's rand function isn't really strong enough. + return false; +} + +/*filesystem stuff*/ +void Sys_mkdir (char *path) +{ +} +qboolean Sys_remove (char *path) +{ + return false; //false for failure +} +qboolean Sys_Rename (char *oldfname, char *newfname) +{ + return false; //false for failure +} +int Sys_EnumerateFiles (const char *gpath, const char *match, int (QDECL *func)(const char *fname, qofs_t fsize, void *parm, searchpathfuncs_t *spath), void *parm, searchpathfuncs_t *spath) +{ + //if func returns false, abort with false return value, otherwise return true. + //use wildcmd to compare two filenames + //note that match may contain wildcards and multiple directories with multiple wildcards all over. + return true; +} + +/*consoles don't tend to need system clipboards, so this is fully internal to our engine*/ +#define SYS_CLIPBOARD_SIZE 256 +static char clipboard_buffer[SYS_CLIPBOARD_SIZE] = {0}; +char *Sys_GetClipboard(void) +{ + return clipboard_buffer; +} +void Sys_CloseClipboard(char *bf) +{ +} +void Sys_SaveClipboard(char *text) +{ + Q_strncpyz(clipboard_buffer, text, SYS_CLIPBOARD_SIZE); +} + +/*dynamic library stubs*/ +dllhandle_t *Sys_LoadLibrary(const char *name, dllfunction_t *funcs) +{ + Con_Printf("Sys_LoadLibrary: %s\n", name); + return NULL; +} +void Sys_CloseLibrary(dllhandle_t *lib) +{ +} +void *Sys_GetAddressForName(dllhandle_t *module, const char *exportname) +{ + return NULL; //unsupported +} +char *Sys_GetNameForAddress(dllhandle_t *module, void *address) +{ + return NULL; //unsupported (on most platforms, actually) +} + +void main( int argc, char **argv) +{ float time, lasttime; quakeparms_t parms; @@ -22,4 +193,48 @@ void main( int argc, char **argv) { lasttime = time; } -} \ No newline at end of file +} + + + + +/*input stubs +in_generic.c should make these kinda useless, but sometimes you need more than the following three functions: +void IN_JoystickAxisEvent(unsigned int devid, int axis, float value); +void IN_KeyEvent(unsigned int devid, int down, int keycode, int unicode); +void IN_MouseMove(unsigned int devid, int abs, float x, float y, float z, float size); +that said, if they're enough, then just call those in Sys_SendKeyEvents. You can also call them from other threads just fine. +their devid values should be assigned only when a button is first pressed, or something, so controllers get assigned to seats in the order that they're pressed. so player 1 always hits a button first to ensure that they are player 1. +or just hardcode those based upon usbport numbers, but that's unreliable with usb hubs. +*/ + +void INS_Shutdown (void) +{ +} +void INS_ReInit (void) +{ +} +void INS_Move(float *movements, int pnum) +{ + //accululates system-specific inputs on a per-seat basis. +} +void INS_Init (void) +{ +} +void INS_Accumulate(void) //input polling +{ +} +void INS_Commands (void) //used to Cbuf_AddText joystick button events in windows. +{ +} +void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, unsigned int *qdevid)) +{ +#if 0 + unsigned int i; + for (i = 0; i < MAX_JOYSTICKS; i++) + if (sdljoy[i].controller) + callback(ctx, "joy", sdljoy[i].devname, &sdljoy[i].qdevid); +#endif +} + + diff --git a/engine/client/winquake.h b/engine/client/winquake.h index 7259cb5f..34058569 100644 --- a/engine/client/winquake.h +++ b/engine/client/winquake.h @@ -42,7 +42,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #else #include - #include #include #include #endif diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 4164af8c..67e3cf41 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -109,7 +109,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #if !defined(NO_DIRECTX) && !defined(NODIRECTX) && defined(_WIN32) #define AVAIL_DINPUT #define AVAIL_DSOUND - #undef AVAIL_WASAPI + #define AVAIL_WASAPI #endif #ifdef WINRT #define AVAIL_XAUDIO2 @@ -117,7 +117,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define AVAIL_XZDEC #if !defined(MINIMAL) && !defined(NPFTE) && !defined(NPQTV) -#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT) +#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT) && !defined(_XBOX) #if !defined(_MSC_VER) || _MSC_VER > 1200 #define HAVE_WINSSPI //built in component, checks against windows' root ca database and revocations etc. #endif @@ -125,9 +125,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HAVE_GNUTLS //currently disabled as it does not validate the server's certificate, beware the mitm attack. #endif #endif -#if defined(HAVE_WINSSPI) || defined(HAVE_GNUTLS) - #define HAVE_SSL -#endif //#define DYNAMIC_ZLIB //#define DYNAMIC_LIBPNG @@ -164,6 +161,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef AVAIL_WASAPI //wasapi is available in the vista sdk, while that's compatible with earlier versions, its not really expected until 2008 #endif +#define HAVE_TCP //says we can use tcp too (either ipv4 or ipv6) +#define HAVE_PACKET //if we have the socket api at all... + //set any additional defines or libs in win32 #define LOADERTHREAD @@ -198,10 +198,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef AVAIL_JPEGLIB #undef AVAIL_XZDEC -#if defined(_WIN32) && !defined(FTE_SDL) && !defined(MULTITHREAD) //always thread on win32 non-minimal builds -#ifndef _XBOX +#if defined(_WIN32) && !defined(FTE_SDL) && !defined(MULTITHREAD) && !defined(_XBOX) //always thread on win32 non-minimal builds #define MULTITHREAD -#endif #endif #elif defined(MINIMAL) #define QUAKESTATS @@ -258,10 +256,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PSKMODELS //PSK model format (ActorX stuff from UT, though not the format the game itself uses) #define HALFLIFEMODELS //halflife model support (experimental) #define INTERQUAKEMODELS - - #ifndef _XBOX - #define RAGDOLL - #endif + #define RAGDOLL #define HUFFNETWORK //huffman network compression #define DOOMWADS //doom wad/sprite support @@ -404,7 +399,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef HAVE_SPEECHTOTEXT //windows speech-to-text thing #endif +#if defined(_XBOX) + #undef HAVE_TCP //FIXME + #undef HAVE_PACKET //FIXME + #undef SUPPORT_ICE //screw that + #undef PLUGINS //would need LoadLibrary working properly. + + #undef AVAIL_DINPUT //xbox apparently only really does controllers. + #undef AVAIL_DSOUND //FIXME + #undef TEXTEDITOR //its hard to edit text when you have just a controller (and no onscreen keyboard) + #undef RAGDOLL //needs a proper physics engine + #undef AVAIL_MP3_ACM //api not supported + #undef HAVE_SPEECHTOTEXT //api not supported + #undef MULTITHREAD //no CreateThread stuff. + #undef SUBSERVERS //single-process. +#endif + #ifdef FTE_TARGET_WEB + //sandboxing... + #undef HAVE_TCP //websockets are not real tcp. + #undef HAVE_PACKET //no udp support + //try to trim the fat #undef VOICECHAT //too lazy to compile speex #undef HLCLIENT //dlls... @@ -437,6 +452,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #undef RTLIGHTS #endif #ifdef WINRT + //microsoft do not support winsock any more. + #undef HAVE_TCP + #undef HAVE_PACKET + #undef TCPCONNECT //err... #undef IRCCONNECT //not happening #undef AVAIL_DSOUND //yeah, good luck there @@ -456,6 +475,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define GLESONLY //should reduce the conditions a little #endif #if defined(NACL) + //stuff is sandboxed. + #undef HAVE_TCP //websockets are not true tcp + #undef HAVE_PACKET //no udp support. + #undef SUPPORT_ICE #undef CL_MASTER //no sockets support #undef SV_MASTER //noone uses this anyway @@ -472,6 +495,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef USE_MYSQL #endif +#if defined(HAVE_WINSSPI) || defined(HAVE_GNUTLS) + #define HAVE_SSL +#endif + #if defined(USE_SQLITE) || defined(USE_MYSQL) #define SQL #endif @@ -529,6 +556,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef SUPPORT_ICE //depends upon zlib's crc32 for fingerprinting. I cba writing my own. #endif +#ifndef HAVE_TCP + #undef TCPCONNECT + #undef IRCCONNECT + #undef WEBSERVER + #undef WEBCLIENT +#endif +#ifndef HAVE_PACKET + #undef SV_MASTER + #undef CL_MASTER + #undef SUPPORT_ICE +#endif + #ifdef SERVERONLY //remove options that don't make sense on only a server #undef Q2CLIENT #undef Q3CLIENT diff --git a/engine/common/netinc.h b/engine/common/netinc.h index c2f65f26..9c5afdfc 100644 --- a/engine/common/netinc.h +++ b/engine/common/netinc.h @@ -1,9 +1,6 @@ +#ifndef NETINC_INCLUDED +#define NETINC_INCLUDED -#if !defined(NACL) && !defined(FTE_TARGET_WEB) && !defined(WINRT) -#define HAVE_IPV4 //says we can send and receive AF_INET ipv4 udp packets. -#define HAVE_TCP //says we can use tcp too (either ipv4 or ipv6) -#define HAVE_PACKET //if we have the socket api at all... -#endif #ifndef HAVE_PACKET @@ -36,26 +33,23 @@ #define ntohl BigLong #elif defined(_WIN32) - #ifdef _MSC_VER - #define USEIPX + #ifdef _XBOX + #include + #include + #else + #ifdef _MSC_VER + #define USEIPX + #endif + #define WIN32_LEAN_AND_MEAN + #include + #include + #ifdef USEIPX + #include "wsipx.h" + #endif + #include #endif - #define WIN32_LEAN_AND_MEAN -#ifdef _XBOX - #include - #include -#else - #include - #include -#endif -// #include "winquake.h" -#ifndef _XBOX - #ifdef USEIPX - #include "wsipx.h" - #endif - #include -#endif #include - #ifndef IPPROTO_IPV6 + #if !defined(IPPROTO_IPV6) && !defined(_XBOX) /*for msvc6*/ #define IPPROTO_IPV6 41 @@ -77,39 +71,44 @@ }; #if !defined(in_addr6) - struct in6_addr - { - u_char s6_addr[16]; /* IPv6 address */ - }; - #define sockaddr_in6 sockaddr_in6_fixed /*earlier versions of msvc have a sockaddr_in6 which does _not_ match windows, so this *must* be redefined for any non-final msvc releases or it won't work at all*/ - typedef struct sockaddr_in6 - { - short sin6_family; - u_short sin6_port; - u_long sin6_flowinfo; - struct in6_addr sin6_addr; - union + struct in6_addr { - u_long sin6_scope_id; - struct ip6_scope_id sin6_scope_struct; + u_char s6_addr[16]; /* IPv6 address */ + }; + #define sockaddr_in6 sockaddr_in6_fixed /*earlier versions of msvc have a sockaddr_in6 which does _not_ match windows, so this *must* be redefined for any non-final msvc releases or it won't work at all*/ + typedef struct sockaddr_in6 + { + short sin6_family; + u_short sin6_port; + u_long sin6_flowinfo; + struct in6_addr sin6_addr; + union + { + u_long sin6_scope_id; + struct ip6_scope_id sin6_scope_struct; + }; + }; + struct addrinfo + { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + size_t ai_addrlen; + char* ai_canonname; + struct sockaddr * ai_addr; + struct addrinfo * ai_next; }; - }; - struct addrinfo - { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - size_t ai_addrlen; - char* ai_canonname; - struct sockaddr * ai_addr; - struct addrinfo * ai_next; - }; #endif #endif #ifndef IPV6_V6ONLY #define IPV6_V6ONLY 27 #endif + + #define HAVE_IPV4 + #ifdef IPPROTO_IPV6 + #define HAVE_IPV6 + #endif #else #include #include @@ -141,7 +140,14 @@ #endif #if defined(AF_INET6) && !defined(IPPROTO_IPV6) - #define IPPROTO_IPV6 IPPROTO_IPV6 + #define IPPROTO_IPV6 IPPROTO_IPV6 //fte often just checks to see if IPPROTO_IPV6 is defined or not, which doesn't work if its an enum value or somesuch... + #endif + + #if defined(AF_INET) + #define HAVE_IPV4 + #endif + #ifdef IPPROTO_IPV6 + #define HAVE_IPV6 #endif #define SOCKET int @@ -314,3 +320,5 @@ vfsfile_t *FS_OpenTCP(const char *name, int defaultport); #ifndef SOCK_CLOEXEC #define SOCK_CLOEXEC 0 #endif + +#endif //NETINC_INCLUDED diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 2a8417de..084e96f1 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -940,12 +940,6 @@ static int Plug_NewStreamHandle(plugstream_e type) return i; } -#if defined(_XBOX) - #undef TCPCONNECT - #undef IPPROTO_IPV6 - #undef USEIPX -#endif - #ifdef HAVE_PACKET //EBUILTIN(int, NET_TCPListen, (char *ip, int port, int maxcount)); //returns a new socket with listen enabled. diff --git a/engine/common/pr_bgcmd.c b/engine/common/pr_bgcmd.c index bb37600c..a52d1707 100644 --- a/engine/common/pr_bgcmd.c +++ b/engine/common/pr_bgcmd.c @@ -111,13 +111,11 @@ extern int isPlugin; //if 2, we were invoked by a debugger, and we need to give static int debuggerstacky; #endif -#if defined(_WIN32) && !defined(FTE_SDL) -#ifndef _XBOX +#if defined(_WIN32) && !defined(FTE_SDL) && !defined(_XBOX) #include + void INS_UpdateGrabs(int fullscreen, int activeapp); #endif -void INS_UpdateGrabs(int fullscreen, int activeapp); -#endif int QCLibEditor(pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *error, pbool fatal); void QCLoadBreakpoints(const char *vmname, const char *progsname) { //this asks the gui to reapply any active breakpoints and waits for them so that any spawn functions can be breakpointed properly. @@ -307,7 +305,8 @@ qboolean QCExternalDebuggerCommand(char *text) int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *reason, pbool fatal) { -#if defined(_WIN32) && !defined(SERVERONLY) && !defined(FTE_SDL) && !defined(_XBOX) +#ifndef SERVERONLY +#if defined(_WIN32) && !defined(FTE_SDL) && !defined(_XBOX) if (isPlugin >= 2) { if (wantquit) @@ -368,6 +367,7 @@ int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int return debuggerresume; } #endif +#endif #ifdef TEXTEDITOR return QCLibEditor(prinst, filename, line, statement, reason, fatal); diff --git a/engine/common/sys.h b/engine/common/sys.h index 59b0549a..c1ee91e9 100644 --- a/engine/common/sys.h +++ b/engine/common/sys.h @@ -172,7 +172,7 @@ void NPQTV_Sys_MainLoop(void); #define UPD_STABLE 1 #define UPD_TESTING 2 -#if defined(WEBCLIENT) && defined(_WIN32) && !defined(SERVERONLY) +#if defined(WEBCLIENT) && defined(_WIN32) && !defined(SERVERONLY) && !defined(_XBOX) int StartLocalServer(int close); #define HAVEAUTOUPDATE diff --git a/engine/gl/glquake.h b/engine/gl/glquake.h index 7cab0fe0..0c132c4b 100644 --- a/engine/gl/glquake.h +++ b/engine/gl/glquake.h @@ -28,27 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning(disable : 4051) // ALPHA #endif -#ifdef _WIN32 -#ifndef WIN32_BLOATED -#define WIN32_LEAN_AND_MEAN -#endif - -#ifndef _XBOX - #include -#endif - -#if defined(WINAPI_FAMILY) && !defined(WINRT) - #if WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP - //don't just define it. things that don't #include winquake.h / glquake.h need it too. - #error "WINRT needs to be defined for non-desktop" - #endif -#endif -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif - void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs); qboolean BoundsIntersect (vec3_t mins1, vec3_t maxs1, vec3_t mins2, vec3_t maxs2); void ClearBounds (vec3_t mins, vec3_t maxs); @@ -102,14 +81,25 @@ void Mod_LightmapAllocBlock(lmalloc_t *lmallocator, int w, int h, unsigned short #define GLclampd GLclampf #define GLdouble GLfloat #else + #ifdef _WIN32 //windows might use the standard header filename, but it still requires that we manually include windows.h first. + #ifndef WIN32_BLOATED + #define WIN32_LEAN_AND_MEAN + #endif + #include + #endif + #include #ifdef GL_STATIC #define GL_GLEXT_PROTOTYPES #include #endif #endif -//#include -#include "glsupp.h" +// #include + + #ifndef APIENTRY + #define APIENTRY //our code decorates function pointers with this for windows, so make sure it exists on systems that don't need it. + #endif + #include "glsupp.h" diff --git a/engine/http/iweb.h b/engine/http/iweb.h index 86563aaa..d32c4c7e 100644 --- a/engine/http/iweb.h +++ b/engine/http/iweb.h @@ -6,9 +6,6 @@ #ifdef WEBSVONLY #include "quakedef.h" -#ifdef _WIN32 -#include "winquake.h" -#endif #define Con_TPrintf IWebPrintf #define IWebPrintf printf @@ -33,10 +30,6 @@ qboolean SV_AllowDownload (const char *name); typedef qboolean iwboolean; -#ifndef _WIN32 -#define INVALID_SOCKET ~0 -#endif - //it's not allowed to error. #ifndef WEBSVONLY void VARGS IWebDPrintf(char *fmt, ...) LIKEPRINTF(1); diff --git a/engine/http/iwebiface.c b/engine/http/iwebiface.c index 30405f8c..bd288739 100644 --- a/engine/http/iwebiface.c +++ b/engine/http/iwebiface.c @@ -3,6 +3,7 @@ #ifdef WEBSERVER #include "iweb.h" +#include "netinc.h" #ifdef WEBSVONLY //we need some functions from quake diff --git a/engine/server/pr_q1qvm.c b/engine/server/pr_q1qvm.c index e07b7a3f..d3551bac 100755 --- a/engine/server/pr_q1qvm.c +++ b/engine/server/pr_q1qvm.c @@ -1709,7 +1709,9 @@ struct {"SetExtField", QVM_SetExtField}, {"GetExtField", QVM_GetExtField}, {"ChangeLevel2", QVM_ChangeLevel2}, //with start spot - {"URI_Query", QVM_uri_query}, //with start spot +#ifdef WEBCLIENT + {"URI_Query", QVM_uri_query}, +#endif {"particleeffectnum", QVM_particleeffectnum}, {"trailparticles", QVM_trailparticles}, {"pointparticles", QVM_pointparticles}, diff --git a/plugins/jabber/jabberclient.c b/plugins/jabber/jabberclient.c index 05e3b657..2509ae5e 100644 --- a/plugins/jabber/jabberclient.c +++ b/plugins/jabber/jabberclient.c @@ -236,8 +236,8 @@ char *JCL_Info_ValueForKey (char *s, const char *key, char *valuebuf, int valuel } } -#ifdef _WIN32 -#include "windns.h" +#if defined(_WIN32) && defined(HAVE_PACKET) +#include static DNS_STATUS (WINAPI *pDnsQuery_UTF8) (PCSTR pszName, WORD wType, DWORD Options, PIP4_ARRAY aipServers, PDNS_RECORD *ppQueryResults, PVOID *pReserved); static VOID (WINAPI *pDnsRecordListFree)(PDNS_RECORD pRecordList, DNS_FREE_TYPE FreeType); static HMODULE dnsapi_lib; @@ -263,7 +263,7 @@ qboolean NET_DNSLookup_SRV(char *host, char *out, int outlen) } return false; } -#else +#elif defined(__unix__) || defined(ANDROID) || defined(__MACH__) || defined(__linux__) #include #include qboolean NET_DNSLookup_SRV(char *host, char *out, int outlen) @@ -352,6 +352,11 @@ qboolean NET_DNSLookup_SRV(char *host, char *out, int outlen) return false; return true; } +#else +qboolean NET_DNSLookup_SRV(char *host, char *out, int outlen) +{ + return false; +} #endif