LeviLamina
Loading...
Searching...
No Matches
PlayScreenModel.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/screens/models/LegacyWorldConversionManager.h"
7#include "mc/client/gui/screens/models/MainMenuScreenModel.h"
8#include "mc/client/gui/screens/models/MinecraftScreenModel.h"
9#include "mc/client/gui/screens/models/WorldType.h"
10#include "mc/client/gui/screens/models/interface/IWorldsProvider.h"
11#include "mc/client/legacy/ImportStatus.h"
12#include "mc/client/network/realms/GenericStatus.h"
13#include "mc/client/network/realms/RealmId.h"
14#include "mc/client/world/NetworkWorldType.h"
15#include "mc/deps/core/file/PathBuffer.h"
16#include "mc/deps/core/resource/PackType.h"
17#include "mc/deps/core/threading/Async.h"
18#include "mc/deps/core/utility/pub_sub/Subscription.h"
19#include "mc/platform/Result.h"
20#include "mc/util/CallbackToken.h"
21#include "mc/util/UploadState.h"
22#include "mc/world/level/LevelListCacheObserver.h"
23
24// auto generated forward declare list
25// clang-format off
27class ILevelListCache;
29class LevelSettings;
32struct ExternalServer;
33struct ImportResult;
34struct LegacyWorldInfo;
35struct LocalWorldInfo;
36struct NetworkWorldInfo;
38struct RealmsWorldInfo;
40namespace Core { class Path; }
41namespace Core { class Result; }
42namespace Legacy { class WorldImporter; }
43namespace Legacy { class WorldProcessRequest; }
44namespace MSGraph::Models { struct DriveItemCollection; }
45namespace MSGraph::Models { struct GraphError; }
46namespace Realms { struct World; }
47namespace Social { class MultiplayerGameInfo; }
48// clang-format on
49
51public:
52 // PlayScreenModel inner types declare
53 // clang-format off
54 struct LiveServer;
56 // clang-format on
57
58 // PlayScreenModel inner types define
59 struct LiveServer {
60 public:
61 // member variables
62 // NOLINTBEGIN
63 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Social::MultiplayerGameInfo>> server;
64 ::ll::TypedStorage<1, 1, bool> found;
65 ::ll::TypedStorage<8, 8, double> lastFoundTime;
66 ::ll::TypedStorage<1, 1, bool> dead;
67 // NOLINTEND
68 };
69
70 class PlayScreenLevelListCacheObserver : public ::LevelListCacheObserver {
71 public:
72 // member variables
73 // NOLINTBEGIN
74 ::ll::TypedStorage<8, 8, ::PlayScreenModel&> mModel;
75 // NOLINTEND
76
77 public:
78 // prevent constructor by default
79 PlayScreenLevelListCacheObserver& operator=(PlayScreenLevelListCacheObserver const&);
80 PlayScreenLevelListCacheObserver(PlayScreenLevelListCacheObserver const&);
81 PlayScreenLevelListCacheObserver();
82
83 public:
84 // virtual functions
85 // NOLINTBEGIN
86 virtual void onLevelAdded(::std::string const& levelId) /*override*/;
87
88 virtual void onLevelUpdated(::std::string const& levelId) /*override*/;
89
90 virtual void onLevelDeleted(::std::string const& levelId) /*override*/;
91
92 virtual void onStorageChanged() /*override*/;
93
94 virtual ~PlayScreenLevelListCacheObserver() /*override*/;
95 // NOLINTEND
96
97 public:
98 // destructor thunk
99 // NOLINTBEGIN
100 MCFOLD void $dtor();
101 // NOLINTEND
102
103 public:
104 // virtual function thunks
105 // NOLINTBEGIN
106 MCFOLD void $onLevelAdded(::std::string const& levelId);
107
108 MCFOLD void $onLevelUpdated(::std::string const& levelId);
109
110 MCFOLD void $onLevelDeleted(::std::string const& levelId);
111
112 MCFOLD void $onStorageChanged();
113 // NOLINTEND
114
115 public:
116 // vftables
117 // NOLINTBEGIN
118 MCNAPI static void** $vftable();
119 // NOLINTEND
120 };
121
122 using PlayerCountMap = ::std::map<::Realms::RealmId, int>;
123
124 using RealmFullMap = ::std::map<::Realms::RealmId, bool>;
125
126 using RealmsWorldList = ::std::vector<::Realms::World>;
127
128 using StashedNetworkSelection = ::std::pair<::NetworkWorldInfo const, ::NetworkWorldType>;
129
130public:
131 // member variables
132 // NOLINTBEGIN
133 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::pair<::NetworkWorldInfo const, ::NetworkWorldType>>>
134 mLastNetworkSelection;
135 ::ll::TypedStorage<1, 1, bool> mIsDirty;
136 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mLocalWorldList;
137 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mBetaRetailLocalWorldList;
138 ::ll::TypedStorage<8, 24, ::std::vector<::WorldTemplateInfo>> mWorldTemplates;
139 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mFriendsNetworkWorldList;
140 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mCrossPlatformFriendsNetworkWorldList;
141 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mLANNetworkWorldList;
142 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mServerNetworkWorldList;
143 ::ll::TypedStorage<8, 24, ::std::vector<::RealmsWorldInfo>> mRealmWorldList;
144 ::ll::TypedStorage<8, 24, ::std::vector<::RealmsWorldInfo>> mUnpairedParentRealmWorldList;
145 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::NetworkWorldInfo>>> mThirdPartyServerWorldList;
146 ::ll::TypedStorage<8, 24, ::std::vector<::LegacyWorldInfo>> mLegacyWorldList;
147 ::ll::TypedStorage<8, 24, ::std::vector<::LegacyWorldInfo>> mBetaRetailLegacyWorldList;
148 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::ResourceLocation>> mNetworkedFriendsGamerpicMap;
149 ::ll::TypedStorage<8, 72, ::std::chrono::steady_clock::time_point[9]> mUpdateTimes;
150 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::World>> mWorlds;
151 ::ll::TypedStorage<1, 1, bool> mWorldsFetched;
152 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::World>> mUnpairedParentWorlds;
153 ::ll::TypedStorage<1, 1, bool> mUnpairedWorldsFetched;
154 ::ll::TypedStorage<8, 16, ::std::map<::Realms::RealmId, int>> mUnreadCounts;
155 ::ll::TypedStorage<4, 4, int> mRealmWorldPartitionIndex;
156 ::ll::TypedStorage<4, 20, ::std::array<int, 5>> mSeenUnreadPosts;
157 ::ll::TypedStorage<1, 1, bool> mLocalWorldsPopulated;
158 ::ll::TypedStorage<1, 1, bool> mHasPendingInvites;
159 ::ll::TypedStorage<4, 4, int> mPendingInviteCount;
160 ::ll::TypedStorage<1, 1, bool> mFetchingInvites;
161 ::ll::TypedStorage<1, 1, bool> mFetchingLegacyWorldsInProgress;
162 ::ll::TypedStorage<1, 1, bool> mLegacyWorldsFetched;
163 ::ll::TypedStorage<1, 1, bool> mFoundLegacyWorlds;
164 ::ll::TypedStorage<8, 48, ::LegacyWorldConversionManager> mLegacyWorldConversionManager;
165 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mEduCloudWorlds;
166 ::ll::TypedStorage<1, 1, bool> mFetchingEduCloudWorldsInProgress;
167 ::ll::TypedStorage<1, 1, bool> mEduCloudWorldsFetched;
168 ::ll::TypedStorage<1, 1, bool> mEduCloudWorldsPopulated;
169 ::ll::TypedStorage<1, 1, bool> mEduCloudFetchFailed;
170 ::ll::TypedStorage<4, 4, int> mEduCloudWorldsFetchRetriesRemaining;
171 ::ll::TypedStorage<8, 32, ::std::string> mEduCloudWorldsFetchNextLinkUrl;
172 ::ll::TypedStorage<
173 8,
174 16,
177 mEduCloudWorldsHandle;
178 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mFetchStartTimestamp;
179 ::ll::TypedStorage<8, 32, ::std::string> mFetchCorrelationId;
180 ::ll::TypedStorage<1, 1, bool> mFetchingPlayerCounts;
181 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastRealmsUpdate;
182 ::ll::TypedStorage<1, 1, bool> mJoiningRealm;
183 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastTryJoin;
184 ::ll::TypedStorage<8, 8, ::std::chrono::seconds> mRetryJoinInterval;
185 ::ll::TypedStorage<4, 4, int> mRetryTime;
186 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mPendingInviteCountSubscriber;
187 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Legacy::WorldImporter>> mLegacyWorldImporter;
188 ::ll::TypedStorage<8, 16, ::CallbackToken> mRetrieveCallbackToken;
189 ::ll::TypedStorage<8, 16, ::CallbackToken> mImportCallbackToken;
190 ::ll::TypedStorage<1, 1, bool> mFirstRealmsFetchComplete;
191 ::ll::TypedStorage<1, 1, bool> mFirstUnpairedParentRealmsFetchComplete;
192 ::ll::TypedStorage<4, 4, ::Realms::GenericStatus> mRealmsStatus;
193 ::ll::TypedStorage<4, 4, ::Realms::GenericStatus> mUnpairedParentRealmsStatus;
194 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastPlayerCountUpdate;
195 ::ll::TypedStorage<8, 24, ::PlayScreenModel::PlayScreenLevelListCacheObserver> mLevelListCacheObserver;
196 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mTrialModeUpdateSubscription;
197 ::ll::TypedStorage<1, 1, bool> mAreTrialWorldsHidden;
198 ::ll::TypedStorage<1, 1, bool> mIsEditScreenLoading;
199 ::ll::TypedStorage<1, 1, bool> mIsLoadingAdditionalRealmInfo;
200 ::ll::TypedStorage<4, 4, int> mNumRealmsWorldsToQuery;
201 ::ll::TypedStorage<8, 16, ::std::set<::Realms::RealmId>> mWorldsWithDetailedInfo;
202 ::ll::TypedStorage<1, 1, bool> initRequestPendingInvites;
203 // NOLINTEND
204
205public:
206 // prevent constructor by default
207 PlayScreenModel();
208
209public:
210 // virtual functions
211 // NOLINTBEGIN
212 virtual ~PlayScreenModel() /*override*/;
213
214 virtual int getWorldCount(::WorldType worldType, ::NetworkWorldType networkType) const /*override*/;
215
216 virtual ::LocalWorldInfo const* getLocalWorldAtIndex(int const index) const /*override*/;
217
218 virtual ::LocalWorldInfo const* getLocalWorldById(::std::string const& id) const /*override*/;
219
220 virtual bool refresh(::WorldType tabType) /*override*/;
221
222 virtual void startLocalWorld(::LocalWorldInfo worldInfo, ::LevelSettings const* settings) /*override*/;
223
224 virtual bool isDirty() const /*override*/;
225
226 virtual ::IMinecraftEventing& getMinecraftEventing() const /*override*/;
227 // NOLINTEND
228
229public:
230 // member functions
231 // NOLINTBEGIN
232 MCAPI explicit PlayScreenModel(::MinecraftScreenModel::Context context);
233
234 MCAPI void _fetchAdditionalRealmsWorldsInfo();
235
236 MCAPI void _fetchTrialAvailability();
237
238 MCAPI bool _isCrossPlatformGame(::Social::MultiplayerGameInfo const& gameInfo) const;
239
240 MCAPI void _navigateToEditWorldScreen(::LocalWorldInfo const& info);
241
242 MCAPI void _populateAdditionalRealmsWorldsInfo();
243
244 MCAPI void _populateEduCloudWorlds(::std::vector<::LocalWorldInfo>& localWorlds);
245
246 MCFOLD void _populateLocalWorlds();
247
248 MCAPI void _populateLocalWorldsFromStorageSource(
249 ::ILevelListCache& levelListCache,
250 ::std::vector<::LocalWorldInfo>& localWorlds,
251 ::std::vector<::LocalWorldInfo>& betaRetailWorlds,
252 bool restrictTrial,
253 bool fireTelemetry
254 );
255
256 MCAPI void _populateNetworkWorlds();
257
258 MCAPI void _populateRealmsWorldsInternal(bool ofUnpairedParentRealms);
259
260 MCAPI void _postRealmEvents();
261
262 MCAPI void _processLegacyWorld(::std::shared_ptr<::Legacy::WorldProcessRequest> processRequest);
263
264 MCAPI void _remove3PServersMismatchingEditorMode();
265
266 MCAPI void _requestPendingInviteCount();
267
268 MCAPI void _sendBulkUnreadCountRequest();
269
270 MCAPI void _sortRealmsWorlds(::std::string currentUserXUID, ::std::vector<::Realms::World>& worlds);
271
272 MCAPI void _start3PNetworkWorld(::NetworkWorldInfo& world);
273
274 MCAPI void _startFriendNetworkWorld(::NetworkWorldInfo const& world);
275
276 MCAPI void _startRemoteNetworkWorld(::NetworkWorldInfo const& world);
277
278 MCAPI void _updateExternalServer(::ExternalServer& externalServer, ::PingedCompatibleServer& remoteServer);
279
280 MCAPI void _updateOwnerInfo();
281
282 MCAPI bool areExternalAndRemoteServerSame(::ExternalServer& externalServer, ::PingedCompatibleServer remoteServer);
283
284 MCAPI void connectToExperience(::ExperienceConnectionData data, ::std::function<void()> onErrorCallback);
285
286 MCAPI void convertLegacyWorld(
287 ::LegacyWorldInfo worldInfo,
288 ::std::string const& newWorldDir,
289 ::std::function<void(::Legacy::ImportStatus, float, ::std::shared_ptr<::ImportResult>)> callback
290 );
291
292 MCAPI ::Core::PathBuffer<::std::string> const createUniquePathForWorld() const;
293
294 MCAPI void deleteLegacyWorld(uint legacyWorldIndex);
295
296 MCAPI void fetchEduCloudWorlds();
297
298 MCAPI void fetchRealmsPlayerCounts();
299
300 MCAPI void fetchRealmsWorldsForPlayScreen();
301
302 MCAPI void fetchThirdPartyServerWorlds(bool forceFetch);
303
304 MCAPI ::std::shared_ptr<::FilePickerSettings> generateFilePickerSettingsForImport();
305
306 MCAPI bool getFetchingThirdPartyWorldsInProgress() const;
307
308 MCAPI ::std::vector<::ResourceLocation> getLoadingPacks(::PackType type) const;
309
310 MCAPI void handleLegacyWorldConversionComplete(::ImportResult const& result);
311
312 MCAPI bool hasLocalWorldWithId(::std::string const& levelId);
313
314 MCAPI void initializeRealmsWorlds();
315
316 MCAPI bool isEditorPlaytestRoundtrip() const;
317
318 MCAPI bool isLocalWorldRealmsPlus(::LocalWorldInfo const& world);
319
320 MCAPI void navigateToAddEditExternalScreen(int id);
321
322 MCAPI void navigateToEditWorldScreen(int index, ::std::function<void(::Core::Path const&)> onErrorCallback);
323
324 MCAPI void
325 navigateToEditWorldScreen(::LocalWorldInfo* info, ::std::function<void(::Core::Path const&)> onErrorCallback);
326
327 MCAPI void navigateToWorldSyncModalScreen(
328 ::std::string const& levelId,
329 ::std::function<void(::Core::Result)> onCompleteCallback
330 );
331
332 MCAPI ::LocalWorldInfo refreshLocalWorldInfo(::LocalWorldInfo const& worldInfo);
333
334 MCFOLD void repopulateLocalWorlds();
335
336 MCAPI void startNetworkWorld(::NetworkWorldInfo worldInfo, ::NetworkWorldType worldType);
337
338 MCAPI ::Bedrock::PubSub::Subscription subscribeToBuildGameList();
339
340 MCAPI bool supportsEduCloudWorlds() const;
341
342 MCAPI void triggerMultiplayerGameRefresh(bool tryToReconnect);
343
344 MCAPI void uploadLocalWorldFileAtIndex(
345 ::std::string const& realmID,
346 int slotIndex,
347 int index,
348 ::std::function<void(::UploadState, ::Realms::World)> callbackAfterUpload
349 );
350 // NOLINTEND
351
352public:
353 // constructor thunks
354 // NOLINTBEGIN
355 MCAPI void* $ctor(::MinecraftScreenModel::Context context);
356 // NOLINTEND
357
358public:
359 // destructor thunk
360 // NOLINTBEGIN
361 MCAPI void $dtor();
362 // NOLINTEND
363
364public:
365 // virtual function thunks
366 // NOLINTBEGIN
367 MCAPI int $getWorldCount(::WorldType worldType, ::NetworkWorldType networkType) const;
368
369 MCAPI ::LocalWorldInfo const* $getLocalWorldAtIndex(int const index) const;
370
371 MCAPI ::LocalWorldInfo const* $getLocalWorldById(::std::string const& id) const;
372
373 MCAPI bool $refresh(::WorldType tabType);
374
375 MCAPI void $startLocalWorld(::LocalWorldInfo worldInfo, ::LevelSettings const* settings);
376
377 MCAPI bool $isDirty() const;
378
379 MCFOLD ::IMinecraftEventing& $getMinecraftEventing() const;
380 // NOLINTEND
381
382public:
383 // vftables
384 // NOLINTBEGIN
385 MCNAPI static void** $vftableForMainMenuScreenModel();
386
387 MCNAPI static void** $vftableForIMinecraftScreenModel();
388
389 MCNAPI static void** $vftableForIWorldsProvider();
390
391 MCNAPI static void** $vftableForIDlcBatcher();
392 // NOLINTEND
393};
Definition Result.h:9
Definition Async.h:8
Definition Path.h:17
Definition Result.h:11
Definition FilePickerSettings.h:5
Definition ILevelListCache.h:27
Definition IMinecraftEventing.h:134
Definition IWorldsProvider.h:5
Definition WorldImporter.h:7
Definition WorldProcessRequest.h:7
Definition LevelSettings.h:39
Definition MainMenuScreenModel.h:5
Definition Path.h:16
Definition PlayScreenModel.h:5
static MCAPI void ** $vftableForIWorldsProvider()
static MCAPI void ** $vftableForIDlcBatcher()
static MCAPI void ** $vftableForMainMenuScreenModel()
static MCAPI void ** $vftableForIMinecraftScreenModel()
Definition ResourceLocation.h:15
Definition MultiplayerGameInfo.h:7
STL namespace.
Definition ExperienceConnectionData.h:5
Definition ExternalServer.h:5
Definition ImportResult.h:5
Definition LegacyWorldInfo.h:5
Definition LocalWorldInfo.h:5
Definition DriveItemCollection.h:7
Definition GraphError.h:7
Definition MinecraftScreenModel.h:15
Definition NetworkWorldInfo.h:5
Definition PingedCompatibleServer.h:5
Definition PlayScreenModel.h:14
Definition RealmsWorldInfo.h:5
Definition World.h:7
Definition WorldTemplateInfo.h:12
Definition context.h:5