@@ -54,6 +54,7 @@ const CheckBoxState* automaticallyInstallUpdates;
5454
5555static ImGui::MarkdownConfig mdConfig;
5656std::string latestReleaseTag;
57+ std::string installSizeStr;
5758nlohmann::json releasesList, selectedRelease, osReleaseInfo;
5859
5960static void UpdateSelectedRelease (const std::string& tag)
@@ -68,22 +69,41 @@ static void UpdateSelectedRelease(const std::string& tag)
6869 continue ;
6970
7071 selectedRelease = release;
72+ installSizeStr.clear ();
7173
7274 for (const auto & asset : selectedRelease[" assets" ]) {
7375 std::string assetName = asset[" name" ];
7476#ifdef WIN32
7577 if (assetName == std::format (" millennium-{}-windows-x86_64.zip" , tag)) {
7678 osReleaseInfo = asset;
77- return ;
79+ }
80+ if (assetName == std::format (" millennium-{}-windows-x86_64.installsize" , tag)) {
81+ if (asset.contains (" browser_download_url" )) {
82+ auto sizeResponse = Http::Get (asset[" browser_download_url" ].get <std::string>().c_str (), false );
83+ if (!sizeResponse.empty ()) {
84+ installSizeStr = sizeResponse;
85+ // Trim whitespace
86+ installSizeStr.erase (0 , installSizeStr.find_first_not_of (" \t\n\r " ));
87+ installSizeStr.erase (installSizeStr.find_last_not_of (" \t\n\r " ) + 1 );
88+ }
89+ }
7890 }
7991#elif __linux__
8092 if (assetName == std::format (" millennium-{}-linux-x86_64.tar.gz" , tag)) {
8193 osReleaseInfo = asset;
82- return ;
94+ }
95+ if (assetName == std::format (" millennium-{}-linux-x86_64.installsize" , tag)) {
96+ if (asset.contains (" browser_download_url" )) {
97+ auto sizeResponse = Http::Get (asset[" browser_download_url" ].get <std::string>().c_str (), false );
98+ if (!sizeResponse.empty ()) {
99+ installSizeStr = sizeResponse;
100+ installSizeStr.erase (0 , installSizeStr.find_first_not_of (" \t\n\r " ));
101+ installSizeStr.erase (installSizeStr.find_last_not_of (" \t\n\r " ) + 1 );
102+ }
103+ }
83104 }
84105#else
85106 osReleaseInfo = asset;
86- return ;
87107#endif
88108 }
89109
@@ -140,6 +160,7 @@ const bool FetchVersionInfo()
140160 latestReleaseTag = selectedRelease.contains (" tag_name" ) ? selectedRelease[" tag_name" ].get <std::string>() : std::string ();
141161
142162 bool hasFoundReleaseInfo = false ;
163+ installSizeStr.clear ();
143164 if (!selectedRelease.is_null ()) {
144165 std::string releaseTag = selectedRelease.contains (" tag_name" ) ? selectedRelease[" tag_name" ].get <std::string>() : std::string ();
145166 for (const auto & asset : selectedRelease[" assets" ]) {
@@ -148,18 +169,35 @@ const bool FetchVersionInfo()
148169 if (assetName == std::format (" millennium-{}-windows-x86_64.zip" , releaseTag)) {
149170 osReleaseInfo = asset;
150171 hasFoundReleaseInfo = true ;
151- break ;
172+ }
173+ if (assetName == std::format (" millennium-{}-windows-x86_64.installsize" , releaseTag)) {
174+ if (asset.contains (" browser_download_url" )) {
175+ auto sizeResponse = Http::Get (asset[" browser_download_url" ].get <std::string>().c_str (), false );
176+ if (!sizeResponse.empty ()) {
177+ installSizeStr = sizeResponse;
178+ installSizeStr.erase (0 , installSizeStr.find_first_not_of (" \t\n\r " ));
179+ installSizeStr.erase (installSizeStr.find_last_not_of (" \t\n\r " ) + 1 );
180+ }
181+ }
152182 }
153183#elif __linux__
154184 if (assetName == std::format (" millennium-{}-linux-x86_64.tar.gz" , releaseTag)) {
155185 osReleaseInfo = asset;
156186 hasFoundReleaseInfo = true ;
157- break ;
187+ }
188+ if (assetName == std::format (" millennium-{}-linux-x86_64.installsize" , releaseTag)) {
189+ if (asset.contains (" browser_download_url" )) {
190+ auto sizeResponse = Http::Get (asset[" browser_download_url" ].get <std::string>().c_str (), false );
191+ if (!sizeResponse.empty ()) {
192+ installSizeStr = sizeResponse;
193+ installSizeStr.erase (0 , installSizeStr.find_first_not_of (" \t\n\r " ));
194+ installSizeStr.erase (installSizeStr.find_last_not_of (" \t\n\r " ) + 1 );
195+ }
196+ }
158197 }
159198#else
160199 osReleaseInfo = asset;
161200 hasFoundReleaseInfo = true ;
162- break ;
163201#endif
164202 }
165203 }
@@ -274,8 +312,7 @@ const void RenderInstallPrompt(std::shared_ptr<RouterNav> router, float xPos)
274312 PopStyleColor (2 );
275313 PopStyleVar (3 );
276314
277- Spacing ();
278- Spacing ();
315+ SetCursorPosY (GetCursorPosY () + ScaleY (100 ));
279316 PushStyleColor (ImGuiCol_Text, ImVec4 (0 .422f , 0 .425f , 0 .441f , 1 .0f ));
280317
281318 std::string currentTag = selectedRelease.contains (" tag_name" ) ? selectedRelease[" tag_name" ].get <std::string>() : std::string (" (none)" );
@@ -305,7 +342,7 @@ const void RenderInstallPrompt(std::shared_ptr<RouterNav> router, float xPos)
305342 PushStyleVar (ImGuiStyleVar_PopupRounding, 6 );
306343 PushStyleColor (ImGuiCol_PopupBg, ImVec4 (0 .1f , 0 .1f , 0 .11f , 1 .0f ));
307344
308- SetNextWindowSize (ImVec2 (ScaleX (200 ), ScaleY (300 )));
345+ SetNextWindowSize (ImVec2 (ScaleX (200 ), ScaleY (200 )));
309346
310347 if (BeginPopup (" ##VersionPopup" )) {
311348 if (!releasesList.is_null ()) {
@@ -342,16 +379,22 @@ const void RenderInstallPrompt(std::shared_ptr<RouterNav> router, float xPos)
342379
343380 PopStyleVar (2 );
344381 PopStyleColor (3 );
382+
383+ Spacing ();
384+ Spacing ();
385+ Separator ();
345386 Spacing ();
346387 Spacing ();
347388
348- SetCursorPosY (GetCursorPosY () + ScaleY (110 ));
349389 PushStyleColor (ImGuiCol_Text, ImVec4 (0 .422f , 0 .425f , 0 .441f , 1 .0f ));
350- PushStyleColor (ImGuiCol_Text, ImVec4 (0.761 , 0.569 , 0.149 , 1 .0f ));
351390
352- Text (" Attention" );
353- PopStyleColor ();
354- TextWrapped (" Your first Steam launch after installing Millennium will take longer than usual while it sets up - don't close Steam during this process." );
391+ if (installSizeStr.empty ()) {
392+ Text (" • Install size: N/A" );
393+ } else {
394+ Text (" • Install size: %.2f MB" , stof (installSizeStr) / (1024 .0f * 1024 .0f ));
395+ }
396+
397+ Text (" • Download size: %.2f MB" , osReleaseInfo.contains (" size" ) ? osReleaseInfo[" size" ].get <float >() / (1024 .0f * 1024 .0f ) : 0 .0f );
355398
356399 PopStyleColor ();
357400 }
0 commit comments