TrinityCore
Loading...
Searching...
No Matches
ClientBuildInfo.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_CLIENT_BUILD_INFO_H
19#define TRINITYCORE_CLIENT_BUILD_INFO_H
20
21#include "Define.h"
22#include <array>
23#include <string_view>
24#include <vector>
25
26namespace ClientBuild
27{
28inline constexpr uint32 ToFourCC(std::string_view text)
29{
30 uint32 uintValue = 0;
31 for (uint8 c : text)
32 {
33 uintValue <<= 8;
34 uintValue |= c;
35 }
36 return uintValue;
37}
38
39consteval uint32 operator""_fourcc(char const* chars, std::size_t length)
40{
41 if (length > sizeof(uint32))
42 throw "Text can only be max 4 characters long";
43
44 return ToFourCC({ chars, length });
45}
46
47TC_SHARED_API std::array<char, 5> ToCharArray(uint32 value);
48
49namespace Platform
50{
51 inline constexpr uint32 Win_x86 = "Win"_fourcc;
52 inline constexpr uint32 Win_x64 = "Wn64"_fourcc;
53 inline constexpr uint32 Win_arm64 = "WinA"_fourcc;
54 inline constexpr uint32 Mac_x86 = "Mac"_fourcc;
55 inline constexpr uint32 Mac_x64 = "Mc64"_fourcc;
56 inline constexpr uint32 Mac_arm64 = "MacA"_fourcc;
57
58 TC_SHARED_API bool IsValid(std::string_view platform);
59}
60
61namespace PlatformType
62{
63 inline constexpr uint32 Windows = "Win"_fourcc;
64 inline constexpr uint32 macOS = "Mac"_fourcc;
65
66 TC_SHARED_API bool IsValid(std::string_view platformType);
67}
68
69namespace Arch
70{
71 inline constexpr uint32 x86 = "x86"_fourcc;
72 inline constexpr uint32 x64 = "x64"_fourcc;
73 inline constexpr uint32 Arm32 = "A32"_fourcc;
74 inline constexpr uint32 Arm64 = "A64"_fourcc;
75 inline constexpr uint32 WA32 = "WA32"_fourcc;
76
77 TC_SHARED_API bool IsValid(std::string_view arch);
78}
79
80namespace Type
81{
82 inline constexpr uint32 Retail = "WoW"_fourcc;
83 inline constexpr uint32 RetailChina = "WoWC"_fourcc;
84 inline constexpr uint32 Beta = "WoWB"_fourcc;
85 inline constexpr uint32 BetaRelease = "WoWE"_fourcc;
86 inline constexpr uint32 Ptr = "WoWT"_fourcc;
87 inline constexpr uint32 PtrRelease = "WoWR"_fourcc;
88
89 TC_SHARED_API bool IsValid(std::string_view type);
90}
91
93{
97
98 friend bool operator==(VariantId const& left, VariantId const& right) = default;
99};
100
102{
103 static constexpr std::size_t Size = 16;
104
106 std::array<uint8, Size> Key;
107};
108
118
122}
123
124#endif // TRINITYCORE_CLIENT_BUILD_INFO_H
uint8_t uint8
Definition Define.h:156
#define TC_SHARED_API
Definition Define.h:123
uint32_t uint32
Definition Define.h:154
constexpr uint32 x64
constexpr uint32 WA32
constexpr uint32 Arm64
constexpr uint32 x86
TC_SHARED_API bool IsValid(std::string_view arch)
constexpr uint32 Arm32
TC_SHARED_API bool IsValid(std::string_view platformType)
constexpr uint32 Win_x86
constexpr uint32 Win_x64
constexpr uint32 Win_arm64
TC_SHARED_API bool IsValid(std::string_view platform)
constexpr uint32 Mac_arm64
constexpr uint32 Mac_x64
constexpr uint32 Mac_x86
constexpr uint32 Retail
constexpr uint32 Ptr
constexpr uint32 BetaRelease
constexpr uint32 Beta
constexpr uint32 RetailChina
TC_SHARED_API bool IsValid(std::string_view type)
constexpr uint32 PtrRelease
uint32 GetMinorMajorBugfixVersionForBuild(uint32 build)
constexpr uint32 ToFourCC(std::string_view text)
Info const * GetBuildInfo(uint32 build)
std::array< char, 5 > ToCharArray(uint32 value)
std::array< uint8, Size > Key
static constexpr std::size_t Size
std::array< char, 4 > HotfixVersion
std::vector< AuthKey > AuthKeys
friend bool operator==(VariantId const &left, VariantId const &right)=default