mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
Progress Dialog: Force-update counter when complete
This confuses both the user and the developer at times.
This commit is contained in:
parent
150afecc29
commit
d62d6cc852
1 changed files with 30 additions and 15 deletions
|
@ -156,7 +156,7 @@ void progress_dialog_server::operator()()
|
||||||
u32 fdone = 0;
|
u32 fdone = 0;
|
||||||
u32 ptotal = 0;
|
u32 ptotal = 0;
|
||||||
u32 pdone = 0;
|
u32 pdone = 0;
|
||||||
auto text1 = text0;
|
const char* text1 = nullptr;
|
||||||
|
|
||||||
const u64 start_time = get_system_time();
|
const u64 start_time = get_system_time();
|
||||||
|
|
||||||
|
@ -171,11 +171,17 @@ void progress_dialog_server::operator()()
|
||||||
fdone = fdone_new;
|
fdone = fdone_new;
|
||||||
ptotal = ptotal_new;
|
ptotal = ptotal_new;
|
||||||
pdone = pdone_new;
|
pdone = pdone_new;
|
||||||
text1 = text_new;
|
|
||||||
|
|
||||||
if (!text_new)
|
const bool text_changed = text_new && text_new != text1;
|
||||||
|
|
||||||
|
if (text_new)
|
||||||
{
|
{
|
||||||
// Incomplete state
|
text1 = text_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!text1)
|
||||||
|
{
|
||||||
|
// Cannot do anything
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +208,7 @@ void progress_dialog_server::operator()()
|
||||||
// Assume not all programs were found if files were not compiled (as it may contain more)
|
// Assume not all programs were found if files were not compiled (as it may contain more)
|
||||||
const u64 total = std::max<u64>(ptotal, 1) * std::max<u64>(ftotal, 1);
|
const u64 total = std::max<u64>(ptotal, 1) * std::max<u64>(ftotal, 1);
|
||||||
const u64 done = pdone * std::max<u64>(fdone, 1);
|
const u64 done = pdone * std::max<u64>(fdone, 1);
|
||||||
const f32 value = static_cast<f32>(std::fmin(done * 100. / total, 100.f));
|
const u32 value = static_cast<u32>(done >= total ? 100 : done * 100 / total);
|
||||||
|
|
||||||
std::string progr = "Progress:";
|
std::string progr = "Progress:";
|
||||||
|
|
||||||
|
@ -214,26 +220,28 @@ void progress_dialog_server::operator()()
|
||||||
// Changes detected, send update
|
// Changes detected, send update
|
||||||
if (native_dlg)
|
if (native_dlg)
|
||||||
{
|
{
|
||||||
native_dlg->set_text(text_new);
|
if (text_changed)
|
||||||
|
{
|
||||||
|
native_dlg->set_text(text1);
|
||||||
|
}
|
||||||
|
|
||||||
native_dlg->progress_bar_set_message(0, std::move(progr));
|
native_dlg->progress_bar_set_message(0, std::move(progr));
|
||||||
native_dlg->progress_bar_set_value(0, std::floor(value));
|
native_dlg->progress_bar_set_value(0, static_cast<f32>(value));
|
||||||
}
|
}
|
||||||
else if (dlg)
|
else if (dlg)
|
||||||
{
|
{
|
||||||
Emu.CallFromMainThread([=]()
|
Emu.CallFromMainThread([=]()
|
||||||
{
|
{
|
||||||
dlg->SetMsg(text_new);
|
if (text_changed)
|
||||||
|
{
|
||||||
|
dlg->SetMsg(text1);
|
||||||
|
}
|
||||||
|
|
||||||
dlg->ProgressBarSetMsg(0, progr);
|
dlg->ProgressBarSetMsg(0, progr);
|
||||||
dlg->ProgressBarSetValue(0, static_cast<u32>(std::floor(value)));
|
dlg->ProgressBarSetValue(0, value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Leave only if total count is equal to done count
|
|
||||||
else if (ftotal == fdone && ptotal == pdone && !text_new)
|
|
||||||
{
|
|
||||||
// Complete state, empty message: close dialog
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (show_overlay_message)
|
if (show_overlay_message)
|
||||||
{
|
{
|
||||||
|
@ -241,6 +249,13 @@ void progress_dialog_server::operator()()
|
||||||
rsx::overlays::refresh_message_queue();
|
rsx::overlays::refresh_message_queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Leave only if total count is equal to done count
|
||||||
|
if (ftotal == fdone && ptotal == pdone && !text_new)
|
||||||
|
{
|
||||||
|
// Complete state, empty message: close dialog
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
thread_ctrl::wait_for(10000);
|
thread_ctrl::wait_for(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue