ReXGlue SDK
Loading...
Searching...
No Matches
content.h
Go to the documentation of this file.
1
14
15#pragma once
16
17#include <algorithm>
18#include <cstdint>
19#include <cstring>
20#include <string>
21#include <string_view>
22#include <utility>
23
24#include <rex/assert.h>
25#include <rex/math.h>
26#include <rex/memory.h>
27#include <rex/string/text.h>
28#include <rex/types.h>
29
30namespace rex::kernel {
31
33enum class XContentType : u32 {
34 kInvalid = 0x00000000,
35 kSavedGame = 0x00000001,
36 kMarketplaceContent = 0x00000002,
37 kPublisher = 0x00000003,
38 kXbox360Title = 0x00001000,
39 kIPTVPauseBuffer = 0x00002000,
40 kXNACommunity = 0x00003000,
41 kInstalledGame = 0x00004000,
42 kXboxTitle = 0x00005000,
43 kSocialTitle = 0x00006000,
44 kGamesOnDemand = 0x00007000,
45 kSUStoragePack = 0x00008000,
46 kAvatarItem = 0x00009000,
47 kProfile = 0x00010000,
48 kGamerPicture = 0x00020000,
49 kTheme = 0x00030000,
50 kCacheFile = 0x00040000,
51 kStorageDownload = 0x00050000,
52 kXboxSavedGame = 0x00060000,
53 kXboxDownload = 0x00070000,
54 kGameDemo = 0x00080000,
55 kVideo = 0x00090000,
56 kGameTitle = 0x000A0000,
57 kInstaller = 0x000B0000,
58 kGameTrailer = 0x000C0000,
59 kArcadeTitle = 0x000D0000,
60 kXNA = 0x000E0000,
61 kLicenseStore = 0x000F0000,
62 kMovie = 0x00100000,
63 kTV = 0x00200000,
64 kMusicVideo = 0x00300000,
65 kGameVideo = 0x00400000,
66 kPodcastVideo = 0x00500000,
67 kViralVideo = 0x00600000,
68 kCommunityGame = 0x02000000,
69};
70
72constexpr u32 kRunningTitleID = 0xFFFFFFFF;
73
76 be_u32 device_id;
77 BE<XContentType> content_type;
78 union {
80 u16 code_units[128];
82 char16_t chars[128];
84
85 char file_name_raw[42];
86
88 u8 padding[2];
89
91 bool operator==(const XCONTENT_DATA& other) const {
92 return device_id == other.device_id && content_type == other.content_type &&
93 rex::string::utf8_equal_case(GetFileName(), other.GetFileName());
94 }
95
99 std::u16string GetDisplayName() const {
101 }
102
106 std::string GetFileName() const {
107 return std::string(file_name_raw, strnlen(file_name_raw, CountOf(file_name_raw)));
108 }
109
113 void SetDisplayName(const std::u16string_view value) {
114 std::fill_n(display_name_raw.chars, CountOf(display_name_raw.chars), 0);
116 CountOf(display_name_raw.chars));
117 }
118
120 void SetFileName(const std::string_view value) {
121 std::fill_n(file_name_raw, CountOf(file_name_raw), 0);
122 rex::string::CopyUnterminated(file_name_raw, value, rex::CountOf(file_name_raw));
123
124 padding[0] = padding[1] = 0;
125 }
126};
127REX_STATIC_ASSERT_SIZE(XCONTENT_DATA, 0x134);
128
130struct XCONTENT_AGGREGATE_DATA : XCONTENT_DATA {
131 be_u64 xuid;
132 be_u32 title_id;
133
134 XCONTENT_AGGREGATE_DATA() = default;
137 device_id = other.device_id;
138 content_type = other.content_type;
140 SetFileName(other.GetFileName());
141 padding[0] = padding[1] = 0;
142 xuid = 0;
144 }
145
147 bool operator==(const XCONTENT_AGGREGATE_DATA& other) const {
148 return device_id == other.device_id && title_id == other.title_id &&
149 content_type == other.content_type &&
150 rex::string::utf8_equal_case(GetFileName(), other.GetFileName());
151 }
152};
153REX_STATIC_ASSERT_SIZE(XCONTENT_AGGREGATE_DATA, 0x148);
154
156enum class XLanguage : u8 {
157 kInvalid = 0,
158 kEnglish = 1,
159 kJapanese = 2,
160 kGerman = 3,
161 kFrench = 4,
162 kSpanish = 5,
163 kItalian = 6,
164 kKorean = 7,
165 kTChinese = 8,
166 kPortuguese = 9,
168 kPolish = 11,
169 kRussian = 12,
170 kSwedish = 13,
171 kTurkish = 14,
172 kNorwegian = 15,
173 kDutch = 16,
174 kSChinese = 17,
176};
177
184constexpr XLanguage ToXLanguage(u32 value) noexcept {
185 return value < std::to_underlying(XLanguage::kMaxLanguages) ? static_cast<XLanguage>(value)
186 : XLanguage::kInvalid;
187}
188
189} // namespace rex::kernel
Definition export.h:24
XLanguage
Definition content.h:156
@ kMaxLanguages
Definition content.h:175
@ kSChineseDeprecated
Definition content.h:167
constexpr XLanguage ToXLanguage(u32 value) noexcept
Definition content.h:184
XContentType
Definition content.h:33
@ kInvalid
Definition content.h:34
constexpr u32 kRunningTitleID
Definition content.h:72
std::u16string load_and_swap< std::u16string >(const void *mem)
Definition endian.h:176
XCONTENT_AGGREGATE_DATA(const XCONTENT_DATA &other)
Definition content.h:136
be_u32 title_id
Definition content.h:132
bool operator==(const XCONTENT_AGGREGATE_DATA &other) const
Definition content.h:147
be_u64 xuid
Definition content.h:131
Definition content.h:75
void SetFileName(const std::string_view value)
Definition content.h:120
union rex::kernel::XCONTENT_DATA::@065323247207310262231361200047330076234121057007 display_name_raw
u8 padding[2]
Definition content.h:88
bool operator==(const XCONTENT_DATA &other) const
Definition content.h:91
void SetDisplayName(const std::u16string_view value)
Definition content.h:113
std::string GetFileName() const
Definition content.h:106
std::u16string GetDisplayName() const
Definition content.h:99
ASCII and UTF-8 text operations, the string builder and the string keys.
size_t CopyUnterminated(char *dest, const std::string_view source, size_t dest_buffer_count)
Definition text.h:225
size_t CopyAndSwapTruncating(char16_t *dest, const std::u16string_view source, size_t dest_buffer_count)
Definition text.h:207
Integer types, byte order wrappers and size literals.