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