diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-08-30 00:52:33 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-08-30 17:54:32 +0200 |
commit | 842e1b6c9b5030c05dab9149a4feb9904d440462 (patch) | |
tree | edc4301ecface91f7381371d512582876724f6fe /src/server/shared/Realm/ClientBuildInfo.h | |
parent | 7627085c1b906a380f1680a14bb0e51b184e1cf4 (diff) |
Core/Client Builds: Refactor build_info structure to support any client variants
(cherry picked from commit e94558d07892a98d78bec3633e0c82e1394b9d66)
# Conflicts:
# sql/base/auth_database.sql
# sql/updates/auth/cata_classic/2024_08_30_00_auth.sql
Diffstat (limited to 'src/server/shared/Realm/ClientBuildInfo.h')
-rw-r--r-- | src/server/shared/Realm/ClientBuildInfo.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/server/shared/Realm/ClientBuildInfo.h b/src/server/shared/Realm/ClientBuildInfo.h index 9d99c28b744..56acd3af3de 100644 --- a/src/server/shared/Realm/ClientBuildInfo.h +++ b/src/server/shared/Realm/ClientBuildInfo.h @@ -25,21 +25,25 @@ namespace ClientBuild { -consteval uint32 operator""_fourcc(char const* chars, std::size_t length) +inline constexpr uint32 ToFourCC(std::string_view text) { - if (length > sizeof(uint32)) - throw "Text can only be max 4 characters long"; - uint32 uintValue = 0; - for (uint8 c : std::string_view(chars, length)) + for (uint8 c : text) { uintValue <<= 8; uintValue |= c; } - return uintValue; } +consteval uint32 operator""_fourcc(char const* chars, std::size_t length) +{ + if (length > sizeof(uint32)) + throw "Text can only be max 4 characters long"; + + return ToFourCC({ chars, length }); +} + TC_SHARED_API std::array<char, 5> ToCharArray(uint32 value); namespace Platform @@ -58,6 +62,8 @@ namespace PlatformType { inline constexpr uint32 Windows = "Win"_fourcc; inline constexpr uint32 macOS = "Mac"_fourcc; + + TC_SHARED_API bool IsValid(std::string_view platformType); } namespace Arch @@ -67,6 +73,8 @@ namespace Arch inline constexpr uint32 Arm32 = "A32"_fourcc; inline constexpr uint32 Arm64 = "A64"_fourcc; inline constexpr uint32 WA32 = "WA32"_fourcc; + + TC_SHARED_API bool IsValid(std::string_view arch); } namespace Type @@ -77,6 +85,8 @@ namespace Type inline constexpr uint32 BetaRelease = "WoWE"_fourcc; inline constexpr uint32 Ptr = "WoWT"_fourcc; inline constexpr uint32 PtrRelease = "WoWR"_fourcc; + + TC_SHARED_API bool IsValid(std::string_view type); } struct VariantId |