From 232c6c3aaf3e8b574695d856cc25e34af45ea886 Mon Sep 17 00:00:00 2001 From: Eladash Date: Thu, 30 Jan 2020 18:49:32 +0200 Subject: [PATCH] Qt: Display "Reboot With Custom/Global config" on running game --- rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp | 2 +- rpcs3/rpcs3qt/game_list_frame.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp b/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp index fd01402d75..532c08865a 100644 --- a/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp +++ b/rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp @@ -34,7 +34,7 @@ void XAudio2Backend::Pause() void XAudio2Backend::Open(u32 /* num_buffers */) { - if (lib.get() == nullptr) + if (!lib) { void* hmodule; diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index a006ddcfae..97fe28a325 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -838,7 +838,7 @@ void game_list_frame::doubleClickedSlot(QTableWidgetItem *item) game = GetGameInfoFromItem(item); } - if (game.get() == nullptr) + if (!game) { return; } @@ -865,7 +865,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) } game_info gameinfo = GetGameInfoFromItem(item); - if (gameinfo.get() == nullptr) + if (!gameinfo) { return; } @@ -879,12 +879,16 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) // Make Actions QMenu myMenu; - QAction* boot = new QAction(gameinfo->hasCustomConfig ? tr("&Boot with global configuration") : tr("&Boot")); + + const bool is_current_running_game = (Emu.IsRunning() || Emu.IsPaused()) && currGame.serial == Emu.GetTitleID(); + + QAction* boot = new QAction(gameinfo->hasCustomConfig ? tr(is_current_running_game ? "&Reboot with global configuration" : "&Boot with global configuration") : tr("&Boot")); QFont f = boot->font(); f.setBold(true); + if (gameinfo->hasCustomConfig) { - QAction* boot_custom = myMenu.addAction(tr("&Boot with custom configuration")); + QAction* boot_custom = myMenu.addAction(tr(is_current_running_game ? "&Reboot with custom configuration" : "&Boot with custom configuration")); boot_custom->setFont(f); connect(boot_custom, &QAction::triggered, [=] { @@ -896,8 +900,10 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) { boot->setFont(f); } + myMenu.addAction(boot); myMenu.addSeparator(); + QAction* configure = myMenu.addAction(gameinfo->hasCustomConfig ? tr("&Change Custom Configuration") : tr("&Create Custom Configuration")); QAction* pad_configure = myMenu.addAction(gameinfo->hasCustomPadConfig ? tr("&Change Custom Gamepad Configuration") : tr("&Create Custom Gamepad Configuration")); QAction* createPPUCache = myMenu.addAction(tr("&Create PPU Cache")); @@ -1852,7 +1858,7 @@ bool game_list_frame::eventFilter(QObject *object, QEvent *event) game_info gameinfo = GetGameInfoFromItem(item); - if (gameinfo.get() == nullptr) + if (!gameinfo) return false; LOG_NOTICE(LOADER, "Booting from gamelist by pressing %s...", keyEvent->key() == Qt::Key_Enter ? "Enter" : "Return");