Example #1
0
void *Com_GetProcAddress( void *hInstance, const char *name )
{
#ifdef DLL_LOADER
	void *wm;
	if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) )
		return Loader_GetProcAddress(hInstance, name);
	else
#endif
#ifdef _WIN32
	return GetProcAddress( hInstance, name );
#else
	return dlsym( hInstance, name );
#endif
}
Example #2
0
void Com_FreeLibrary( void *hInstance )
{
#ifdef DLL_LOADER
	void *wm;
	if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) )
		return Loader_FreeLibrary(hInstance);
	else
#endif
#ifdef _WIN32
	FreeLibrary( hInstance);
#else
	dlclose( hInstance );
#endif
}
Example #3
0
const char *Com_NameForFunction( void *hInstance, void *function )
{
#ifdef DLL_LOADER
	void *wm;
	if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) )
		return Loader_GetFuncName_int(wm, function);
	else
#endif
	// Note: dladdr() is a glibc extension
	{
#ifndef _WIN32
		Dl_info info;
		dladdr((void*)function, &info);
		return info.dli_sname;
#endif
	}
}
Example #4
0
void *Com_FunctionFromName( void *hInstance, const char *pName )
{
	void *function;
#ifdef DLL_LOADER
	void *wm;
	if( host.enabledll && (wm = Loader_GetDllHandle( hInstance )) )
		return Loader_GetProcAddress(hInstance, pName);
	else
#endif
	function = dlsym( hInstance, pName );	
	if(!function)
	{
#ifdef __ANDROID__
		// Shitty Android dlsym don't resolve weak symbols
		function = dlsym_weak( hInstance, pName );
		if(!function)
#endif
#ifndef _WIN32
			MsgDev(D_ERROR, "FunctionFromName: Can't get symbol %s: %s\n", pName, dlerror());
#endif
	}
	return function;
}
Example #5
0
/*
===============
CL_InitClientMove

===============
*/
void CL_InitClientMove( void )
{
    int	i;

    Pmove_Init ();

    clgame.pmove->server = false;	// running at client
    clgame.pmove->movevars = &clgame.movevars;
    clgame.pmove->runfuncs = false;

    Mod_SetupHulls( clgame.player_mins, clgame.player_maxs );

    // enumerate client hulls
    for( i = 0; i < MAX_MAP_HULLS; i++ )
    {
        if( clgame.dllFuncs.pfnGetHullBounds( i, clgame.player_mins[i], clgame.player_maxs[i] ))
            MsgDev( D_NOTE, "CL: hull%i, player_mins: %g %g %g, player_maxs: %g %g %g\n", i,
                    clgame.player_mins[i][0], clgame.player_mins[i][1], clgame.player_mins[i][2],
                    clgame.player_maxs[i][0], clgame.player_maxs[i][1], clgame.player_maxs[i][2] );
    }

    Q_memcpy( clgame.pmove->player_mins, clgame.player_mins, sizeof( clgame.player_mins ));
    Q_memcpy( clgame.pmove->player_maxs, clgame.player_maxs, sizeof( clgame.player_maxs ));

    // common utilities
    clgame.pmove->PM_Info_ValueForKey = (void*)Info_ValueForKey;
    clgame.pmove->PM_Particle = pfnParticle;
    clgame.pmove->PM_TestPlayerPosition = pfnTestPlayerPosition;
    clgame.pmove->Con_NPrintf = Con_NPrintf;
    clgame.pmove->Con_DPrintf = Con_DPrintf;
    clgame.pmove->Con_Printf = Con_Printf;
    clgame.pmove->Sys_FloatTime = Sys_DoubleTime;
    clgame.pmove->PM_StuckTouch = pfnStuckTouch;
    clgame.pmove->PM_PointContents = pfnPointContents;
    clgame.pmove->PM_TruePointContents = pfnTruePointContents;
    clgame.pmove->PM_HullPointContents = pfnHullPointContents;
    clgame.pmove->PM_PlayerTrace = pfnPlayerTrace;
    clgame.pmove->PM_TraceLine = pfnTraceLine;
    clgame.pmove->RandomLong = (void*)Com_RandomLong;
    clgame.pmove->RandomFloat = Com_RandomFloat;
    clgame.pmove->PM_GetModelType = pfnGetModelType;
    clgame.pmove->PM_GetModelBounds = pfnGetModelBounds;
    clgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp;
    clgame.pmove->PM_TraceModel = pfnTraceModel;
    clgame.pmove->COM_FileSize = (void*)COM_FileSize;
    clgame.pmove->COM_LoadFile = (void*)COM_LoadFile;
    clgame.pmove->COM_FreeFile = COM_FreeFile;
    clgame.pmove->memfgets = COM_MemFgets;
    clgame.pmove->PM_PlaySound = pfnPlaySound;
    clgame.pmove->PM_TraceTexture = pfnTraceTexture;
    clgame.pmove->PM_PlaybackEventFull = pfnPlaybackEventFull;
    clgame.pmove->PM_PlayerTraceEx = pfnPlayerTraceEx;
    clgame.pmove->PM_TestPlayerPositionEx = pfnTestPlayerPositionEx;
    clgame.pmove->PM_TraceLineEx = pfnTraceLineEx;
    clgame.pmove->PM_TraceSurface = pfnTraceSurface;
#ifdef DLL_LOADER // w32-compatible ABI
    if( host.enabledll && Loader_GetDllHandle( clgame.hInstance ) )
    {
        clgame.pmove->PM_PlayerTrace = (void*)pfnPlayerTrace_w32;
        clgame.pmove->PM_PlayerTraceEx = (void*)pfnPlayerTraceEx_w32;
    }
#endif
#if defined(__MINGW32__)
    clgame.pmove->PM_PlayerTrace = (void*)pfnPlayerTrace_w32;
    clgame.pmove->PM_PlayerTraceEx = (void*)pfnPlayerTraceEx_w32;
#endif

    // initalize pmove
    clgame.dllFuncs.pfnPlayerMoveInit( clgame.pmove );
}