Fix ppu compilation progress dialog

We could only increase the value because we completely based the dialog on cellMsgDialog.
This led to an issue where the dialog would increase its maximum and thus decrease the current percentage.
It then couldn't decrease and was stuck on the old percentage.
This commit is contained in:
Megamouse 2021-01-30 19:38:55 +01:00
parent 16c6b44f55
commit 1078626eea
4 changed files with 35 additions and 8 deletions

View file

@ -368,7 +368,6 @@ namespace
u32 fdone = 0;
u32 ptotal = 0;
u32 pdone = 0;
u32 value = 0;
// Update progress
while (thread_ctrl::state() != thread_state::aborting)
@ -383,12 +382,7 @@ namespace
// Compute new progress in percents
const u32 total = ftotal + ptotal;
const u32 done = fdone + pdone;
const u32 new_value = static_cast<u32>(double(done) * 100. / double(total ? total : 1));
// Compute the difference
const u32 delta = new_value > value ? new_value - value : 0;
value += delta;
const double value = double(done) * 100. / double(total ? total : 1);
// Changes detected, send update
Emu.CallAfter([=]()
@ -404,7 +398,7 @@ namespace
{
dlg->SetMsg(+g_progr);
dlg->ProgressBarSetMsg(0, progr);
dlg->ProgressBarInc(0, delta);
dlg->ProgressBarSetValue(0, std::floor(value));
}
});
}