Add Open Achievements Hotkey

Adds a hotkey to pause emulation and bring up the Achievements dialog.
This commit is contained in:
LillyJadeKatrin 2024-07-02 02:43:35 -04:00
parent 5ea3d9fca0
commit 2372b6a386
5 changed files with 25 additions and 0 deletions

View File

@ -38,6 +38,9 @@ constexpr std::array<const char*, NUM_HOTKEYS> s_hotkey_labels{{
_trans("Center Mouse"), _trans("Center Mouse"),
_trans("Activate NetPlay Chat"), _trans("Activate NetPlay Chat"),
_trans("Control NetPlay Golf Mode"), _trans("Control NetPlay Golf Mode"),
#ifdef USE_RETRO_ACHIEVEMENTS
_trans("Open Achievements"),
#endif // USE_RETRO_ACHIEVEMENTS
_trans("Volume Down"), _trans("Volume Down"),
_trans("Volume Up"), _trans("Volume Up"),
@ -330,7 +333,11 @@ struct HotkeyGroupInfo
}; };
constexpr std::array<HotkeyGroupInfo, NUM_HOTKEY_GROUPS> s_groups_info = { constexpr std::array<HotkeyGroupInfo, NUM_HOTKEY_GROUPS> 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}, {{_trans("General"), HK_OPEN, HK_REQUEST_GOLF_CONTROL},
#endif // USE_RETROACHIEVEMENTS
{_trans("Volume"), HK_VOLUME_DOWN, HK_VOLUME_TOGGLE_MUTE}, {_trans("Volume"), HK_VOLUME_DOWN, HK_VOLUME_TOGGLE_MUTE},
{_trans("Emulation Speed"), HK_DECREASE_EMULATION_SPEED, HK_TOGGLE_THROTTLE}, {_trans("Emulation Speed"), HK_DECREASE_EMULATION_SPEED, HK_TOGGLE_THROTTLE},
{_trans("Frame Advance"), HK_FRAME_ADVANCE, HK_FRAME_ADVANCE_RESET_SPEED}, {_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_STOP, "Escape");
set_key_expression(HK_FULLSCREEN, hotkey_string({"Alt", "Return"})); set_key_expression(HK_FULLSCREEN, hotkey_string({"Alt", "Return"}));
#endif #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, "F11");
set_key_expression(HK_STEP_OVER, hotkey_string({"Shift", "F10"})); set_key_expression(HK_STEP_OVER, hotkey_string({"Shift", "F10"}));
set_key_expression(HK_STEP_OUT, hotkey_string({"Shift", "F11"})); set_key_expression(HK_STEP_OUT, hotkey_string({"Shift", "F11"}));

View File

@ -32,6 +32,9 @@ enum Hotkey
HK_CENTER_MOUSE, HK_CENTER_MOUSE,
HK_ACTIVATE_CHAT, HK_ACTIVATE_CHAT,
HK_REQUEST_GOLF_CONTROL, HK_REQUEST_GOLF_CONTROL,
#ifdef USE_RETRO_ACHIEVEMENTS
HK_OPEN_ACHIEVEMENTS,
#endif // USE_RETRO_ACHIEVEMENTS
HK_VOLUME_DOWN, HK_VOLUME_DOWN,
HK_VOLUME_UP, HK_VOLUME_UP,

View File

@ -192,6 +192,11 @@ void HotkeyScheduler::Run()
if (IsHotkey(HK_EXIT)) if (IsHotkey(HK_EXIT))
emit ExitHotkey(); emit ExitHotkey();
#ifdef USE_RETRO_ACHIEVEMENTS
if (IsHotkey(HK_OPEN_ACHIEVEMENTS))
emit OpenAchievements();
#endif // USE_RETRO_ACHIEVEMENTS
if (!Core::IsRunning(system)) if (!Core::IsRunning(system))
{ {
// Only check for Play Recording hotkey when no game is running // Only check for Play Recording hotkey when no game is running

View File

@ -53,6 +53,9 @@ signals:
void ExportRecording(); void ExportRecording();
void ToggleReadOnlyMode(); void ToggleReadOnlyMode();
void ConnectWiiRemote(int id); void ConnectWiiRemote(int id);
#ifdef USE_RETRO_ACHIEVEMENTS
void OpenAchievements();
#endif // USE_RETRO_ACHIEVEMENTS
void Step(); void Step();
void StepOver(); void StepOver();

View File

@ -658,6 +658,10 @@ void MainWindow::ConnectHotkeys()
movie.SetReadOnly(read_only); movie.SetReadOnly(read_only);
emit ReadOnlyModeChanged(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::Step, m_code_widget, &CodeWidget::Step);
connect(m_hotkey_scheduler, &HotkeyScheduler::StepOver, m_code_widget, &CodeWidget::StepOver); connect(m_hotkey_scheduler, &HotkeyScheduler::StepOver, m_code_widget, &CodeWidget::StepOver);