diff --git a/cheat-base/src/cheat-base/util.cpp b/cheat-base/src/cheat-base/util.cpp index 1557180..3ef4286 100644 --- a/cheat-base/src/cheat-base/util.cpp +++ b/cheat-base/src/cheat-base/util.cpp @@ -172,6 +172,30 @@ namespace util return tokens; } + std::string SplitWords(const std::string& value) + { + std::stringstream outStream; + std::stringstream inStream(value); + + char ch; + inStream >> ch; + outStream << ch; + while (inStream >> ch) + { + if (isupper(ch)) + outStream << " "; + outStream << ch; + } + return outStream.str(); + } + + std::string MakeCapital(std::string value) + { + if (islower(value[0])) + value[0] = toupper(value[0]); + return value; + } + static const std::string base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" diff --git a/cheat-base/src/cheat-base/util.h b/cheat-base/src/cheat-base/util.h index aa09c1b..366bba7 100644 --- a/cheat-base/src/cheat-base/util.h +++ b/cheat-base/src/cheat-base/util.h @@ -37,6 +37,8 @@ namespace util int64_t GetCurrentTimeMillisec(); std::vector StringSplit(const std::string& delimiter, const std::string& content); + std::string SplitWords(const std::string& value); + std::string MakeCapital(std::string value); std::string to_hex_string(uint8_t* barray, int length); bool IsLittleEndian(); diff --git a/cheat-library/src/user/cheat/esp/ESP.cpp b/cheat-library/src/user/cheat/esp/ESP.cpp index b6f9d94..2165fed 100644 --- a/cheat-library/src/user/cheat/esp/ESP.cpp +++ b/cheat-library/src/user/cheat/esp/ESP.cpp @@ -409,31 +409,7 @@ namespace cheat::feature return; } - std::string SplitWords(const std::string& value) - { - std::stringstream outStream; - std::stringstream inStream(value); - - char ch; - inStream >> ch; - outStream << ch; - while (inStream >> ch) - { - if (isupper(ch)) - outStream << " "; - outStream << ch; - } - return outStream.str(); - } - - std::string MakeCapital(std::string value) - { - if (islower(value[0])) - value[0] = toupper(value[0]); - return value; - } - -#define ADD_FILTER_FIELD(section, name) AddFilter(MakeCapital(#section), SplitWords(#name), &game::filters::##section##::##name##) +#define ADD_FILTER_FIELD(section, name) AddFilter(util::MakeCapital(#section), util::SplitWords(#name), &game::filters::##section##::##name##) void ESP::InstallFilters() { ADD_FILTER_FIELD(collection, Book);