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/scripts/client | |
parent | 7133fe80c6615297dfef3653981e766ff5d56038 (diff) | |
download | NorthstarLauncher-1.11.4.tar.gz NorthstarLauncher-1.11.4.zip |
Fix issues of restriction of chat message charset (#391)v1.11.4-rc1v1.11.41.11.X
Diffstat (limited to 'NorthstarDLL/scripts/client')
-rw-r--r-- | NorthstarDLL/scripts/client/clientchathooks.cpp | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/NorthstarDLL/scripts/client/clientchathooks.cpp b/NorthstarDLL/scripts/client/clientchathooks.cpp index d4fa0c41..a1a9e503 100644 --- a/NorthstarDLL/scripts/client/clientchathooks.cpp +++ b/NorthstarDLL/scripts/client/clientchathooks.cpp @@ -1,5 +1,6 @@ #include "pch.h" #include "squirrel/squirrel.h" +#include "util/utils.h" #include "server/serverchathooks.h" #include "client/localchatwriter.h" @@ -8,25 +9,6 @@ AUTOHOOK_INIT() -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; -} - // clang-format off AUTOHOOK(CHudChat__AddGameLine, client.dll + 0x22E580, void, __fastcall, (void* self, const char* message, int inboxId, bool isTeam, bool isDead)) @@ -49,13 +31,7 @@ void, __fastcall, (void* self, const char* message, int inboxId, bool isTeam, bo payload = message + 1; } - for (char* c = const_cast<char*>(message); *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*>(message), true); SQRESULT result = g_pSquirrel<ScriptContext::CLIENT>->Call( "CHudChat_ProcessMessageStartThread", static_cast<int>(senderId) - 1, payload, isTeam, isDead, type); |