Improve progress display.

This commit is contained in:
Steven Smith 2015-04-12 20:50:16 -07:00
parent 1887af3192
commit 41bc5aef19

View File

@ -9,6 +9,7 @@
#include <sys/dirent.h>
#include <3ds.h>
#include <ctrcommon/app.hpp>
typedef enum {
INSTALL_CIA,
@ -101,8 +102,13 @@ int main(int argc, char **argv) {
return breakLoop;
};
auto onProgress = [&](int progress) {
uiDisplayProgress(TOP_SCREEN, "Installing", "Press B to cancel.", true, progress);
auto onProgress = [&](u64 pos, u64 totalSize) {
std::stringstream details;
details << "(" << std::fixed << std::setprecision(2) << ((double) pos / 1024.0 / 1024.0) << "MB / " << std::fixed << std::setprecision(2) << ((double) totalSize / 1024.0 / 1024.0) << "MB)" << "\n";
details << "Press B to cancel.";
u32 progress = (u32) (((double) pos / (double) totalSize) * 100);
uiDisplayProgress(TOP_SCREEN, "Installing", details.str(), true, progress);
inputPoll();
return !inputIsPressed(BUTTON_B);
};