diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 41 | ||||
| -rw-r--r-- | src/yuzu/main.h | 4 |
3 files changed, 29 insertions, 18 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index bc47d1688..d5157c502 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -128,7 +128,7 @@ const std::array<UISettings::Shortcut, 22> Config::default_hotkeys{{ | |||
| 128 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Fullscreen")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F11"), QStringLiteral("Home+B"), Qt::WindowShortcut, false}}, | 128 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Fullscreen")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F11"), QStringLiteral("Home+B"), Qt::WindowShortcut, false}}, |
| 129 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load File")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+O"), QStringLiteral(""), Qt::WidgetWithChildrenShortcut, false}}, | 129 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load File")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+O"), QStringLiteral(""), Qt::WidgetWithChildrenShortcut, false}}, |
| 130 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load/Remove Amiibo")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F2"), QStringLiteral("Home+A"), Qt::WidgetWithChildrenShortcut, false}}, | 130 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Load/Remove Amiibo")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F2"), QStringLiteral("Home+A"), Qt::WidgetWithChildrenShortcut, false}}, |
| 131 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Restart Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F6"), QStringLiteral(""), Qt::WindowShortcut, false}}, | 131 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Restart Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F6"), QStringLiteral("R+Plus+Minus"), Qt::WindowShortcut, false}}, |
| 132 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Stop Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F5"), QStringLiteral("L+Plus+Minus"), Qt::WindowShortcut, false}}, | 132 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Stop Emulation")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F5"), QStringLiteral("L+Plus+Minus"), Qt::WindowShortcut, false}}, |
| 133 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Record")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F7"), QStringLiteral(""), Qt::ApplicationShortcut, false}}, | 133 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Record")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F7"), QStringLiteral(""), Qt::ApplicationShortcut, false}}, |
| 134 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Reset")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F6"), QStringLiteral(""), Qt::ApplicationShortcut, false}}, | 134 | {QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "TAS Reset")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+F6"), QStringLiteral(""), Qt::ApplicationShortcut, false}}, |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 2727f9d06..425f546f7 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -3400,10 +3400,13 @@ void GMainWindow::OnRestartGame() { | |||
| 3400 | if (!system->IsPoweredOn()) { | 3400 | if (!system->IsPoweredOn()) { |
| 3401 | return; | 3401 | return; |
| 3402 | } | 3402 | } |
| 3403 | // Make a copy since ShutdownGame edits game_path | 3403 | |
| 3404 | const auto current_game = QString(current_game_path); | 3404 | if (ConfirmShutdownGame()) { |
| 3405 | ShutdownGame(); | 3405 | // Make a copy since ShutdownGame edits game_path |
| 3406 | BootGame(current_game); | 3406 | const auto current_game = QString(current_game_path); |
| 3407 | ShutdownGame(); | ||
| 3408 | BootGame(current_game); | ||
| 3409 | } | ||
| 3407 | } | 3410 | } |
| 3408 | 3411 | ||
| 3409 | void GMainWindow::OnPauseGame() { | 3412 | void GMainWindow::OnPauseGame() { |
| @@ -3425,15 +3428,27 @@ void GMainWindow::OnPauseContinueGame() { | |||
| 3425 | } | 3428 | } |
| 3426 | 3429 | ||
| 3427 | void GMainWindow::OnStopGame() { | 3430 | void GMainWindow::OnStopGame() { |
| 3428 | // Open (or not) the right confirm dialog based on current setting and game exit lock | 3431 | if (ConfirmShutdownGame()) { |
| 3432 | play_time_manager->Stop(); | ||
| 3433 | // Update game list to show new play time | ||
| 3434 | game_list->PopulateAsync(UISettings::values.game_dirs); | ||
| 3435 | if (OnShutdownBegin()) { | ||
| 3436 | OnShutdownBeginDialog(); | ||
| 3437 | } else { | ||
| 3438 | OnEmulationStopped(); | ||
| 3439 | } | ||
| 3440 | } | ||
| 3441 | } | ||
| 3442 | |||
| 3443 | bool GMainWindow::ConfirmShutdownGame() { | ||
| 3429 | if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) { | 3444 | if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) { |
| 3430 | if (system->GetExitLocked()) { | 3445 | if (system->GetExitLocked()) { |
| 3431 | if (!ConfirmForceLockedExit()) { | 3446 | if (!ConfirmForceLockedExit()) { |
| 3432 | return; | 3447 | return false; |
| 3433 | } | 3448 | } |
| 3434 | } else { | 3449 | } else { |
| 3435 | if (!ConfirmChangeGame()) { | 3450 | if (!ConfirmChangeGame()) { |
| 3436 | return; | 3451 | return false; |
| 3437 | } | 3452 | } |
| 3438 | } | 3453 | } |
| 3439 | } else { | 3454 | } else { |
| @@ -3441,19 +3456,11 @@ void GMainWindow::OnStopGame() { | |||
| 3441 | ConfirmStop::Ask_Based_On_Game && | 3456 | ConfirmStop::Ask_Based_On_Game && |
| 3442 | system->GetExitLocked()) { | 3457 | system->GetExitLocked()) { |
| 3443 | if (!ConfirmForceLockedExit()) { | 3458 | if (!ConfirmForceLockedExit()) { |
| 3444 | return; | 3459 | return false; |
| 3445 | } | 3460 | } |
| 3446 | } | 3461 | } |
| 3447 | } | 3462 | } |
| 3448 | 3463 | return true; | |
| 3449 | play_time_manager->Stop(); | ||
| 3450 | // Update game list to show new play time | ||
| 3451 | game_list->PopulateAsync(UISettings::values.game_dirs); | ||
| 3452 | if (OnShutdownBegin()) { | ||
| 3453 | OnShutdownBeginDialog(); | ||
| 3454 | } else { | ||
| 3455 | OnEmulationStopped(); | ||
| 3456 | } | ||
| 3457 | } | 3464 | } |
| 3458 | 3465 | ||
| 3459 | void GMainWindow::OnLoadComplete() { | 3466 | void GMainWindow::OnLoadComplete() { |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 711c53a32..178eef294 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -426,6 +426,10 @@ private: | |||
| 426 | bool CheckSystemArchiveDecryption(); | 426 | bool CheckSystemArchiveDecryption(); |
| 427 | bool CheckFirmwarePresence(); | 427 | bool CheckFirmwarePresence(); |
| 428 | void ConfigureFilesystemProvider(const std::string& filepath); | 428 | void ConfigureFilesystemProvider(const std::string& filepath); |
| 429 | /** | ||
| 430 | * Open (or not) the right confirm dialog based on current setting and game exit lock | ||
| 431 | */ | ||
| 432 | bool ConfirmShutdownGame(); | ||
| 429 | 433 | ||
| 430 | QString GetTasStateDescription() const; | 434 | QString GetTasStateDescription() const; |
| 431 | bool CreateShortcut(const std::string& shortcut_path, const std::string& title, | 435 | bool CreateShortcut(const std::string& shortcut_path, const std::string& title, |