mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-05-09 17:48:58 +08:00
Don't use floating point division in onProgress.
This commit is contained in:
parent
4b972fd747
commit
e8e4f09268
@ -99,11 +99,10 @@ int main(int argc, char **argv) {
|
|||||||
auto onProgress = [&](u64 pos, u64 totalSize) {
|
auto onProgress = [&](u64 pos, u64 totalSize) {
|
||||||
std::stringstream details;
|
std::stringstream details;
|
||||||
details << batchInfo;
|
details << batchInfo;
|
||||||
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 << "(" << pos << " / " << totalSize << ")" << "\n";
|
||||||
details << "Press B to cancel.";
|
details << "Press B to cancel.";
|
||||||
|
|
||||||
u32 progress = (u32) (((double) pos / (double) totalSize) * 100);
|
uiDisplayProgress(TOP_SCREEN, "Installing", details.str(), true, (u32) ((pos * 100) / totalSize));
|
||||||
uiDisplayProgress(TOP_SCREEN, "Installing", details.str(), true, progress);
|
|
||||||
inputPoll();
|
inputPoll();
|
||||||
return !inputIsPressed(BUTTON_B);
|
return !inputIsPressed(BUTTON_B);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user