Exposed IServer through SDKTools (bug 3545, r=ds).
This commit is contained in:
parent
4e37900d93
commit
3bdc8583e5
@ -38,6 +38,7 @@
|
|||||||
#include "tempents.h"
|
#include "tempents.h"
|
||||||
#include "vsound.h"
|
#include "vsound.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
#include <ISDKTools.h>
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
#define SDKTOOLS_GAME_FILE "sdktools.games.l4d"
|
#define SDKTOOLS_GAME_FILE "sdktools.games.l4d"
|
||||||
@ -73,6 +74,7 @@ SourceHook::CallClass<IVEngineServer> *enginePatch = NULL;
|
|||||||
SourceHook::CallClass<IEngineSound> *enginesoundPatch = NULL;
|
SourceHook::CallClass<IEngineSound> *enginesoundPatch = NULL;
|
||||||
HandleType_t g_CallHandle = 0;
|
HandleType_t g_CallHandle = 0;
|
||||||
HandleType_t g_TraceHandle = 0;
|
HandleType_t g_TraceHandle = 0;
|
||||||
|
ISDKTools *g_pSDKTools;
|
||||||
|
|
||||||
SMEXT_LINK(&g_SdkTools);
|
SMEXT_LINK(&g_SdkTools);
|
||||||
|
|
||||||
@ -84,6 +86,8 @@ extern sp_nativeinfo_t g_VoiceNatives[];
|
|||||||
extern sp_nativeinfo_t g_EntInputNatives[];
|
extern sp_nativeinfo_t g_EntInputNatives[];
|
||||||
extern sp_nativeinfo_t g_TeamNatives[];
|
extern sp_nativeinfo_t g_TeamNatives[];
|
||||||
|
|
||||||
|
static void InitSDKToolsAPI();
|
||||||
|
|
||||||
bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
||||||
{
|
{
|
||||||
HandleError err;
|
HandleError err;
|
||||||
@ -148,6 +152,10 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
|
|
||||||
VoiceInit();
|
VoiceInit();
|
||||||
|
|
||||||
|
GetIServer();
|
||||||
|
|
||||||
|
InitSDKToolsAPI();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +263,6 @@ void SDKTools::SDK_OnAllLoaded()
|
|||||||
s_TempEntHooks.Initialize();
|
s_TempEntHooks.Initialize();
|
||||||
s_SoundHooks.Initialize();
|
s_SoundHooks.Initialize();
|
||||||
InitializeValveGlobals();
|
InitializeValveGlobals();
|
||||||
GetIServer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDKTools::QueryRunning(char *error, size_t maxlength)
|
bool SDKTools::QueryRunning(char *error, size_t maxlength)
|
||||||
@ -379,3 +386,28 @@ bool SDKTools::ProcessCommandTarget(cmd_target_info_t *info)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SDKTools_API : public ISDKTools
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const char *GetInterfaceName()
|
||||||
|
{
|
||||||
|
return SMINTERFACE_SDKTOOLS_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual unsigned int GetInterfaceVersion()
|
||||||
|
{
|
||||||
|
return SMINTERFACE_SDKTOOLS_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual IServer *GetIServer()
|
||||||
|
{
|
||||||
|
return iserver;
|
||||||
|
}
|
||||||
|
} g_SDKTools_API;
|
||||||
|
|
||||||
|
static void InitSDKToolsAPI()
|
||||||
|
{
|
||||||
|
g_pSDKTools = &g_SDKTools_API;
|
||||||
|
sharesys->AddInterface(myself, g_pSDKTools);
|
||||||
|
}
|
||||||
|
@ -763,6 +763,10 @@
|
|||||||
RelativePath="..\extension.h"
|
RelativePath="..\extension.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\public\extensions\ISDKTools.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\output.h"
|
RelativePath="..\output.h"
|
||||||
>
|
>
|
||||||
|
67
public/extensions/ISDKTools.h
Normal file
67
public/extensions/ISDKTools.h
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* =============================================================================
|
||||||
|
* SourceMod SDKTools Extension
|
||||||
|
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||||
|
* =============================================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||||
|
* Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, 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.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||||
|
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||||
|
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||||
|
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||||
|
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||||
|
* this exception to all derivative works. AlliedModders LLC defines further
|
||||||
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||||
|
* or <http://www.sourcemod.net/license.php>.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_SMEXT_I_SDKTOOLS_H_
|
||||||
|
#define _INCLUDE_SMEXT_I_SDKTOOLS_H_
|
||||||
|
|
||||||
|
#include <IShareSys.h>
|
||||||
|
|
||||||
|
#define SMINTERFACE_SDKTOOLS_NAME "ISDKTools"
|
||||||
|
#define SMINTERFACE_SDKTOOLS_VERSION 1
|
||||||
|
|
||||||
|
class IServer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SDKTools shared API
|
||||||
|
* @file ISDKTools.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace SourceMod
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief SDKTools API.
|
||||||
|
*/
|
||||||
|
class ISDKTools : public SMInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const char *GetInterfaceName() = 0;
|
||||||
|
virtual unsigned int GetInterfaceVersion() = 0;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Returns a pointer to IServer if one was found.
|
||||||
|
*
|
||||||
|
* @return IServer pointer, or NULL if SDKTools was unable to find one.
|
||||||
|
*/
|
||||||
|
virtual IServer* GetIServer() = 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _INCLUDE_SMEXT_I_SDKTOOLS_H_ */
|
Loading…
Reference in New Issue
Block a user