Browse Source

engine: remove LoadLibrary macros, to avoid possible misuse. Although macros moved to game_launch, it's part of it's own problem from now

pull/2/head
Alibek Omarov 3 years ago
parent
commit
7c9f5f8ab1
  1. 6
      common/port.h
  2. 9
      engine/common/system.c
  3. 5
      game_launch/game.cpp

6
common/port.h

@ -47,14 +47,8 @@ GNU General Public License for more details. @@ -47,14 +47,8 @@ GNU General Public License for more details.
#define O_BINARY 0
#define O_TEXT 0
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
#define LoadLibrary( x ) dlopen( x, RTLD_NOW )
#define GetProcAddress( x, y ) dlsym( x, y )
#define FreeLibrary( x ) dlclose( x )
#elif XASH_DOS4GW
#define PATH_SPLITTER "\\"
#define LoadLibrary( x ) (0)
#define GetProcAddress( x, y ) (0)
#define FreeLibrary( x ) (0)
#endif
typedef void* HANDLE;

9
engine/common/system.c

@ -34,6 +34,8 @@ GNU General Public License for more details. @@ -34,6 +34,8 @@ GNU General Public License for more details.
#include "menu_int.h" // _UPDATE_PAGE macro
#include "library.h"
qboolean error_on_exit = false; // arg for exit();
#define DEBUG_BREAK
@ -272,7 +274,8 @@ qboolean Sys_LoadLibrary( dll_info_t *dll ) @@ -272,7 +274,8 @@ qboolean Sys_LoadLibrary( dll_info_t *dll )
*func->func = NULL;
}
if( !dll->link ) dll->link = LoadLibrary ( dll->name ); // environment pathes
if( !dll->link )
dll->link = COM_LoadLibrary( dll->name, false, true ); // environment pathes
// no DLL found
if( !dll->link )
@ -307,7 +310,7 @@ void* Sys_GetProcAddress( dll_info_t *dll, const char* name ) @@ -307,7 +310,7 @@ void* Sys_GetProcAddress( dll_info_t *dll, const char* name )
if( !dll || !dll->link ) // invalid desc
return NULL;
return (void *)GetProcAddress( dll->link, name );
return (void *)COM_GetProcAddress( dll->link, name );
}
qboolean Sys_FreeLibrary( dll_info_t *dll )
@ -324,7 +327,7 @@ qboolean Sys_FreeLibrary( dll_info_t *dll ) @@ -324,7 +327,7 @@ qboolean Sys_FreeLibrary( dll_info_t *dll )
}
else Con_Reportf( "Sys_FreeLibrary: Unloading %s\n", dll->name );
FreeLibrary( dll->link );
COM_FreeLibrary( dll->link );
dll->link = NULL;
return true;

5
game_launch/game.cpp

@ -23,6 +23,9 @@ GNU General Public License for more details. @@ -23,6 +23,9 @@ GNU General Public License for more details.
#if XASH_POSIX
#define XASHLIB "libxash." OS_LIB_EXT
#define LoadLibrary( x ) dlopen( x, RTLD_NOW )
#define GetProcAddress( x, y ) dlsym( x, y )
#define FreeLibrary( x ) dlclose( x )
#include <unistd.h> // execve
#elif XASH_WIN32
#define XASHLIB "xash.dll"
@ -46,7 +49,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; @@ -46,7 +49,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#endif
#if XASH_WIN32 || XASH_POSIX
#define USE_EXECVE_FOR_CHANGE_GAME 1
#define USE_EXECVE_FOR_CHANGE_GAME 0
#else
#define USE_EXECVE_FOR_CHANGE_GAME 0
#endif

Loading…
Cancel
Save