Quote:
Originally Posted by Spirit_12
Did you grab the config file from the first post? I didn't look at the source code, so not sure, if there are any signatures in there. I'll check when I get time.
Try this one.
|
I got the same warning again. The cleaner.cfg and cleaner.autoload files are placed in their respective folders.
[03] <FAILED> file "cleaner.ext.2.css.so": Failed to find signature. Please contact the author.
Maybe the author likes only L4D2
If I'm not wrong this is causing the problem.
PHP Code:
#if SOURCE_ENGINE > SE_LEFT4DEAD2
#define WINDOWS_SIGNATURE "\x55\x8B\xEC\x83\xEC\x14\x8B\x45\x08\x53\x8B\xD9\x89\x5D\xFC\x85"
#define WINDOWS_SIG_LENGTH 16
#define LINUX_SIGNATURE "_ZN14CLoggingSystem9LogDirectEi17LoggingSeverity_t5ColorPKc"
#define MAC_SIGNATURE "_ZN14CLoggingSystem9LogDirectEi17LoggingSeverity_t5ColorPKc"
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
#define WINDOWS_SIGNATURE "\x83\xEC\x14\x8B\x44\x24\x18\x8B\x54\x24\x1C\x53\x89\x44\x24\x08\x56\x8D\x04\x40"
#define WINDOWS_SIG_LENGTH 20
#define LINUX_SIGNATURE "_ZN14CLoggingSystem9LogDirectEi17LoggingSeverity_t5ColorPKc"
#define MAC_SIGNATURE "_ZN14CLoggingSystem9LogDirectEi17LoggingSeverity_t5ColorPKc"
#endif
I know exactly nothing about write extensions
Can you update this please (and compile
)?
PHP Code:
#include <sourcemod_version.h>
#include "extension.h"
#if SOURCE_ENGINE > SE_LEFT4DEAD2
#define WINDOWS_SIGNATURE "\x55\x8B\xEC\x83\xEC\x14\x8B\x45\x08\x53\x8B\xD9\x89\x5D\xFC\x85"
#define WINDOWS_SIG_LENGTH 16
#define LINUX_SIGNATURE "_ZN14CLoggingSystem9LogDirectEi17LoggingSeverity_t5ColorPKc"
#define MAC_SIGNATURE "_ZN14CLoggingSystem9LogDirectEi17LoggingSeverity_t5ColorPKc"
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
#define WINDOWS_SIGNATURE "\x83\xEC\x14\x8B\x44\x24\x18\x8B\x54\x24\x1C\x53\x89\x44\x24\x08\x56\x8D\x04\x40"
#define WINDOWS_SIG_LENGTH 20
#define LINUX_SIGNATURE "_ZN14CLoggingSystem9LogDirectEi17LoggingSeverity_t5ColorPKc"
#define MAC_SIGNATURE "_ZN14CLoggingSystem9LogDirectEi17LoggingSeverity_t5ColorPKc"
#endif
IGameConfig *g_pGameConf = NULL;
IMemoryUtils *memutils = NULL;
Cleaner g_Cleaner;
SMEXT_LINK(&g_Cleaner);
CDetour *g_pDetour = 0;
CDetour *g_pPrintf = 0;
char ** g_szStrings;
int g_iStrings = 0;
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
DETOUR_DECL_MEMBER4(Detour_LogDirect, LoggingResponse_t, LoggingChannelID_t, channelID, LoggingSeverity_t, severity, Color, color, const tchar *, pMessage)
{
for(int i=0;i<g_iStrings;++i)
if(strstr(pMessage, g_szStrings[i])!=0)
return LR_CONTINUE;
return DETOUR_MEMBER_CALL(Detour_LogDirect)(channelID, severity, color, pMessage);
}
#else
DETOUR_DECL_STATIC2(Detour_DefSpew, SpewRetval_t, SpewType_t, channel, char *, text)
{
for(int i=0;i<g_iStrings;++i)
if(strstr(text, g_szStrings[i])!=0)
return SPEW_CONTINUE;
return DETOUR_STATIC_CALL(Detour_DefSpew)(channel, text);
}
#endif
bool Cleaner::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
SM_GET_IFACE(MEMORYUTILS, memutils);
CDetourManager::Init(g_pSM->GetScriptingEngine(), 0);
char szPath[256];
g_pSM->BuildPath(Path_SM, szPath, sizeof(szPath), "configs/cleaner.cfg");
FILE * file = fopen(szPath, "r");
if(file==NULL)
{
snprintf(error, maxlength, "Could not read configs/cleaner.cfg.");
return false;
}
int lines = 0;
char str[255];
while(!feof(file))
{
fgets(str, 255, file);
++lines;
}
rewind(file);
int len;
g_szStrings = (char**)malloc(lines*sizeof(char**));
while(!feof(file))
{
g_szStrings[g_iStrings] = (char*)malloc(256*sizeof(char*));
fgets(g_szStrings[g_iStrings], 255, file);
len = strlen(g_szStrings[g_iStrings]);
if(g_szStrings[g_iStrings][len-1]=='\r' || g_szStrings[g_iStrings][len-1]=='\n')
g_szStrings[g_iStrings][len-1]=0;
if(g_szStrings[g_iStrings][len-2]=='\r')
g_szStrings[g_iStrings][len-2]=0;
++g_iStrings;
}
fclose(file);
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
#ifdef PLATFORM_WINDOWS
HMODULE tier0 = GetModuleHandle("tier0.dll");
void * fn = memutils->FindPattern(tier0, WINDOWS_SIGNATURE, WINDOWS_SIG_LENGTH);
#elif defined PLATFORM_LINUX
void * tier0 = dlopen("libtier0.so", RTLD_NOW);
void * fn = memutils->ResolveSymbol(tier0, LINUX_SIGNATURE);
#elif defined PLATFORM_APPLE
void * tier0 = dlopen("libtier0.dylib", RTLD_NOW);
void * fn = memutils->ResolveSymbol(tier0, MAC_SIGNATURE);
#endif
if(!fn)
{
snprintf(error, maxlength, "Failed to find signature. Please contact the author.");
return false;
}
#endif
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
g_pDetour = DETOUR_CREATE_MEMBER_PTR(Detour_LogDirect, fn);
#else
g_pDetour = DETOUR_CREATE_STATIC_PTR(Detour_DefSpew, (gpointer)GetSpewOutputFunc());
#endif
if (g_pDetour == NULL)
{
snprintf(error, maxlength, "Failed to initialize the detours. Please contact the author.");
return false;
}
g_pDetour->EnableDetour();
return true;
}
void Cleaner::SDK_OnUnload()
{
if(g_pDetour)
g_pDetour->Destroy();
delete [] g_szStrings;
}
void Cleaner::SDK_OnAllLoaded()
{
}