MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / DownloadImage

Method DownloadImage

pcsx2/Achievements.cpp:347–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345
346
347void Achievements::DownloadImage(std::string url, std::string cache_filename)
348{
349 auto callback = [cache_filename = std::move(cache_filename)](s32 status_code, const std::string& content_type, HTTPDownloader::Request::Data data) {
350 if (status_code != HTTPDownloader::HTTP_STATUS_OK)
351 return;
352
353 if (!FileSystem::WriteBinaryFile(cache_filename.c_str(), data.data(), data.size()))
354 {
355 Console.Error("Failed to write badge image to '%s'", cache_filename.c_str());
356 return;
357 }
358
359 ImGuiFullscreen::InvalidateCachedTexture(cache_filename);
360 };
361
362 s_http_downloader->CreateRequest(std::move(url), std::move(callback));
363}
364
365bool Achievements::IsActive()
366{

Callers

nothing calls this directly

Calls 5

CreateRequestMethod · 0.80
c_strMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected