Qt: abort batch PPU compilation on dialog cancel

This commit is contained in:
Megamouse 2021-07-29 01:50:54 +02:00
parent 6dc35a3772
commit 7aca2785b6
3 changed files with 17 additions and 2 deletions

View File

@ -12,6 +12,9 @@ atomic_t<u32> g_progr_fdone{0};
atomic_t<u32> g_progr_ptotal{0};
atomic_t<u32> g_progr_pdone{0};
// For Batch PPU Compilation
atomic_t<bool> g_system_progress_canceled{false};
namespace rsx::overlays
{
class progress_dialog : public message_dialog
@ -44,6 +47,8 @@ void progress_dialog_server::operator()()
break;
}
g_system_progress_canceled = false;
// Initialize message dialog
bool skip_this_one = false; // Workaround: do not open a progress dialog if there is already a cell message dialog open.
std::shared_ptr<MsgDialogBase> dlg;
@ -82,6 +87,8 @@ void progress_dialog_server::operator()()
// Abort everything
Emu.Stop();
});
g_system_progress_canceled = true;
};
Emu.CallAfter([dlg, text0]()

View File

@ -8,6 +8,7 @@ extern atomic_t<u32> g_progr_ftotal;
extern atomic_t<u32> g_progr_fdone;
extern atomic_t<u32> g_progr_ptotal;
extern atomic_t<u32> g_progr_pdone;
extern atomic_t<bool> g_system_progress_canceled;
// Initialize progress dialog (can be recursive)
class scoped_progress_dialog final

View File

@ -44,6 +44,8 @@
LOG_CHANNEL(game_list_log, "GameList");
LOG_CHANNEL(sys_log, "SYS");
extern atomic_t<bool> g_system_progress_canceled;
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
game_list_frame::game_list_frame(std::shared_ptr<gui_settings> gui_settings, std::shared_ptr<emu_settings> emu_settings, std::shared_ptr<persistent_settings> persistent_settings, QWidget* parent)
@ -1664,7 +1666,7 @@ void game_list_frame::BatchCreatePPUCaches()
for (const auto& game : m_game_data)
{
if (pdlg->wasCanceled())
if (pdlg->wasCanceled() || g_system_progress_canceled)
{
break;
}
@ -1678,7 +1680,7 @@ void game_list_frame::BatchCreatePPUCaches()
}
}
if (pdlg->wasCanceled())
if (pdlg->wasCanceled() || g_system_progress_canceled)
{
game_list_log.notice("PPU Cache Batch Creation was canceled");
@ -1687,6 +1689,11 @@ void game_list_frame::BatchCreatePPUCaches()
QApplication::processEvents();
Emu.Stop();
}
if (!pdlg->wasCanceled())
{
pdlg->close();
}
return;
}