From 96e495c61da9722ef4fab59b44a71eecd36c37fd Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 30 Sep 2024 21:22:05 +0200 Subject: [PATCH] Qt/Overlays: Add home menu shortcut to game window --- rpcs3/Input/pad_thread.cpp | 3 ++- rpcs3/Input/pad_thread.h | 1 + rpcs3/rpcs3qt/gs_frame.cpp | 11 +++++++++++ rpcs3/rpcs3qt/shortcut_settings.cpp | 2 ++ rpcs3/rpcs3qt/shortcut_settings.h | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/rpcs3/Input/pad_thread.cpp b/rpcs3/Input/pad_thread.cpp index cb85fbcfce..dc59258f67 100644 --- a/rpcs3/Input/pad_thread.cpp +++ b/rpcs3/Input/pad_thread.cpp @@ -42,6 +42,7 @@ namespace pad atomic_t g_started{false}; atomic_t g_reset{false}; atomic_t g_enabled{true}; + atomic_t g_home_menu_requested{false}; } namespace rsx @@ -451,7 +452,7 @@ void pad_thread::operator()() } // Make sure we call this function only once per button press - if (ps_button_pressed && !m_ps_button_pressed) + if ((ps_button_pressed && !m_ps_button_pressed) || pad::g_home_menu_requested.exchange(false)) { open_home_menu(); } diff --git a/rpcs3/Input/pad_thread.h b/rpcs3/Input/pad_thread.h index b1206f5491..d1f63b5fdb 100644 --- a/rpcs3/Input/pad_thread.h +++ b/rpcs3/Input/pad_thread.h @@ -76,6 +76,7 @@ namespace pad extern atomic_t g_enabled; extern atomic_t g_reset; extern atomic_t g_started; + extern atomic_t g_home_menu_requested; static inline class pad_thread* get_current_handler(bool relaxed = false) { diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index ccfb3327cf..4239ca63f5 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -57,6 +57,11 @@ extern atomic_t g_recording_mode; atomic_t g_game_window_focused = false; +namespace pad +{ + extern atomic_t g_home_menu_requested; +} + bool is_input_allowed() { return g_game_window_focused || g_cfg.io.background_input_enabled; @@ -149,6 +154,7 @@ gs_frame::gs_frame(QScreen* screen, const QRect& geometry, const QIcon& appIcon, gs_frame::~gs_frame() { g_user_asked_for_screenshot = false; + pad::g_home_menu_requested = false; // Save active screen to gui settings const QScreen* current_screen = screen(); @@ -349,6 +355,11 @@ void gs_frame::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKey input::toggle_mouse_and_keyboard(); break; } + case gui::shortcuts::shortcut::gw_home_menu: + { + pad::g_home_menu_requested = true; + break; + } default: { break; diff --git a/rpcs3/rpcs3qt/shortcut_settings.cpp b/rpcs3/rpcs3qt/shortcut_settings.cpp index c28245bd7d..d8f376cfeb 100644 --- a/rpcs3/rpcs3qt/shortcut_settings.cpp +++ b/rpcs3/rpcs3qt/shortcut_settings.cpp @@ -28,6 +28,7 @@ void fmt_class_string::format(std::string& out, u64 arg) case shortcut::gw_rsx_capture: return "gw_rsx_capture"; case shortcut::gw_frame_limit: return "gw_frame_limit"; case shortcut::gw_toggle_mouse_and_keyboard: return "gw_toggle_mouse_and_keyboard"; + case shortcut::gw_home_menu: return "gw_home_menu"; case shortcut::count: return "count"; } @@ -71,6 +72,7 @@ shortcut_settings::shortcut_settings() { shortcut::gw_rsx_capture, shortcut_info{ "game_window_rsx_capture", tr("RSX Capture"), "Alt+C", shortcut_handler_id::game_window } }, { shortcut::gw_frame_limit, shortcut_info{ "game_window_frame_limit", tr("Toggle Framelimit"), "Ctrl+F10", shortcut_handler_id::game_window } }, { shortcut::gw_toggle_mouse_and_keyboard, shortcut_info{ "game_window_toggle_mouse_and_keyboard", tr("Toggle Keyboard"), "Ctrl+F11", shortcut_handler_id::game_window } }, + { shortcut::gw_home_menu, shortcut_info{ "gw_home_menu", tr("Open Home Menu"), "Shift+F10", shortcut_handler_id::game_window } }, }) { } diff --git a/rpcs3/rpcs3qt/shortcut_settings.h b/rpcs3/rpcs3qt/shortcut_settings.h index 8e5094b80a..c47f8ff3a9 100644 --- a/rpcs3/rpcs3qt/shortcut_settings.h +++ b/rpcs3/rpcs3qt/shortcut_settings.h @@ -36,6 +36,7 @@ namespace gui gw_rsx_capture, gw_frame_limit, gw_toggle_mouse_and_keyboard, + gw_home_menu, count };