From 9375e255e107b6f4e2c137f1e246bf542dc56ed9 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 21 Jan 2023 00:53:49 +0100 Subject: [PATCH] overlays: add pages to home menu --- Utilities/Config.h | 11 +- rpcs3/Emu/Cell/Modules/cellAudio.h | 2 +- rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp | 2 +- .../Overlays/HomeMenu/overlay_home_menu.cpp | 217 ++++++++++++++ .../{ => HomeMenu}/overlay_home_menu.h | 32 +-- .../HomeMenu/overlay_home_menu_components.cpp | 67 +++++ .../HomeMenu/overlay_home_menu_components.h | 201 +++++++++++++ .../HomeMenu/overlay_home_menu_main_menu.cpp | 65 +++++ .../HomeMenu/overlay_home_menu_main_menu.h | 15 + .../HomeMenu/overlay_home_menu_page.cpp | 177 ++++++++++++ .../HomeMenu/overlay_home_menu_page.h | 46 +++ .../HomeMenu/overlay_home_menu_settings.cpp | 135 +++++++++ .../HomeMenu/overlay_home_menu_settings.h | 238 ++++++++++++++++ rpcs3/Emu/RSX/Overlays/overlay_home_menu.cpp | 268 ------------------ .../Overlays/overlay_media_list_dialog.cpp | 4 +- .../RSX/Overlays/overlay_message_dialog.cpp | 4 +- .../Emu/RSX/Overlays/overlay_perf_metrics.cpp | 2 +- .../Emu/RSX/Overlays/overlay_save_dialog.cpp | 2 +- .../RSX/Overlays/overlay_user_list_dialog.cpp | 4 +- rpcs3/Emu/RSX/Overlays/overlays.h | 64 ++--- rpcs3/Emu/System.h | 1 + rpcs3/Emu/localized_string_id.h | 8 + rpcs3/Input/pad_thread.cpp | 2 +- rpcs3/emucore.vcxproj | 12 +- rpcs3/emucore.vcxproj.filters | 38 ++- rpcs3/main_application.cpp | 58 +++- rpcs3/main_application.h | 2 + rpcs3/rpcs3qt/config_adapter.cpp | 4 +- rpcs3/rpcs3qt/gui_application.cpp | 41 +-- rpcs3/rpcs3qt/gui_application.h | 1 - rpcs3/rpcs3qt/localized_emu.h | 8 + 31 files changed, 1345 insertions(+), 386 deletions(-) create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu.cpp rename rpcs3/Emu/RSX/Overlays/{ => HomeMenu}/overlay_home_menu.h (53%) create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_components.cpp create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_components.h create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.h create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_page.cpp create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_page.h create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp create mode 100644 rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.h delete mode 100644 rpcs3/Emu/RSX/Overlays/overlay_home_menu.cpp diff --git a/Utilities/Config.h b/Utilities/Config.h index a3f3f1354e..5f8b188ff4 100644 --- a/Utilities/Config.h +++ b/Utilities/Config.h @@ -285,8 +285,8 @@ namespace cfg int_type def; // Expose range - static const s64 max = Max; - static const s64 min = Min; + static constexpr s64 max = Max; + static constexpr s64 min = Min; _int(node* owner, const std::string& name, int_type def = std::min(Max, std::max(Min, 0)), bool dynamic = false) : _base(type::_int, owner, name, dynamic) @@ -334,6 +334,7 @@ namespace cfg void set(const s64& value) { + ensure(value >= Min && value <= Max); m_value = static_cast(value); } @@ -405,6 +406,7 @@ namespace cfg void set(const f64& value) { + ensure(value >= Min && value <= Max); m_value = static_cast(value); } @@ -435,8 +437,8 @@ namespace cfg int_type def; // Expose range - static const u64 max = Max; - static const u64 min = Min; + static constexpr u64 max = Max; + static constexpr u64 min = Min; uint(node* owner, const std::string& name, int_type def = std::max(Min, 0), bool dynamic = false) : _base(type::uint, owner, name, dynamic) @@ -484,6 +486,7 @@ namespace cfg void set(const u64& value) { + ensure(value >= Min && value <= Max); m_value = static_cast(value); } diff --git a/rpcs3/Emu/Cell/Modules/cellAudio.h b/rpcs3/Emu/Cell/Modules/cellAudio.h index f047324b69..3b1b921d05 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudio.h +++ b/rpcs3/Emu/Cell/Modules/cellAudio.h @@ -427,5 +427,5 @@ using cell_audio = named_thread; namespace audio { cell_audio_config::raw_config get_raw_config(); - void configure_audio(bool force_reset = false); + extern void configure_audio(bool force_reset = false); } diff --git a/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp b/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp index eb4b0bca8d..07bcb48b77 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsxaudio.cpp @@ -1268,7 +1268,7 @@ bool rsxaudio_data_thread::enqueue_data(RsxaudioPort dst, bool silence, const vo namespace audio { - void configure_rsxaudio() + extern void configure_rsxaudio() { if (g_cfg.audio.provider == audio_provider::rsxaudio && g_fxo->is_init()) { diff --git a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu.cpp b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu.cpp new file mode 100644 index 0000000000..f6d2952daa --- /dev/null +++ b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu.cpp @@ -0,0 +1,217 @@ +#include "stdafx.h" +#include "overlay_home_menu.h" +#include "Emu/RSX/RSXThread.h" + +namespace rsx +{ + namespace overlays + { + std::string get_time_string() + { + std::ostringstream ost; + const std::time_t dateTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + const std::tm tm = *std::localtime(&dateTime); + ost << std::put_time(&tm, "%Y/%m/%e %H:%M:%S"); + return ost.str(); + } + + home_menu_dialog::home_menu_dialog() + { + m_allow_input_on_pause = true; + + m_dim_background = std::make_unique(); + m_dim_background->set_size(overlay::virtual_width, overlay::virtual_height); + m_dim_background->back_color.a = 0.5f; + + m_main_menu = std::make_unique(20, 85, 1240, 540, false, nullptr); + + m_description = std::make_unique