Browse Source

lib: restore dll loader support

pull/2/head
mittorn 5 years ago
parent
commit
bbd033c254
  1. 2
      engine/client/vgui/vgui_draw.c
  2. 2
      engine/common/common.c
  3. 5
      engine/common/host.c
  4. 24
      engine/platform/posix/lib_posix.c
  5. 12
      engine/server/sv_game.c
  6. 3
      engine/wscript
  7. 3
      wscript

2
engine/client/vgui/vgui_draw.c

@ -318,7 +318,7 @@ void VGui_Startup( const char *clientlib, int width, int height ) @@ -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

2
engine/common/common.c

@ -1062,7 +1062,7 @@ COM_CompareFileTime @@ -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;

5
engine/common/host.c

@ -769,11 +769,6 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha @@ -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

24
engine/platform/posix/lib_posix.c

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -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. @@ -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 @@ -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 @@ -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 @@ -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 ) @@ -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 ) @@ -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);

12
engine/server/sv_game.c

@ -1263,7 +1263,7 @@ pfnPrecacheModel @@ -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 @@ -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 @@ -2418,7 +2418,7 @@ pfnServerExecute
=========
*/
void pfnServerExecute( void )
void GAME_EXPORT pfnServerExecute( void )
{
Cbuf_Execute();
@ -2444,8 +2444,8 @@ pfnClientCommand @@ -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 @@ -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;

3
engine/wscript

@ -69,6 +69,7 @@ def configure(conf): @@ -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): @@ -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',

3
wscript

@ -54,7 +54,8 @@ SUBDIRS = [ @@ -54,7 +54,8 @@ SUBDIRS = [
Subproject('vgui_support'),
Subproject('stub/server', dedicated=False),
Subproject('stub/client'),
Subproject('engine', dedicated=False, mandatory = False),
Subproject('dllemu'),
Subproject('engine', dedicated=False),
]
def subdirs():

Loading…
Cancel
Save