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;
22class ResourceGroup;
25class ResourcePack;
28struct PackIdVersion;
30namespace Core { class Path; }
31namespace Core { class PathView; }
32namespace mce { class UUID; }
33namespace mce { struct Image; }
34// clang-format on
35
36class ResourcePackManager : public ::ResourceLoader {
37public:
38 // member variables
39 // NOLINTBEGIN
40 ::ll::TypedStorage<8, 64, ::std::unordered_set<::gsl::not_null<::ResourcePackListener*>>> mListeners;
41 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mLevelStack;
42 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mGlobalStack;
43 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mTreatmentStack;
44 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mBaseGameStack;
45 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackStack>> mFullStack;
46 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PackSourceReport>> mLoadingReport;
47 ::ll::TypedStorage<8, 32, ::std::string> mLocaleCode;
48 ::ll::TypedStorage<1, 1, bool> mInitializing;
49 ::ll::TypedStorage<1, 1, bool> mPendingRestack;
50 ::ll::TypedStorage<1, 1, bool> mUseGlobalPackStack;
51 ::ll::TypedStorage<1, 1, bool> mGameplayResourcesLoaded;
52 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mFullStackAccess;
53 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const>> mContentTierManager;
54 ::ll::TypedStorage<8, 24, ::SemVersion> mFullStackMinEngineVersion_DEPRECATED_DONOTUSE;
55 // NOLINTEND
56
57public:
58 // prevent constructor by default
59 ResourcePackManager();
60
61public:
62 // virtual functions
63 // NOLINTBEGIN
64 virtual ~ResourcePackManager() /*override*/ = default;
65
66 virtual bool load(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const /*override*/;
67
68 virtual bool load(
69 ::ResourceLocation const& resourceLocation,
70 ::std::string& resourceStream,
71 ::gsl::span<::std::string const> extensionList
72 ) const /*override*/;
73
74 virtual bool load(
75 ::ResourceLocationPair const& resourceLocationPair,
76 ::std::string& resourceStream,
77 ::gsl::span<::std::string const> extensionList
78 ) const /*override*/;
79
80 virtual bool loadText(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const /*override*/;
81
82 virtual ::std::vector<::LoadedResourceData> loadAllVersionsOf(::ResourceLocation const& resourceLocation) const
83 /*override*/;
84
85#ifdef LL_PLAT_C
86 virtual ::mce::Image loadTexture(::ResourceLocation const& resourceLocation) const /*override*/;
87
88#endif
89 virtual bool isInStreamableLocation(::ResourceLocation const& resourceLocation) const /*override*/;
90
91 virtual bool isInStreamableLocation(
92 ::ResourceLocation const& resourceLocation,
93 ::gsl::span<::std::string const> extensionList
94 ) const /*override*/;
95
96 virtual ::Core::PathBuffer<::std::string> getPath(::ResourceLocation const& resourceLocation) const /*override*/;
97
98 virtual ::Core::PathBuffer<::std::string>
99 getPath(::ResourceLocation const& resourceLocation, ::gsl::span<::std::string const> extensionList) const
100 /*override*/;
101
102 virtual ::Core::PathBuffer<::std::string>
103 getPathContainingResource(::ResourceLocation const& resourceLocation) const /*override*/;
104
105 virtual ::Core::PathBuffer<::std::string> getPathContainingResource(
106 ::ResourceLocation const& resourceLocation,
107 ::gsl::span<::std::string const> extensionList
108 ) const /*override*/;
109
110 virtual ::std::pair<int, ::std::string_view> getPackStackIndexOfResource(
111 ::ResourceLocation const& resourceLocation,
112 ::gsl::span<::std::string const> extensionList
113 ) const /*override*/;
114
115 virtual bool hasCapability(::std::string_view requiredCapability) const;
116 // NOLINTEND
117
118public:
119 // member functions
120 // NOLINTBEGIN
121 MCAPI ResourcePackManager(
122 ::std::function<::Core::PathBuffer<::std::string>()> getPath,
123 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
124 bool needsToInitialize
125 );
126
127 MCAPI void _calculateMinEngineVersionFromFullStack();
128
129 MCAPI void _composeFullStack();
130
131 MCAPI bool _doStackOperation(
132 ::ResourcePackStackType stackType,
133 ::brstd::move_only_function<bool(::std::unique_ptr<::ResourcePackStack>*) const> operation
134 );
135
136 MCAPI void _updateLanguageSubpacks();
137
138#ifdef LL_PLAT_C
139 MCAPI ::ContentTierIncompatibleReason canSupportPacks();
140#endif
141
142 MCAPI int composeFullStack(
143 ::ResourcePackStack& output,
144 ::ResourcePackStack const& globalStack,
145 ::ResourcePackStack const& levelStack
146 ) const;
147
148#ifdef LL_PLAT_C
149 MCAPI void ensureSupportedSubpacks();
150
151 MCAPI ::std::vector<::ResourceLocationPair> findAllTexturesInUse() const;
152
153 MCAPI ::std::vector<::PackIdVersion> findInPacks(::ResourceLocation const& resourceLocation) const;
154
155 MCAPI void finishLoadingLinkedAssets(::LinkedAssetValidator& validator);
156
157 MCAPI ::SemVersion getFullStackMinEngineVersion_DEPRECATED() const;
158
159 MCAPI ::std::vector<::PackInstance> getIncompatiblePacks() const;
160#endif
161
162 MCAPI ::std::vector<::PackInstance> getPacksWhereAssetExtractionNotViable(
163 ::std::function<::std::string(::ContentIdentity const&)> getContentKey,
164 ::std::string const& sourceContext
165 ) const;
166
167 MCAPI ::ResourceGroup getResourcesOfGroup(::std::string const& group) const;
168
169 MCAPI ::ResourceGroup getResourcesOfGroup(::PackInstance const& packInstance, ::std::string const& group) const;
170
171#ifdef LL_PLAT_C
172 MCAPI ::std::optional<::StreamableAssetSource> getStreamableSource(
173 ::ResourceLocation const& resourceLocation,
174 ::gsl::span<::std::string const> extensionList,
175 ::std::optional<::Core::PathView> tempDirectory
176 ) const;
177
178 MCAPI bool
179 hasResource(::ResourceLocation const& resourceLocation, ::std::optional<::mce::UUID> const& packIdToMatch) const;
180
181 MCAPI bool hasResource(
182 ::ResourcePackStack const& resourcePackStack,
183 ::ResourceLocation const& resourceLocation,
184 ::gsl::span<::std::string const> extensionList
185 ) const;
186#endif
187
188 MCAPI bool isAssetExtractionViableForFullStack(
189 ::std::function<::std::string(::ContentIdentity const&)> getContentKey,
190 ::std::string const& sourceContext
191 ) const;
192
193 MCAPI void iteratePacks(::std::function<void(::PackInstance const&)> const& pred) const;
194
195#ifdef LL_PLAT_C
196 MCAPI bool load(
197 ::ResourceLocation const& resourceLocation,
198 ::std::string& resourceStream,
199 ::std::optional<::mce::UUID> packId
200 ) const;
201
202 MCAPI void onLanguageChanged();
203
204 MCAPI void releasePreloadCacheHandles();
205#endif
206
207 MCAPI void removeIf(::std::function<bool(::PackInstance const&)> const& pred);
208
209#ifdef LL_PLAT_C
210 MCAPI void removePacks(::std::vector<::gsl::not_null<::ResourcePack const*>> const& packs);
211
212 MCAPI void removeUnsupportedPacks();
213#endif
214
215 MCAPI void setPackSourceReport(::PackSourceReport&& report);
216
217 MCAPI bool setStack(::std::unique_ptr<::ResourcePackStack> stack, ::ResourcePackStackType stackType);
218 // NOLINTEND
219
220public:
221 // static functions
222 // NOLINTBEGIN
223 MCAPI static void _getResourcesOfGroup(
224 ::PackInstance const& packInstance,
225 ::std::string const& group,
226 ::std::vector<::Core::Path>& resources
227 );
228 // NOLINTEND
229
230public:
231 // constructor thunks
232 // NOLINTBEGIN
233 MCAPI void* $ctor(
234 ::std::function<::Core::PathBuffer<::std::string>()> getPath,
235 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
236 bool needsToInitialize
237 );
238 // NOLINTEND
239
240public:
241 // virtual function thunks
242 // NOLINTBEGIN
243 MCAPI bool $load(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const;
244
245 MCAPI bool $load(
246 ::ResourceLocation const& resourceLocation,
247 ::std::string& resourceStream,
248 ::gsl::span<::std::string const> extensionList
249 ) const;
250
251 MCAPI bool $load(
252 ::ResourceLocationPair const& resourceLocationPair,
253 ::std::string& resourceStream,
254 ::gsl::span<::std::string const> extensionList
255 ) const;
256
257 MCAPI bool $loadText(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const;
258
259 MCAPI ::std::vector<::LoadedResourceData> $loadAllVersionsOf(::ResourceLocation const& resourceLocation) const;
260
261 MCAPI bool $isInStreamableLocation(::ResourceLocation const& resourceLocation) const;
262
263 MCAPI bool $isInStreamableLocation(
264 ::ResourceLocation const& resourceLocation,
265 ::gsl::span<::std::string const> extensionList
266 ) const;
267
268 MCAPI ::Core::PathBuffer<::std::string> $getPath(::ResourceLocation const& resourceLocation) const;
269
270 MCAPI ::Core::PathBuffer<::std::string>
271 $getPath(::ResourceLocation const& resourceLocation, ::gsl::span<::std::string const> extensionList) const;
272
273 MCAPI ::Core::PathBuffer<::std::string>
274 $getPathContainingResource(::ResourceLocation const& resourceLocation) const;
275
276 MCAPI ::Core::PathBuffer<::std::string> $getPathContainingResource(
277 ::ResourceLocation const& resourceLocation,
278 ::gsl::span<::std::string const> extensionList
279 ) const;
280
281 MCAPI ::std::pair<int, ::std::string_view> $getPackStackIndexOfResource(
282 ::ResourceLocation const& resourceLocation,
283 ::gsl::span<::std::string const> extensionList
284 ) const;
285
286 MCAPI bool $hasCapability(::std::string_view requiredCapability) const;
287
288#ifdef LL_PLAT_C
289 MCAPI ::mce::Image $loadTexture(::ResourceLocation const& resourceLocation) const;
290#endif
291
292
293 // NOLINTEND
294};
Definition ContentIdentity.h:8
Definition ContentTierIncompatibleReason.h:10
Definition PathBuffer.h:8
Definition PathView.h:19
Definition Path.h:11
Definition IContentTierManager.h:13
Definition LinkedAssetValidator.h:8
Definition LoadedResourceData.h:5
Definition PackInstance.h:16
Definition PackSourceReport.h:11
Definition ResourceGroup.h:8
Definition ResourceLocationPair.h:9
Definition ResourceLocation.h:15
Definition ResourcePackListener.h:10
Definition ResourcePackStack.h:26
Definition ResourcePack.h:25
Definition move_only_function.h:9
Definition UUID.h:8
Definition PackIdVersion.h:10
Definition StreamableAssetSource.h:5
Definition Image.h:13