MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / UpdateOverlay

Method UpdateOverlay

3ds/source/UpdateOverlay.cpp:38–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36#include <cstdio>
37
38UpdateOverlay::UpdateOverlay(Screen& screen, const AutoUpdater::Update& update, std::function<void()> onInstalled)
39 : Overlay(screen), mJob(std::make_shared<Job>()), mOnInstalled(std::move(onInstalled))
40{
41 mJob->update = update;
42 mText = i18n::t("updater.downloading", {update.version});
43 mLayout = ModalChrome::fitText(mText, SIZE, false);
44 mPosx = ceilf((320 - StringUtils::textWidth(mText, SIZE)) / 2);
45
46 if (!Threads::create(Threads::WORKER_STACK, [job = mJob]() {
47 const AutoUpdater::Outcome outcome = AutoUpdater::install(job->update);
48 job->outcome = outcome;
49 job->finished.store(true, std::memory_order_release);
50 })) {
51 // No worker, no transfer: report the failure through the same path the
52 // worker would have taken rather than leaving the bar up forever.
53 Logging::warning("Could not start the update worker thread.");
54 mJob->finished.store(true, std::memory_order_release);
55 }
56}
57
58void UpdateOverlay::drawTop(void) const
59{

Callers

nothing calls this directly

Calls 3

warningFunction · 0.85
storeMethod · 0.80
createFunction · 0.50

Tested by

no test coverage detected