diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index 83b0c31616..3d0a153fd6 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -38,6 +38,9 @@ constexpr std::array s_hotkey_labels{{ _trans("Center Mouse"), _trans("Activate NetPlay Chat"), _trans("Control NetPlay Golf Mode"), +#ifdef USE_RETRO_ACHIEVEMENTS + _trans("Open Achievements"), +#endif // USE_RETRO_ACHIEVEMENTS _trans("Volume Down"), _trans("Volume Up"), @@ -330,7 +333,11 @@ struct HotkeyGroupInfo }; constexpr std::array s_groups_info = { +#ifdef USE_RETRO_ACHIEVEMENTS + {{_trans("General"), HK_OPEN, HK_OPEN_ACHIEVEMENTS}, +#else // USE_RETRO_ACHIEVEMENTS {{_trans("General"), HK_OPEN, HK_REQUEST_GOLF_CONTROL}, +#endif // USE_RETROACHIEVEMENTS {_trans("Volume"), HK_VOLUME_DOWN, HK_VOLUME_TOGGLE_MUTE}, {_trans("Emulation Speed"), HK_DECREASE_EMULATION_SPEED, HK_TOGGLE_THROTTLE}, {_trans("Frame Advance"), HK_FRAME_ADVANCE, HK_FRAME_ADVANCE_RESET_SPEED}, @@ -448,6 +455,9 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface) set_key_expression(HK_STOP, "Escape"); set_key_expression(HK_FULLSCREEN, hotkey_string({"Alt", "Return"})); #endif +#ifdef USE_RETRO_ACHIEVEMENTS + set_key_expression(HK_OPEN_ACHIEVEMENTS, hotkey_string({"Alt", "A"})); +#endif // USE_RETRO_ACHIEVEMENTS set_key_expression(HK_STEP, "F11"); set_key_expression(HK_STEP_OVER, hotkey_string({"Shift", "F10"})); set_key_expression(HK_STEP_OUT, hotkey_string({"Shift", "F11"})); diff --git a/Source/Core/Core/HotkeyManager.h b/Source/Core/Core/HotkeyManager.h index aae894cb5b..bb287b6561 100644 --- a/Source/Core/Core/HotkeyManager.h +++ b/Source/Core/Core/HotkeyManager.h @@ -32,6 +32,9 @@ enum Hotkey HK_CENTER_MOUSE, HK_ACTIVATE_CHAT, HK_REQUEST_GOLF_CONTROL, +#ifdef USE_RETRO_ACHIEVEMENTS + HK_OPEN_ACHIEVEMENTS, +#endif // USE_RETRO_ACHIEVEMENTS HK_VOLUME_DOWN, HK_VOLUME_UP, diff --git a/Source/Core/DolphinQt/HotkeyScheduler.cpp b/Source/Core/DolphinQt/HotkeyScheduler.cpp index 39e4633a9e..232f41c2f8 100644 --- a/Source/Core/DolphinQt/HotkeyScheduler.cpp +++ b/Source/Core/DolphinQt/HotkeyScheduler.cpp @@ -192,6 +192,11 @@ void HotkeyScheduler::Run() if (IsHotkey(HK_EXIT)) emit ExitHotkey(); +#ifdef USE_RETRO_ACHIEVEMENTS + if (IsHotkey(HK_OPEN_ACHIEVEMENTS)) + emit OpenAchievements(); +#endif // USE_RETRO_ACHIEVEMENTS + if (!Core::IsRunning(system)) { // Only check for Play Recording hotkey when no game is running diff --git a/Source/Core/DolphinQt/HotkeyScheduler.h b/Source/Core/DolphinQt/HotkeyScheduler.h index 97a43be72e..c61cdb265d 100644 --- a/Source/Core/DolphinQt/HotkeyScheduler.h +++ b/Source/Core/DolphinQt/HotkeyScheduler.h @@ -53,6 +53,9 @@ signals: void ExportRecording(); void ToggleReadOnlyMode(); void ConnectWiiRemote(int id); +#ifdef USE_RETRO_ACHIEVEMENTS + void OpenAchievements(); +#endif // USE_RETRO_ACHIEVEMENTS void Step(); void StepOver(); diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 772fee9abf..e68673a205 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -658,6 +658,10 @@ void MainWindow::ConnectHotkeys() movie.SetReadOnly(read_only); emit ReadOnlyModeChanged(read_only); }); +#ifdef USE_RETRO_ACHIEVEMENTS + connect(m_hotkey_scheduler, &HotkeyScheduler::OpenAchievements, this, + &MainWindow::ShowAchievementsWindow, Qt::QueuedConnection); +#endif // USE_RETRO_ACHIEVEMENTS connect(m_hotkey_scheduler, &HotkeyScheduler::Step, m_code_widget, &CodeWidget::Step); connect(m_hotkey_scheduler, &HotkeyScheduler::StepOver, m_code_widget, &CodeWidget::StepOver);