Browse Source

partially fix amd64 build on windows

Quality of this commit is questionable. I have no idea whether what I did
here makes sense or not.
But it compiles and runs (provided with hlsdk-xash3d amd64 build, which
is another story).

This omits necessary waf changes that are necessary to make a valid
64-bit build. Apparently it's not enough to just pass `-8` on Windows,
you also need to hack wscript to add `x64` target to MSVC. I'll do that
later when I figure out how.

This change is a precursor for RTX Vulkan effort --
VK_KHR_ray_tracing_pipeline and friends are only available on 64-bit
nvidia drivers (no idea about AMD, pls send GPUs onegai).
pull/2/head
Ivan Avdeev 4 years ago committed by Alibek Omarov
parent
commit
1b426b67e7
  1. 2
      engine/client/cl_game.c
  2. 2
      engine/common/filesystem.c
  3. 4
      engine/platform/win32/con_win.c
  4. 9
      engine/platform/win32/lib_win.c
  5. 6
      engine/server/sv_game.c

2
engine/client/cl_game.c

@ -3945,7 +3945,7 @@ qboolean CL_LoadProgs( const char *name )
// a1ba: we need to check if client.dll has direct dependency on SDL2 // a1ba: we need to check if client.dll has direct dependency on SDL2
// and if so, disable relative mouse mode // and if so, disable relative mouse mode
#if XASH_WIN32 #if XASH_WIN32 && !defined(XASH_64BIT)
if( ( clgame.client_dll_uses_sdl = COM_CheckLibraryDirectDependency( name, OS_LIB_PREFIX "SDL2." OS_LIB_EXT, false ) ) ) if( ( clgame.client_dll_uses_sdl = COM_CheckLibraryDirectDependency( name, OS_LIB_PREFIX "SDL2." OS_LIB_EXT, false ) ) )
{ {
Con_Printf( S_NOTE "%s uses SDL2 for mouse input\n", name ); Con_Printf( S_NOTE "%s uses SDL2 for mouse input\n", name );

2
engine/common/filesystem.c

@ -324,7 +324,7 @@ static void listdirectory( stringlist_t *list, const char *path, qboolean lowerc
#if XASH_WIN32 #if XASH_WIN32
char pattern[4096]; char pattern[4096];
struct _finddata_t n_file; struct _finddata_t n_file;
int hFile; intptr_t hFile;
#else #else
DIR *dir; DIR *dir;
struct dirent *entry; struct dirent *entry;

4
engine/platform/win32/con_win.c

@ -354,7 +354,11 @@ void Wcon_CreateConsole( void )
if( host.type == HOST_DEDICATED ) if( host.type == HOST_DEDICATED )
{ {
#ifdef XASH_64BIT
s_wcd.SysInputLineWndProc = (WNDPROC)SetWindowLongPtr( s_wcd.hwndInputLine, GWLP_WNDPROC, (LONG_PTR)Wcon_InputLineProc );
#else
s_wcd.SysInputLineWndProc = (WNDPROC)SetWindowLong( s_wcd.hwndInputLine, GWL_WNDPROC, (long)Wcon_InputLineProc ); s_wcd.SysInputLineWndProc = (WNDPROC)SetWindowLong( s_wcd.hwndInputLine, GWL_WNDPROC, (long)Wcon_InputLineProc );
#endif
SendMessage( s_wcd.hwndInputLine, WM_SETFONT, ( WPARAM )s_wcd.hfBufferFont, 0 ); SendMessage( s_wcd.hwndInputLine, WM_SETFONT, ( WPARAM )s_wcd.hfBufferFont, 0 );
} }

9
engine/platform/win32/lib_win.c

@ -20,9 +20,14 @@ GNU General Public License for more details.
#ifdef XASH_64BIT #ifdef XASH_64BIT
#include <dbghelp.h> #include <dbghelp.h>
void *COM_LoadLibrary( const char *dllname, int build_ordinals_table ) void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean directpath )
{ {
return LoadLibraryA( dllname ); dll_user_t *hInst;
hInst = FS_FindLibrary( dllname, directpath );
if( !hInst ) return NULL; // nothing to load
return LoadLibraryA( hInst->fullPath );
} }
void COM_FreeLibrary( void *hInstance ) void COM_FreeLibrary( void *hInstance )

6
engine/server/sv_game.c

@ -3138,9 +3138,9 @@ void SV_AllocStringPool( void )
#endif #endif
str64.pstringarray = ptr; str64.pstringarray = ptr;
str64.pstringarraystatic = ptr + str64.maxstringarray; str64.pstringarraystatic = (byte*)ptr + str64.maxstringarray;
str64.pstringbase = str64.poldstringbase = ptr; str64.pstringbase = str64.poldstringbase = ptr;
str64.plast = ptr + 1; str64.plast = (byte*)ptr + 1;
svgame.globals->pStringBase = ptr; svgame.globals->pStringBase = ptr;
#else #else
svgame.stringspool = Mem_AllocPool( "Server Strings" ); svgame.stringspool = Mem_AllocPool( "Server Strings" );
@ -3153,9 +3153,11 @@ void SV_FreeStringPool( void )
#ifdef XASH_64BIT #ifdef XASH_64BIT
Con_Reportf( "SV_FreeStringPool()\n" ); Con_Reportf( "SV_FreeStringPool()\n" );
#if USE_MMAP
if( str64.pstringarray != str64.staticstringarray ) if( str64.pstringarray != str64.staticstringarray )
munmap( str64.pstringarray, (str64.maxstringarray * 2) & ~(sysconf( _SC_PAGESIZE ) - 1) ); munmap( str64.pstringarray, (str64.maxstringarray * 2) & ~(sysconf( _SC_PAGESIZE ) - 1) );
else else
#endif
Mem_Free( str64.staticstringarray ); Mem_Free( str64.staticstringarray );
#else #else
Mem_FreePool( &svgame.stringspool ); Mem_FreePool( &svgame.stringspool );

Loading…
Cancel
Save