From e064380a7db49ceda2bf9fe0addba78d25157d6d Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 21 Jan 2023 00:53:49 +0100 Subject: [PATCH] overlays: add message box to home menu --- .../HomeMenu/overlay_home_menu_components.h | 8 ++ .../HomeMenu/overlay_home_menu_main_menu.cpp | 3 + .../overlay_home_menu_message_box.cpp | 108 ++++++++++++++++ .../HomeMenu/overlay_home_menu_message_box.h | 28 +++++ .../HomeMenu/overlay_home_menu_page.cpp | 115 +++++++++++++++++- .../HomeMenu/overlay_home_menu_page.h | 16 +-- .../HomeMenu/overlay_home_menu_settings.h | 5 + rpcs3/Emu/System.cpp | 45 +++++++ rpcs3/Emu/System.h | 3 + rpcs3/Emu/localized_string_id.h | 4 + rpcs3/Emu/system_config.cpp | 1 + rpcs3/Emu/system_config.h | 1 + rpcs3/emucore.vcxproj | 2 + rpcs3/emucore.vcxproj.filters | 6 + rpcs3/main_application.cpp | 8 ++ rpcs3/rpcs3qt/emu_settings.cpp | 34 +----- rpcs3/rpcs3qt/localized_emu.h | 4 + 17 files changed, 347 insertions(+), 44 deletions(-) create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_message_box.cpp create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_message_box.h diff --git a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_components.h b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_components.h index c7336d3bad..ac6a991552 100644 --- a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_components.h +++ b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_components.h @@ -12,6 +12,14 @@ namespace rsx static constexpr u16 available_side_width = (overlay::virtual_width - 6 * menu_entry_margin) / 2; static constexpr u16 element_height = 25; + enum class page_navigation + { + stay, + back, + next, + exit + }; + struct home_menu_entry : horizontal_layout { public: diff --git a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp index 797bdaaea2..78407b5bc0 100644 --- a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp +++ b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp @@ -15,6 +15,9 @@ namespace rsx { is_current_page = true; + m_message_box = std::make_shared(x, y, width, height); + m_config_changed = std::make_shared(g_backup_cfg.to_string() != g_cfg.to_string()); + std::unique_ptr resume = std::make_unique(get_localized_string(localized_string_id::HOME_MENU_RESUME)); add_item(resume, [](pad_button btn) -> page_navigation { diff --git a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_message_box.cpp b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_message_box.cpp new file mode 100644 index 0000000000..c840015618 --- /dev/null +++ b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_message_box.cpp @@ -0,0 +1,108 @@ +#include "stdafx.h" +#include "overlay_home_menu_message_box.h" +#include "Emu/System.h" +#include "Emu/system_config.h" + +namespace rsx +{ + namespace overlays + { + home_menu_message_box::home_menu_message_box(u16 x, u16 y, u16 width, u16 height) + : overlay_element() + { + back_color = {0.15f, 0.15f, 0.15f, 0.95f}; + + set_size(width, height); + set_pos(x, y); + + m_label = std::make_unique