LeviLamina
Loading...
Searching...
No Matches
ResourcePackManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/PathBuffer.h"
7#include "mc/deps/core/resource/ResourceLoader.h"
8#include "mc/deps/core/resource/ResourcePackStackType.h"
9#include "mc/deps/core/sem_ver/SemVersion.h"
10#include "mc/deps/core/utility/NonOwnerPointer.h"
11#include "mc/platform/brstd/move_only_function.h"
12
13// auto generated forward declare list
14// clang-format off
15class ContentIdentity;
20class PackInstance;
21class PackReport;
23class ResourceGroup;
26class ResourcePack;
30struct PackIdVersion;
31namespace Core { class Path; }
32namespace mce { struct Image; }
33// clang-format on
34
35class ResourcePackManager : public ::ResourceLoader {
36public:
37 // member variables
38 // NOLINTBEGIN
39 ::ll::TypedStorage<8, 64, ::std::unordered_set<::gsl::not_null<::ResourcePackListener*>>> mListeners;
40 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mLevelStack;
41 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mGlobalStack;
42 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mTreatmentStack;
43 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mBaseGameStack;
44 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mFullStack;
45 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PackSourceReport>> mLoadingReport;
46 ::ll::TypedStorage<8, 32, ::std::string> mLocaleCode;
47 ::ll::TypedStorage<1, 1, bool> mInitializing;
48 ::ll::TypedStorage<1, 1, bool> mPendingRestack;
49 ::ll::TypedStorage<1, 1, bool> mUseGlobalPackStack;
50 ::ll::TypedStorage<1, 1, bool> mGameplayResourcesLoaded;
51 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mFullStackAccess;
52 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const>> mContentTierManager;
53 ::ll::TypedStorage<8, 24, ::SemVersion> mFullStackMinEngineVersion_DEPRECATED_DONOTUSE;
54 // NOLINTEND
55
56public:
57 // prevent constructor by default
58 ResourcePackManager();
59
60public:
61 // virtual functions
62 // NOLINTBEGIN
63 virtual ~ResourcePackManager() /*override*/;
64
65 virtual bool load(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const /*override*/;
66
67 virtual bool load(
68 ::ResourceLocation const& resourceLocation,
69 ::std::string& resourceStream,
70 ::gsl::span<::std::string const> extensionList
71 ) const /*override*/;
72
73 virtual bool load(
74 ::ResourceLocationPair const& resourceLocationPair,
75 ::std::string& resourceStream,
76 ::gsl::span<::std::string const> extensionList
77 ) const /*override*/;
78
79 virtual bool loadText(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const /*override*/;
80
81 virtual ::std::vector<::LoadedResourceData> loadAllVersionsOf(::ResourceLocation const& resourceLocation) const
82 /*override*/;
83
84#ifdef LL_PLAT_C
85 virtual ::mce::Image loadTexture(::ResourceLocation const& resourceLocation) const /*override*/;
86
87#endif
88 virtual bool isInStreamableLocation(::ResourceLocation const& resourceLocation) const /*override*/;
89
90 virtual bool isInStreamableLocation(
91 ::ResourceLocation const& resourceLocation,
92 ::gsl::span<::std::string const> extensionList
93 ) const /*override*/;
94
95 virtual ::Core::PathBuffer<::std::string> getPath(::ResourceLocation const& resourceLocation) const /*override*/;
96
97 virtual ::Core::PathBuffer<::std::string>
98 getPath(::ResourceLocation const& resourceLocation, ::gsl::span<::std::string const> extensionList) const
99 /*override*/;
100
101 virtual ::Core::PathBuffer<::std::string>
102 getPathContainingResource(::ResourceLocation const& resourceLocation) const /*override*/;
103
104 virtual ::Core::PathBuffer<::std::string> getPathContainingResource(
105 ::ResourceLocation const& resourceLocation,
106 ::gsl::span<::std::string const> extensionList
107 ) const /*override*/;
108
109 virtual ::std::pair<int, ::std::string_view> getPackStackIndexOfResource(
110 ::ResourceLocation const& resourceLocation,
111 ::gsl::span<::std::string const> extensionList
112 ) const /*override*/;
113
114 virtual bool hasCapability(::std::string_view requiredCapability) const;
115 // NOLINTEND
116
117public:
118 // member functions
119 // NOLINTBEGIN
120 MCAPI ResourcePackManager(
121 ::std::function<::Core::PathBuffer<::std::string>()> getPath,
122 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
123 bool needsToInitialize
124 );
125
126 MCAPI void _calculateMinEngineVersionFromFullStack();
127
128 MCAPI void _composeFullStack();
129
130 MCAPI bool _doStackOperation(
131 ::ResourcePackStackType stackType,
132 ::brstd::move_only_function<bool(::std::unique_ptr<::ResourcePackStack>*) const> operation
133 );
134
135 MCAPI void _getResourcesOfGroup(
136 ::PackInstance const& packInstance,
137 ::std::string const& group,
138 ::std::vector<::Core::Path>& resources
139 ) const;
140
141 MCAPI void _updateLanguageSubpacks();
142
143#ifdef LL_PLAT_C
144 MCAPI bool areGameplayResourcesLoaded() const;
145
146 MCAPI ::ContentTierIncompatibleReason canSupportPacks();
147
148 MCAPI void clearPackReports();
149#endif
150
151 MCAPI void clearStack(::ResourcePackStackType stackType);
152
153 MCAPI int composeFullStack(
154 ::ResourcePackStack& output,
155 ::ResourcePackStack const& globalStack,
156 ::ResourcePackStack const& levelStack
157 ) const;
158
159#ifdef LL_PLAT_C
160 MCAPI void ensureSupportedSubpacks();
161
162 MCAPI ::std::vector<::ResourceLocationPair> findAllTexturesInUse() const;
163
164 MCAPI ::std::vector<::PackIdVersion> findInPacks(::ResourceLocation const& resourceLocation) const;
165
166 MCAPI void finishLoadingLinkedAssets(::LinkedAssetValidator& validator);
167
168 MCAPI void forceStackCompose_DEPRECATED();
169
170 MCFOLD ::std::shared_mutex& getFullStackAccess() const;
171
172 MCAPI ::SemVersion getFullStackMinEngineVersion_DEPRECATED() const;
173
174 MCAPI ::std::vector<::PackInstance> getIncompatiblePacks() const;
175#endif
176
177 MCAPI ::PackInstance* getPackForResource(::Core::Path const& resourceName) const;
178
179 MCFOLD ::PackSourceReport const* getPackSourceReport() const;
180
181#ifdef LL_PLAT_C
182 MCAPI ::std::vector<::PackInstance> getPacksWhereAssetExtractionNotViable(
183 ::std::function<::std::string(::ContentIdentity const&)> getContentKey,
184 ::std::string const& sourceContext
185 ) const;
186#endif
187
188 MCAPI ::ResourceGroup getResourcesOfGroup(::std::string const& group) const;
189
190 MCAPI ::ResourceGroup getResourcesOfGroup(::PackInstance const& packInstance, ::std::string const& group) const;
191
192 MCAPI ::ResourcePackStack const& getStack(::ResourcePackStackType stackType) const;
193
194 MCAPI void handlePendingStackChanges();
195
196#ifdef LL_PLAT_C
197 MCAPI bool hasResource(::ResourceLocation const& resourceLocation) const;
198
199 MCAPI bool hasResource(
200 ::ResourcePackStack const& resourcePackStack,
201 ::ResourceLocation const& resourceLocation,
202 ::gsl::span<::std::string const> extensionList
203 ) const;
204
205 MCAPI bool hasTexture(::ResourceLocation const& resourceLocation) const;
206
207 MCAPI bool hasTexture(::ResourcePackStackType stackType, ::ResourceLocation const& resourceLocation) const;
208#endif
209
210 MCAPI bool isAssetExtractionViableForFullStack(
211 ::std::function<::std::string(::ContentIdentity const&)> getContentKey,
212 ::std::string const& sourceContext
213 ) const;
214
215 MCAPI bool isOnlyBaseGamePacks() const;
216
217 MCAPI void iteratePacks(::std::function<void(::PackInstance const&)> const& pred) const;
218
219#ifdef LL_PLAT_C
220 MCAPI bool
221 loadAllVersionsOf(::ResourceLocation const& resourceLocation, ::ResourcePackMergeStrategy& mergeStrategy) const;
222
223 MCAPI void mergePackReports(::std::vector<::PackReport>& packReports);
224
225 MCAPI void notifyJsonResourcesChanged();
226
227 MCAPI void onBaseGamePackDownloadComplete();
228
229 MCAPI void onLanguageChanged();
230
231 MCAPI void onLoadingFinished();
232
233 MCAPI bool refreshStack(::ResourcePackStackType stackType);
234
235 MCAPI void regeneratePackAssetSet();
236#endif
237
238 MCAPI void registerResourcePackListener(::ResourcePackListener& listener);
239
240 MCAPI void removeIf(::std::function<bool(::PackInstance const&)> const& pred);
241
242#ifdef LL_PLAT_C
243 MCAPI void removePacks(::std::vector<::gsl::not_null<::ResourcePack const*>> const& packs);
244
245 MCAPI void removeUnsupportedPacks();
246
247 MCAPI void setCanUseGlobalPackStack(bool canUseGlobalPackStack);
248#endif
249
250 MCAPI void setGameplayResourcesLoaded(bool gameplayResourcesLoaded);
251
252 MCAPI void setPackSourceReport(::PackSourceReport&& report);
253
254 MCAPI bool setStack(::std::unique_ptr<::ResourcePackStack> stack, ::ResourcePackStackType stackType);
255
256#ifdef LL_PLAT_C
257 MCAPI bool supportsVibrantVisuals() const;
258
259 MCAPI void unRegisterAllResourcePackListener();
260#endif
261
262 MCAPI void unRegisterResourcePackListener(::ResourcePackListener& listener);
263 // NOLINTEND
264
265public:
266 // constructor thunks
267 // NOLINTBEGIN
268 MCAPI void* $ctor(
269 ::std::function<::Core::PathBuffer<::std::string>()> getPath,
270 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
271 bool needsToInitialize
272 );
273 // NOLINTEND
274
275public:
276 // destructor thunk
277 // NOLINTBEGIN
278 MCAPI void $dtor();
279 // NOLINTEND
280
281public:
282 // virtual function thunks
283 // NOLINTBEGIN
284 MCAPI bool $load(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const;
285
286 MCAPI bool $load(
287 ::ResourceLocation const& resourceLocation,
288 ::std::string& resourceStream,
289 ::gsl::span<::std::string const> extensionList
290 ) const;
291
292 MCAPI bool $load(
293 ::ResourceLocationPair const& resourceLocationPair,
294 ::std::string& resourceStream,
295 ::gsl::span<::std::string const> extensionList
296 ) const;
297
298 MCAPI bool $loadText(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const;
299
300 MCAPI ::std::vector<::LoadedResourceData> $loadAllVersionsOf(::ResourceLocation const& resourceLocation) const;
301
302 MCAPI bool $isInStreamableLocation(::ResourceLocation const& resourceLocation) const;
303
304 MCAPI bool $isInStreamableLocation(
305 ::ResourceLocation const& resourceLocation,
306 ::gsl::span<::std::string const> extensionList
307 ) const;
308
309 MCAPI ::Core::PathBuffer<::std::string> $getPath(::ResourceLocation const& resourceLocation) const;
310
311 MCAPI ::Core::PathBuffer<::std::string>
312 $getPath(::ResourceLocation const& resourceLocation, ::gsl::span<::std::string const> extensionList) const;
313
314 MCAPI ::Core::PathBuffer<::std::string>
315 $getPathContainingResource(::ResourceLocation const& resourceLocation) const;
316
317 MCAPI ::Core::PathBuffer<::std::string> $getPathContainingResource(
318 ::ResourceLocation const& resourceLocation,
319 ::gsl::span<::std::string const> extensionList
320 ) const;
321
322 MCAPI ::std::pair<int, ::std::string_view> $getPackStackIndexOfResource(
323 ::ResourceLocation const& resourceLocation,
324 ::gsl::span<::std::string const> extensionList
325 ) const;
326
327 MCAPI bool $hasCapability(::std::string_view requiredCapability) const;
328
329#ifdef LL_PLAT_C
330 MCAPI ::mce::Image $loadTexture(::ResourceLocation const& resourceLocation) const;
331#endif
332
333
334 // NOLINTEND
335
336public:
337 // vftables
338 // NOLINTBEGIN
339 MCNAPI static void** $vftable();
340 // NOLINTEND
341};
Definition ContentIdentity.h:8
Definition ContentTierIncompatibleReason.h:5
Definition PathBuffer.h:8
Definition Path.h:12
Definition IContentTierManager.h:13
Definition LinkedAssetValidator.h:8
Definition LoadedResourceData.h:5
Definition PackInstance.h:28
Definition PackReport.h:17
Definition PackSourceReport.h:11
Definition ResourceGroup.h:8
Definition ResourceLocationPair.h:9
Definition ResourceLocation.h:15
Definition ResourcePackListener.h:10
static MCAPI void ** $vftable()
Definition ResourcePackMergeStrategy.h:10
Definition ResourcePackStack.h:24
Definition ResourcePack.h:28
Definition move_only_function.h:9
Definition PackIdVersion.h:10
Definition Image.h:12