Compare commits
34
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0fda1f919 | ||
|
|
79ea33beda | ||
|
|
fef5bd321c | ||
|
|
6c7a763b76 | ||
|
|
78fa1c9995 | ||
|
|
3623ee3ce8 | ||
|
|
ba28da5fdc | ||
|
|
c2b7bd10ec | ||
|
|
35ab37c76c | ||
|
|
c968dfa113 | ||
|
|
8541040bb9 | ||
|
|
8ae003046c | ||
|
|
38c37b8160 | ||
|
|
aec3469c03 | ||
|
|
71b48fad0f | ||
|
|
a3fade1c1d | ||
|
|
3ab1ef139f | ||
|
|
36bd6423c2 | ||
|
|
178347f9f1 | ||
|
|
94303ea9a0 | ||
|
|
50e1c5ba1f | ||
|
|
7d3ebce7d1 | ||
|
|
7167a807bf | ||
|
|
a8e1a4f2fd | ||
|
|
157f050f89 | ||
|
|
c676ecc026 | ||
|
|
0fbb87e3b2 | ||
|
|
29996d0133 | ||
|
|
7807f3e31a | ||
|
|
e246d14a6b | ||
|
|
a34a27be65 | ||
|
|
e1d2b88c23 | ||
|
|
5c92b0d154 | ||
|
|
2b7ccf6625 |
@@ -1 +1,3 @@
|
|||||||
54539fa4e51f98d7841c853c1370dff6ccd3cdf2 sourcemod-1.0.0
|
54539fa4e51f98d7841c853c1370dff6ccd3cdf2 sourcemod-1.0.0
|
||||||
|
e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0
|
||||||
|
ffa740152efd042ad0461c797d52c5e6eab3d52c sourcemod-1.1.1
|
||||||
|
|||||||
@@ -2,6 +2,26 @@ SourceMod Changelog
|
|||||||
|
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.1.1 [2009-02-25]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.1.1_Release Notes
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Added Age of Chivalry support (bug 3366, IceMatrix).
|
||||||
|
- Added Obsidian Conflict support (bug 2699, The DOO).
|
||||||
|
- Fixed compatibility issues with latest TF2 update.
|
||||||
|
- Fixed crash when an event handler fired an event of the same name (bug 3468).
|
||||||
|
- Fixed rare crash in the event manager on post hooks (bug 3548).
|
||||||
|
- Fixed formatting error with zero precision floats (bug 3447).
|
||||||
|
- Fixed various Insurgency offsets (bug 3544).
|
||||||
|
- Fixed admin menu (topmenu) categories being selectable when not usable (bug 3256).
|
||||||
|
- Fixed sm_sql_addgroup not working (bug 3578).
|
||||||
|
- Fixed memory leak when events were hooked as EventHookMode_Post.
|
||||||
|
- Fixed nextmap trigger showing wrong output with end-of-map voting disabled and sm_trigger_show set to zero (bug 3597, mr.e.unk).
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
SourceMod 1.1.0 [2008-12-28]
|
SourceMod 1.1.0 [2008-12-28]
|
||||||
|
|
||||||
URL: http://wiki.alliedmods.net/SourceMod_1.1.0_Release_Notes
|
URL: http://wiki.alliedmods.net/SourceMod_1.1.0_Release_Notes
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
// "@Full Admins"
|
// "@Full Admins"
|
||||||
//
|
//
|
||||||
// You can also specify immunity values. Two examples:
|
// You can also specify immunity values. Two examples:
|
||||||
// "83:abcdefg" //Immunity is 83, flags are abcefgh
|
// "83:abcdefgh" //Immunity is 83, flags are abcdefgh
|
||||||
// "6:@Full Admins" //Immunity is 6, group is "Full Admins"
|
// "6:@Full Admins" //Immunity is 6, group is "Full Admins"
|
||||||
//
|
//
|
||||||
// Immunity values can be any number. An admin cannot target an admin with
|
// Immunity values can be any number. An admin cannot target an admin with
|
||||||
@@ -37,9 +37,9 @@
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// Examples: (do not put // in front of real lines, as // means 'comment')
|
// Examples: (do not put // in front of real lines, as // means 'comment')
|
||||||
//
|
//
|
||||||
// "STEAM_0:1:16" "bce" //kick, ban, slay for this steam ID, no immunity
|
// "STEAM_0:1:16" "bce" //generic, kick, unban for this steam ID, no immunity
|
||||||
// "!127.0.0.1" "99:z" //all permissions for this ip, immunity value is 99
|
// "!127.0.0.1" "99:z" //all permissions for this ip, immunity value is 99
|
||||||
// "BAILOPAN" "abc" "Gab3n" //name BAILOPAN, password "Gab3n": gets reservation, kick, ban
|
// "BAILOPAN" "abc" "Gab3n" //name BAILOPAN, password "Gab3n": gets reservation, generic, kick
|
||||||
//
|
//
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
@@ -51,12 +51,6 @@
|
|||||||
"target" "default"
|
"target" "default"
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For the "rockthevote" plugin */
|
|
||||||
"rockthevote"
|
|
||||||
{
|
|
||||||
"target" "default"
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For the "nominations" plugin */
|
/* For the "nominations" plugin */
|
||||||
"nominations"
|
"nominations"
|
||||||
{
|
{
|
||||||
|
|||||||
+41
-19
@@ -193,6 +193,9 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
|
|||||||
pHook->pPostHook->AddFunction(pFunction);
|
pHook->pPostHook->AddFunction(pFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Cache the name for post hooks */
|
||||||
|
pHook->name = strdup(name);
|
||||||
|
|
||||||
/* Increase reference count */
|
/* Increase reference count */
|
||||||
pHook->refCount++;
|
pHook->refCount++;
|
||||||
|
|
||||||
@@ -296,6 +299,9 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
|
|||||||
/* Delete entry in trie */
|
/* Delete entry in trie */
|
||||||
sm_trie_delete(m_EventHooks, name);
|
sm_trie_delete(m_EventHooks, name);
|
||||||
|
|
||||||
|
/* Free the cached name */
|
||||||
|
free(pHook->name);
|
||||||
|
|
||||||
/* And finally free structure memory */
|
/* And finally free structure memory */
|
||||||
delete pHook;
|
delete pHook;
|
||||||
}
|
}
|
||||||
@@ -365,33 +371,36 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
{
|
{
|
||||||
RETURN_META_VALUE(MRES_IGNORED, false);
|
RETURN_META_VALUE(MRES_IGNORED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the event name, we're going to need this for passing to post hooks */
|
|
||||||
name = pEvent->GetName();
|
name = pEvent->GetName();
|
||||||
|
|
||||||
m_EventNames.push(name);
|
|
||||||
|
|
||||||
if (sm_trie_retrieve(m_EventHooks, name, reinterpret_cast<void **>(&pHook)))
|
if (sm_trie_retrieve(m_EventHooks, name, reinterpret_cast<void **>(&pHook)))
|
||||||
{
|
{
|
||||||
|
/* Push the event onto the event stack. The reference count is increased to make sure
|
||||||
|
* the structure is not garbage collected in between now and the post hook.
|
||||||
|
*/
|
||||||
|
pHook->refCount++;
|
||||||
|
m_EventStack.push(pHook);
|
||||||
|
|
||||||
pForward = pHook->pPreHook;
|
pForward = pHook->pPreHook;
|
||||||
|
|
||||||
if (pForward)
|
if (pForward)
|
||||||
{
|
{
|
||||||
EventInfo info = { pEvent, NULL };
|
EventInfo info(pEvent, NULL);
|
||||||
|
HandleSecurity sec(NULL, g_pCoreIdent);
|
||||||
Handle_t hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
Handle_t hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
||||||
|
|
||||||
pForward->PushCell(hndl);
|
pForward->PushCell(hndl);
|
||||||
pForward->PushString(name);
|
pForward->PushString(name);
|
||||||
pForward->PushCell(bDontBroadcast);
|
pForward->PushCell(bDontBroadcast);
|
||||||
pForward->Execute(&res, NULL);
|
pForward->Execute(&res, NULL);
|
||||||
|
|
||||||
HandleSecurity sec(NULL, g_pCoreIdent);
|
|
||||||
g_HandleSys.FreeHandle(hndl, &sec);
|
g_HandleSys.FreeHandle(hndl, &sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pHook->postCopy)
|
if (pHook->postCopy)
|
||||||
{
|
{
|
||||||
pHook->pEventCopy = gameevents->DuplicateEvent(pEvent);
|
m_EventCopies.push(gameevents->DuplicateEvent(pEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
@@ -400,6 +409,10 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
RETURN_META_VALUE(MRES_SUPERCEDE, false);
|
RETURN_META_VALUE(MRES_SUPERCEDE, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_EventStack.push(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_IGNORED, true);
|
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||||
}
|
}
|
||||||
@@ -407,10 +420,9 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
/* IGameEventManager2::FireEvent post hook */
|
/* IGameEventManager2::FireEvent post hook */
|
||||||
bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
||||||
{
|
{
|
||||||
IGameEvent *pEventCopy = NULL;
|
|
||||||
EventHook *pHook;
|
EventHook *pHook;
|
||||||
|
EventInfo info;
|
||||||
IChangeableForward *pForward;
|
IChangeableForward *pForward;
|
||||||
const char *name;
|
|
||||||
Handle_t hndl = 0;
|
Handle_t hndl = 0;
|
||||||
|
|
||||||
/* The engine accepts NULL without crashing, so to prevent a crash in SM we ignore these */
|
/* The engine accepts NULL without crashing, so to prevent a crash in SM we ignore these */
|
||||||
@@ -419,18 +431,18 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
RETURN_META_VALUE(MRES_IGNORED, false);
|
RETURN_META_VALUE(MRES_IGNORED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = m_EventNames.front();
|
pHook = m_EventStack.front();
|
||||||
|
|
||||||
if (sm_trie_retrieve(m_EventHooks, name, reinterpret_cast<void **>(&pHook)))
|
if (pHook != NULL)
|
||||||
{
|
{
|
||||||
pForward = pHook->pPostHook;
|
pForward = pHook->pPostHook;
|
||||||
|
|
||||||
if (pForward)
|
if (pForward)
|
||||||
{
|
{
|
||||||
EventInfo info = { pHook->pEventCopy, NULL };
|
|
||||||
|
|
||||||
if (pHook->postCopy)
|
if (pHook->postCopy)
|
||||||
{
|
{
|
||||||
|
info.pEvent = m_EventCopies.front();
|
||||||
|
info.pOwner = NULL;
|
||||||
hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
||||||
|
|
||||||
pForward->PushCell(hndl);
|
pForward->PushCell(hndl);
|
||||||
@@ -438,7 +450,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
pForward->PushCell(BAD_HANDLE);
|
pForward->PushCell(BAD_HANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pForward->PushString(name);
|
pForward->PushString(pHook->name);
|
||||||
pForward->PushCell(bDontBroadcast);
|
pForward->PushCell(bDontBroadcast);
|
||||||
pForward->Execute(NULL);
|
pForward->Execute(NULL);
|
||||||
|
|
||||||
@@ -449,13 +461,23 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
g_HandleSys.FreeHandle(hndl, &sec);
|
g_HandleSys.FreeHandle(hndl, &sec);
|
||||||
|
|
||||||
/* Free event structure */
|
/* Free event structure */
|
||||||
gameevents->FreeEvent(pEventCopy);
|
gameevents->FreeEvent(info.pEvent);
|
||||||
pHook->pEventCopy = NULL;
|
m_EventCopies.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Decrement reference count, check if a delayed delete is needed */
|
||||||
|
if (--pHook->refCount == 0)
|
||||||
|
{
|
||||||
|
assert(pHook->pPostHook == NULL);
|
||||||
|
assert(pHook->pPreHook == NULL);
|
||||||
|
sm_trie_delete(m_EventHooks, pHook->name);
|
||||||
|
free(pHook->name);
|
||||||
|
delete pHook;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_EventNames.pop();
|
m_EventStack.pop();
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_IGNORED, true);
|
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-3
@@ -45,6 +45,12 @@ using namespace SourceHook;
|
|||||||
|
|
||||||
struct EventInfo
|
struct EventInfo
|
||||||
{
|
{
|
||||||
|
EventInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
EventInfo(IGameEvent *ev, IdentityToken_t *owner) : pEvent(ev), pOwner(owner)
|
||||||
|
{
|
||||||
|
}
|
||||||
IGameEvent *pEvent;
|
IGameEvent *pEvent;
|
||||||
IdentityToken_t *pOwner;
|
IdentityToken_t *pOwner;
|
||||||
};
|
};
|
||||||
@@ -56,14 +62,13 @@ struct EventHook
|
|||||||
pPreHook = NULL;
|
pPreHook = NULL;
|
||||||
pPostHook = NULL;
|
pPostHook = NULL;
|
||||||
postCopy = false;
|
postCopy = false;
|
||||||
pEventCopy = NULL;
|
|
||||||
refCount = 0;
|
refCount = 0;
|
||||||
}
|
}
|
||||||
IChangeableForward *pPreHook;
|
IChangeableForward *pPreHook;
|
||||||
IChangeableForward *pPostHook;
|
IChangeableForward *pPostHook;
|
||||||
bool postCopy;
|
bool postCopy;
|
||||||
IGameEvent *pEventCopy;
|
|
||||||
unsigned int refCount;
|
unsigned int refCount;
|
||||||
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EventHookMode
|
enum EventHookMode
|
||||||
@@ -120,7 +125,8 @@ private:
|
|||||||
HandleType_t m_EventType;
|
HandleType_t m_EventType;
|
||||||
Trie *m_EventHooks;
|
Trie *m_EventHooks;
|
||||||
CStack<EventInfo *> m_FreeEvents;
|
CStack<EventInfo *> m_FreeEvents;
|
||||||
CStack<const char *> m_EventNames;
|
CStack<EventHook *> m_EventStack;
|
||||||
|
CStack<IGameEvent *> m_EventCopies;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EventManager g_EventManager;
|
extern EventManager g_EventManager;
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ void AddFloat(char **buf_p, size_t &maxlen, double fval, int width, int prec, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write the fraction part
|
// write the fraction part
|
||||||
if (maxlen)
|
if (maxlen && prec)
|
||||||
{
|
{
|
||||||
*buf++ = '.';
|
*buf++ = '.';
|
||||||
maxlen--;
|
maxlen--;
|
||||||
|
|||||||
+3
-3
@@ -41,8 +41,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
|
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
#define _INCLUDE_BINTOOLS_VERSION_H_
|
#define _INCLUDE_BINTOOLS_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_BINTOOLS_VERSION_H_
|
#endif //_INCLUDE_BINTOOLS_VERSION_H_
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ CookieTypeHandler g_CookieTypeHandler;
|
|||||||
HandleType_t g_CookieIterator = 0;
|
HandleType_t g_CookieIterator = 0;
|
||||||
CookieIteratorHandler g_CookieIteratorHandler;
|
CookieIteratorHandler g_CookieIteratorHandler;
|
||||||
DbDriver g_DriverType;
|
DbDriver g_DriverType;
|
||||||
|
static const DatabaseInfo *storage_local = NULL;
|
||||||
|
|
||||||
bool ClientPrefs::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
bool ClientPrefs::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
||||||
{
|
{
|
||||||
@@ -58,6 +59,20 @@ bool ClientPrefs::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
{
|
{
|
||||||
DBInfo = dbi->FindDatabaseConf("default");
|
DBInfo = dbi->FindDatabaseConf("default");
|
||||||
|
|
||||||
|
if (DBInfo == NULL ||
|
||||||
|
(strcmp(DBInfo->host, "localhost") == 0 &&
|
||||||
|
strcmp(DBInfo->database, "sourcemod") == 0 &&
|
||||||
|
strcmp(DBInfo->user, "root") == 0 &&
|
||||||
|
strcmp(DBInfo->pass, "") == 0 &&
|
||||||
|
strcmp(DBInfo->driver, "") == 0))
|
||||||
|
{
|
||||||
|
storage_local = dbi->FindDatabaseConf("storage-local");
|
||||||
|
if (DBInfo == NULL)
|
||||||
|
{
|
||||||
|
DBInfo = storage_local;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (DBInfo == NULL)
|
if (DBInfo == NULL)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Could not find \"clientprefs\" or \"default\" database configs");
|
snprintf(error, maxlength, "Could not find \"clientprefs\" or \"default\" database configs");
|
||||||
@@ -176,6 +191,14 @@ void ClientPrefs::DatabaseConnect()
|
|||||||
|
|
||||||
Database = Driver->Connect(DBInfo, true, error, sizeof(error));
|
Database = Driver->Connect(DBInfo, true, error, sizeof(error));
|
||||||
|
|
||||||
|
if (Database == NULL &&
|
||||||
|
DBInfo != storage_local &&
|
||||||
|
storage_local != NULL)
|
||||||
|
{
|
||||||
|
DBInfo = storage_local;
|
||||||
|
Database = Driver->Connect(DBInfo, true, error, sizeof(error));
|
||||||
|
}
|
||||||
|
|
||||||
if (Database == NULL)
|
if (Database == NULL)
|
||||||
{
|
{
|
||||||
g_pSM->LogError(myself, error);
|
g_pSM->LogError(myself, error);
|
||||||
|
|||||||
@@ -36,7 +36,9 @@
|
|||||||
#ifndef _INCLUDE_CLIENTPREFS_VERSION_H_
|
#ifndef _INCLUDE_CLIENTPREFS_VERSION_H_
|
||||||
#define _INCLUDE_CLIENTPREFS_VERSION_H_
|
#define _INCLUDE_CLIENTPREFS_VERSION_H_
|
||||||
|
|
||||||
#define SVN_FULL_VERSION "1.1.0-svn"
|
#define SM_BUILD_STRING ""
|
||||||
#define SVN_FILE_VERSION 1,1,0,2230
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_CLIENTPREFS_VERSION_H_
|
#endif //_INCLUDE_CLIENTPREFS_VERSION_H_
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
#define _INCLUDE_SDKTOOLS_VERSION_H_
|
#define _INCLUDE_SDKTOOLS_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
|
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
#define _INCLUDE_GEOIP_VERSION_H_
|
#define _INCLUDE_GEOIP_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_GEOIP_VERSION_H_
|
#endif //_INCLUDE_GEOIP_VERSION_H_
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
#define _INCLUDE_MYSQLEXT_VERSION_H_
|
#define _INCLUDE_MYSQLEXT_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_MYSQLEXT_VERSION_H_
|
#endif //_INCLUDE_MYSQLEXT_VERSION_H_
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
#define _INCLUDE_REGEXEXT_VERSION_H_
|
#define _INCLUDE_REGEXEXT_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_REGEXEXT_VERSION_H_
|
#endif //_INCLUDE_REGEXEXT_VERSION_H_
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
#define _INCLUDE_SDKTOOLS_VERSION_H_
|
#define _INCLUDE_SDKTOOLS_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
|
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
#define _INCLUDE_SQLITEEXT_VERSION_H_
|
#define _INCLUDE_SQLITEEXT_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
|
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
|
||||||
|
|||||||
@@ -26,13 +26,13 @@
|
|||||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||||
* or <http://www.sourcemod.net/license.php>.
|
* or <http://www.sourcemod.net/license.php>.
|
||||||
*
|
*
|
||||||
* Version: $Id$
|
* Version: $Id: detourhelpers.h 248 2008-08-27 00:56:22Z pred $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
#ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||||
#define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
#define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||||
|
|
||||||
#if defined PLATFORM_POSIX
|
#if defined PLATFORM_LINUX
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#define PAGE_SIZE 4096
|
#define PAGE_SIZE 4096
|
||||||
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
||||||
@@ -52,7 +52,7 @@ struct patch_t
|
|||||||
|
|
||||||
inline void ProtectMemory(void *addr, int length, int prot)
|
inline void ProtectMemory(void *addr, int length, int prot)
|
||||||
{
|
{
|
||||||
#if defined PLATFORM_POSIX
|
#if defined PLATFORM_LINUX
|
||||||
void *addr2 = (void *)ALIGN(addr);
|
void *addr2 = (void *)ALIGN(addr);
|
||||||
mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
|
mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
|
||||||
#elif defined PLATFORM_WINDOWS
|
#elif defined PLATFORM_WINDOWS
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||||
* or <http://www.sourcemod.net/license.php>.
|
* or <http://www.sourcemod.net/license.php>.
|
||||||
*
|
*
|
||||||
* Version: $Id$
|
* Version: $Id: detours.cpp 248 2008-08-27 00:56:22Z pred $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "detours.h"
|
#include "detours.h"
|
||||||
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
ISourcePawnEngine *CDetourManager::spengine = NULL;
|
ISourcePawnEngine *CDetourManager::spengine = NULL;
|
||||||
IGameConfig *CDetourManager::gameconf = NULL;
|
IGameConfig *CDetourManager::gameconf = NULL;
|
||||||
int CDetourManager::returnValue = 0;
|
|
||||||
|
|
||||||
void CDetourManager::Init(ISourcePawnEngine *spengine, IGameConfig *gameconf)
|
void CDetourManager::Init(ISourcePawnEngine *spengine, IGameConfig *gameconf)
|
||||||
{
|
{
|
||||||
@@ -42,9 +41,9 @@ void CDetourManager::Init(ISourcePawnEngine *spengine, IGameConfig *gameconf)
|
|||||||
CDetourManager::gameconf = gameconf;
|
CDetourManager::gameconf = gameconf;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDetour *CDetourManager::CreateDetour(void *callbackfunction, size_t paramsize, const char *signame)
|
CDetour *CDetourManager::CreateDetour(void *callbackfunction, void **trampoline, const char *signame)
|
||||||
{
|
{
|
||||||
CDetour *detour = new CDetour(callbackfunction, paramsize, signame);
|
CDetour *detour = new CDetour(callbackfunction, trampoline, signame);
|
||||||
if (detour)
|
if (detour)
|
||||||
{
|
{
|
||||||
if (!detour->Init(spengine, gameconf))
|
if (!detour->Init(spengine, gameconf))
|
||||||
@@ -59,50 +58,17 @@ CDetour *CDetourManager::CreateDetour(void *callbackfunction, size_t paramsize,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDetourManager::DeleteDetour(CDetour *detour)
|
CDetour::CDetour(void *callbackfunction, void **trampoline, const char *signame)
|
||||||
{
|
|
||||||
delete detour;
|
|
||||||
}
|
|
||||||
|
|
||||||
CBlocker * CDetourManager::CreateFunctionBlock( const char *signame, bool isVoid )
|
|
||||||
{
|
|
||||||
CBlocker *block = new CBlocker(signame, isVoid);
|
|
||||||
|
|
||||||
if (block)
|
|
||||||
{
|
|
||||||
if (!block->Init(spengine, gameconf))
|
|
||||||
{
|
|
||||||
delete block;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return block;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CDetourManager::DeleteFunctionBlock(CBlocker *block)
|
|
||||||
{
|
|
||||||
delete block;
|
|
||||||
}
|
|
||||||
|
|
||||||
CDetour::CDetour(void *callbackfunction, size_t paramsize, const char *signame)
|
|
||||||
{
|
{
|
||||||
enabled = false;
|
enabled = false;
|
||||||
detoured = false;
|
detoured = false;
|
||||||
detour_address = NULL;
|
detour_address = NULL;
|
||||||
detour_callback = NULL;
|
detour_trampoline = NULL;
|
||||||
this->signame = signame;
|
this->signame = signame;
|
||||||
this->callbackfunction = callbackfunction;
|
this->detour_callback = callbackfunction;
|
||||||
spengine = NULL;
|
spengine = NULL;
|
||||||
gameconf = NULL;
|
gameconf = NULL;
|
||||||
this->paramsize = paramsize;
|
this->trampoline = trampoline;
|
||||||
}
|
|
||||||
|
|
||||||
CDetour::~CDetour()
|
|
||||||
{
|
|
||||||
DeleteDetour();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDetour::Init(ISourcePawnEngine *spengine, IGameConfig *gameconf)
|
bool CDetour::Init(ISourcePawnEngine *spengine, IGameConfig *gameconf)
|
||||||
@@ -121,6 +87,12 @@ bool CDetour::Init(ISourcePawnEngine *spengine, IGameConfig *gameconf)
|
|||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDetour::Destroy()
|
||||||
|
{
|
||||||
|
DeleteDetour();
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
bool CDetour::IsEnabled()
|
bool CDetour::IsEnabled()
|
||||||
{
|
{
|
||||||
return enabled;
|
return enabled;
|
||||||
@@ -148,7 +120,6 @@ bool CDetour::CreateDetour()
|
|||||||
detour_restore.patch[i] = ((unsigned char *)detour_address)[i];
|
detour_restore.patch[i] = ((unsigned char *)detour_address)[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
//detour_callback = spengine->ExecAlloc(100);
|
|
||||||
JitWriter wr;
|
JitWriter wr;
|
||||||
JitWriter *jit = ≀
|
JitWriter *jit = ≀
|
||||||
jit_uint32_t CodeSize = 0;
|
jit_uint32_t CodeSize = 0;
|
||||||
@@ -158,47 +129,6 @@ bool CDetour::CreateDetour()
|
|||||||
|
|
||||||
jit_rewind:
|
jit_rewind:
|
||||||
|
|
||||||
/* Push all our params onto the stack */
|
|
||||||
for (size_t i=0; i<paramsize; i++)
|
|
||||||
{
|
|
||||||
#if defined PLATFORM_WINDOWS
|
|
||||||
IA32_Push_Rm_Disp8_ESP(jit, (paramsize*4));
|
|
||||||
#elif defined PLATFORM_LINUX
|
|
||||||
IA32_Push_Rm_Disp8_ESP(jit, 4 +(paramsize*4));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Push thisptr onto the stack */
|
|
||||||
#if defined PLATFORM_WINDOWS
|
|
||||||
IA32_Push_Reg(jit, REG_ECX);
|
|
||||||
#elif defined PLATFORM_LINUX
|
|
||||||
IA32_Push_Rm_Disp8_ESP(jit, 4 + (paramsize*4));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
jitoffs_t call = IA32_Call_Imm32(jit, 0);
|
|
||||||
IA32_Write_Jump32_Abs(jit, call, callbackfunction);
|
|
||||||
|
|
||||||
/* Pop thisptr */
|
|
||||||
#if defined PLATFORM_LINUX
|
|
||||||
IA32_Add_Rm_Imm8(jit, REG_ESP, 4, MOD_REG); //add esp, 4
|
|
||||||
#elif defined PLATFORM_WINDOWS
|
|
||||||
IA32_Pop_Reg(jit, REG_ECX);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Pop params from the stack */
|
|
||||||
for (size_t i=0; i<paramsize; i++)
|
|
||||||
{
|
|
||||||
IA32_Add_Rm_Imm8(jit, REG_ESP, 4, MOD_REG);
|
|
||||||
}
|
|
||||||
|
|
||||||
//If TempDetour returns non-zero we want to load something into eax and return this value
|
|
||||||
|
|
||||||
//test eax, eax
|
|
||||||
IA32_Test_Rm_Reg(jit, REG_EAX, REG_EAX, MOD_REG);
|
|
||||||
|
|
||||||
//jnz _skip
|
|
||||||
jitoffs_t jmp = IA32_Jump_Cond_Imm8(jit, CC_NZ, 0);
|
|
||||||
|
|
||||||
/* Patch old bytes in */
|
/* Patch old bytes in */
|
||||||
if (wr.outbase != NULL)
|
if (wr.outbase != NULL)
|
||||||
{
|
{
|
||||||
@@ -207,15 +137,8 @@ jit_rewind:
|
|||||||
wr.outptr += detour_restore.bytes;
|
wr.outptr += detour_restore.bytes;
|
||||||
|
|
||||||
/* Return to the original function */
|
/* Return to the original function */
|
||||||
call = IA32_Jump_Imm32(jit, 0);
|
jitoffs_t call = IA32_Jump_Imm32(jit, 0);
|
||||||
IA32_Write_Jump32_Abs(jit, call, (unsigned char *)detour_address + detour_restore.bytes);
|
IA32_Write_Jump32_Abs(jit, call, (unsigned char *)detour_address + detour_restore.bytes);
|
||||||
|
|
||||||
//_skip:
|
|
||||||
//mov eax, [g_returnvalue]
|
|
||||||
//ret
|
|
||||||
IA32_Send_Jump8_Here(jit, jmp);
|
|
||||||
IA32_Mov_Eax_Mem(jit, (jit_int32_t)&CDetourManager::returnValue);
|
|
||||||
IA32_Return(jit);
|
|
||||||
|
|
||||||
if (wr.outbase == NULL)
|
if (wr.outbase == NULL)
|
||||||
{
|
{
|
||||||
@@ -223,15 +146,32 @@ jit_rewind:
|
|||||||
wr.outbase = (jitcode_t)spengine->AllocatePageMemory(CodeSize);
|
wr.outbase = (jitcode_t)spengine->AllocatePageMemory(CodeSize);
|
||||||
spengine->SetReadWrite(wr.outbase);
|
spengine->SetReadWrite(wr.outbase);
|
||||||
wr.outptr = wr.outbase;
|
wr.outptr = wr.outbase;
|
||||||
detour_callback = wr.outbase;
|
detour_trampoline = wr.outbase;
|
||||||
goto jit_rewind;
|
goto jit_rewind;
|
||||||
}
|
}
|
||||||
|
|
||||||
spengine->SetReadExecute(wr.outbase);
|
spengine->SetReadExecute(wr.outbase);
|
||||||
|
|
||||||
|
*trampoline = detour_trampoline;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDetour::DeleteDetour()
|
||||||
|
{
|
||||||
|
if (detoured)
|
||||||
|
{
|
||||||
|
DisableDetour();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (detour_trampoline)
|
||||||
|
{
|
||||||
|
/* Free the allocated trampoline memory */
|
||||||
|
spengine->FreePageMemory(detour_trampoline);
|
||||||
|
detour_trampoline = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CDetour::EnableDetour()
|
void CDetour::EnableDetour()
|
||||||
{
|
{
|
||||||
if (!detoured)
|
if (!detoured)
|
||||||
@@ -241,132 +181,12 @@ void CDetour::EnableDetour()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDetour::DeleteDetour()
|
|
||||||
{
|
|
||||||
if (detoured)
|
|
||||||
{
|
|
||||||
DisableDetour();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (detour_callback)
|
|
||||||
{
|
|
||||||
/* Free the gate */
|
|
||||||
spengine->FreePageMemory(detour_callback);
|
|
||||||
detour_callback = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CDetour::DisableDetour()
|
void CDetour::DisableDetour()
|
||||||
{
|
{
|
||||||
if (detoured)
|
if (detoured)
|
||||||
{
|
{
|
||||||
/* Remove the patch */
|
/* Remove the patch */
|
||||||
/* This may screw up */
|
|
||||||
ApplyPatch(detour_address, 0, &detour_restore, NULL);
|
ApplyPatch(detour_address, 0, &detour_restore, NULL);
|
||||||
detoured = false;
|
detoured = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CBlocker::CBlocker( const char *signame, bool isVoid )
|
|
||||||
{
|
|
||||||
this->isVoid = isVoid;
|
|
||||||
isEnabled = false;
|
|
||||||
isValid = false;
|
|
||||||
|
|
||||||
spengine = NULL;
|
|
||||||
gameconf = NULL;
|
|
||||||
block_address = NULL;
|
|
||||||
block_sig = signame;
|
|
||||||
|
|
||||||
if (isVoid)
|
|
||||||
{
|
|
||||||
/* Void functions we only patch in a 'ret' (1 byte) */
|
|
||||||
block_restore.bytes = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Normal functions need an mov eax, value */
|
|
||||||
block_restore.bytes = 6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CBlocker::EnableBlock( int returnValue )
|
|
||||||
{
|
|
||||||
if (!isValid || isEnabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* First, save restore bits */
|
|
||||||
for (size_t i=0; i<block_restore.bytes; i++)
|
|
||||||
{
|
|
||||||
block_restore.patch[i] = ((unsigned char *)block_address)[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
JitWriter wr;
|
|
||||||
JitWriter *jit = ≀
|
|
||||||
wr.outbase = (jitcode_t)block_address;
|
|
||||||
wr.outptr = wr.outbase;
|
|
||||||
|
|
||||||
if (isVoid)
|
|
||||||
{
|
|
||||||
IA32_Return(jit);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IA32_Mov_Reg_Imm32(jit, REG_EAX, returnValue);
|
|
||||||
IA32_Return(jit);
|
|
||||||
}
|
|
||||||
|
|
||||||
isEnabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CBlocker::DisableBlock()
|
|
||||||
{
|
|
||||||
if (!isValid || !isEnabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* First, save restore bits */
|
|
||||||
for (size_t i=0; i<block_restore.bytes; i++)
|
|
||||||
{
|
|
||||||
((unsigned char *)block_address)[i] = block_restore.patch[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
isEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CBlocker::~CBlocker()
|
|
||||||
{
|
|
||||||
if (!isValid || !isEnabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DisableBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CBlocker::Init( ISourcePawnEngine *spengine, IGameConfig *gameconf )
|
|
||||||
{
|
|
||||||
this->spengine = spengine;
|
|
||||||
this->gameconf = gameconf;
|
|
||||||
|
|
||||||
if (!gameconf->GetMemSig(block_sig, &block_address))
|
|
||||||
{
|
|
||||||
g_pSM->LogError(myself, "Could not locate %s - Disabling blocker", block_sig);
|
|
||||||
isValid = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!block_address)
|
|
||||||
{
|
|
||||||
g_pSM->LogError(myself, "Sigscan for %s failed - Disabling blocker", block_sig);
|
|
||||||
isValid = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
isValid = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||||
* or <http://www.sourcemod.net/license.php>.
|
* or <http://www.sourcemod.net/license.php>.
|
||||||
*
|
*
|
||||||
* Version: $Id$
|
* Version: $Id: detours.h 257 2008-09-23 03:12:13Z pred $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _INCLUDE_SOURCEMOD_DETOURS_H_
|
#ifndef _INCLUDE_SOURCEMOD_DETOURS_H_
|
||||||
@@ -40,9 +40,103 @@
|
|||||||
/**
|
/**
|
||||||
* CDetours class for SourceMod Extensions by pRED*
|
* CDetours class for SourceMod Extensions by pRED*
|
||||||
* detourhelpers.h entirely stolen from CSS:DM and were written by BAILOPAN (I assume).
|
* detourhelpers.h entirely stolen from CSS:DM and were written by BAILOPAN (I assume).
|
||||||
* asm.h/c from devmaster.net (thanks cybermind)
|
* asm.h/c from devmaster.net (thanks cybermind) edited by pRED* to handle gcc -fPIC thunks correctly
|
||||||
|
* Concept by Nephyrin Zey (http://www.doublezen.net/) and Windows Detour Library (http://research.microsoft.com/sn/detours/)
|
||||||
|
* Member function pointer ideas by Don Clugston (http://www.codeproject.com/cpp/FastDelegate.asp)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define DETOUR_MEMBER_CALL(name) (this->*name##_Actual)
|
||||||
|
#define DETOUR_STATIC_CALL(name) (name##_Actual)
|
||||||
|
|
||||||
|
#define DETOUR_DECL_STATIC0(name, ret) \
|
||||||
|
ret (*name##_Actual)(void) = NULL; \
|
||||||
|
ret name(void)
|
||||||
|
|
||||||
|
#define DETOUR_DECL_STATIC1(name, ret, p1type, p1name) \
|
||||||
|
ret (*name##_Actual)(p1type) = NULL; \
|
||||||
|
ret name(p1type p1name)
|
||||||
|
|
||||||
|
#define DETOUR_DECL_STATIC4(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name) \
|
||||||
|
ret (*name##_Actual)(p1type, p2type, p3type, p4type) = NULL; \
|
||||||
|
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name)
|
||||||
|
|
||||||
|
#define DETOUR_DECL_MEMBER0(name, ret) \
|
||||||
|
class name##Class \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
ret name(); \
|
||||||
|
static ret (name##Class::* name##_Actual)(void); \
|
||||||
|
}; \
|
||||||
|
ret (name##Class::* name##Class::name##_Actual)(void) = NULL; \
|
||||||
|
ret name##Class::name()
|
||||||
|
|
||||||
|
#define DETOUR_DECL_MEMBER1(name, ret, p1type, p1name) \
|
||||||
|
class name##Class \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
ret name(p1type p1name); \
|
||||||
|
static ret (name##Class::* name##_Actual)(p1type); \
|
||||||
|
}; \
|
||||||
|
ret (name##Class::* name##Class::name##_Actual)(p1type) = NULL; \
|
||||||
|
ret name##Class::name(p1type p1name)
|
||||||
|
|
||||||
|
#define DETOUR_DECL_MEMBER2(name, ret, p1type, p1name, p2type, p2name) \
|
||||||
|
class name##Class \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
ret name(p1type p1name, p2type p2name); \
|
||||||
|
static ret (name##Class::* name##_Actual)(p1type, p2type); \
|
||||||
|
}; \
|
||||||
|
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type) = NULL; \
|
||||||
|
ret name##Class::name(p1type p1name, p2type p2name)
|
||||||
|
|
||||||
|
#define DETOUR_DECL_MEMBER3(name, ret, p1type, p1name, p2type, p2name, p3type, p3name) \
|
||||||
|
class name##Class \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
ret name(p1type p1name, p2type p2name, p3type p3name); \
|
||||||
|
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type); \
|
||||||
|
}; \
|
||||||
|
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type) = NULL; \
|
||||||
|
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name)
|
||||||
|
|
||||||
|
#define DETOUR_DECL_MEMBER4(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name) \
|
||||||
|
class name##Class \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name); \
|
||||||
|
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type, p4type); \
|
||||||
|
}; \
|
||||||
|
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type) = NULL; \
|
||||||
|
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name)
|
||||||
|
|
||||||
|
|
||||||
|
#define GET_MEMBER_CALLBACK(name) (void *)GetCodeAddress(&name##Class::name)
|
||||||
|
#define GET_MEMBER_TRAMPOLINE(name) (void **)(&name##Class::name##_Actual)
|
||||||
|
|
||||||
|
#define GET_STATIC_CALLBACK(name) (void *)&name
|
||||||
|
#define GET_STATIC_TRAMPOLINE(name) (void **)&name##_Actual
|
||||||
|
|
||||||
|
#define DETOUR_CREATE_MEMBER(name, gamedata) CDetourManager::CreateDetour(GET_MEMBER_CALLBACK(name), GET_MEMBER_TRAMPOLINE(name), gamedata);
|
||||||
|
#define DETOUR_CREATE_STATIC(name, gamedata) CDetourManager::CreateDetour(GET_STATIC_CALLBACK(name), GET_STATIC_TRAMPOLINE(name), gamedata);
|
||||||
|
|
||||||
|
|
||||||
|
class GenericClass {};
|
||||||
|
typedef void (GenericClass::*VoidFunc)();
|
||||||
|
|
||||||
|
inline void *GetCodeAddr(VoidFunc mfp)
|
||||||
|
{
|
||||||
|
return *(void **)&mfp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a member function pointer to a void pointer.
|
||||||
|
* This relies on the assumption that the code address lies at mfp+0
|
||||||
|
* This is the case for both g++ and later MSVC versions on non virtual functions but may be different for other compilers
|
||||||
|
* Based on research by Don Clugston : http://www.codeproject.com/cpp/FastDelegate.asp
|
||||||
|
*/
|
||||||
|
#define GetCodeAddress(mfp) GetCodeAddr(reinterpret_cast<VoidFunc>(mfp))
|
||||||
|
|
||||||
class CDetourManager;
|
class CDetourManager;
|
||||||
|
|
||||||
class CDetour
|
class CDetour
|
||||||
@@ -57,11 +151,12 @@ public:
|
|||||||
void EnableDetour();
|
void EnableDetour();
|
||||||
void DisableDetour();
|
void DisableDetour();
|
||||||
|
|
||||||
|
void Destroy();
|
||||||
|
|
||||||
friend class CDetourManager;
|
friend class CDetourManager;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CDetour(void *callbackfunction, size_t paramsize, const char *signame);
|
CDetour(void *callbackfunction, void **trampoline, const char *signame);
|
||||||
~CDetour();
|
|
||||||
|
|
||||||
bool Init(ISourcePawnEngine *spengine, IGameConfig *gameconf);
|
bool Init(ISourcePawnEngine *spengine, IGameConfig *gameconf);
|
||||||
private:
|
private:
|
||||||
@@ -74,42 +169,16 @@ private:
|
|||||||
bool detoured;
|
bool detoured;
|
||||||
|
|
||||||
patch_t detour_restore;
|
patch_t detour_restore;
|
||||||
|
/* Address of the detoured function */
|
||||||
void *detour_address;
|
void *detour_address;
|
||||||
|
/* Address of the allocated trampoline function */
|
||||||
|
void *detour_trampoline;
|
||||||
|
/* Address of the callback handler */
|
||||||
void *detour_callback;
|
void *detour_callback;
|
||||||
|
/* The function pointer used to call our trampoline */
|
||||||
|
void **trampoline;
|
||||||
|
|
||||||
const char *signame;
|
const char *signame;
|
||||||
|
|
||||||
void *callbackfunction;
|
|
||||||
|
|
||||||
size_t paramsize;
|
|
||||||
|
|
||||||
ISourcePawnEngine *spengine;
|
|
||||||
IGameConfig *gameconf;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CBlocker
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void EnableBlock(int returnValue = 0);
|
|
||||||
void DisableBlock();
|
|
||||||
|
|
||||||
friend class CDetourManager;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
CBlocker(const char *signame, bool isVoid);
|
|
||||||
~CBlocker();
|
|
||||||
|
|
||||||
bool Init(ISourcePawnEngine *spengine, IGameConfig *gameconf);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool isValid;
|
|
||||||
bool isEnabled;
|
|
||||||
bool isVoid;
|
|
||||||
patch_t block_restore;
|
|
||||||
void *block_address;
|
|
||||||
|
|
||||||
const char *block_sig;
|
|
||||||
|
|
||||||
ISourcePawnEngine *spengine;
|
ISourcePawnEngine *spengine;
|
||||||
IGameConfig *gameconf;
|
IGameConfig *gameconf;
|
||||||
};
|
};
|
||||||
@@ -118,25 +187,13 @@ class CDetourManager
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
|
||||||
* Return Types for Detours
|
|
||||||
*/
|
|
||||||
enum DetourReturn
|
|
||||||
{
|
|
||||||
DetourReturn_Ignored = 0, /** Ignore our result and let the original function run */
|
|
||||||
DetourReturn_Override = 1, /** Block the original function from running and use our return value */
|
|
||||||
};
|
|
||||||
|
|
||||||
static void Init(ISourcePawnEngine *spengine, IGameConfig *gameconf);
|
static void Init(ISourcePawnEngine *spengine, IGameConfig *gameconf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new detour
|
* Creates a new detour
|
||||||
* @param callbackfunction Void pointer to your detour callback function. This should be a static function.
|
*
|
||||||
* It should have pointer to the thisptr as the first param and then the same params
|
* @param callbackfunction Void pointer to your detour callback function.
|
||||||
* as the original function. Use void * for unknown types.
|
* @param trampoline Address of the trampoline pointer
|
||||||
* @param paramsize This is usually the number of params the function has (not including thisptr). If the function
|
|
||||||
* passes complex types by value you need to add the sizeof() the type (aligned to 4 bytes).
|
|
||||||
* Ie: passing something of size 8 would count as 2 in the param count.
|
|
||||||
* @param signame Section name containing a signature to fetch from the gamedata file.
|
* @param signame Section name containing a signature to fetch from the gamedata file.
|
||||||
* @return A new CDetour pointer to control your detour.
|
* @return A new CDetour pointer to control your detour.
|
||||||
*
|
*
|
||||||
@@ -144,37 +201,34 @@ public:
|
|||||||
*
|
*
|
||||||
* CBaseServer::ConnectClient(netadr_s &, int, int, int, char const*, char const*, char const*, int)
|
* CBaseServer::ConnectClient(netadr_s &, int, int, int, char const*, char const*, char const*, int)
|
||||||
*
|
*
|
||||||
* Callback:
|
* Define a new class with the required function and a member function pointer to the same type:
|
||||||
* DetourReturn ConnectClientDetour(void *CBaseServer, void *netaddr_s, int something, int something2, int something3, char const* name, char const* pass, const char* steamcert, int len);
|
*
|
||||||
|
* class CBaseServerDetour
|
||||||
|
* {
|
||||||
|
* public:
|
||||||
|
* bool ConnectClient(void *netaddr_s, int, int, int, char const*, char const*, char const*, int);
|
||||||
|
* static bool (CBaseServerDetour::* ConnectClient_Actual)(void *netaddr_s, int, int, int, char const*, char const*, char const*, int);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* void *callbackfunc = GetCodeAddress(&CBaseServerDetour::ConnectClient);
|
||||||
|
* void **trampoline = (void **)(&CBaseServerDetour::ConnectClient_Actual);
|
||||||
*
|
*
|
||||||
* Creation:
|
* Creation:
|
||||||
* CDetourManager::CreateDetour((void *)&ConnectClientDetour, 8, "ConnectClient");
|
* CDetourManager::CreateDetour(callbackfunc, trampoline, "ConnectClient");
|
||||||
*/
|
|
||||||
static CDetour *CreateDetour(void *callbackfunction, size_t paramsize, const char *signame);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes a detour
|
|
||||||
*/
|
|
||||||
static void DeleteDetour(CDetour *detour);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a function blocker. This is slightly faster than a detour because it avoids a call.
|
|
||||||
*
|
*
|
||||||
* @param signame Section name containing a signature to fetch from the gamedata file.
|
* Usage:
|
||||||
* @param isVoid Specifies if the function can return void.
|
*
|
||||||
|
* CBaseServerDetour::ConnectClient(void *netaddr_s, int, int, int, char const*, char const*, char const*, int)
|
||||||
|
* {
|
||||||
|
* //pre hook code
|
||||||
|
* bool result = (this->*ConnectClient_Actual)(netaddr_s, rest of params);
|
||||||
|
* //post hook code
|
||||||
|
* return result;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Note we changed the netadr_s reference into a void* to avoid needing to define the type
|
||||||
*/
|
*/
|
||||||
static CBlocker *CreateFunctionBlock(const char *signame, bool isVoid);
|
static CDetour *CreateDetour(void *callbackfunction, void **trampoline, const char *signame);
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete a function blocker.
|
|
||||||
*/
|
|
||||||
static void DeleteFunctionBlock(CBlocker *block);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Global DetourReturn value to use for the current hook
|
|
||||||
*/
|
|
||||||
static int returnValue;
|
|
||||||
|
|
||||||
friend class CBlocker;
|
friend class CBlocker;
|
||||||
friend class CDetour;
|
friend class CDetour;
|
||||||
@@ -184,13 +238,4 @@ private:
|
|||||||
static IGameConfig *gameconf;
|
static IGameConfig *gameconf;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef bool DetourReturn;
|
|
||||||
|
|
||||||
#define DETOUR_RESULT_IGNORED false
|
|
||||||
#define DETOUR_RESULT_OVERRIDE true
|
|
||||||
|
|
||||||
#define SET_DETOUR_RETURN_VALUE(value) CDetourManager::returnValue=(int)value
|
|
||||||
#define RETURN_DETOUR(result) return result
|
|
||||||
#define RETURN_DETOUR_VALUE(result,value) do { SET_DETOUR_RETURN_VALUE(value); return (result); } while(0)
|
|
||||||
|
|
||||||
#endif // _INCLUDE_SOURCEMOD_DETOURS_H_
|
#endif // _INCLUDE_SOURCEMOD_DETOURS_H_
|
||||||
|
|||||||
@@ -1,5 +1,91 @@
|
|||||||
#include "asm.h"
|
#include "asm.h"
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define REG_EAX 0
|
||||||
|
#define REG_ECX 1
|
||||||
|
#define REG_EDX 2
|
||||||
|
#define REG_EBX 3
|
||||||
|
|
||||||
|
#define IA32_MOV_REG_IMM 0xB8 // encoding is +r <imm32>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void Msg( const char *, ... );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a call to a fpic thunk has just been written into dest.
|
||||||
|
* If found replaces it with a direct mov that sets the required register to the value of pc.
|
||||||
|
*
|
||||||
|
* @param dest Destination buffer where a call opcode + addr (5 bytes) has just been written.
|
||||||
|
* @param pc The program counter value that needs to be set (usually the next address from the source).
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
void check_thunks(unsigned char *dest, unsigned char *pc)
|
||||||
|
{
|
||||||
|
#if defined WIN32
|
||||||
|
return;
|
||||||
|
#else
|
||||||
|
/* Step write address back 4 to the start of the function address */
|
||||||
|
unsigned char *writeaddr = dest - 4;
|
||||||
|
unsigned char *calloffset = *(unsigned char **)writeaddr;
|
||||||
|
unsigned char *calladdr = (unsigned char *)(dest + (unsigned int)calloffset);
|
||||||
|
|
||||||
|
/* Lookup name of function being called */
|
||||||
|
if ((*calladdr == 0x8B) && (*(calladdr+2) == 0x24) && (*(calladdr+3) == 0xC3))
|
||||||
|
{
|
||||||
|
//a thunk maybe?
|
||||||
|
char movByte = IA32_MOV_REG_IMM;
|
||||||
|
|
||||||
|
/* Calculate the correct mov opcode */
|
||||||
|
switch (*(calladdr+1))
|
||||||
|
{
|
||||||
|
case 0x04:
|
||||||
|
{
|
||||||
|
movByte += REG_EAX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x1C:
|
||||||
|
{
|
||||||
|
movByte += REG_EBX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x0C:
|
||||||
|
{
|
||||||
|
movByte += REG_ECX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x14:
|
||||||
|
{
|
||||||
|
movByte += REG_EDX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Msg("Unknown thunk: %c\n", *(calladdr+1));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Move our write address back one to where the call opcode was */
|
||||||
|
writeaddr--;
|
||||||
|
|
||||||
|
|
||||||
|
/* Write our mov */
|
||||||
|
*writeaddr = movByte;
|
||||||
|
writeaddr++;
|
||||||
|
|
||||||
|
/* Write the value - The provided program counter value */
|
||||||
|
*(void **)writeaddr = (void *)pc;
|
||||||
|
writeaddr += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//if dest is NULL, returns minimum number of bytes needed to be copied
|
//if dest is NULL, returns minimum number of bytes needed to be copied
|
||||||
//if dest is not NULL, it will copy the bytes to dest as well as fix CALLs and JMPs
|
//if dest is not NULL, it will copy the bytes to dest as well as fix CALLs and JMPs
|
||||||
//http://www.devmaster.net/forums/showthread.php?t=2311
|
//http://www.devmaster.net/forums/showthread.php?t=2311
|
||||||
@@ -195,9 +281,15 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
|
|||||||
//Fix CALL/JMP offset
|
//Fix CALL/JMP offset
|
||||||
if ((opcode & 0xFE) == 0xE8) {
|
if ((opcode & 0xFE) == 0xE8) {
|
||||||
if (operandSize == 4)
|
if (operandSize == 4)
|
||||||
|
{
|
||||||
*(long*)dest = ((func + *(long*)func) - dest);
|
*(long*)dest = ((func + *(long*)func) - dest);
|
||||||
|
|
||||||
|
//pRED* edit. func is the current address of the call address, +4 is the next instruction, so the value of $pc
|
||||||
|
check_thunks(dest+4, func+4);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
*(short*)dest = ((func + *(short*)func) - dest);
|
*(short*)dest = ((func + *(short*)func) - dest);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (operandSize == 4)
|
if (operandSize == 4)
|
||||||
*(unsigned long*)dest = *(unsigned long*)func;
|
*(unsigned long*)dest = *(unsigned long*)func;
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void check_thunks(unsigned char *dest, unsigned char *pc);
|
||||||
|
|
||||||
//if dest is NULL, returns minimum number of bytes needed to be copied
|
//if dest is NULL, returns minimum number of bytes needed to be copied
|
||||||
//if dest is not NULL, it will copy the bytes to dest as well as fix CALLs and JMPs
|
//if dest is not NULL, it will copy the bytes to dest as well as fix CALLs and JMPs
|
||||||
//http://www.devmaster.net/forums/showthread.php?t=2311
|
//http://www.devmaster.net/forums/showthread.php?t=2311
|
||||||
|
|||||||
@@ -39,40 +39,6 @@ CDetour *calcIsAttackCriticalKnifeDetour = NULL;
|
|||||||
|
|
||||||
IForward *g_critForward = NULL;
|
IForward *g_critForward = NULL;
|
||||||
|
|
||||||
void InitialiseDetours()
|
|
||||||
{
|
|
||||||
calcIsAttackCriticalDetour = CDetourManager::CreateDetour((void *)&TempDetour, 0, "CalcCritical");
|
|
||||||
calcIsAttackCriticalMeleeDetour = CDetourManager::CreateDetour((void *)&TempDetour, 0, "CalcCriticalMelee");
|
|
||||||
calcIsAttackCriticalKnifeDetour = CDetourManager::CreateDetour((void *)&TempDetour, 0, "CalcCriticalKnife");
|
|
||||||
|
|
||||||
bool HookCreated = false;
|
|
||||||
|
|
||||||
if (calcIsAttackCriticalDetour != NULL)
|
|
||||||
{
|
|
||||||
calcIsAttackCriticalDetour->EnableDetour();
|
|
||||||
HookCreated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (calcIsAttackCriticalMeleeDetour != NULL)
|
|
||||||
{
|
|
||||||
calcIsAttackCriticalMeleeDetour->EnableDetour();
|
|
||||||
HookCreated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (calcIsAttackCriticalKnifeDetour != NULL)
|
|
||||||
{
|
|
||||||
calcIsAttackCriticalKnifeDetour->EnableDetour();
|
|
||||||
HookCreated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!HookCreated)
|
|
||||||
{
|
|
||||||
g_pSM->LogError(myself, "No critical hit forwards could be initialized - Disabled critical hit hooks");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int CheckBaseHandle(CBaseHandle &hndl)
|
int CheckBaseHandle(CBaseHandle &hndl)
|
||||||
{
|
{
|
||||||
if (!hndl.IsValid())
|
if (!hndl.IsValid())
|
||||||
@@ -106,9 +72,9 @@ int CheckBaseHandle(CBaseHandle &hndl)
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
DetourReturn TempDetour(void *pWeapon)
|
DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelper, bool)
|
||||||
{
|
{
|
||||||
edict_t *pEdict = gameents->BaseEntityToEdict((CBaseEntity *)pWeapon);
|
edict_t *pEdict = gameents->BaseEntityToEdict((CBaseEntity *)this);
|
||||||
|
|
||||||
if (!pEdict)
|
if (!pEdict)
|
||||||
{
|
{
|
||||||
@@ -132,7 +98,7 @@ DetourReturn TempDetour(void *pWeapon)
|
|||||||
|
|
||||||
int returnValue=0;
|
int returnValue=0;
|
||||||
|
|
||||||
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pWeapon + info.actual_offset);
|
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)this + info.actual_offset);
|
||||||
int index = CheckBaseHandle(hndl);
|
int index = CheckBaseHandle(hndl);
|
||||||
|
|
||||||
g_critForward->PushCell(index); //Client index
|
g_critForward->PushCell(index); //Client index
|
||||||
@@ -146,18 +112,52 @@ DetourReturn TempDetour(void *pWeapon)
|
|||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
RETURN_DETOUR_VALUE(DETOUR_RESULT_OVERRIDE, returnValue);
|
return !!returnValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RETURN_DETOUR_VALUE(DETOUR_RESULT_IGNORED, returnValue);
|
return DETOUR_MEMBER_CALL(CalcIsAttackCriticalHelper)();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InitialiseDetours()
|
||||||
|
{
|
||||||
|
calcIsAttackCriticalDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelper, "CalcCritical");
|
||||||
|
calcIsAttackCriticalMeleeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelper, "CalcCriticalMelee");
|
||||||
|
calcIsAttackCriticalKnifeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelper, "CalcCriticalKnife");
|
||||||
|
|
||||||
|
bool HookCreated = false;
|
||||||
|
|
||||||
|
if (calcIsAttackCriticalDetour != NULL)
|
||||||
|
{
|
||||||
|
calcIsAttackCriticalDetour->EnableDetour();
|
||||||
|
HookCreated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (calcIsAttackCriticalMeleeDetour != NULL)
|
||||||
|
{
|
||||||
|
calcIsAttackCriticalMeleeDetour->EnableDetour();
|
||||||
|
HookCreated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (calcIsAttackCriticalKnifeDetour != NULL)
|
||||||
|
{
|
||||||
|
calcIsAttackCriticalKnifeDetour->EnableDetour();
|
||||||
|
HookCreated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!HookCreated)
|
||||||
|
{
|
||||||
|
g_pSM->LogError(myself, "No critical hit forwards could be initialized - Disabled critical hit hooks");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void RemoveDetours()
|
void RemoveDetours()
|
||||||
{
|
{
|
||||||
CDetourManager::DeleteDetour(calcIsAttackCriticalDetour);
|
calcIsAttackCriticalDetour->Destroy();
|
||||||
CDetourManager::DeleteDetour(calcIsAttackCriticalMeleeDetour);
|
calcIsAttackCriticalMeleeDetour->Destroy();
|
||||||
CDetourManager::DeleteDetour(calcIsAttackCriticalKnifeDetour);
|
calcIsAttackCriticalKnifeDetour->Destroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,6 @@
|
|||||||
void InitialiseDetours();
|
void InitialiseDetours();
|
||||||
void RemoveDetours();
|
void RemoveDetours();
|
||||||
|
|
||||||
bool TempDetour(void *pWeapon);
|
|
||||||
|
|
||||||
extern IForward *g_critForward;
|
extern IForward *g_critForward;
|
||||||
|
|
||||||
extern IServerGameEnts *gameents;
|
extern IServerGameEnts *gameents;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ bool TF2Tools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
char conf_error[255] = "";
|
char conf_error[255] = "";
|
||||||
if (!gameconfs->LoadGameConfigFile("sm-tf2.games", &g_pGameConf, conf_error, sizeof(conf_error)))
|
if (!gameconfs->LoadGameConfigFile("sm-tf2.games", &g_pGameConf, conf_error, sizeof(conf_error)))
|
||||||
{
|
{
|
||||||
if (conf_error)
|
if (conf_error[0])
|
||||||
{
|
{
|
||||||
UTIL_Format(error, maxlength, "Could not read sm-tf2.games.txt: %s", conf_error);
|
UTIL_Format(error, maxlength, "Could not read sm-tf2.games.txt: %s", conf_error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
#define _INCLUDE_SDKTOOLS_VERSION_H_
|
#define _INCLUDE_SDKTOOLS_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
|
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ unsigned int TopMenu::AddToMenu2(const char *name,
|
|||||||
cat->serial = 1;
|
cat->serial = 1;
|
||||||
|
|
||||||
/* Add it, then update our serial change number. */
|
/* Add it, then update our serial change number. */
|
||||||
|
obj->cat_id = m_Categories.size();
|
||||||
m_Categories.push_back(cat);
|
m_Categories.push_back(cat);
|
||||||
m_SerialNo++;
|
m_SerialNo++;
|
||||||
|
|
||||||
@@ -257,6 +258,7 @@ unsigned int TopMenu::AddToMenu2(const char *name,
|
|||||||
else if (obj->type == TopMenuObject_Item)
|
else if (obj->type == TopMenuObject_Item)
|
||||||
{
|
{
|
||||||
/* Update the category, mark it as needing changes */
|
/* Update the category, mark it as needing changes */
|
||||||
|
obj->cat_id = 0;
|
||||||
parent_cat->obj_list.push_back(obj);
|
parent_cat->obj_list.push_back(obj);
|
||||||
parent_cat->reorder = true;
|
parent_cat->reorder = true;
|
||||||
parent_cat->serial++;
|
parent_cat->serial++;
|
||||||
@@ -407,6 +409,12 @@ bool TopMenu::DisplayMenu(int client, unsigned int hold_time, TopMenuPosition po
|
|||||||
|
|
||||||
UpdateClientRoot(client, pPlayer);
|
UpdateClientRoot(client, pPlayer);
|
||||||
|
|
||||||
|
/* This is unfortunate but it's the best solution. */
|
||||||
|
for (size_t i = 0; i < m_Categories.size(); i++)
|
||||||
|
{
|
||||||
|
UpdateClientCategory(client, i, true);
|
||||||
|
}
|
||||||
|
|
||||||
topmenu_player_t *pClient = &m_clients[client];
|
topmenu_player_t *pClient = &m_clients[client];
|
||||||
if (pClient->root == NULL)
|
if (pClient->root == NULL)
|
||||||
{
|
{
|
||||||
@@ -443,8 +451,7 @@ bool TopMenu::DisplayCategory(int client, unsigned int category, unsigned int ho
|
|||||||
UpdateClientCategory(client, category);
|
UpdateClientCategory(client, category);
|
||||||
|
|
||||||
topmenu_player_t *pClient = &m_clients[client];
|
topmenu_player_t *pClient = &m_clients[client];
|
||||||
if (category >= pClient->cat_count
|
if (category >= pClient->cat_count || pClient->cats[category].menu == NULL)
|
||||||
|| pClient->cats[category].menu == NULL)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -488,18 +495,16 @@ void TopMenu::OnMenuSelect2(IBaseMenu *menu, int client, unsigned int item, unsi
|
|||||||
if (obj->type == TopMenuObject_Category)
|
if (obj->type == TopMenuObject_Category)
|
||||||
{
|
{
|
||||||
/* If it's a category, the user wants to view it.. */
|
/* If it's a category, the user wants to view it.. */
|
||||||
for (size_t i = 0; i < m_Categories.size(); i++)
|
assert(obj->cat_id < m_Categories.size());
|
||||||
|
assert(m_Categories[obj->cat_id]->obj == obj);
|
||||||
|
pClient->last_root_pos = item_on_page;
|
||||||
|
if (!DisplayCategory(client, obj->cat_id, MENU_TIME_FOREVER, false))
|
||||||
{
|
{
|
||||||
if (m_Categories[i]->obj == obj)
|
/* If we can't display the category, re-display the root menu.
|
||||||
{
|
* This code should be dead as of bug 3256, which disables categories
|
||||||
pClient->last_root_pos = item_on_page;
|
* that cannot be displayed.
|
||||||
if (!DisplayCategory(client, (unsigned int)i, MENU_TIME_FOREVER, false))
|
*/
|
||||||
{
|
DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot);
|
||||||
/* If we can't display the category, re-display the root menu */
|
|
||||||
DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -535,6 +540,19 @@ void TopMenu::OnMenuDrawItem(IBaseMenu *menu, int client, unsigned int item, uns
|
|||||||
|
|
||||||
obj = *pObject;
|
obj = *pObject;
|
||||||
|
|
||||||
|
/* If the category has nothing to display, disable it. */
|
||||||
|
if (obj->type == TopMenuObject_Category)
|
||||||
|
{
|
||||||
|
assert(obj->cat_id < m_Categories.size());
|
||||||
|
assert(m_Categories[obj->cat_id]->obj == obj);
|
||||||
|
topmenu_player_t *pClient = &m_clients[client];
|
||||||
|
if (obj->cat_id >= pClient->cat_count || pClient->cats[obj->cat_id].menu == NULL)
|
||||||
|
{
|
||||||
|
style = ITEMDRAW_IGNORE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
style = obj->callbacks->OnTopMenuDrawOption(this, client, obj->object_id);
|
style = obj->callbacks->OnTopMenuDrawOption(this, client, obj->object_id);
|
||||||
if (style != ITEMDRAW_DEFAULT)
|
if (style != ITEMDRAW_DEFAULT)
|
||||||
{
|
{
|
||||||
@@ -701,13 +719,18 @@ void TopMenu::UpdateClientRoot(int client, IGamePlayer *pGamePlayer)
|
|||||||
pClient->last_root_pos = 0;
|
pClient->last_root_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopMenu::UpdateClientCategory(int client, unsigned int category)
|
void TopMenu::UpdateClientCategory(int client, unsigned int category, bool bSkipRootCheck)
|
||||||
{
|
{
|
||||||
|
bool has_access = false;
|
||||||
|
|
||||||
/* Update the client's root menu just in case it needs it. This
|
/* Update the client's root menu just in case it needs it. This
|
||||||
* will validate that we have both a valid client and a valid
|
* will validate that we have both a valid client and a valid
|
||||||
* category structure for that client.
|
* category structure for that client.
|
||||||
*/
|
*/
|
||||||
UpdateClientRoot(client);
|
if (!bSkipRootCheck)
|
||||||
|
{
|
||||||
|
UpdateClientRoot(client);
|
||||||
|
}
|
||||||
|
|
||||||
/* Now it's guaranteed that our category tables will be usable */
|
/* Now it's guaranteed that our category tables will be usable */
|
||||||
topmenu_player_t *pClient = &m_clients[client];
|
topmenu_player_t *pClient = &m_clients[client];
|
||||||
@@ -744,6 +767,13 @@ void TopMenu::UpdateClientCategory(int client, unsigned int category)
|
|||||||
for (size_t i = 0; i < cat->sorted.size(); i++)
|
for (size_t i = 0; i < cat->sorted.size(); i++)
|
||||||
{
|
{
|
||||||
cat_menu->AppendItem(cat->sorted[i]->name, ItemDrawInfo(""));
|
cat_menu->AppendItem(cat->sorted[i]->name, ItemDrawInfo(""));
|
||||||
|
if (!has_access && adminsys->CheckAccess(client,
|
||||||
|
cat->sorted[i]->cmdname,
|
||||||
|
cat->sorted[i]->flags,
|
||||||
|
false))
|
||||||
|
{
|
||||||
|
has_access = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now handle unsorted items */
|
/* Now handle unsorted items */
|
||||||
@@ -761,20 +791,39 @@ void TopMenu::UpdateClientCategory(int client, unsigned int category)
|
|||||||
item->name,
|
item->name,
|
||||||
sizeof(item->name));
|
sizeof(item->name));
|
||||||
item->obj_index = (unsigned int)i;
|
item->obj_index = (unsigned int)i;
|
||||||
|
if (!has_access && adminsys->CheckAccess(client, obj->cmdname, obj->flags, false))
|
||||||
|
{
|
||||||
|
has_access = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sort the names */
|
if (has_access)
|
||||||
qsort(item_list, cat->unsorted.size(), sizeof(obj_by_name_t), _SortObjectNamesDescending);
|
|
||||||
|
|
||||||
/* Add to the menu */
|
|
||||||
for (size_t i = 0; i < cat->unsorted.size(); i++)
|
|
||||||
{
|
{
|
||||||
cat_menu->AppendItem(cat->unsorted[item_list[i].obj_index]->name, ItemDrawInfo(""));
|
/* Sort the names */
|
||||||
|
qsort(item_list,
|
||||||
|
cat->unsorted.size(),
|
||||||
|
sizeof(obj_by_name_t),
|
||||||
|
_SortObjectNamesDescending);
|
||||||
|
|
||||||
|
/* Add to the menu */
|
||||||
|
for (size_t i = 0; i < cat->unsorted.size(); i++)
|
||||||
|
{
|
||||||
|
cat_menu->AppendItem(cat->unsorted[item_list[i].obj_index]->name, ItemDrawInfo(""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] item_list;
|
delete [] item_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the player has access to no items, don't draw a menu. */
|
||||||
|
if (!has_access)
|
||||||
|
{
|
||||||
|
cat_menu->Destroy();
|
||||||
|
player_cat->menu = NULL;
|
||||||
|
player_cat->serial = cat->serial;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the menu's title */
|
/* Set the menu's title */
|
||||||
char renderbuf[128];
|
char renderbuf[128];
|
||||||
cat->obj->callbacks->OnTopMenuDisplayTitle(this,
|
cat->obj->callbacks->OnTopMenuDisplayTitle(this,
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ struct topmenu_object_t
|
|||||||
TopMenuObjectType type; /** Object Type */
|
TopMenuObjectType type; /** Object Type */
|
||||||
bool is_free; /** Free or not? */
|
bool is_free; /** Free or not? */
|
||||||
char info[255]; /** Info string */
|
char info[255]; /** Info string */
|
||||||
|
unsigned int cat_id; /** Set if a category */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct topmenu_category_t
|
struct topmenu_category_t
|
||||||
@@ -157,7 +158,7 @@ private:
|
|||||||
bool DisplayCategory(int client, unsigned int category, unsigned int hold_time, bool last_position);
|
bool DisplayCategory(int client, unsigned int category, unsigned int hold_time, bool last_position);
|
||||||
void CreatePlayers(int max_clients);
|
void CreatePlayers(int max_clients);
|
||||||
void UpdateClientRoot(int client, IGamePlayer *pGamePlayer=NULL);
|
void UpdateClientRoot(int client, IGamePlayer *pGamePlayer=NULL);
|
||||||
void UpdateClientCategory(int client, unsigned int category);
|
void UpdateClientCategory(int client, unsigned int category, bool bSkipRootCheck=false);
|
||||||
void TearDownClient(topmenu_player_t *player);
|
void TearDownClient(topmenu_player_t *player);
|
||||||
private:
|
private:
|
||||||
void OnClientConnected(int client);
|
void OnClientConnected(int client);
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
#define _INCLUDE_SQLITEEXT_VERSION_H_
|
#define _INCLUDE_SQLITEEXT_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
|
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
|
||||||
|
|||||||
+22
-1
@@ -58,6 +58,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"ageofchivalry"
|
||||||
|
{
|
||||||
|
"Keys"
|
||||||
|
{
|
||||||
|
"RadioMenuTimeout" "4"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Offsets"
|
||||||
|
{
|
||||||
|
"GetDataDescMap"
|
||||||
|
{
|
||||||
|
"windows" "11"
|
||||||
|
"linux" "12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Which games support ShowMenu?
|
* Which games support ShowMenu?
|
||||||
*/
|
*/
|
||||||
@@ -75,6 +92,8 @@
|
|||||||
"game" "diprip"
|
"game" "diprip"
|
||||||
"game" "synergy"
|
"game" "synergy"
|
||||||
"game" "FortressForever"
|
"game" "FortressForever"
|
||||||
|
"game" "ageofchivalry"
|
||||||
|
"game" "obsidian"
|
||||||
}
|
}
|
||||||
|
|
||||||
"Keys"
|
"Keys"
|
||||||
@@ -93,6 +112,8 @@
|
|||||||
"game" "hl2mp"
|
"game" "hl2mp"
|
||||||
"game" "sourceforts"
|
"game" "sourceforts"
|
||||||
"game" "tf"
|
"game" "tf"
|
||||||
|
"game" "ageofchivalry"
|
||||||
|
"game" "obsidian"
|
||||||
}
|
}
|
||||||
|
|
||||||
"Keys"
|
"Keys"
|
||||||
@@ -136,7 +157,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"synergy"
|
"synergy"
|
||||||
{
|
{
|
||||||
"Keys"
|
"Keys"
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
{
|
{
|
||||||
"game" "dod"
|
"game" "dod"
|
||||||
"game" "tf"
|
"game" "tf"
|
||||||
|
"game" "ageofchivalry"
|
||||||
}
|
}
|
||||||
|
|
||||||
"Offsets"
|
"Offsets"
|
||||||
@@ -81,6 +82,7 @@
|
|||||||
{
|
{
|
||||||
"game" "dod"
|
"game" "dod"
|
||||||
"game" "tf"
|
"game" "tf"
|
||||||
|
"game" "ageofchivalry"
|
||||||
}
|
}
|
||||||
|
|
||||||
"Signatures"
|
"Signatures"
|
||||||
@@ -107,6 +109,7 @@
|
|||||||
{
|
{
|
||||||
"game" "dod"
|
"game" "dod"
|
||||||
"game" "tf"
|
"game" "tf"
|
||||||
|
"game" "ageofchivalry"
|
||||||
}
|
}
|
||||||
|
|
||||||
"Offsets"
|
"Offsets"
|
||||||
@@ -148,6 +151,7 @@
|
|||||||
{
|
{
|
||||||
"game" "dod"
|
"game" "dod"
|
||||||
"game" "tf"
|
"game" "tf"
|
||||||
|
"game" "ageofchivalry"
|
||||||
}
|
}
|
||||||
|
|
||||||
"Offsets"
|
"Offsets"
|
||||||
@@ -226,6 +230,7 @@
|
|||||||
{
|
{
|
||||||
"game" "dod"
|
"game" "dod"
|
||||||
"game" "tf"
|
"game" "tf"
|
||||||
|
"game" "ageofchivalry"
|
||||||
}
|
}
|
||||||
"Signatures"
|
"Signatures"
|
||||||
{
|
{
|
||||||
@@ -313,8 +318,8 @@
|
|||||||
}
|
}
|
||||||
"CommitSuicide"
|
"CommitSuicide"
|
||||||
{
|
{
|
||||||
"windows" "388"
|
"windows" "390"
|
||||||
"linux" "388"
|
"linux" "390"
|
||||||
}
|
}
|
||||||
"GetVelocity"
|
"GetVelocity"
|
||||||
{
|
{
|
||||||
@@ -451,4 +456,180 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Afe of Chivalry */
|
||||||
|
"ageofchivalry"
|
||||||
|
{
|
||||||
|
"Offsets"
|
||||||
|
{
|
||||||
|
"GiveNamedItem"
|
||||||
|
{
|
||||||
|
"windows" "351"
|
||||||
|
"linux" "352"
|
||||||
|
}
|
||||||
|
"RemovePlayerItem"
|
||||||
|
{
|
||||||
|
"windows" "239"
|
||||||
|
"linux" "240"
|
||||||
|
}
|
||||||
|
"Weapon_GetSlot"
|
||||||
|
{
|
||||||
|
"windows" "237"
|
||||||
|
"linux" "238"
|
||||||
|
}
|
||||||
|
"Ignite"
|
||||||
|
{
|
||||||
|
"windows" "194"
|
||||||
|
"linux" "195"
|
||||||
|
}
|
||||||
|
"Extinguish"
|
||||||
|
{
|
||||||
|
"windows" "198"
|
||||||
|
"linux" "199"
|
||||||
|
}
|
||||||
|
"Teleport"
|
||||||
|
{
|
||||||
|
"windows" "101"
|
||||||
|
"linux" "102"
|
||||||
|
}
|
||||||
|
"CommitSuicide"
|
||||||
|
{
|
||||||
|
"windows" "389"
|
||||||
|
"linux" "389"
|
||||||
|
}
|
||||||
|
"GetVelocity"
|
||||||
|
{
|
||||||
|
"windows" "130"
|
||||||
|
"linux" "131"
|
||||||
|
}
|
||||||
|
"EyeAngles"
|
||||||
|
{
|
||||||
|
"windows" "122"
|
||||||
|
"linux" "123"
|
||||||
|
}
|
||||||
|
"AcceptInput"
|
||||||
|
{
|
||||||
|
"windows" "34"
|
||||||
|
"linux" "35"
|
||||||
|
}
|
||||||
|
"DispatchKeyValue"
|
||||||
|
{
|
||||||
|
"windows" "29"
|
||||||
|
"linux" "28"
|
||||||
|
}
|
||||||
|
"DispatchKeyValueFloat"
|
||||||
|
{
|
||||||
|
"windows" "28"
|
||||||
|
"linux" "29"
|
||||||
|
}
|
||||||
|
"DispatchKeyValueVector"
|
||||||
|
{
|
||||||
|
"windows" "27"
|
||||||
|
"linux" "30"
|
||||||
|
}
|
||||||
|
"SetEntityModel"
|
||||||
|
{
|
||||||
|
"windows" "23"
|
||||||
|
"linux" "24"
|
||||||
|
}
|
||||||
|
"WeaponEquip"
|
||||||
|
{
|
||||||
|
"windows" "230"
|
||||||
|
"linux" "231"
|
||||||
|
}
|
||||||
|
"Activate"
|
||||||
|
{
|
||||||
|
"windows" "31"
|
||||||
|
"linux" "32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Obsidian Conflict 1.3 */
|
||||||
|
"obsidian"
|
||||||
|
{
|
||||||
|
"Offsets"
|
||||||
|
{
|
||||||
|
"GiveNamedItem"
|
||||||
|
{
|
||||||
|
"windows" "350"
|
||||||
|
"linux" "351"
|
||||||
|
}
|
||||||
|
"RemovePlayerItem"
|
||||||
|
{
|
||||||
|
"windows" "237"
|
||||||
|
"linux" "238"
|
||||||
|
}
|
||||||
|
"Weapon_GetSlot"
|
||||||
|
{
|
||||||
|
"windows" "235"
|
||||||
|
"linux" "236"
|
||||||
|
}
|
||||||
|
"Ignite"
|
||||||
|
{
|
||||||
|
"windows" "190"
|
||||||
|
"linux" "191"
|
||||||
|
}
|
||||||
|
"Extinguish"
|
||||||
|
{
|
||||||
|
"windows" "194"
|
||||||
|
"linux" "195"
|
||||||
|
}
|
||||||
|
"Teleport"
|
||||||
|
{
|
||||||
|
"windows" "100"
|
||||||
|
"linux" "101"
|
||||||
|
}
|
||||||
|
"CommitSuicide"
|
||||||
|
{
|
||||||
|
"windows" "395"
|
||||||
|
"linux" "395"
|
||||||
|
}
|
||||||
|
"GetVelocity"
|
||||||
|
{
|
||||||
|
"windows" "127"
|
||||||
|
"linux" "128"
|
||||||
|
}
|
||||||
|
"EyeAngles"
|
||||||
|
{
|
||||||
|
"windows" "119"
|
||||||
|
"linux" "120"
|
||||||
|
}
|
||||||
|
"AcceptInput"
|
||||||
|
{
|
||||||
|
"windows" "34"
|
||||||
|
"linux" "35"
|
||||||
|
}
|
||||||
|
"DispatchKeyValue"
|
||||||
|
{
|
||||||
|
"windows" "29"
|
||||||
|
"linux" "28"
|
||||||
|
}
|
||||||
|
"DispatchKeyValueFloat"
|
||||||
|
{
|
||||||
|
"windows" "28"
|
||||||
|
"linux" "29"
|
||||||
|
}
|
||||||
|
"DispatchKeyValueVector"
|
||||||
|
{
|
||||||
|
"windows" "27"
|
||||||
|
"linux" "30"
|
||||||
|
}
|
||||||
|
"SetEntityModel"
|
||||||
|
{
|
||||||
|
"windows" "23"
|
||||||
|
"linux" "24"
|
||||||
|
}
|
||||||
|
"WeaponEquip"
|
||||||
|
{
|
||||||
|
"windows" "228"
|
||||||
|
"linux" "229"
|
||||||
|
}
|
||||||
|
"Activate"
|
||||||
|
{
|
||||||
|
"windows" "31"
|
||||||
|
"linux" "32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-115
@@ -37,8 +37,7 @@
|
|||||||
"game" "!Dystopia"
|
"game" "!Dystopia"
|
||||||
"game" "!Insurgency"
|
"game" "!Insurgency"
|
||||||
"game" "pvkii"
|
"game" "pvkii"
|
||||||
"game" "!SourceForts v1.9.2"
|
"game" "sourceforts"
|
||||||
"game" "$SourceForts v1.9.3"
|
|
||||||
"game" "FortressForever"
|
"game" "FortressForever"
|
||||||
"game" "empires"
|
"game" "empires"
|
||||||
"game" "synergy"
|
"game" "synergy"
|
||||||
@@ -97,8 +96,7 @@
|
|||||||
"game" "!Dystopia"
|
"game" "!Dystopia"
|
||||||
"game" "!Insurgency"
|
"game" "!Insurgency"
|
||||||
"game" "pvkii"
|
"game" "pvkii"
|
||||||
"game" "!SourceForts v1.9.2"
|
"game" "sourceforts"
|
||||||
"game" "$SourceForts v1.9.3"
|
|
||||||
"game" "FortressForever"
|
"game" "FortressForever"
|
||||||
"game" "empires"
|
"game" "empires"
|
||||||
"game" "synergy"
|
"game" "synergy"
|
||||||
@@ -148,8 +146,7 @@
|
|||||||
"game" "ship"
|
"game" "ship"
|
||||||
"game" "!Insurgency"
|
"game" "!Insurgency"
|
||||||
"game" "pvkii"
|
"game" "pvkii"
|
||||||
"game" "!SourceForts v1.9.2"
|
"game" "sourceforts"
|
||||||
"game" "$SourceForts v1.9.3"
|
|
||||||
"game" "FortressForever"
|
"game" "FortressForever"
|
||||||
"game" "empires"
|
"game" "empires"
|
||||||
"game" "synergy"
|
"game" "synergy"
|
||||||
@@ -198,7 +195,7 @@
|
|||||||
"game" "hl2mp"
|
"game" "hl2mp"
|
||||||
"game" "!Insurgency"
|
"game" "!Insurgency"
|
||||||
"game" "pvkii"
|
"game" "pvkii"
|
||||||
"game" "$SourceForts v1.9.3"
|
"game" "sourceforts"
|
||||||
"game" "empires"
|
"game" "empires"
|
||||||
"game" "synergy"
|
"game" "synergy"
|
||||||
"game" "hidden"
|
"game" "hidden"
|
||||||
@@ -743,28 +740,28 @@
|
|||||||
/* CBasePlayer */
|
/* CBasePlayer */
|
||||||
"Ignite"
|
"Ignite"
|
||||||
{
|
{
|
||||||
"windows" "174"
|
"windows" "176"
|
||||||
"linux" "175"
|
"linux" "177"
|
||||||
}
|
}
|
||||||
"Extinguish"
|
"Extinguish"
|
||||||
{
|
{
|
||||||
"windows" "175"
|
"windows" "176"
|
||||||
"linux" "176"
|
"linux" "177"
|
||||||
}
|
}
|
||||||
"Teleport"
|
"Teleport"
|
||||||
{
|
{
|
||||||
"windows" "90"
|
"windows" "91"
|
||||||
"linux" "91"
|
"linux" "92"
|
||||||
}
|
}
|
||||||
"GetVelocity"
|
"GetVelocity"
|
||||||
{
|
{
|
||||||
"windows" "115"
|
"windows" "116"
|
||||||
"linux" "116"
|
"linux" "117"
|
||||||
}
|
}
|
||||||
"EyeAngles"
|
"EyeAngles"
|
||||||
{
|
{
|
||||||
"windows" "107"
|
"windows" "108"
|
||||||
"linux" "108"
|
"linux" "109"
|
||||||
}
|
}
|
||||||
"AcceptInput"
|
"AcceptInput"
|
||||||
{
|
{
|
||||||
@@ -893,102 +890,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SourceForts 1.9.2 */
|
|
||||||
"!SourceForts v1.9.2"
|
|
||||||
{
|
|
||||||
"Offsets"
|
|
||||||
{
|
|
||||||
/* CBasePlayer */
|
|
||||||
"GiveNamedItem"
|
|
||||||
{
|
|
||||||
"windows" "294"
|
|
||||||
"linux" "295"
|
|
||||||
}
|
|
||||||
"RemovePlayerItem"
|
|
||||||
{
|
|
||||||
"windows" "207"
|
|
||||||
"linux" "208"
|
|
||||||
}
|
|
||||||
"Weapon_GetSlot"
|
|
||||||
{
|
|
||||||
"windows" "205"
|
|
||||||
"linux" "206"
|
|
||||||
}
|
|
||||||
"Ignite"
|
|
||||||
{
|
|
||||||
"windows" "170"
|
|
||||||
"linux" "171"
|
|
||||||
}
|
|
||||||
"Extinguish"
|
|
||||||
{
|
|
||||||
"windows" "171"
|
|
||||||
"linux" "172"
|
|
||||||
}
|
|
||||||
"Teleport"
|
|
||||||
{
|
|
||||||
"windows" "90"
|
|
||||||
"linux" "91"
|
|
||||||
}
|
|
||||||
"GetVelocity"
|
|
||||||
{
|
|
||||||
"windows" "114"
|
|
||||||
"linux" "115"
|
|
||||||
}
|
|
||||||
"EyeAngles"
|
|
||||||
{
|
|
||||||
"windows" "106"
|
|
||||||
"linux" "107"
|
|
||||||
}
|
|
||||||
"DispatchKeyValue"
|
|
||||||
{
|
|
||||||
"windows" "30"
|
|
||||||
"linux" "29"
|
|
||||||
}
|
|
||||||
"DispatchKeyValueFloat"
|
|
||||||
{
|
|
||||||
"windows" "29"
|
|
||||||
"linux" "30"
|
|
||||||
}
|
|
||||||
"DispatchKeyValueVector"
|
|
||||||
{
|
|
||||||
"windows" "28"
|
|
||||||
"linux" "31"
|
|
||||||
}
|
|
||||||
"AcceptInput"
|
|
||||||
{
|
|
||||||
"windows" "34"
|
|
||||||
"linux" "35"
|
|
||||||
}
|
|
||||||
"SetEntityModel"
|
|
||||||
{
|
|
||||||
"windows" "25"
|
|
||||||
"linux" "26"
|
|
||||||
}
|
|
||||||
|
|
||||||
"TE_GetServerClass"
|
|
||||||
{
|
|
||||||
"windows" "0"
|
|
||||||
"linux" "0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"Signatures"
|
|
||||||
{
|
|
||||||
"DispatchSpawn"
|
|
||||||
{
|
|
||||||
"library" "server"
|
|
||||||
"linux" "@_Z13DispatchSpawnP11CBaseEntity"
|
|
||||||
"windows" "\x53\x56\x8B\x74\x24\x0C\x85\xF6\x57\x0F\x84\x2A\x2A\x2A\x2A\x8B\x1D\x2A\x2A\x2A\x2A\x8B\x03\x8B\xCB\xFF\x50\x14\x8B\x16\x8B\xCE"
|
|
||||||
}
|
|
||||||
"CreateEntityByName"
|
|
||||||
{
|
|
||||||
"library" "server"
|
|
||||||
"linux" "@_Z18CreateEntityByNamePKci"
|
|
||||||
"windows" "\x56\x8B\x74\x24\x0C\x83\xFE\xFF\x57\x8B\x7C\x24\x0C\x74\x25\x8B\x0D\x2A\x2A\x2A\x2A\x8B\x01\x56\xFF\x50\x54\x85\xC0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fortress Forever */
|
/* Fortress Forever */
|
||||||
"FortressForever"
|
"FortressForever"
|
||||||
{
|
{
|
||||||
@@ -1269,8 +1170,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SourceForts 1.9.3 */
|
"sourceforts"
|
||||||
"$SourceForts v1.9.3"
|
|
||||||
{
|
{
|
||||||
"Offsets"
|
"Offsets"
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,39 +6,39 @@
|
|||||||
{
|
{
|
||||||
"Burn"
|
"Burn"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x56\x8B\xF1\x8B\x8E\x2A\x2A\x00\x00\x8B\x01\x8B\x90\x2A\x2A\x00\x00\xFF\xD2\x84\xC0"
|
"windows" "\x56\x8B\xF1\x8B\x8E\x2A\x2A\x00\x00\x8B\x01\x8B\x90\x2A\x2A\x00\x00\xFF\xD2\x84\xC0"
|
||||||
"linux" "@_ZN15CTFPlayerShared4BurnEP9CTFPlayerP13CTFWeaponBase"
|
"linux" "@_ZN15CTFPlayerShared4BurnEP9CTFPlayerP13CTFWeaponBase"
|
||||||
}
|
}
|
||||||
"RemoveDisguise"
|
"RemoveDisguise"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x51\x56\x8B\xF1\x8B\x46\x2A\x57\x8D\x7E\x2A\x8D\x4C\x24\x08\x83\xE0\xF7"
|
"windows" "\x51\x56\x8B\xF1\x8B\x46\x2A\x57\x8D\x7E\x2A\x8D\x4C\x24\x08\x83\xE0\xF7"
|
||||||
"linux" "@_ZN15CTFPlayerShared14RemoveDisguiseEv"
|
"linux" "@_ZN15CTFPlayerShared14RemoveDisguiseEv"
|
||||||
}
|
}
|
||||||
"Disguise"
|
"Disguise"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x56\x8B\xF1\x8B\x8E\x2A\x2A\x00\x00\xE8\x2A\x2A\x2A\x2A\x8B\x8E\x2A\x2A\x00\x00\x8B\x89\x2A\x2A\x00\x00"
|
"windows" "\x56\x8B\xF1\x8B\x8E\x2A\x2A\x00\x00\xE8\x2A\x2A\x2A\x2A\x8B\x8E\x2A\x2A\x00\x00\x8B\x89\x2A\x2A\x00\x00"
|
||||||
"linux" "@_ZN15CTFPlayerShared8DisguiseEii"
|
"linux" "@_ZN15CTFPlayerShared8DisguiseEii"
|
||||||
}
|
}
|
||||||
"CalcCritical"
|
"CalcCritical"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"linux" "@_ZN13CTFWeaponBase26CalcIsAttackCriticalHelperEv"
|
"linux" "@_ZN13CTFWeaponBase26CalcIsAttackCriticalHelperEv"
|
||||||
"windows" "\x83\xEC\x08\x53\x56\x6A\x00"
|
"windows" "\x83\xEC\x08\x53\x56\x6A\x00"
|
||||||
}
|
}
|
||||||
"CalcCriticalMelee"
|
"CalcCriticalMelee"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"linux" "@_ZN18CTFWeaponBaseMelee26CalcIsAttackCriticalHelperEv"
|
"linux" "@_ZN18CTFWeaponBaseMelee26CalcIsAttackCriticalHelperEv"
|
||||||
"windows" "\x83\xEC\x08\x53\x57\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x8B\xD8"
|
"windows" "\x83\xEC\x08\x53\x57\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x8B\xD8"
|
||||||
}
|
}
|
||||||
"CalcCriticalKnife"
|
"CalcCriticalKnife"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"linux" "@_ZN8CTFKnife26CalcIsAttackCriticalHelperEv"
|
"linux" "@_ZN8CTFKnife26CalcIsAttackCriticalHelperEv"
|
||||||
"windows" "\x33\xC0\x83\xB9\x08\x13\x00\x00\x01\x0F\x94\xC0\xC3"
|
"windows" "\x8B\x81\xF0\x13\x00\x00\x83\xF8\xFF\x74\x29\x8B\x15"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
|
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
|
||||||
|
|||||||
+5
-2
@@ -1,7 +1,7 @@
|
|||||||
[PRODUCT]
|
[PRODUCT]
|
||||||
major = 1
|
major = 1
|
||||||
minor = 1
|
minor = 1
|
||||||
revision = 0
|
revision = 1
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
folder = core
|
folder = core
|
||||||
@@ -73,4 +73,7 @@ folder = extensions/tf2
|
|||||||
in = svn_version.tpl
|
in = svn_version.tpl
|
||||||
out = svn_version.h
|
out = svn_version.h
|
||||||
|
|
||||||
|
[clientprefs]
|
||||||
|
folder = extensions/clientprefs
|
||||||
|
in = svn_version.tpl
|
||||||
|
out = svn_version.h
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ BuildDynamicMenu()
|
|||||||
new count = 1;
|
new count = 1;
|
||||||
decl String:countBuffer[10] = "1";
|
decl String:countBuffer[10] = "1";
|
||||||
|
|
||||||
decl String:inputBuffer[32];
|
decl String:inputBuffer[48];
|
||||||
|
|
||||||
while (KvJumpToKey(kvMenu, countBuffer))
|
while (KvJumpToKey(kvMenu, countBuffer))
|
||||||
{
|
{
|
||||||
@@ -718,4 +718,4 @@ stock bool:UnQuoteString(String:input[], String:output[], maxlen, String:quotech
|
|||||||
output[count] = 0;
|
output[count] = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ public Action:Command_Say(client, args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mapchooser && !HasEndOfMapVoteFinished())
|
if (mapchooser && EndOfMapVoteEnabled() && !HasEndOfMapVoteFinished())
|
||||||
{
|
{
|
||||||
PrintToChat(client, "[SM] %t", "Pending Vote");
|
PrintToChat(client, "[SM] %t", "Pending Vote");
|
||||||
}
|
}
|
||||||
|
|||||||
+219
-219
@@ -1,219 +1,219 @@
|
|||||||
/**
|
/**
|
||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This file is part of the SourceMod/SourcePawn SDK.
|
* This file is part of the SourceMod/SourcePawn SDK.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* 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
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||||
* Free Software Foundation.
|
* Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* 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
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
* 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
|
* 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
|
* "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
|
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||||
* this exception to all derivative works. AlliedModders LLC defines further
|
* this exception to all derivative works. AlliedModders LLC defines further
|
||||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||||
* or <http://www.sourcemod.net/license.php>.
|
* or <http://www.sourcemod.net/license.php>.
|
||||||
*
|
*
|
||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined _tf2_stocks_included
|
#if defined _tf2_stocks_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _tf2_stocks_included
|
#define _tf2_stocks_included
|
||||||
|
|
||||||
#include <tf2>
|
#include <tf2>
|
||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
|
|
||||||
enum TFResourceType
|
enum TFResourceType
|
||||||
{
|
{
|
||||||
TFResource_Ping,
|
TFResource_Ping,
|
||||||
TFResource_Score,
|
TFResource_Score,
|
||||||
TFResource_Deaths,
|
TFResource_Deaths,
|
||||||
TFResource_TotalScore,
|
TFResource_TotalScore,
|
||||||
TFResource_Captures,
|
TFResource_Captures,
|
||||||
TFResource_Defenses,
|
TFResource_Defenses,
|
||||||
TFResource_Dominations,
|
TFResource_Dominations,
|
||||||
TFResource_Revenge,
|
TFResource_Revenge,
|
||||||
TFResource_BuildingsDestroyed,
|
TFResource_BuildingsDestroyed,
|
||||||
TFResource_Headshots,
|
TFResource_Headshots,
|
||||||
TFResource_Backstabs,
|
TFResource_Backstabs,
|
||||||
TFResource_HealPoints,
|
TFResource_HealPoints,
|
||||||
TFResource_Invulns,
|
TFResource_Invulns,
|
||||||
TFResource_Teleports,
|
TFResource_Teleports,
|
||||||
TFResource_ResupplyPoints,
|
TFResource_ResupplyPoints,
|
||||||
TFResource_KillAssists,
|
TFResource_KillAssists,
|
||||||
TFResource_MaxHealth,
|
TFResource_MaxHealth,
|
||||||
TFResource_PlayerClass
|
TFResource_PlayerClass
|
||||||
};
|
};
|
||||||
|
|
||||||
static const String:TFResourceNames[TFResourceType][] =
|
static const String:TFResourceNames[TFResourceType][] =
|
||||||
{
|
{
|
||||||
"m_iPing",
|
"m_iPing",
|
||||||
"m_iScore",
|
"m_iScore",
|
||||||
"m_iDeaths",
|
"m_iDeaths",
|
||||||
"m_iTotalScore",
|
"m_iTotalScore",
|
||||||
"m_iCaptures",
|
"m_iCaptures",
|
||||||
"m_iDefenses",
|
"m_iDefenses",
|
||||||
"m_iDominations",
|
"m_iDominations",
|
||||||
"m_iRevenge",
|
"m_iRevenge",
|
||||||
"m_iBuildingsDestroyed",
|
"m_iBuildingsDestroyed",
|
||||||
"m_iHeadshots",
|
"m_iHeadshots",
|
||||||
"m_iBackstabs",
|
"m_iBackstabs",
|
||||||
"m_iHealPoints",
|
"m_iHealPoints",
|
||||||
"m_iInvulns",
|
"m_iInvulns",
|
||||||
"m_iTeleports",
|
"m_iTeleports",
|
||||||
"m_iResupplyPoints",
|
"m_iResupplyPoints",
|
||||||
"m_iKillAssists",
|
"m_iKillAssists",
|
||||||
"m_iMaxHealth",
|
"m_iMaxHealth",
|
||||||
"m_iPlayerClass"
|
"m_iPlayerClass"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get's a Clients current class.
|
* Get's a Clients current class.
|
||||||
*
|
*
|
||||||
* @param client Player's index.
|
* @param client Player's index.
|
||||||
* @param class TFClassType to change to.
|
* @return Current TFClassType of player.
|
||||||
* @noreturn
|
* @error Invalid client index.
|
||||||
* @error Invalid client index.
|
*/
|
||||||
*/
|
stock TFClassType:TF2_GetPlayerClass(client)
|
||||||
stock TFClassType:TF2_GetPlayerClass(client)
|
{
|
||||||
{
|
return TFClassType:GetEntProp(client, Prop_Send, "m_iClass");
|
||||||
return TFClassType:GetEntProp(client, Prop_Send, "m_iClass");
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Set's a Clients class.
|
||||||
* Set's a Clients class.
|
*
|
||||||
*
|
* Note: If setting player class in a player spawn hook weapons should be set to false.
|
||||||
* Note: If setting player class in a player spawn hook weapons should be set to false.
|
*
|
||||||
*
|
* @param client Player's index.
|
||||||
* @param client Player's index.
|
* @param class TFClassType class symbol.
|
||||||
* @param class TFClassType class symbol.
|
* @param weapons This paramater is ignored.
|
||||||
* @param weapons This paramater is ignored.
|
* @param persistant If true changes the players desired class so the change stays after death.
|
||||||
* @param persistant If true changes the players desired class so the change stays after death.
|
* @noreturn
|
||||||
* @noreturn
|
* @error Invalid client index.
|
||||||
* @error Invalid client index.
|
*/
|
||||||
*/
|
stock TF2_SetPlayerClass(client, TFClassType:class, bool:weapons=true, bool:persistant=true)
|
||||||
stock TF2_SetPlayerClass(client, TFClassType:class, bool:weapons=true, bool:persistant=true)
|
{
|
||||||
{
|
SetEntProp(client, Prop_Send, "m_iClass", _:class);
|
||||||
SetEntProp(client, Prop_Send, "m_iClass", _:class);
|
|
||||||
|
if (persistant)
|
||||||
if (persistant)
|
{
|
||||||
{
|
SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:class);
|
||||||
SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:class);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Retrieves client data from the resource entity
|
||||||
* Retrieves client data from the resource entity
|
*
|
||||||
*
|
* @param client Player's index.
|
||||||
* @param client Player's index.
|
* @param type ResourceType constant
|
||||||
* @param type ResourceType constant
|
* @return Value or -1 on failure.
|
||||||
* @return Value or -1 on failure.
|
* @error Invalid client index, client not in game or failed to find resource entity.
|
||||||
* @error Invalid client index, client not in game or failed to find resource entity.
|
*/
|
||||||
*/
|
stock TF2_GetPlayerResourceData(client, TFResourceType:type)
|
||||||
stock TF2_GetPlayerResourceData(client, TFResourceType:type)
|
{
|
||||||
{
|
if (!IsClientConnected(client))
|
||||||
if (!IsClientConnected(client))
|
{
|
||||||
{
|
return -1;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
|
||||||
new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
|
|
||||||
|
if (offset < 1)
|
||||||
if (offset < 1)
|
{
|
||||||
{
|
return -1;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
new entity = TF2_GetResourceEntity();
|
||||||
new entity = TF2_GetResourceEntity();
|
|
||||||
|
if (entity == -1)
|
||||||
if (entity == -1)
|
{
|
||||||
{
|
return -1;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
return GetEntData(entity, offset + (client*4));
|
||||||
return GetEntData(entity, offset + (client*4));
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Sets client data in the resource entity
|
||||||
* Sets client data in the resource entity
|
*
|
||||||
*
|
* Note: The game overwrites these values every frame, so changing them will have very little effect.
|
||||||
* Note: The game overwrites these values every frame, so changing them will have very little effect.
|
*
|
||||||
*
|
* @param client Player's index.
|
||||||
* @param client Player's index.
|
* @param type ResourceType constant
|
||||||
* @param type ResourceType constant
|
* @param value Value to set.
|
||||||
* @param value Value to set.
|
* @return Value or -1 on failure.
|
||||||
* @return Value or -1 on failure.
|
* @error Invalid client index, client not in game or failed to find resource entity.
|
||||||
* @error Invalid client index, client not in game or failed to find resource entity.
|
*/
|
||||||
*/
|
stock bool:TF2_SetPlayerResourceData(client, TFResourceType:type, any:value)
|
||||||
stock bool:TF2_SetPlayerResourceData(client, TFResourceType:type, any:value)
|
{
|
||||||
{
|
if (!IsClientConnected(client))
|
||||||
if (!IsClientConnected(client))
|
{
|
||||||
{
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
|
||||||
new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
|
|
||||||
|
if (offset < 1)
|
||||||
if (offset < 1)
|
{
|
||||||
{
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
new entity = TF2_GetResourceEntity();
|
||||||
new entity = TF2_GetResourceEntity();
|
|
||||||
|
if (entity == -1)
|
||||||
if (entity == -1)
|
{
|
||||||
{
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
SetEntData(entity, offset + (client*4), value);
|
||||||
SetEntData(entity, offset + (client*4), value);
|
|
||||||
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Removes all weapons from a client's weapon slot
|
||||||
* Removes all weapons from a client's weapon slot
|
*
|
||||||
*
|
* @param client Player's index.
|
||||||
* @param client Player's index.
|
* @param slot Slot index (0-5)
|
||||||
* @param slot Slot index (0-5)
|
* @noreturn
|
||||||
* @noreturn
|
* @error Invalid client, invalid slot or lack of mod support
|
||||||
* @error Invalid client, invalid slot or lack of mod support
|
*/
|
||||||
*/
|
stock TF2_RemoveWeaponSlot(client, slot)
|
||||||
stock TF2_RemoveWeaponSlot(client, slot)
|
{
|
||||||
{
|
new weaponIndex;
|
||||||
new weaponIndex;
|
while ((weaponIndex = GetPlayerWeaponSlot(client, slot)) != -1)
|
||||||
while ((weaponIndex = GetPlayerWeaponSlot(client, slot)) != -1)
|
{
|
||||||
{
|
RemovePlayerItem(client, weaponIndex);
|
||||||
RemovePlayerItem(client, weaponIndex);
|
RemoveEdict(weaponIndex);
|
||||||
RemoveEdict(weaponIndex);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Removes all weapons from a client
|
||||||
* Removes all weapons from a client
|
*
|
||||||
*
|
* @param client Player's index.
|
||||||
* @param client Player's index.
|
* @noreturn
|
||||||
* @noreturn
|
*/
|
||||||
*/
|
stock TF2_RemoveAllWeapons(client)
|
||||||
stock TF2_RemoveAllWeapons(client)
|
{
|
||||||
{
|
for (new i = 0; i <= 5; i++)
|
||||||
for (new i = 0; i <= 5; i++)
|
{
|
||||||
{
|
TF2_RemoveWeaponSlot(client, i);
|
||||||
TF2_RemoveWeaponSlot(client, i);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -37,6 +37,6 @@
|
|||||||
|
|
||||||
#define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */
|
#define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */
|
||||||
#define SOURCEMOD_V_MINOR 1 /**< SourceMod Minor version */
|
#define SOURCEMOD_V_MINOR 1 /**< SourceMod Minor version */
|
||||||
#define SOURCEMOD_V_RELEASE 0 /**< SourceMod Release version */
|
#define SOURCEMOD_V_RELEASE 1 /**< SourceMod Release version */
|
||||||
|
|
||||||
#define SOURCEMOD_VERSION "1.1.0" /**< SourceMod version string (major.minor.release.build) */
|
#define SOURCEMOD_VERSION "1.1.1" /**< SourceMod version string (major.minor.release.build) */
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ public Action:Command_AddGroup(client, args)
|
|||||||
{
|
{
|
||||||
if (args < 2)
|
if (args < 2)
|
||||||
{
|
{
|
||||||
ReplyToCommand(client, "[SM] Usage: sm_sql_addgroup <flags> <name> [immunity]");
|
ReplyToCommand(client, "[SM] Usage: sm_sql_addgroup <name> <flags> [immunity]");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,8 +660,8 @@ public Action:Command_AddGroup(client, args)
|
|||||||
Format(query,
|
Format(query,
|
||||||
sizeof(query),
|
sizeof(query),
|
||||||
"INSERT INTO sm_groups (flags, name, immunity_level) VALUES ('%s', '%s', '%d')",
|
"INSERT INTO sm_groups (flags, name, immunity_level) VALUES ('%s', '%s', '%d')",
|
||||||
safe_name,
|
|
||||||
safe_flags,
|
safe_flags,
|
||||||
|
safe_name,
|
||||||
immunity);
|
immunity);
|
||||||
|
|
||||||
if (!SQL_FastQuery(db, query))
|
if (!SQL_FastQuery(db, query))
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.1.0
|
1.1.1
|
||||||
|
|||||||
+1
-2
@@ -1,2 +1 @@
|
|||||||
a billion and TRILLIONS
|
release 1.1.1
|
||||||
timeout dance
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
|
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
#define _INCLUDE_JIT_VERSION_H_
|
#define _INCLUDE_JIT_VERSION_H_
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
#define SM_BUILD_STRING ""
|
||||||
#define SM_BUILD_UNIQUEID "2439:62cc69f6aa8b" SM_BUILD_STRING
|
#define SM_BUILD_UNIQUEID "2473:49a607a25edc" SM_BUILD_STRING
|
||||||
#define SVN_FULL_VERSION "1.1.0" SM_BUILD_STRING
|
#define SVN_FULL_VERSION "1.1.1" SM_BUILD_STRING
|
||||||
#define SVN_FILE_VERSION 1,1,0,0
|
#define SVN_FILE_VERSION 1,1,1,0
|
||||||
|
|
||||||
#endif //_INCLUDE_JIT_VERSION_H_
|
#endif //_INCLUDE_JIT_VERSION_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user