Updated Core and SDK Tools for ep2v EmitSound sdk change.
3 * =============================================================================
4 * SourceMod SDKTools Extension
5 * Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
6 * =============================================================================
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, version 3.0, as published by the
10 * Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to link the
21 * code of this program (as well as its derivative works) to "Half-Life 2," the
22 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
23 * by the Valve Corporation. You must obey the GNU General Public License in
24 * all respects for all other code used. Additionally, AlliedModders LLC grants
25 * this exception to all derivative works. AlliedModders LLC defines further
26 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
27 * or <http://www.sourcemod.net/license.php>.
32 #ifndef _INCLUDE_SOURCEMOD_OUTPUT_H_
33 #define _INCLUDE_SOURCEMOD_OUTPUT_H_
35 #include <jit/jit_helpers.h>
36 #include <jit/x86/x86_macros.h>
39 #include "sm_trie_tpl.h"
40 #include "CDetour/detours.h"
42 extern ISourcePawnEngine *spengine;
44 struct OutputNameStruct;
47 * This is a function specific hook that corresponds to an entity classname
48 * and outputname. There can be many of these for each classname/output combo
55 OutputNameStruct *m_parent;
61 * This represents an output belonging to a specific classname
63 struct OutputNameStruct
65 SourceHook::List<omg_hooks *> hooks;
70 * This represents an entity classname
72 struct ClassNameStruct
74 //Trie mapping outputname to a OutputNameStruct
75 //KTrie<OutputNameStruct *> OutputList;
76 IBasicTrie *OutputList;
80 OutputList = adtfactory->CreateBasicTrie();
85 OutputList->Destroy();
89 class EntityOutputManager : public IPluginsListener
92 EntityOutputManager();
98 void FireEventDetour(void *pOutput, CBaseEntity *pActivator, CBaseEntity *pCaller, float fDelay);
100 void OnPluginDestroyed(IPlugin *plugin);
102 OutputNameStruct *FindOutputPointer(const char *classname, const char *outputname, bool create);
104 void CleanUpHook(omg_hooks *hook);
106 omg_hooks *NewHook();
109 void OnHookRemoved();
111 const char *GetEntityClassname(CBaseEntity *pEntity);
116 // Patch/unpatch the server dll
117 void InitFireEventDetour();
118 void ShutdownFireEventDetour();
120 //These create/delete the allocated memory and write into it
121 bool CreateFireEventDetour();
122 void DeleteFireEventDetour();
124 const char *FindOutputName(void *pOutput, CBaseEntity *pCaller);
126 //Maps CEntityOutput * to a OutputNameStruct
127 IBasicTrie *EntityOutputs;
128 // Maps classname to a ClassNameStruct
129 IBasicTrie *ClassNames;
131 SourceHook::CStack<omg_hooks *> FreeHooks; //Stores hook pointers to avoid calls to new
135 patch_t info_restore;
140 void TempDetour(void *pOutput, CBaseEntity *pActivator, CBaseEntity *pCaller, float fDelay);
142 extern EntityOutputManager g_OutputManager;
144 extern sp_nativeinfo_t g_EntOutputNatives[];
146 #endif //_INCLUDE_SOURCEMOD_OUTPUT_H_