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

Qt: Display "Reboot With Custom/Global config" on running game #7347

Merged
merged 2 commits into from Jan 30, 2020
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
2 changes: 1 addition & 1 deletion rpcs3/Emu/Audio/XAudio2/XAudio2Backend.cpp
Expand Up @@ -34,7 +34,7 @@ void XAudio2Backend::Pause()

void XAudio2Backend::Open(u32 /* num_buffers */)
{
if (lib.get() == nullptr)
if (!lib)
{
void* hmodule;

Expand Down
16 changes: 11 additions & 5 deletions rpcs3/rpcs3qt/game_list_frame.cpp
Expand Up @@ -838,7 +838,7 @@ void game_list_frame::doubleClickedSlot(QTableWidgetItem *item)
game = GetGameInfoFromItem(item);
}

if (game.get() == nullptr)
if (!game)
{
return;
}
Expand All @@ -865,7 +865,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
}

game_info gameinfo = GetGameInfoFromItem(item);
if (gameinfo.get() == nullptr)
if (!gameinfo)
{
return;
}
Expand All @@ -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, [=]
{
Expand All @@ -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"));
Expand Down Expand Up @@ -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");
Expand Down
10 changes: 8 additions & 2 deletions rpcs3/rpcs3qt/gs_frame.cpp
Expand Up @@ -456,15 +456,21 @@ bool gs_frame::event(QEvent* ev)
toggle_fullscreen();
}

int result;
int result = QMessageBox::Yes;
atomic_t<bool> called = false;

Emu.CallAfter([this, &result]()
Emu.CallAfter([this, &result, &called]()
{
m_gui_settings->ShowConfirmationBox(tr("Exit Game?"),
tr("Do you really want to exit the game?\n\nAny unsaved progress will be lost!\n"),
gui::ib_confirm_exit, &result, nullptr);

called = true;
called.notify_one();
elad335 marked this conversation as resolved.
Show resolved Hide resolved
});

called.wait(false);

if (result != QMessageBox::Yes)
{
return true;
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/rpcs3qt/main_window.cpp
Expand Up @@ -242,7 +242,7 @@ void main_window::Boot(const std::string& path, const std::string& title_id, boo
{
if (!Emu.IsStopped())
{
int result;
int result = QMessageBox::Yes;
guiSettings->ShowConfirmationBox(tr("Close Running Game?"),
tr("Booting another game will close the current game.\nDo you really want to boot another game?\n\nAny unsaved progress will be lost!\n"),
gui::ib_confirm_boot, &result, this);
Expand Down Expand Up @@ -1801,7 +1801,7 @@ void main_window::closeEvent(QCloseEvent* closeEvent)
{
if (!Emu.IsStopped() && guiSettings->GetValue(gui::ib_confirm_exit).toBool())
{
int result;
int result = QMessageBox::Yes;

guiSettings->ShowConfirmationBox(tr("Exit RPCS3?"),
tr("A game is currently running. Do you really want to close RPCS3?\n\nAny unsaved progress will be lost!\n"),
Expand Down