3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/client/gui/screens/models/ContentFlags.h"
7#include "mc/client/gui/screens/models/ContentManagerContextCollection.h"
8#include "mc/client/gui/screens/models/ContentType.h"
9#include "mc/client/gui/screens/models/IContentManager.h"
10#include "mc/deps/core/file/PathBuffer.h"
11#include "mc/deps/core/resource/PackType.h"
12#include "mc/deps/core/threading/Async.h"
13#include "mc/deps/core/utility/NonOwnerPointer.h"
14#include "mc/deps/core/utility/pub_sub/Publisher.h"
15#include "mc/world/level/LevelListCacheObserver.h"
29class IEntitlementManager;
40class StoreCatalogRepository;
52namespace Realms {
struct Content; }
53namespace Realms {
struct RealmId; }
56namespace mce {
class UUID; }
61 public ::std::enable_shared_from_this<::ContentManager> {
65 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::ContentManager>> mSelf;
66 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager>> mWorldTemplateManager;
67 ::ll::TypedStorage<8, 8, ::IPackManifestFactory&> mPackManifestFactory;
68 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::MutableContentItemCollection>>> mContent;
69 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::ContentSource>>> mContentSources;
70 ::ll::TypedStorage<8, 24, ::ContentManagerContextCollection> mContexts;
71 ::ll::TypedStorage<8, 8, uint64> mContentId;
72 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::IContentCatalogPackSource>> mCatalogResourcePackSource;
73 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::Realms::RealmsServicePackSource>>>
74 mRealmsServicePackSources;
75 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::CachedHostPackIdProvider>> mCachedHostPackIdProvider;
76 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ContentManagerProxy>> mProxy;
77 ::ll::TypedStorage<1, 1, bool> mInitialized;
78 ::ll::TypedStorage<8, 32, ::std::string const> WORLD_RESOURCE_PACK_FILENAME;
79 ::ll::TypedStorage<8, 32, ::std::string const> WORLD_BEHAVIOR_PACK_FILENAME;
80 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager>> mFilePathManager;
81 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mMutex;
82 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IContentManagerFactory>> mFactory;
83 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::ContentManagerUtils::SourcesAsyncReloader>>>
85 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager>> mEntitlementManager;
86 ::ll::TypedStorage<8, 48, ::Bedrock::PubSub::Publisher<void(), ::Bedrock::PubSub::ThreadModel::SingleThreaded, 0>>
87 mReloadViewsPublisher;
88 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::StorageManager::ContentItemProvider>> mWeakStorageContentItemProvider;
89 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::StorageManager::IContentHandler>>>
90 mStorageContentHandler;
95 ContentManager& operator=(ContentManager
const&);
96 ContentManager(ContentManager
const&);
102 virtual ~ContentManager() ;
104 virtual ::ContentSource* loadContent(::ContentType contentType, ::ContentFlags flags) ;
106 virtual ::ContentSource* loadContent(::InvalidPacksFilterGroup
const& invalidFilter) ;
108 virtual ::ContentSource*
109 loadContentForLevel(::std::string
const& levelId, ::mce::UUID
const& premiumTemplateId) ;
111 virtual ::ContentSource* loadContentForRealm(int64
const realmId) ;
113 virtual ::std::unique_ptr<::ContentSource> loadContentForRealmsWorld(
114 ::Realms::RealmId realmId,
115 ::std::vector<::Realms::Content>
const& servicePackData
118 virtual void addPackSourceFromPremiumTemplate(
119 ::RealmPackManagerContentSource* source,
120 ::mce::UUID
const& premiumTemplateId,
124 virtual void addRealmsUnknownPackSources(::RealmPackManagerContentSource* contentSource) ;
126 virtual void addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack> pack) ;
128 virtual void addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider> provider) ;
130 virtual void clearRealmsUnknownPackSource() ;
132 virtual void removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID
const&
id) ;
134 virtual ::gsl::not_null<::std::shared_ptr<::ContentItemCollection>>
135 getGlobalResourcePackCollection(
bool isEditorMode) ;
137 virtual ::std::unique_ptr<::IContentManagerContext>
138 createContext(::std::function<
bool(::std::shared_ptr<::ContentItem const>
const&)> contextPredicate) ;
140 virtual void removeContext(::IContentManagerContext& context) ;
142 virtual ::std::vector<::std::unique_ptr<::ContentSource>>
const& getSources() const ;
144 virtual ::std::vector<::std::shared_ptr<::ContentItem>> getContentItems() const ;
146 virtual ::std::shared_ptr<::IVersionedContentItemCollection const> getVersionedItems() const ;
148 virtual
void enableCatalogPackSource() ;
150 virtual
void generateItems(::ContentSource* source) ;
152 virtual ::Bedrock::Threading::Async<
void> reloadSources(
bool saveSources) ;
154 virtual
void reloadItems() ;
156 virtual
void reloadViews() ;
158 virtual
void populateDependencies() const ;
160 virtual
void deleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) ;
162 virtual
void deleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) ;
164 virtual
void deleteContentFiles(::std::shared_ptr<::ContentItem const> const& contentItem) ;
167 deleteContentFiles(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) ;
169 virtual
void postDeleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) ;
172 postDeleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) ;
174 virtual uint64 generateContentId() ;
176 virtual ::Core::PathBuffer<::std::
string> const getWorldResourcePath(::std::
string const& levelId) const
179 virtual ::Core::PathBuffer<::std::
string> const getWorldBehaviorPath(::std::
string const& levelId) const
182 virtual ::Core::PathBuffer<::std::
string> const getWorldResourceFolder(::std::
string const& levelId) const
185 virtual ::Core::PathBuffer<::std::
string> const getWorldBehaviorFolder(::std::
string const& levelId) const
188 virtual ::Core::PathBuffer<::std::
string> const getWorldPath(::std::
string const& levelId) const ;
190 virtual ::Core::PathBuffer<::std::
string> const&
191 getPremiumWorldTemplateFolder(::ContentIdentity const& templateId) ;
193 virtual ::ContentManagerProxy* getProxy() ;
195 virtual
void beginAsyncInit(::TaskGroup& taskGroup) ;
197 virtual
bool isInitialized() const ;
199 virtual
void onLanguageChanged() ;
201 virtual
void refreshContentCatalogPackSource() ;
203 virtual ::Bedrock::PubSub::Subscription
204 refreshContentCatalogPackSource(::std::function<
void()>&& callback) ;
206 virtual ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> getFilePathManager() ;
208 virtual
void onLevelDeleted(::std::
string const& levelId) ;
210 virtual
void onRealmsReset(::Realms::RealmId const realmsId) ;
212 virtual ::Bedrock::PubSub::Subscription
213 subscribeToSourcesReloadedAsyncCompleted(::std::function<
void()>&& onSourcesReloadedAsyncCallback) ;
215 virtual ::std::shared_ptr<::StorageManager::ContentItemProvider> getStorageContentItemProvider() ;
217 virtual ::StorageManager::IContentHandler& getStorageContentHandler() ;
219 virtual ::Bedrock::PubSub::Subscription registerToReloadViews(::std::function<
void()> callback) ;
225 MCAPI ContentManager(
226 ::std::unique_ptr<::IContentManagerFactory> factory,
227 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
228 ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager> worldTemplateManager,
229 ::IPackManifestFactory& packManifestFactory,
230 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> filePathManager,
231 ::std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler
234 MCAPI ContentManager(
235 ::ILevelListCache& levelListCache,
236 ::Bedrock::NotNullNonOwnerPtr<::WorldTemplateManager> const& worldTemplateManager,
237 ::IResourcePackRepository& resourcePackRepository,
238 ::ResourcePackManager& resourcePackManager,
239 ::PackManifestFactory& packManifestFactory,
240 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
241 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
242 ::Bedrock::NotNullNonOwnerPtr<::StoreCatalogRepository> const& storeCatalog,
243 ::Bedrock::NotNullNonOwnerPtr<::ContentCatalogService> const& contentCatalogService,
244 ::ClientPackSourceFactory& packSourceFactory,
245 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& filePathManager,
246 ::std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler
249 MCAPI
void _asyncInitWork();
251 MCAPI
void _dispatchReloadViewPublisher();
253 MCAPI ::ContentSource* _loadResourceContent(::ContentType type, ::ContentFlags flags);
255 MCAPI
void _removeContentItemsFromSource(::gsl::not_null<::ContentSource*> source);
257 MCAPI
void _retrievePackSources(::PackType packType, ::std::vector<::PackSource*>& packSources);
259 MCAPI ::Bedrock::NotNullNonOwnerPtr<::Realms::RealmsServicePackSource> _updateOrCreateRealmsServicePackSource(
262 ::std::vector<::gsl::not_null<::std::shared_ptr<::Pack>>>&& servicePackData
265 MCAPI
void initExistanceTracking(::std::weak_ptr<::ContentManager> self);
271 MCAPI static
void _deleteContent(
272 ::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems,
273 ::std::function<
void(::ContentSource&, ::std::vector<::std::shared_ptr<::ContentItem const>> const&)>
277 MCAPI static ::std::vector<::std::shared_ptr<::ContentItem const>>
278 _prepareContentItemsForDeleting(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
285 ::std::unique_ptr<::IContentManagerFactory> factory,
286 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
287 ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager> worldTemplateManager,
288 ::IPackManifestFactory& packManifestFactory,
289 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> filePathManager,
290 ::std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler
294 ::ILevelListCache& levelListCache,
295 ::Bedrock::NotNullNonOwnerPtr<::WorldTemplateManager> const& worldTemplateManager,
296 ::IResourcePackRepository& resourcePackRepository,
297 ::ResourcePackManager& resourcePackManager,
298 ::PackManifestFactory& packManifestFactory,
299 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
300 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
301 ::Bedrock::NotNullNonOwnerPtr<::StoreCatalogRepository> const& storeCatalog,
302 ::Bedrock::NotNullNonOwnerPtr<::ContentCatalogService> const& contentCatalogService,
303 ::ClientPackSourceFactory& packSourceFactory,
304 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& filePathManager,
305 ::std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler
318 MCAPI ::ContentSource* $loadContent(::ContentType contentType, ::ContentFlags flags);
320 MCAPI ::ContentSource* $loadContent(::InvalidPacksFilterGroup const& invalidFilter);
322 MCAPI ::ContentSource* $loadContentForLevel(::std::
string const& levelId, ::mce::UUID const& premiumTemplateId);
324 MCAPI ::ContentSource* $loadContentForRealm(int64 const realmId);
326 MCAPI ::std::unique_ptr<::ContentSource>
327 $loadContentForRealmsWorld(::Realms::RealmId realmId, ::std::vector<::Realms::Content> const& servicePackData);
329 MCAPI
void $addPackSourceFromPremiumTemplate(
330 ::RealmPackManagerContentSource* source,
331 ::mce::UUID const& premiumTemplateId,
335 MCAPI
void $addRealmsUnknownPackSources(::RealmPackManagerContentSource* contentSource);
337 MCAPI
void $addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack> pack);
339 MCAPI
void $addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider> provider);
341 MCAPI
void $clearRealmsUnknownPackSource();
343 MCAPI
void $removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID const&
id);
345 MCAPI ::gsl::not_null<::std::shared_ptr<::ContentItemCollection>>
346 $getGlobalResourcePackCollection(
bool isEditorMode);
348 MCAPI ::std::unique_ptr<::IContentManagerContext>
349 $createContext(::std::function<
bool(::std::shared_ptr<::ContentItem const> const&)> contextPredicate);
351 MCAPI
void $removeContext(::IContentManagerContext& context);
353 MCFOLD ::std::vector<::std::unique_ptr<::ContentSource>> const& $getSources() const;
355 MCAPI ::std::vector<::std::shared_ptr<::ContentItem>> $getContentItems() const;
357 MCFOLD ::std::shared_ptr<::IVersionedContentItemCollection const> $getVersionedItems() const;
359 MCAPI
void $enableCatalogPackSource();
361 MCAPI
void $generateItems(::ContentSource* source);
363 MCAPI ::Bedrock::Threading::Async<
void> $reloadSources(
bool saveSources);
365 MCAPI
void $reloadItems();
367 MCAPI
void $reloadViews();
369 MCAPI
void $populateDependencies() const;
371 MCAPI
void $deleteContent(::std::shared_ptr<::ContentItem const> const& contentItem);
373 MCAPI
void $deleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
375 MCAPI
void $deleteContentFiles(::std::shared_ptr<::ContentItem const> const& contentItem);
377 MCAPI
void $deleteContentFiles(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
379 MCAPI
void $postDeleteContent(::std::shared_ptr<::ContentItem const> const& contentItem);
381 MCAPI
void $postDeleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
383 MCAPI uint64 $generateContentId();
385 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldResourcePath(::std::
string const& levelId) const;
387 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldBehaviorPath(::std::
string const& levelId) const;
389 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldResourceFolder(::std::
string const& levelId) const;
391 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldBehaviorFolder(::std::
string const& levelId) const;
393 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldPath(::std::
string const& levelId) const;
395 MCAPI ::Core::PathBuffer<::std::
string> const& $getPremiumWorldTemplateFolder(::ContentIdentity const& templateId);
397 MCAPI ::ContentManagerProxy* $getProxy();
399 MCAPI
void $beginAsyncInit(::TaskGroup& taskGroup);
401 MCFOLD
bool $isInitialized() const;
403 MCAPI
void $onLanguageChanged();
405 MCAPI
void $refreshContentCatalogPackSource();
407 MCAPI ::Bedrock::PubSub::Subscription $refreshContentCatalogPackSource(::std::function<
void()>&& callback);
409 MCAPI ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> $getFilePathManager();
411 MCAPI
void $onLevelDeleted(::std::
string const& levelId);
413 MCAPI
void $onRealmsReset(::Realms::RealmId const realmsId);
415 MCAPI ::Bedrock::PubSub::Subscription
416 $subscribeToSourcesReloadedAsyncCompleted(::std::function<
void()>&& onSourcesReloadedAsyncCallback);
418 MCAPI ::std::shared_ptr<::StorageManager::ContentItemProvider> $getStorageContentItemProvider();
420 MCFOLD ::StorageManager::IContentHandler& $getStorageContentHandler();
422 MCAPI ::Bedrock::PubSub::Subscription $registerToReloadViews(::std::function<
void()> callback);
Definition Subscription.h:10
Definition CachedHostPackIdProvider.h:5
Definition ClientPackSourceFactory.h:5
Definition ContentCatalogService.h:5
Definition ContentIdentity.h:8
Definition ContentItemCollection.h:5
Definition ContentManagerProxy.h:5
Definition SourcesAsyncReloader.h:7
Definition ContentManager.h:5
static MCAPI void ** $vftableForIContentManager()
static MCAPI void ** $vftableForLevelListCacheObserver()
Definition FilePathManager.h:18
Definition IContentCatalogPackSource.h:5
Definition IContentManagerContext.h:5
Definition IContentManagerFactory.h:5
Definition IContentManager.h:5
Definition IContentTierManager.h:13
Definition ILevelListCache.h:27
Definition IPackManifestFactory.h:17
Definition IResourcePackRepository.h:34
Definition IVersionedContentItemCollection.h:5
Definition IWorldTemplateManager.h:17
Definition LevelListCacheObserver.h:13
Definition MutableContentItemCollection.h:5
Definition PackManifestFactory.h:21
Definition PackSource.h:30
Definition RealmsServicePackSource.h:19
Definition ResourcePackManager.h:35
Definition ContentItemProvider.h:7
Definition IContentHandler.h:7
Definition TaskGroup.h:55
Definition WorldTemplateManager.h:22
Definition SingleThreaded.h:7
Definition ContentItem.h:5
Definition ContentSource.h:5
Definition InvalidPacksFilterGroup.h:8
Definition RealmPackManagerContentSource.h:5