From 4661b5c1a5245b27a5532745c11e44b5540e4172 Mon Sep 17 00:00:00 2001 From: mittorn Date: Fri, 14 Jul 2017 13:11:58 +0000 Subject: [PATCH 1/5] Increase graph version --- dlls/nodes.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/nodes.h b/dlls/nodes.h index 27b890ed..cbf1e2a6 100644 --- a/dlls/nodes.h +++ b/dlls/nodes.h @@ -103,7 +103,11 @@ typedef struct //========================================================= // CGraph //========================================================= +#ifdef __amd64 +#define GRAPH_VERSION (int)16 * 10 +#else #define GRAPH_VERSION (int)16// !!!increment this whever graph/node/link classes change, to obsolesce older disk files. +#endif class CGraph { From a08bd614fe524d8c827ac34810a130b6f2dc90ba Mon Sep 17 00:00:00 2001 From: mittorn Date: Fri, 14 Jul 2017 13:15:17 +0000 Subject: [PATCH 2/5] Fix client build --- cl_dll/com_weapons.cpp | 2 +- cl_dll/com_weapons.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cl_dll/com_weapons.cpp b/cl_dll/com_weapons.cpp index 4f539df9..d359a3f1 100644 --- a/cl_dll/com_weapons.cpp +++ b/cl_dll/com_weapons.cpp @@ -283,7 +283,7 @@ unsigned short stub_PrecacheEvent( int type, const char *s ) return 0; } -const char *stub_NameForFunction( unsigned long function ) +const char *stub_NameForFunction( void *function ) { return "func"; } diff --git a/cl_dll/com_weapons.h b/cl_dll/com_weapons.h index 7e1fdd77..4ce861f4 100644 --- a/cl_dll/com_weapons.h +++ b/cl_dll/com_weapons.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -34,7 +34,7 @@ void HUD_SetMaxSpeed( const struct edict_s *ed, float speed ); int stub_PrecacheModel( char* s ); int stub_PrecacheSound( char* s ); unsigned short stub_PrecacheEvent( int type, const char *s ); -const char *stub_NameForFunction( unsigned long function ); +const char *stub_NameForFunction( void *function ); void stub_SetModel( struct edict_s *e, const char *m ); extern cvar_t *cl_lw; From 00833188dab87ef5746286479ba5aeb9d83b4a0c Mon Sep 17 00:00:00 2001 From: mittorn Date: Fri, 14 Jul 2017 13:42:47 +0000 Subject: [PATCH 3/5] Use real MAKE_STRING when possible --- dlls/util.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/util.h b/dlls/util.h index e8aee878..5b00fe94 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -39,7 +39,14 @@ extern globalvars_t *gpGlobals; #if !defined __amd64__ || defined(CLIENT_DLL) #define MAKE_STRING(str) ((int)(size_t)str - (int)(size_t)STRING(0)) #else -#define MAKE_STRING ALLOC_STRING +static inline int MAKE_STRING(const char *szValue) +{ + long long ptrdiff = szValue - STRING(0); + if( ptrdiff > INT_MAX || ptrdiff < INT_MIN ) + return ALLOC_STRING(szValue); + else + return (int)ptrdiff; +} #endif inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName) From 1674a4b6d496b03da7efd689b739d721b83a9c8a Mon Sep 17 00:00:00 2001 From: mittorn Date: Fri, 14 Jul 2017 15:34:44 +0000 Subject: [PATCH 4/5] Use XASH_64BIT macro --- cl_dll/cl_dll.h | 4 ++++ dlls/extdll.h | 4 ++++ dlls/nodes.h | 2 +- dlls/util.h | 2 +- engine/studio.h | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cl_dll/cl_dll.h b/cl_dll/cl_dll.h index fda4b812..24d1874b 100644 --- a/cl_dll/cl_dll.h +++ b/cl_dll/cl_dll.h @@ -41,6 +41,10 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf ); #include "exportdef.h" #include +#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) + #define XASH_64BIT +#endif + extern cl_enginefunc_t gEngfuncs; #include "../engine/mobility_int.h" extern mobile_engfuncs_t *gMobileEngfuncs; diff --git a/dlls/extdll.h b/dlls/extdll.h index cbc7ebb9..dda1cec5 100644 --- a/dlls/extdll.h +++ b/dlls/extdll.h @@ -57,6 +57,10 @@ typedef int BOOL; #include "stdlib.h" #include "math.h" +#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) + #define XASH_64BIT +#endif + // Header file containing definition of globalvars_t and entvars_t typedef unsigned int func_t; typedef unsigned int string_t; // from engine's pr_comp.h; diff --git a/dlls/nodes.h b/dlls/nodes.h index cbf1e2a6..c959dd2e 100644 --- a/dlls/nodes.h +++ b/dlls/nodes.h @@ -103,7 +103,7 @@ typedef struct //========================================================= // CGraph //========================================================= -#ifdef __amd64 +#ifdef XASH_64BIT #define GRAPH_VERSION (int)16 * 10 #else #define GRAPH_VERSION (int)16// !!!increment this whever graph/node/link classes change, to obsolesce older disk files. diff --git a/dlls/util.h b/dlls/util.h index 5b00fe94..a61240fd 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -36,7 +36,7 @@ extern globalvars_t *gpGlobals; // Use this instead of ALLOC_STRING on constant strings #define STRING(offset) (const char *)(gpGlobals->pStringBase + (int)offset) -#if !defined __amd64__ || defined(CLIENT_DLL) +#if !defined XASH_64BIT || defined(CLIENT_DLL) #define MAKE_STRING(str) ((int)(size_t)str - (int)(size_t)STRING(0)) #else static inline int MAKE_STRING(const char *szValue) diff --git a/engine/studio.h b/engine/studio.h index b5b709bb..5e5ec26c 100644 --- a/engine/studio.h +++ b/engine/studio.h @@ -215,7 +215,7 @@ typedef struct char label[32]; // textual name char name[64]; // file name cache_user_t cache; // cache index pointer -#ifndef __amd64 +#ifndef XASH_64BIT int data; // hack for group 0 #endif } mstudioseqgroup_t; From 8bae5a5450e7f0c1040fb7c2329a92723a9fc584 Mon Sep 17 00:00:00 2001 From: mittorn Date: Tue, 18 Jul 2017 12:59:46 +0000 Subject: [PATCH 5/5] Fix infinite loop on mingw --- cl_dll/Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cl_dll/Android.mk b/cl_dll/Android.mk index 94489844..ecbae657 100755 --- a/cl_dll/Android.mk +++ b/cl_dll/Android.mk @@ -91,7 +91,7 @@ SRCS+=./input_xash3d.cpp SRCS+=./scoreboard.cpp SRCS+=./MOTD.cpp INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w +DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \ $(LOCAL_PATH)/../common \