mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 01:45:19 +01:00
lib: restore dll loader support
This commit is contained in:
parent
22dc5b7416
commit
bbd033c254
@ -318,7 +318,7 @@ void VGui_Startup( const char *clientlib, int width, int height )
|
||||
width = 1280;
|
||||
else if( width <= 1600 )
|
||||
width = 1600;
|
||||
#ifdef DLL_LOADER
|
||||
#ifdef XASH_DLL_LOADER
|
||||
else if ( Q_strstr( vguiloader, ".dll" ) )
|
||||
width = 1600;
|
||||
#endif
|
||||
|
@ -1062,7 +1062,7 @@ COM_CompareFileTime
|
||||
|
||||
=============
|
||||
*/
|
||||
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare )
|
||||
int GAME_EXPORT COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare )
|
||||
{
|
||||
int bRet = 0;
|
||||
|
||||
|
@ -769,11 +769,6 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
|
||||
host.enabledll = !Sys_CheckParm( "-nodll" );
|
||||
|
||||
#ifdef DLL_LOADER
|
||||
if( host.enabledll )
|
||||
Setup_LDT_Keeper( ); // Must call before creating any thread
|
||||
#endif
|
||||
|
||||
host.change_game = bChangeGame;
|
||||
host.config_executed = false;
|
||||
host.status = HOST_INIT; // initialzation started
|
||||
|
@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "platform/platform.h"
|
||||
#if XASH_LIB == LIB_POSIX
|
||||
|
||||
@ -25,6 +25,16 @@ GNU General Public License for more details.
|
||||
#include "platform/emscripten/lib_em.h"
|
||||
#include "platform/apple/lib_ios.h"
|
||||
|
||||
#ifdef XASH_DLL_LOADER // wine-based dll loader
|
||||
void * Loader_LoadLibrary (const char *name);
|
||||
void * Loader_GetProcAddress (void *hndl, const char *name);
|
||||
void Loader_FreeLibrary(void *hndl);
|
||||
void *Loader_GetDllHandle( void *hndl );
|
||||
const char * Loader_GetFuncName( void *hndl, void *func);
|
||||
const char * Loader_GetFuncName_int( void *wm , void *func);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XASH_NO_LIBDL
|
||||
#ifndef XASH_DLL_LOADER
|
||||
#error Enable at least one dll backend!!!
|
||||
@ -83,7 +93,7 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d
|
||||
if( !hInst )
|
||||
{
|
||||
// HACKHACK: direct load dll
|
||||
#ifdef DLL_LOADER
|
||||
#ifdef XASH_DLL_LOADER
|
||||
if( host.enabledll && ( pHandle = Loader_LoadLibrary(dllname)) )
|
||||
{
|
||||
return pHandle;
|
||||
@ -110,8 +120,8 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef DLL_LOADER
|
||||
if( host.enabledll && ( !Q_stricmp( FS_FileExtension( hInst->shortPath ), "dll" ) ) )
|
||||
#ifdef XASH_DLL_LOADER
|
||||
if( host.enabledll && ( !Q_stricmp( COM_FileExtension( hInst->shortPath ), "dll" ) ) )
|
||||
{
|
||||
if( hInst->encrypted )
|
||||
{
|
||||
@ -147,7 +157,7 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d
|
||||
|
||||
void COM_FreeLibrary( void *hInstance )
|
||||
{
|
||||
#ifdef DLL_LOADER
|
||||
#ifdef XASH_DLL_LOADER
|
||||
void *wm;
|
||||
if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) )
|
||||
return Loader_FreeLibrary( hInstance );
|
||||
@ -164,7 +174,7 @@ void COM_FreeLibrary( void *hInstance )
|
||||
|
||||
void *COM_GetProcAddress( void *hInstance, const char *name )
|
||||
{
|
||||
#ifdef DLL_LOADER
|
||||
#ifdef XASH_DLL_LOADER
|
||||
void *wm;
|
||||
if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) )
|
||||
return Loader_GetProcAddress(hInstance, name);
|
||||
@ -206,7 +216,7 @@ int d_dladdr( void *sym, Dl_info *info )
|
||||
|
||||
const char *COM_NameForFunction( void *hInstance, void *function )
|
||||
{
|
||||
#ifdef DLL_LOADER
|
||||
#ifdef XASH_DLL_LOADER
|
||||
void *wm;
|
||||
if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) )
|
||||
return Loader_GetFuncName_int(wm, function);
|
||||
|
@ -1263,7 +1263,7 @@ pfnPrecacheModel
|
||||
|
||||
=========
|
||||
*/
|
||||
int pfnPrecacheModel( const char *s )
|
||||
int GAME_EXPORT pfnPrecacheModel( const char *s )
|
||||
{
|
||||
qboolean optional = false;
|
||||
int i;
|
||||
@ -1291,7 +1291,7 @@ pfnSetModel
|
||||
|
||||
=================
|
||||
*/
|
||||
void pfnSetModel( edict_t *e, const char *m )
|
||||
void GAME_EXPORT pfnSetModel( edict_t *e, const char *m )
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
qboolean found = false;
|
||||
@ -2418,7 +2418,7 @@ pfnServerExecute
|
||||
|
||||
=========
|
||||
*/
|
||||
void pfnServerExecute( void )
|
||||
void GAME_EXPORT pfnServerExecute( void )
|
||||
{
|
||||
Cbuf_Execute();
|
||||
|
||||
@ -2444,8 +2444,8 @@ pfnClientCommand
|
||||
|
||||
=========
|
||||
*/
|
||||
void pfnClientCommand( edict_t* pEdict, char* szFmt, ... ) _format( 2 );
|
||||
void pfnClientCommand( edict_t* pEdict, char* szFmt, ... )
|
||||
void GAME_EXPORT pfnClientCommand( edict_t* pEdict, char* szFmt, ... ) _format( 2 );
|
||||
void GAME_EXPORT pfnClientCommand( edict_t* pEdict, char* szFmt, ... )
|
||||
{
|
||||
sv_client_t *cl;
|
||||
string buffer;
|
||||
@ -2876,7 +2876,7 @@ pfnAlertMessage
|
||||
=============
|
||||
*/
|
||||
static void pfnAlertMessage( ALERT_TYPE type, char *szFmt, ... ) _format( 2 );
|
||||
static void pfnAlertMessage( ALERT_TYPE type, char *szFmt, ... )
|
||||
static void GAME_EXPORT pfnAlertMessage( ALERT_TYPE type, char *szFmt, ... )
|
||||
{
|
||||
char buffer[2048];
|
||||
va_list args;
|
||||
|
@ -69,6 +69,7 @@ def configure(conf):
|
||||
|
||||
conf.define_cond('XASH_STATIC_LIBS', conf.env.STATIC_LINKING)
|
||||
conf.define_cond('XASH_CUSTOM_SWAP', conf.options.CUSTOM_SWAP)
|
||||
conf.define_cond('XASH_DLL_LOADER', conf.options.DLLEMU)
|
||||
conf.define_cond('SINGLE_BINARY', conf.env.SINGLE_BINARY)
|
||||
conf.define_cond('XASH_NO_ASYNC_NS_RESOLVE', conf.options.NO_ASYNC_RESOLVE)
|
||||
conf.define_cond('XASH_USE_SELECT', conf.options.USE_SELECT or conf.options.DEDICATED)
|
||||
@ -79,7 +80,7 @@ def configure(conf):
|
||||
|
||||
def build(bld):
|
||||
is_cxx_link = False
|
||||
libs = [ 'public' ]
|
||||
libs = [ 'public', 'dllemu' ]
|
||||
source = bld.path.ant_glob([
|
||||
'common/*.c',
|
||||
'common/imagelib/*.c',
|
||||
|
Loading…
Reference in New Issue
Block a user