diff options
author | p0358 <p0358@users.noreply.github.com> | 2023-01-06 19:00:42 +0100 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-01-06 19:03:07 +0100 |
commit | a9db977bf04973c22f99c4866b0fc43d57cc7ccd (patch) | |
tree | ee46ff15309a79e20a5ba5ef2b0d02a9636f3fcb /NorthstarDLL/server | |
parent | 7133fe80c6615297dfef3653981e766ff5d56038 (diff) | |
download | NorthstarLauncher-a9db977bf04973c22f99c4866b0fc43d57cc7ccd.tar.gz NorthstarLauncher-a9db977bf04973c22f99c4866b0fc43d57cc7ccd.zip |
Fix issues of restriction of chat message charset (#391)v1.11.4-rc1v1.11.41.11.X
Diffstat (limited to 'NorthstarDLL/server')
-rw-r--r-- | NorthstarDLL/server/serverchathooks.cpp | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/NorthstarDLL/server/serverchathooks.cpp b/NorthstarDLL/server/serverchathooks.cpp index eb0034c0..0ea3c2d2 100644 --- a/NorthstarDLL/server/serverchathooks.cpp +++ b/NorthstarDLL/server/serverchathooks.cpp @@ -3,6 +3,7 @@ #include "shared/exploit_fixes/ns_limits.h" #include "squirrel/squirrel.h" #include "server/r2server.h" +#include "util/utils.h" #include <rapidjson/document.h> #include <rapidjson/stringbuffer.h> @@ -34,38 +35,13 @@ void(__fastcall* MessageWriteByte)(int iValue); void(__fastcall* MessageWriteString)(const char* sz); void(__fastcall* MessageWriteBool)(bool bValue); -static char* skip_valid_ansi_csi_sgr(char* str) -{ - if (*str++ != '\x1B') - return NULL; - if (*str++ != '[') // CSI - return NULL; - for (char* c = str; *c; c++) - { - if (*c >= '0' && *c <= '9') - continue; - if (*c == ';') - continue; - if (*c == 'm') // SGR - break; - return NULL; - } - return str; -} - bool bShouldCallSayTextHook = false; // clang-format off AUTOHOOK(_CServerGameDLL__OnReceivedSayTextMessage, server.dll + 0x1595C0, void, __fastcall, (CServerGameDLL* self, unsigned int senderPlayerId, const char* text, bool isTeam)) // clang-format on { - for (char* c = const_cast<char*>(text); *c; c++) - { - if (*c == '\x1B' && (c = skip_valid_ansi_csi_sgr(c))) - c--; - else if (*c <= 9 || (*c >= 12 && *c <= 31)) - *c = ' '; - } + NS::Utils::RemoveAsciiControlSequences(const_cast<char*>(text), true); // MiniHook doesn't allow calling the base function outside of anywhere but the hook function. // To allow bypassing the hook, isSkippingHook can be set. |