mirror of
https://github.com/accelerator74/Cleaner.git
synced 2025-12-06 18:18:27 +00:00
1.4.0
Improved performance
This commit is contained in:
parent
de0316c500
commit
d1809a7085
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -142,7 +142,7 @@ jobs:
|
||||
- name: Uploading package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}-${{ matrix.sm_version }}-${{ matrix.os_short }}
|
||||
name: ${{ github.event.repository.name }}-${{ matrix.os_short }}-${{ env.GITHUB_SHA_SHORT }}
|
||||
path: src/build/package
|
||||
|
||||
release:
|
||||
|
||||
@ -10,34 +10,22 @@ SMEXT_LINK(&g_Cleaner);
|
||||
|
||||
CDetour *g_pDetour = 0;
|
||||
|
||||
vector<string> szStrings;
|
||||
unordered_set<string> szStrings;
|
||||
|
||||
#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 < szStrings.size(); ++i)
|
||||
{
|
||||
// make sure we're stripping at least 2 or more chars just in case we accidentally inhale a \0
|
||||
// also there's no reason to strip a single char ever
|
||||
if (szStrings[i].length() >= 2 && strstr(pMessage, szStrings[i].c_str()) != 0)
|
||||
{
|
||||
if (szStrings.find(pMessage) != szStrings.end())
|
||||
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 < szStrings.size(); ++i)
|
||||
{
|
||||
// make sure we're stripping at least 2 or more chars just in case we accidentally inhale a \0
|
||||
// also there's no reason to strip a single char ever
|
||||
if (szStrings[i].length() >= 2 && strstr(text, szStrings[i].c_str()) != 0)
|
||||
{
|
||||
if (szStrings.find(text) != szStrings.end())
|
||||
return SPEW_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
return DETOUR_STATIC_CALL(Detour_DefSpew)(channel, text);
|
||||
}
|
||||
#endif
|
||||
@ -73,17 +61,18 @@ bool Cleaner::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
||||
stripBadChars(line);
|
||||
|
||||
// don't strip tiny (including 1 len or less) strings
|
||||
if (line.length() < 1)
|
||||
if (line.length() >= 2)
|
||||
{
|
||||
rootconsole->ConsolePrint("[CLEANER] Not stripping string on -> L%i with 1 or less length! Length: %i", counter, line.length());
|
||||
szStrings.insert(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
szStrings.push_back(line);
|
||||
rootconsole->ConsolePrint("[CLEANER] Not stripping string on -> L%i with 1 or less length! Length: %i", counter, line.length());
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
|
||||
rootconsole->ConsolePrint("[CLEANER] %i strings added from cleaner.cfg", szStrings.size());
|
||||
cleanerConfig.close();
|
||||
|
||||
@ -105,11 +94,13 @@ bool Cleaner::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
||||
rootconsole->ConsolePrint("[CLEANER] Failed to find signature. Please contact the author.");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined SIG_LINUX_OFFSET
|
||||
#ifdef PLATFORM_LINUX
|
||||
fn = (void *)((intptr_t)fn + SIG_LINUX_OFFSET);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
g_pDetour = DETOUR_CREATE_MEMBER(Detour_LogDirect, fn);
|
||||
#else
|
||||
g_pDetour = DETOUR_CREATE_STATIC(Detour_DefSpew, (gpointer)GetSpewOutputFunc());
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <cctype>
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
/* Basic information exposed publicly */
|
||||
#define SMEXT_CONF_NAME "Console Cleaner"
|
||||
#define SMEXT_CONF_DESCRIPTION "Console warning suppressor"
|
||||
#define SMEXT_CONF_VERSION "1.3.1"
|
||||
#define SMEXT_CONF_VERSION "1.4.0"
|
||||
#define SMEXT_CONF_AUTHOR "Accelerator, Zephyrus"
|
||||
#define SMEXT_CONF_URL "https://github.com/Accelerator74/Cleaner"
|
||||
#define SMEXT_CONF_LOGTAG "Cleaner"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user