Qt/Overlays: Add home menu shortcut to game window

This commit is contained in:
Megamouse 2024-09-30 21:22:05 +02:00
parent e4dd957bbc
commit 96e495c61d
5 changed files with 17 additions and 1 deletions

View File

@ -42,6 +42,7 @@ namespace pad
atomic_t<bool> g_started{false};
atomic_t<bool> g_reset{false};
atomic_t<bool> g_enabled{true};
atomic_t<bool> 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();
}

View File

@ -76,6 +76,7 @@ namespace pad
extern atomic_t<bool> g_enabled;
extern atomic_t<bool> g_reset;
extern atomic_t<bool> g_started;
extern atomic_t<bool> g_home_menu_requested;
static inline class pad_thread* get_current_handler(bool relaxed = false)
{

View File

@ -57,6 +57,11 @@ extern atomic_t<recording_mode> g_recording_mode;
atomic_t<bool> g_game_window_focused = false;
namespace pad
{
extern atomic_t<bool> 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;

View File

@ -28,6 +28,7 @@ void fmt_class_string<shortcut>::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 } },
})
{
}

View File

@ -36,6 +36,7 @@ namespace gui
gw_rsx_capture,
gw_frame_limit,
gw_toggle_mouse_and_keyboard,
gw_home_menu,
count
};