2017-03-10 18:38:35 +03:00
|
|
|
#include <extdll.h>
|
|
|
|
#include <meta_api.h>
|
|
|
|
|
|
|
|
DLL_FUNCTIONS g_DllFunctionTable =
|
|
|
|
{
|
|
|
|
NULL, // pfnGameInit
|
|
|
|
NULL, // pfnSpawn
|
|
|
|
NULL, // pfnThink
|
|
|
|
NULL, // pfnUse
|
|
|
|
NULL, // pfnTouch
|
|
|
|
NULL, // pfnBlocked
|
|
|
|
NULL, // pfnKeyValue
|
|
|
|
NULL, // pfnSave
|
|
|
|
NULL, // pfnRestore
|
|
|
|
NULL, // pfnSetAbsBox
|
|
|
|
NULL, // pfnSaveWriteFields
|
|
|
|
NULL, // pfnSaveReadFields
|
|
|
|
NULL, // pfnSaveGlobalState
|
|
|
|
NULL, // pfnRestoreGlobalState
|
|
|
|
NULL, // pfnResetGlobalState
|
|
|
|
NULL, // pfnClientConnect
|
|
|
|
NULL, // pfnClientDisconnect
|
|
|
|
NULL, // pfnClientKill
|
|
|
|
NULL, // pfnClientPutInServer
|
|
|
|
NULL, // pfnClientCommand
|
|
|
|
NULL, // pfnClientUserInfoChanged
|
|
|
|
NULL, // pfnServerActivate
|
|
|
|
NULL, // pfnServerDeactivate
|
|
|
|
NULL, // pfnPlayerPreThink
|
|
|
|
NULL, // pfnPlayerPostThink
|
|
|
|
NULL, // pfnStartFrame
|
|
|
|
NULL, // pfnParmsNewLevel
|
|
|
|
NULL, // pfnParmsChangeLevel
|
|
|
|
NULL, // pfnGetGameDescription
|
|
|
|
NULL, // pfnPlayerCustomization
|
|
|
|
NULL, // pfnSpectatorConnect
|
|
|
|
NULL, // pfnSpectatorDisconnect
|
|
|
|
NULL, // pfnSpectatorThink
|
|
|
|
NULL, // pfnSys_Error
|
|
|
|
NULL, // pfnPM_Move
|
|
|
|
NULL, // pfnPM_Init
|
|
|
|
NULL, // pfnPM_FindTextureType
|
|
|
|
NULL, // pfnSetupVisibility
|
|
|
|
NULL, // pfnUpdateClientData
|
|
|
|
NULL, // pfnAddToFullPack
|
|
|
|
NULL, // pfnCreateBaseline
|
|
|
|
NULL, // pfnRegisterEncoders
|
|
|
|
NULL, // pfnGetWeaponData
|
|
|
|
NULL, // pfnCmdStart
|
|
|
|
NULL, // pfnCmdEnd
|
|
|
|
NULL, // pfnConnectionlessPacket
|
|
|
|
NULL, // pfnGetHullBounds
|
|
|
|
NULL, // pfnCreateInstancedBaselines
|
|
|
|
NULL, // pfnInconsistentFile
|
|
|
|
NULL, // pfnAllowLagCompensation
|
|
|
|
};
|
|
|
|
|
|
|
|
DLL_FUNCTIONS g_DllFunctionTable_Post =
|
|
|
|
{
|
|
|
|
NULL, // pfnGameInit
|
|
|
|
NULL, // pfnSpawn
|
|
|
|
NULL, // pfnThink
|
|
|
|
NULL, // pfnUse
|
|
|
|
NULL, // pfnTouch
|
|
|
|
NULL, // pfnBlocked
|
|
|
|
NULL, // pfnKeyValue
|
|
|
|
NULL, // pfnSave
|
|
|
|
NULL, // pfnRestore
|
|
|
|
NULL, // pfnSetAbsBox
|
|
|
|
NULL, // pfnSaveWriteFields
|
|
|
|
NULL, // pfnSaveReadFields
|
|
|
|
NULL, // pfnSaveGlobalState
|
|
|
|
NULL, // pfnRestoreGlobalState
|
|
|
|
NULL, // pfnResetGlobalState
|
|
|
|
NULL, // pfnClientConnect
|
|
|
|
NULL, // pfnClientDisconnect
|
|
|
|
NULL, // pfnClientKill
|
|
|
|
NULL, // pfnClientPutInServer
|
|
|
|
NULL, // pfnClientCommand
|
|
|
|
NULL, // pfnClientUserInfoChanged
|
|
|
|
NULL, // pfnServerActivate
|
|
|
|
NULL, // pfnServerDeactivate
|
|
|
|
NULL, // pfnPlayerPreThink
|
|
|
|
NULL, // pfnPlayerPostThink
|
|
|
|
NULL, // pfnStartFrame
|
|
|
|
NULL, // pfnParmsNewLevel
|
|
|
|
NULL, // pfnParmsChangeLevel
|
|
|
|
NULL, // pfnGetGameDescription
|
|
|
|
NULL, // pfnPlayerCustomization
|
|
|
|
NULL, // pfnSpectatorConnect
|
|
|
|
NULL, // pfnSpectatorDisconnect
|
|
|
|
NULL, // pfnSpectatorThink
|
|
|
|
NULL, // pfnSys_Error
|
|
|
|
NULL, // pfnPM_Move
|
|
|
|
NULL, // pfnPM_Init
|
|
|
|
NULL, // pfnPM_FindTextureType
|
|
|
|
NULL, // pfnSetupVisibility
|
|
|
|
NULL, // pfnUpdateClientData
|
|
|
|
NULL, // pfnAddToFullPack
|
|
|
|
NULL, // pfnCreateBaseline
|
|
|
|
NULL, // pfnRegisterEncoders
|
|
|
|
NULL, // pfnGetWeaponData
|
|
|
|
NULL, // pfnCmdStart
|
|
|
|
NULL, // pfnCmdEnd
|
|
|
|
NULL, // pfnConnectionlessPacket
|
|
|
|
NULL, // pfnGetHullBounds
|
|
|
|
NULL, // pfnCreateInstancedBaselines
|
|
|
|
NULL, // pfnInconsistentFile
|
|
|
|
NULL, // pfnAllowLagCompensation
|
|
|
|
};
|
|
|
|
|
|
|
|
NEW_DLL_FUNCTIONS g_NewDllFunctionTable =
|
|
|
|
{
|
|
|
|
NULL, //! pfnOnFreeEntPrivateData() Called right before the object's memory is freed. Calls its destructor.
|
|
|
|
NULL, //! pfnGameShutdown()
|
|
|
|
NULL, //! pfnShouldCollide()
|
|
|
|
NULL, //! pfnCvarValue()
|
|
|
|
NULL, //! pfnCvarValue2()
|
|
|
|
};
|
|
|
|
|
|
|
|
NEW_DLL_FUNCTIONS g_NewDllFunctionTable_Post =
|
|
|
|
{
|
|
|
|
NULL, //! pfnOnFreeEntPrivateData() Called right before the object's memory is freed. Calls its destructor.
|
|
|
|
NULL, //! pfnGameShutdown()
|
|
|
|
NULL, //! pfnShouldCollide()
|
|
|
|
NULL, //! pfnCvarValue()
|
|
|
|
NULL, //! pfnCvarValue2()
|
|
|
|
};
|
|
|
|
|
|
|
|
C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
|
|
|
|
{
|
2017-06-27 01:17:45 +03:00
|
|
|
if (!pFunctionTable) {
|
|
|
|
ALERT(at_logged, "%s called with null pFunctionTable", __FUNCTION__);
|
2017-03-10 18:38:35 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
2017-06-27 01:17:45 +03:00
|
|
|
if (*interfaceVersion != INTERFACE_VERSION) {
|
|
|
|
ALERT(at_logged, "%s version mismatch; requested=%d ours=%d", __FUNCTION__, *interfaceVersion, INTERFACE_VERSION);
|
2017-03-10 18:38:35 +03:00
|
|
|
*interfaceVersion = INTERFACE_VERSION;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(pFunctionTable, &g_DllFunctionTable, sizeof(DLL_FUNCTIONS));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
|
|
|
|
{
|
2017-06-27 01:17:45 +03:00
|
|
|
if (!pFunctionTable) {
|
|
|
|
ALERT(at_logged, "%s called with null pFunctionTable", __FUNCTION__);
|
2017-03-10 18:38:35 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
2017-06-27 01:17:45 +03:00
|
|
|
if (*interfaceVersion != INTERFACE_VERSION) {
|
|
|
|
ALERT(at_logged, "%s version mismatch; requested=%d ours=%d", __FUNCTION__, *interfaceVersion, INTERFACE_VERSION);
|
2017-03-10 18:38:35 +03:00
|
|
|
*interfaceVersion = INTERFACE_VERSION;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(pFunctionTable, &g_DllFunctionTable_Post, sizeof(DLL_FUNCTIONS));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion)
|
|
|
|
{
|
2017-06-27 01:17:45 +03:00
|
|
|
if (!pNewFunctionTable) {
|
|
|
|
ALERT(at_logged, "%s called with null pNewFunctionTable", __FUNCTION__);
|
2017-03-10 18:38:35 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
2017-06-27 01:17:45 +03:00
|
|
|
if (*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) {
|
|
|
|
ALERT(at_logged, "%s version mismatch; requested=%d ours=%d", __FUNCTION__, *interfaceVersion, NEW_DLL_FUNCTIONS_VERSION);
|
2017-03-10 18:38:35 +03:00
|
|
|
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(pNewFunctionTable, &g_NewDllFunctionTable, sizeof(NEW_DLL_FUNCTIONS));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
C_DLLEXPORT int GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion)
|
|
|
|
{
|
2017-06-27 01:17:45 +03:00
|
|
|
if (!pNewFunctionTable) {
|
|
|
|
ALERT(at_logged, "%s called with null pNewFunctionTable", __FUNCTION__);
|
2017-03-10 18:38:35 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
2017-06-27 01:17:45 +03:00
|
|
|
if (*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) {
|
|
|
|
ALERT(at_logged, "%s version mismatch; requested=%d ours=%d", __FUNCTION__, *interfaceVersion, NEW_DLL_FUNCTIONS_VERSION);
|
2017-03-10 18:38:35 +03:00
|
|
|
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(pNewFunctionTable, &g_NewDllFunctionTable_Post, sizeof(NEW_DLL_FUNCTIONS));
|
|
|
|
return TRUE;
|
|
|
|
}
|