Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ppu compilation progress dialog #9688

Merged
merged 1 commit into from Jan 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions rpcs3/Emu/Cell/Modules/cellMsgDialog.h
Expand Up @@ -114,6 +114,7 @@ class MsgDialogBase
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) = 0;
virtual void ProgressBarReset(u32 progressBarIndex) = 0;
virtual void ProgressBarInc(u32 progressBarIndex, u32 delta) = 0;
virtual void ProgressBarSetValue(u32 progressBarIndex, u32 value) = 0;
virtual void ProgressBarSetLimit(u32 index, u32 limit) = 0;

void ProgressBarSetTaskbarIndex(s32 index)
Expand Down
10 changes: 2 additions & 8 deletions rpcs3/Emu/System.cpp
Expand Up @@ -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)
Expand All @@ -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([=]()
Expand All @@ -404,7 +398,7 @@ namespace
{
dlg->SetMsg(+g_progr);
dlg->ProgressBarSetMsg(0, progr);
dlg->ProgressBarInc(0, delta);
dlg->ProgressBarSetValue(0, std::floor(value));
}
});
}
Expand Down
31 changes: 31 additions & 0 deletions rpcs3/rpcs3qt/msg_dialog_frame.cpp
Expand Up @@ -271,6 +271,37 @@ void msg_dialog_frame::ProgressBarInc(u32 index, u32 delta)
}
}

void msg_dialog_frame::ProgressBarSetValue(u32 index, u32 value)
{
if (!m_dialog)
{
return;
}

if (index == 0 && m_gauge1)
{
m_gauge1->setValue(std::min(static_cast<int>(value), m_gauge1->maximum()));
}

if (index == 1 && m_gauge2)
{
m_gauge2->setValue(std::min(static_cast<int>(value), m_gauge2->maximum()));
}

if (index == taskbar_index + 0u || taskbar_index == -1)
{
#ifdef _WIN32
if (m_tb_progress)
{
m_tb_progress->setValue(std::min(static_cast<int>(value), m_tb_progress->maximum()));
}
#elif HAVE_QTDBUS
m_progress_value = std::min(static_cast<int>(value), m_gauge_max);
UpdateProgress(m_progress_value);
#endif
}
}

void msg_dialog_frame::ProgressBarSetLimit(u32 index, u32 limit)
{
if (!m_dialog)
Expand Down
1 change: 1 addition & 0 deletions rpcs3/rpcs3qt/msg_dialog_frame.h
Expand Up @@ -44,6 +44,7 @@ class msg_dialog_frame : public QObject, public MsgDialogBase
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) override;
virtual void ProgressBarReset(u32 progressBarIndex) override;
virtual void ProgressBarInc(u32 progressBarIndex, u32 delta) override;
virtual void ProgressBarSetValue(u32 progressBarIndex, u32 value) override;
virtual void ProgressBarSetLimit(u32 index, u32 limit) override;
#ifdef HAVE_QTDBUS
private:
Expand Down