From cee1e74872bce9e21e531183fa7784c22bf9a548 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 29 Sep 2025 00:00:59 +0500 Subject: [PATCH] engine: drop dllemu glue, as it won't build with current engine anyway and not supported by it's author :( --- engine/common/common.h | 3 - engine/common/host.c | 4 -- engine/platform/misc/lib_static.c | 35 +----------- engine/platform/posix/lib_posix.c | 95 +++++-------------------------- engine/wscript | 5 +- wscript | 1 - 6 files changed, 17 insertions(+), 126 deletions(-) diff --git a/engine/common/common.h b/engine/common/common.h index 38657f73..6650f70f 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -337,9 +337,6 @@ typedef struct host_parm_s qboolean apply_game_config; // when true apply only to game cvars and ignore all other commands qboolean apply_opengl_config; // when true apply only to opengl cvars and ignore all other commands qboolean config_executed; // a bit who indicated was config.cfg already executed e.g. from valve.rc -#if XASH_DLL_LOADER - qboolean enabledll; -#endif qboolean textmode; // some settings were changed and needs to global update diff --git a/engine/common/host.c b/engine/common/host.c index b5ee1fe4..7e7715dc 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -1038,10 +1038,6 @@ static void Host_InitCommon( int argc, char **argv, const char *progname, qboole if( !Sys_CheckParm( "-noch" )) Sys_SetupCrashHandler( argv[0] ); -#if XASH_DLL_LOADER - host.enabledll = !Sys_CheckParm( "-nodll" ); -#endif - host.change_game = bChangeGame || Sys_CheckParm( "-changegame" ); host.config_executed = false; host.status = HOST_INIT; // initialzation started diff --git a/engine/platform/misc/lib_static.c b/engine/platform/misc/lib_static.c index 84f5677a..d0014a7a 100644 --- a/engine/platform/misc/lib_static.c +++ b/engine/platform/misc/lib_static.c @@ -15,39 +15,8 @@ GNU General Public License for more details. #include "platform/platform.h" #include "library.h" + #if XASH_LIB == LIB_STATIC -#ifdef XASH_NO_LIBDL - -void *dlsym(void *handle, const char *symbol ) -{ - Con_DPrintf( "%s( %p, \"%s\" ): stub\n", __func__, handle, symbol ); - return NULL; -} - -void *dlopen(const char *name, int flag ) -{ - Con_DPrintf( "%s( \"%s\", %d ): stub\n", __func__, name, flag ); - return NULL; -} - -int dlclose(void *handle) -{ - Con_DPrintf( "%s( %p ): stub\n", __func__, handle ); - return 0; -} - -char *dlerror( void ) -{ - return "Loading ELF libraries not supported in this build!\n"; -} - -int dladdr( const void *addr, void *info ) -{ - return 0; -} -#endif // XASH_NO_LIBDL - - typedef struct table_s { const char *name; @@ -98,4 +67,4 @@ const char *COM_NameForFunction( void *hInstance, void *function ) return NULL; #endif } -#endif +#endif // XASH_LIB == LIB_STATIC diff --git a/engine/platform/posix/lib_posix.c b/engine/platform/posix/lib_posix.c index 23d1c3b1..0e66ee4c 100644 --- a/engine/platform/posix/lib_posix.c +++ b/engine/platform/posix/lib_posix.c @@ -27,34 +27,20 @@ GNU General Public License for more details. #include "platform/android/lib_android.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!!! -#endif // XASH_DLL_LOADER - -void *dlsym(void *handle, const char *symbol ) +void *dlsym( void *handle, const char *symbol ) { Con_DPrintf( "%s( %p, \"%s\" ): stub\n", __func__, handle, symbol ); return NULL; } -void *dlopen(const char *name, int flag ) +void *dlopen( const char *name, int flag ) { Con_DPrintf( "%s( \"%s\", %d ): stub\n", __func__, name, flag ); return NULL; } -int dlclose(void *handle) +int dlclose( void *handle ) { Con_DPrintf( "%s( %p ): stub\n", __func__, handle ); return 0; @@ -95,14 +81,6 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d hInst = FS_FindLibrary( dllname, directpath ); if( !hInst ) { - // HACKHACK: direct load dll -#ifdef XASH_DLL_LOADER - if( host.enabledll && ( pHandle = Loader_LoadLibrary(dllname)) ) - { - return pHandle; - } -#endif - // try to find by linker(LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, LD_32_LIBRARY_PATH and so on...) if( !pHandle ) { @@ -125,34 +103,11 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d return NULL; } -#ifdef XASH_DLL_LOADER - if( host.enabledll && ( !Q_stricmp( COM_FileExtension( hInst->shortPath ), "dll" ) ) ) + if( !( hInst->hInstance = dlopen( hInst->fullPath, RTLD_NOW ) ) ) { - if( hInst->encrypted ) - { - Q_snprintf( buf, sizeof( buf ), "Library %s is encrypted. Cannot load", hInst->shortPath ); - COM_PushLibraryError( buf ); - Mem_Free( hInst ); - return NULL; - } - - if( !( hInst->hInstance = Loader_LoadLibrary( hInst->fullPath ) ) ) - { - Q_snprintf( buf, sizeof( buf ), "Failed to load DLL with DLL loader: %s", hInst->shortPath ); - COM_PushLibraryError( buf ); - Mem_Free( hInst ); - return NULL; - } - } - else -#endif - { - if( !( hInst->hInstance = dlopen( hInst->fullPath, RTLD_NOW ) ) ) - { - COM_PushLibraryError( dlerror() ); - Mem_Free( hInst ); - return NULL; - } + COM_PushLibraryError( dlerror() ); + Mem_Free( hInst ); + return NULL; } pHandle = hInst->hInstance; @@ -164,29 +119,15 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d void COM_FreeLibrary( void *hInstance ) { -#ifdef XASH_DLL_LOADER - void *wm; - if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) ) - return Loader_FreeLibrary( hInstance ); - else -#endif - { #ifdef Platform_POSIX_FreeLibrary - Platform_POSIX_FreeLibrary( hInstance ); + Platform_POSIX_FreeLibrary( hInstance ); #else - dlclose( hInstance ); + dlclose( hInstance ); #endif - } } void *COM_GetProcAddress( void *hInstance, const char *name ) { -#ifdef XASH_DLL_LOADER - void *wm; - if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) ) - return Loader_GetProcAddress(hInstance, name); - else -#endif #if Platform_POSIX_GetProcAddress return Platform_POSIX_GetProcAddress( hInstance, name ); #else @@ -201,20 +142,12 @@ void *COM_FunctionFromName( void *hInstance, const char *pName ) const char *COM_NameForFunction( void *hInstance, void *function ) { -#ifdef XASH_DLL_LOADER - void *wm; - if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) ) -#error ConvertMangledName - return Loader_GetFuncName_int(wm, function); - else -#endif // NOTE: dladdr() is a glibc extension - { - Dl_info info = {0}; - int ret = dladdr( (void*)function, &info ); - if( ret && info.dli_sname ) - return COM_GetPlatformNeutralName( info.dli_sname ); - } + Dl_info info = {0}; + int ret = dladdr( (void*)function, &info ); + if( ret && info.dli_sname ) + return COM_GetPlatformNeutralName( info.dli_sname ); + #ifdef XASH_ALLOW_SAVERESTORE_OFFSETS return COM_OffsetNameForFunction( function ); #else diff --git a/engine/wscript b/engine/wscript index cdf76280..f5a9626a 100644 --- a/engine/wscript +++ b/engine/wscript @@ -149,9 +149,6 @@ def configure(conf): if not conf.env.DEST_OS in ['win32', 'android'] and have_async_resolve: conf.check_pthreads(mode='c') - if hasattr(conf.options, 'DLLEMU'): - conf.define_cond('XASH_DLL_LOADER', conf.options.DLLEMU) - conf.check_cc(fragment=EXECINFO_TEST, msg='Checking for glibc backtrace()', mandatory=False, define_name='HAVE_EXECINFO') conf.define('ENGINE_DLL', 1) @@ -200,7 +197,7 @@ def build(bld): # public includes for renderers and utils use bld(name = 'engine_includes', export_includes = '. common common/imagelib', use = 'filesystem_includes') - libs = ['engine_includes', 'public', 'dllemu', 'werror', 'backtrace'] + libs = ['engine_includes', 'public', 'werror', 'backtrace'] includes = ['server', 'client', 'client/vgui', 'common/soundlib', 'platform'] # basic build: dedicated only diff --git a/wscript b/wscript index da609f47..610ac20b 100644 --- a/wscript +++ b/wscript @@ -83,7 +83,6 @@ SUBDIRS = [ Subproject('public'), Subproject('filesystem'), Subproject('stub/server'), - Subproject('dllemu'), Subproject('3rdparty/libbacktrace'), # disable only by engine feature, makes no sense to even parse subprojects in dedicated mode