From 07904813b5e0694be1c1ba2dfb0ad87ed89be2a5 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 23 Jul 2024 18:51:42 +0800 Subject: [PATCH] [saco] Implement/match `RemoveColorEmbedsFromString(...)` --- saco/game/util.cpp | 14 ++++++++++++++ saco/game/util.h | 1 + saco/subclass.cpp | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/saco/game/util.cpp b/saco/game/util.cpp index 7d54baf..af6d876 100644 --- a/saco/game/util.cpp +++ b/saco/game/util.cpp @@ -1897,6 +1897,20 @@ DWORD GetColorFromEmbedCode(wchar_t *szString) return 0xFFFFFFFF; } +void RemoveColorEmbedsFromString(char *szString) +{ + while(*szString) + { + if(GetColorFromEmbedCode(szString) != 0xFFFFFFFF) + { + strcpy(szString, szString + 8); + continue; + } + szString++; + } + *szString = 0; +} + DWORD unnamed_100B6100(char *szString, int nMaxLen) { char tmp_buf[2049]; diff --git a/saco/game/util.h b/saco/game/util.h index 31db93e..5cfd7be 100644 --- a/saco/game/util.h +++ b/saco/game/util.h @@ -69,3 +69,4 @@ BOOL IsHexChar(char c); BOOL IsHexChar(wchar_t c); DWORD GetColorFromEmbedCode(char *szString); DWORD GetColorFromEmbedCode(wchar_t *szString); +void RemoveColorEmbedsFromString(char *szString); diff --git a/saco/subclass.cpp b/saco/subclass.cpp index 3b053fb..1f0023f 100644 --- a/saco/subclass.cpp +++ b/saco/subclass.cpp @@ -8,7 +8,7 @@ LRESULT APIENTRY NewWndProc(HWND,UINT,WPARAM,LPARAM); //---------------------------------------------------- -void InstallNewWindowProcedure() +void InstallWindowProcedure() { HWND hwndGameWnd = pGame->GetMainWindowHwnd(); @@ -31,7 +31,7 @@ BOOL SubclassGameWindow() DWORD dwStyle = GetClassLong(hwndGameWnd,GCL_STYLE); SetClassLong(hwndGameWnd,GCL_STYLE,dwStyle|CS_DBLCLKS); - InstallNewWindowProcedure(); + InstallWindowProcedure(); SetWindowText(hwndGameWnd,"GTA:SA:MP");