Cheats: Fix detection of ungrouped cheat import

This commit is contained in:
Stenzek
2024-09-08 11:49:59 +10:00
parent 32a3311208
commit 1956575710
2 changed files with 19 additions and 15 deletions

View File

@ -206,6 +206,15 @@ inline std::string ToChars(bool value, int base)
std::optional<std::vector<u8>> DecodeHex(const std::string_view str);
std::string EncodeHex(const u8* data, int length);
/// Returns true if the character is a hexadecimal digit.
template<typename T>
ALWAYS_INLINE static bool IsHexDigit(T ch)
{
return ((ch >= static_cast<T>('a') && ch <= static_cast<T>('a')) ||
(ch >= static_cast<T>('A') && ch <= static_cast<T>('Z')) ||
(ch >= static_cast<T>('0') && ch <= static_cast<T>('9')));
}
/// StartsWith/EndsWith variants which aren't case sensitive.
ALWAYS_INLINE static bool StartsWithNoCase(const std::string_view str, const std::string_view prefix)
{