From dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 31 Dec 2023 09:40:32 -0500 Subject: [PATCH] am: re-namespace frontend applets to frontend directory --- .../main/jni/applets/software_keyboard.cpp | 12 +- .../src/main/jni/applets/software_keyboard.h | 4 +- src/android/app/src/main/jni/native.cpp | 12 +- src/core/CMakeLists.txt | 46 +++---- src/core/core.cpp | 24 ++-- src/core/core.h | 15 ++- .../{general_frontend.cpp => general.cpp} | 2 +- .../applets/{general_frontend.h => general.h} | 0 src/core/frontend/applets/profile_select.h | 8 +- .../frontend/applets/software_keyboard.cpp | 12 +- src/core/frontend/applets/software_keyboard.h | 22 +-- src/core/frontend/applets/web_browser.cpp | 4 +- src/core/frontend/applets/web_browser.h | 4 +- src/core/hle/service/am/applet_manager.cpp | 54 ++++---- .../{applets => frontend}/applet_cabinet.cpp | 12 +- .../am/{applets => frontend}/applet_cabinet.h | 8 +- .../applet_controller.cpp | 10 +- .../{applets => frontend}/applet_controller.h | 8 +- .../am/{applets => frontend}/applet_error.cpp | 10 +- .../am/{applets => frontend}/applet_error.h | 8 +- .../applet_general.cpp} | 20 +-- .../applet_general.h} | 12 +- .../{applets => frontend}/applet_mii_edit.cpp | 8 +- .../{applets => frontend}/applet_mii_edit.h | 10 +- .../applet_mii_edit_types.h | 4 +- .../applet_profile_select.cpp | 10 +- .../applet_profile_select.h | 8 +- .../applet_software_keyboard.cpp | 10 +- .../applet_software_keyboard.h | 10 +- .../applet_software_keyboard_types.h | 4 +- .../applet_web_browser.cpp | 10 +- .../applet_web_browser.h | 10 +- .../applet_web_browser_types.h | 4 +- .../am/{applets => frontend}/applets.cpp | 65 ++++----- .../am/{applets => frontend}/applets.h | 125 +++--------------- .../service/am/library_applet_accessor.cpp | 2 +- .../hle/service/am/library_applet_accessor.h | 6 +- .../hle/service/am/library_applet_creator.cpp | 10 +- .../am/library_applet_self_accessor.cpp | 116 ++++++++-------- .../service/am/process_winding_controller.cpp | 10 +- src/core/hle/service/am/self_controller.cpp | 4 +- src/yuzu/applets/qt_profile_select.cpp | 4 +- src/yuzu/applets/qt_software_keyboard.cpp | 10 +- src/yuzu/applets/qt_software_keyboard.h | 17 +-- src/yuzu/applets/qt_web_browser.cpp | 12 +- src/yuzu/applets/qt_web_browser.h | 10 +- src/yuzu/main.cpp | 66 ++++----- src/yuzu/main.h | 15 ++- 48 files changed, 394 insertions(+), 473 deletions(-) rename src/core/frontend/applets/{general_frontend.cpp => general.cpp} (97%) rename src/core/frontend/applets/{general_frontend.h => general.h} (100%) rename src/core/hle/service/am/{applets => frontend}/applet_cabinet.cpp (95%) rename src/core/hle/service/am/{applets => frontend}/applet_cabinet.h (94%) rename src/core/hle/service/am/{applets => frontend}/applet_controller.cpp (97%) rename src/core/hle/service/am/{applets => frontend}/applet_controller.h (96%) rename src/core/hle/service/am/{applets => frontend}/applet_error.cpp (96%) rename src/core/hle/service/am/{applets => frontend}/applet_error.h (86%) rename src/core/hle/service/am/{applets/applet_general_backend.cpp => frontend/applet_general.cpp} (93%) rename src/core/hle/service/am/{applets/applet_general_backend.h => frontend/applet_general.h} (89%) rename src/core/hle/service/am/{applets => frontend}/applet_mii_edit.cpp (96%) rename src/core/hle/service/am/{applets => frontend}/applet_mii_edit.h (84%) rename src/core/hle/service/am/{applets => frontend}/applet_mii_edit_types.h (96%) rename src/core/hle/service/am/{applets => frontend}/applet_profile_select.cpp (93%) rename src/core/hle/service/am/{applets => frontend}/applet_profile_select.h (95%) rename src/core/hle/service/am/{applets => frontend}/applet_software_keyboard.cpp (99%) rename src/core/hle/service/am/{applets => frontend}/applet_software_keyboard.h (96%) rename src/core/hle/service/am/{applets => frontend}/applet_software_keyboard_types.h (99%) rename src/core/hle/service/am/{applets => frontend}/applet_web_browser.cpp (98%) rename src/core/hle/service/am/{applets => frontend}/applet_web_browser.h (89%) rename src/core/hle/service/am/{applets => frontend}/applet_web_browser_types.h (98%) rename src/core/hle/service/am/{applets => frontend}/applets.cpp (83%) rename src/core/hle/service/am/{applets => frontend}/applets.h (63%) diff --git a/src/android/app/src/main/jni/applets/software_keyboard.cpp b/src/android/app/src/main/jni/applets/software_keyboard.cpp index 74e040478f..9943483e81 100644 --- a/src/android/app/src/main/jni/applets/software_keyboard.cpp +++ b/src/android/app/src/main/jni/applets/software_keyboard.cpp @@ -82,7 +82,7 @@ AndroidKeyboard::ResultData AndroidKeyboard::ResultData::CreateFromFrontend(jobj const jstring string = reinterpret_cast(env->GetObjectField( object, env->GetFieldID(s_keyboard_data_class, "text", "Ljava/lang/String;"))); return ResultData{GetJString(env, string), - static_cast(env->GetIntField( + static_cast(env->GetIntField( object, env->GetFieldID(s_keyboard_data_class, "result", "I")))}; } @@ -149,7 +149,7 @@ void AndroidKeyboard::ShowNormalKeyboard() const { } void AndroidKeyboard::ShowTextCheckDialog( - Service::AM::Applets::SwkbdTextCheckResult text_check_result, + Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const { LOG_WARNING(Frontend, "(STUBBED) called, backend requested to show the text check dialog."); } @@ -204,7 +204,7 @@ void AndroidKeyboard::InlineTextChanged( "\ncursor_position={}", Common::UTF16ToUTF8(text_parameters.input_text), text_parameters.cursor_position); - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::ChangedString, + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::ChangedString, text_parameters.input_text, text_parameters.cursor_position); } @@ -219,7 +219,7 @@ void AndroidKeyboard::SubmitInlineKeyboardText(std::u16string submitted_text) { m_current_text += submitted_text; - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::ChangedString, m_current_text, + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::ChangedString, m_current_text, m_current_text.size()); } @@ -236,12 +236,12 @@ void AndroidKeyboard::SubmitInlineKeyboardInput(int key_code) { case KEYCODE_BACK: case KEYCODE_ENTER: m_is_inline_active = false; - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::DecidedEnter, m_current_text, + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::DecidedEnter, m_current_text, static_cast(m_current_text.size())); break; case KEYCODE_DEL: m_current_text.pop_back(); - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::ChangedString, m_current_text, + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::ChangedString, m_current_text, m_current_text.size()); break; } diff --git a/src/android/app/src/main/jni/applets/software_keyboard.h b/src/android/app/src/main/jni/applets/software_keyboard.h index b2fb59b68b..2affc01f6f 100644 --- a/src/android/app/src/main/jni/applets/software_keyboard.h +++ b/src/android/app/src/main/jni/applets/software_keyboard.h @@ -24,7 +24,7 @@ public: void ShowNormalKeyboard() const override; - void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result, + void ShowTextCheckDialog(Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const override; void ShowInlineKeyboard( @@ -45,7 +45,7 @@ private: static ResultData CreateFromFrontend(jobject object); std::string text; - Service::AM::Applets::SwkbdResult result{}; + Service::AM::Frontend::SwkbdResult result{}; }; void SubmitNormalText(const ResultData& result) const; diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 64627db889..1da510b7aa 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -42,14 +42,14 @@ #include "core/frontend/applets/cabinet.h" #include "core/frontend/applets/controller.h" #include "core/frontend/applets/error.h" -#include "core/frontend/applets/general_frontend.h" +#include "core/frontend/applets/general.h" #include "core/frontend/applets/mii_edit.h" #include "core/frontend/applets/profile_select.h" #include "core/frontend/applets/software_keyboard.h" #include "core/frontend/applets/web_browser.h" #include "core/hle/service/am/applet_ae.h" #include "core/hle/service/am/applet_oe.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/loader/loader.h" #include "frontend_common/config.h" @@ -226,7 +226,7 @@ Core::SystemResultStatus EmulationSession::InitializeEmulation(const std::string m_system.ApplySettings(); Settings::LogSettings(); m_system.HIDCore().ReloadInputDevices(); - m_system.SetAppletFrontendSet({ + m_system.SetFrontendAppletSet({ nullptr, // Amiibo Settings nullptr, // Controller Selector nullptr, // Error Display @@ -809,13 +809,13 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getAppletLaunchPath(JNIEnv* env, j void Java_org_yuzu_yuzu_1emu_NativeLibrary_setCurrentAppletId(JNIEnv* env, jclass clazz, jint jappletId) { - EmulationSession::GetInstance().System().GetAppletManager().SetCurrentAppletId( - static_cast(jappletId)); + EmulationSession::GetInstance().System().GetFrontendAppletHolder().SetCurrentAppletId( + static_cast(jappletId)); } void Java_org_yuzu_yuzu_1emu_NativeLibrary_setCabinetMode(JNIEnv* env, jclass clazz, jint jcabinetMode) { - EmulationSession::GetInstance().System().GetAppletManager().SetCabinetMode( + EmulationSession::GetInstance().System().GetFrontendAppletHolder().SetCabinetMode( static_cast(jcabinetMode)); } diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 0499464264..5fb0ad822e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -176,8 +176,8 @@ add_library(core STATIC frontend/applets/controller.h frontend/applets/error.cpp frontend/applets/error.h - frontend/applets/general_frontend.cpp - frontend/applets/general_frontend.h + frontend/applets/general.cpp + frontend/applets/general.h frontend/applets/mii_edit.cpp frontend/applets/mii_edit.h frontend/applets/profile_select.cpp @@ -390,6 +390,27 @@ add_library(core STATIC hle/service/acc/errors.h hle/service/acc/profile_manager.cpp hle/service/acc/profile_manager.h + hle/service/am/frontend/applet_cabinet.cpp + hle/service/am/frontend/applet_cabinet.h + hle/service/am/frontend/applet_controller.cpp + hle/service/am/frontend/applet_controller.h + hle/service/am/frontend/applet_error.cpp + hle/service/am/frontend/applet_error.h + hle/service/am/frontend/applet_general.cpp + hle/service/am/frontend/applet_general.h + hle/service/am/frontend/applet_mii_edit.cpp + hle/service/am/frontend/applet_mii_edit.h + hle/service/am/frontend/applet_mii_edit_types.h + hle/service/am/frontend/applet_profile_select.cpp + hle/service/am/frontend/applet_profile_select.h + hle/service/am/frontend/applet_software_keyboard.cpp + hle/service/am/frontend/applet_software_keyboard.h + hle/service/am/frontend/applet_software_keyboard_types.h + hle/service/am/frontend/applet_web_browser.cpp + hle/service/am/frontend/applet_web_browser.h + hle/service/am/frontend/applet_web_browser_types.h + hle/service/am/frontend/applets.cpp + hle/service/am/frontend/applets.h hle/service/am/am.cpp hle/service/am/am.h hle/service/am/am_results.h @@ -402,27 +423,6 @@ add_library(core STATIC hle/service/am/applet_manager.h hle/service/am/applet_oe.cpp hle/service/am/applet_oe.h - hle/service/am/applets/applet_cabinet.cpp - hle/service/am/applets/applet_cabinet.h - hle/service/am/applets/applet_controller.cpp - hle/service/am/applets/applet_controller.h - hle/service/am/applets/applet_error.cpp - hle/service/am/applets/applet_error.h - hle/service/am/applets/applet_general_backend.cpp - hle/service/am/applets/applet_general_backend.h - hle/service/am/applets/applet_mii_edit.cpp - hle/service/am/applets/applet_mii_edit.h - hle/service/am/applets/applet_mii_edit_types.h - hle/service/am/applets/applet_profile_select.cpp - hle/service/am/applets/applet_profile_select.h - hle/service/am/applets/applet_software_keyboard.cpp - hle/service/am/applets/applet_software_keyboard.h - hle/service/am/applets/applet_software_keyboard_types.h - hle/service/am/applets/applet_web_browser.cpp - hle/service/am/applets/applet_web_browser.h - hle/service/am/applets/applet_web_browser_types.h - hle/service/am/applets/applets.cpp - hle/service/am/applets/applets.h hle/service/am/applet_common_functions.cpp hle/service/am/applet_common_functions.h hle/service/am/applet_message_queue.cpp diff --git a/src/core/core.cpp b/src/core/core.cpp index 11bf8d2f69..2bf377b24c 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -36,7 +36,7 @@ #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/physical_core.h" #include "core/hle/service/acc/profile_manager.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/apm/apm_controller.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/glue/glue_manager.h" @@ -135,8 +135,8 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs, struct System::Impl { explicit Impl(System& system) - : kernel{system}, fs_controller{system}, hid_core{}, room_network{}, - cpu_manager{system}, reporter{system}, applet_manager{system}, profile_manager{} {} + : kernel{system}, fs_controller{system}, hid_core{}, room_network{}, cpu_manager{system}, + reporter{system}, frontend_applets{system}, profile_manager{} {} void Initialize(System& system) { device_memory = std::make_unique(); @@ -157,7 +157,7 @@ struct System::Impl { } // Create default implementations of applets if one is not provided. - applet_manager.SetDefaultAppletsIfMissing(); + frontend_applets.SetDefaultAppletsIfMissing(); is_async_gpu = Settings::values.use_asynchronous_gpu_emulation.GetValue(); @@ -567,7 +567,7 @@ struct System::Impl { std::unique_ptr renderdoc_api; /// Frontend applets - Service::AM::Applets::AppletManager applet_manager; + Service::AM::Frontend::FrontendAppletHolder frontend_applets; /// APM (Performance) services Service::APM::Controller apm_controller{core_timing}; @@ -871,20 +871,20 @@ void System::RegisterCheatList(const std::vector& list, impl->cheat_engine->SetMainMemoryParameters(main_region_begin, main_region_size); } -void System::SetAppletFrontendSet(Service::AM::Applets::AppletFrontendSet&& set) { - impl->applet_manager.SetAppletFrontendSet(std::move(set)); +void System::SetFrontendAppletSet(Service::AM::Frontend::FrontendAppletSet&& set) { + impl->frontend_applets.SetFrontendAppletSet(std::move(set)); } void System::SetDefaultAppletFrontendSet() { - impl->applet_manager.SetDefaultAppletFrontendSet(); + impl->frontend_applets.SetDefaultAppletFrontendSet(); } -Service::AM::Applets::AppletManager& System::GetAppletManager() { - return impl->applet_manager; +Service::AM::Frontend::FrontendAppletHolder& System::GetFrontendAppletHolder() { + return impl->frontend_applets; } -const Service::AM::Applets::AppletManager& System::GetAppletManager() const { - return impl->applet_manager; +const Service::AM::Frontend::FrontendAppletHolder& System::GetFrontendAppletHolder() const { + return impl->frontend_applets; } void System::SetContentProvider(std::unique_ptr provider) { diff --git a/src/core/core.h b/src/core/core.h index d8862e9cee..800e695017 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -50,10 +50,10 @@ namespace Account { class ProfileManager; } // namespace Account -namespace AM::Applets { -struct AppletFrontendSet; -class AppletManager; -} // namespace AM::Applets +namespace AM::Frontend { +struct FrontendAppletSet; +class FrontendAppletHolder; +} // namespace AM::Frontend namespace APM { class Controller; @@ -344,11 +344,12 @@ public: const std::array& build_id, u64 main_region_begin, u64 main_region_size); - void SetAppletFrontendSet(Service::AM::Applets::AppletFrontendSet&& set); + void SetFrontendAppletSet(Service::AM::Frontend::FrontendAppletSet&& set); void SetDefaultAppletFrontendSet(); - [[nodiscard]] Service::AM::Applets::AppletManager& GetAppletManager(); - [[nodiscard]] const Service::AM::Applets::AppletManager& GetAppletManager() const; + [[nodiscard]] Service::AM::Frontend::FrontendAppletHolder& GetFrontendAppletHolder(); + [[nodiscard]] const Service::AM::Frontend::FrontendAppletHolder& GetFrontendAppletHolder() + const; void SetContentProvider(std::unique_ptr provider); diff --git a/src/core/frontend/applets/general_frontend.cpp b/src/core/frontend/applets/general.cpp similarity index 97% rename from src/core/frontend/applets/general_frontend.cpp rename to src/core/frontend/applets/general.cpp index b4b213a31c..4c299ee9c7 100644 --- a/src/core/frontend/applets/general_frontend.cpp +++ b/src/core/frontend/applets/general.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "common/logging/log.h" -#include "core/frontend/applets/general_frontend.h" +#include "core/frontend/applets/general.h" namespace Core::Frontend { diff --git a/src/core/frontend/applets/general_frontend.h b/src/core/frontend/applets/general.h similarity index 100% rename from src/core/frontend/applets/general_frontend.h rename to src/core/frontend/applets/general.h diff --git a/src/core/frontend/applets/profile_select.h b/src/core/frontend/applets/profile_select.h index 92e2737ea7..880b69ad65 100644 --- a/src/core/frontend/applets/profile_select.h +++ b/src/core/frontend/applets/profile_select.h @@ -8,15 +8,15 @@ #include "common/uuid.h" #include "core/frontend/applets/applet.h" -#include "core/hle/service/am/applets/applet_profile_select.h" +#include "core/hle/service/am/frontend/applet_profile_select.h" namespace Core::Frontend { struct ProfileSelectParameters { - Service::AM::Applets::UiMode mode; + Service::AM::Frontend::UiMode mode; std::array invalid_uid_list; - Service::AM::Applets::UiSettingsDisplayOptions display_options; - Service::AM::Applets::UserSelectionPurpose purpose; + Service::AM::Frontend::UiSettingsDisplayOptions display_options; + Service::AM::Frontend::UserSelectionPurpose purpose; }; class ProfileSelectApplet : public Applet { diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp index 7655d215b4..d00da8ac9e 100644 --- a/src/core/frontend/applets/software_keyboard.cpp +++ b/src/core/frontend/applets/software_keyboard.cpp @@ -69,7 +69,7 @@ void DefaultSoftwareKeyboardApplet::ShowNormalKeyboard() const { } void DefaultSoftwareKeyboardApplet::ShowTextCheckDialog( - Service::AM::Applets::SwkbdTextCheckResult text_check_result, + Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to show the text check dialog."); } @@ -118,7 +118,7 @@ void DefaultSoftwareKeyboardApplet::InlineTextChanged(InlineTextParameters text_ "\ncursor_position={}", Common::UTF16ToUTF8(text_parameters.input_text), text_parameters.cursor_position); - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::ChangedString, + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::ChangedString, text_parameters.input_text, text_parameters.cursor_position); } @@ -127,22 +127,22 @@ void DefaultSoftwareKeyboardApplet::ExitKeyboard() const { } void DefaultSoftwareKeyboardApplet::SubmitNormalText(std::u16string text) const { - submit_normal_callback(Service::AM::Applets::SwkbdResult::Ok, text, true); + submit_normal_callback(Service::AM::Frontend::SwkbdResult::Ok, text, true); } void DefaultSoftwareKeyboardApplet::SubmitInlineText(std::u16string_view text) const { std::this_thread::sleep_for(std::chrono::milliseconds(500)); for (std::size_t index = 0; index < text.size(); ++index) { - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::ChangedString, + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::ChangedString, std::u16string(text.data(), text.data() + index + 1), static_cast(index) + 1); std::this_thread::sleep_for(std::chrono::milliseconds(250)); } - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::DecidedEnter, std::u16string(text), - static_cast(text.size())); + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::DecidedEnter, + std::u16string(text), static_cast(text.size())); } } // namespace Core::Frontend diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h index 8ed96da240..a32a98e4cf 100644 --- a/src/core/frontend/applets/software_keyboard.h +++ b/src/core/frontend/applets/software_keyboard.h @@ -8,7 +8,7 @@ #include "common/common_types.h" #include "core/frontend/applets/applet.h" -#include "core/hle/service/am/applets/applet_software_keyboard_types.h" +#include "core/hle/service/am/frontend/applet_software_keyboard_types.h" namespace Core::Frontend { @@ -23,10 +23,10 @@ struct KeyboardInitializeParameters { u32 max_text_length; u32 min_text_length; s32 initial_cursor_position; - Service::AM::Applets::SwkbdType type; - Service::AM::Applets::SwkbdPasswordMode password_mode; - Service::AM::Applets::SwkbdTextDrawType text_draw_type; - Service::AM::Applets::SwkbdKeyDisableFlags key_disable_flags; + Service::AM::Frontend::SwkbdType type; + Service::AM::Frontend::SwkbdPasswordMode password_mode; + Service::AM::Frontend::SwkbdTextDrawType text_draw_type; + Service::AM::Frontend::SwkbdKeyDisableFlags key_disable_flags; bool use_blur_background; bool enable_backspace_button; bool enable_return_button; @@ -40,8 +40,8 @@ struct InlineAppearParameters { f32 key_top_scale_y; f32 key_top_translate_x; f32 key_top_translate_y; - Service::AM::Applets::SwkbdType type; - Service::AM::Applets::SwkbdKeyDisableFlags key_disable_flags; + Service::AM::Frontend::SwkbdType type; + Service::AM::Frontend::SwkbdKeyDisableFlags key_disable_flags; bool key_top_as_floating; bool enable_backspace_button; bool enable_return_button; @@ -56,9 +56,9 @@ struct InlineTextParameters { class SoftwareKeyboardApplet : public Applet { public: using SubmitInlineCallback = - std::function; + std::function; using SubmitNormalCallback = - std::function; + std::function; virtual ~SoftwareKeyboardApplet(); @@ -69,7 +69,7 @@ public: virtual void ShowNormalKeyboard() const = 0; - virtual void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result, + virtual void ShowTextCheckDialog(Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const = 0; virtual void ShowInlineKeyboard(InlineAppearParameters appear_parameters) const = 0; @@ -93,7 +93,7 @@ public: void ShowNormalKeyboard() const override; - void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result, + void ShowTextCheckDialog(Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const override; void ShowInlineKeyboard(InlineAppearParameters appear_parameters) const override; diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 6e703ef065..eca8d6d98d 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp @@ -18,7 +18,7 @@ void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url, LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", local_url); - callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); + callback(Service::AM::Frontend::WebExitReason::WindowClosed, "http://localhost/"); } void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_url, @@ -26,7 +26,7 @@ void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_ur LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", external_url); - callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); + callback(Service::AM::Frontend::WebExitReason::WindowClosed, "http://localhost/"); } } // namespace Core::Frontend diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 178bbdd3f5..b70856a22b 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h @@ -6,7 +6,7 @@ #include #include "core/frontend/applets/applet.h" -#include "core/hle/service/am/applets/applet_web_browser_types.h" +#include "core/hle/service/am/frontend/applet_web_browser_types.h" namespace Core::Frontend { @@ -14,7 +14,7 @@ class WebBrowserApplet : public Applet { public: using ExtractROMFSCallback = std::function; using OpenWebPageCallback = - std::function; + std::function; virtual ~WebBrowserApplet(); diff --git a/src/core/hle/service/am/applet_manager.cpp b/src/core/hle/service/am/applet_manager.cpp index 9f7ccfbf25..4aac5dba70 100644 --- a/src/core/hle/service/am/applet_manager.cpp +++ b/src/core/hle/service/am/applet_manager.cpp @@ -7,10 +7,10 @@ #include "core/core_timing.h" #include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/am/applet_manager.h" -#include "core/hle/service/am/applets/applet_cabinet.h" -#include "core/hle/service/am/applets/applet_controller.h" -#include "core/hle/service/am/applets/applet_mii_edit_types.h" -#include "core/hle/service/am/applets/applet_software_keyboard_types.h" +#include "core/hle/service/am/frontend/applet_cabinet.h" +#include "core/hle/service/am/frontend/applet_controller.h" +#include "core/hle/service/am/frontend/applet_mii_edit_types.h" +#include "core/hle/service/am/frontend/applet_software_keyboard_types.h" #include "hid_core/hid_types.h" namespace Service::AM { @@ -54,13 +54,13 @@ void PushInShowController(Core::System& system, AppletStorageChannel& channel) { const CommonArguments common_args = { .arguments_version = CommonArgumentVersion::Version3, .size = CommonArgumentSize::Version3, - .library_version = static_cast(Applets::ControllerAppletVersion::Version8), + .library_version = static_cast(Frontend::ControllerAppletVersion::Version8), .theme_color = ThemeColor::BasicBlack, .play_startup_sound = true, .system_tick = system.CoreTiming().GetClockTicks(), }; - Applets::ControllerSupportArgNew user_args = { + Frontend::ControllerSupportArgNew user_args = { .header = {.player_count_min = 1, .player_count_max = 4, .enable_take_over_connection = true, @@ -73,13 +73,13 @@ void PushInShowController(Core::System& system, AppletStorageChannel& channel) { .explain_text = {}, }; - Applets::ControllerSupportArgPrivate private_args = { - .arg_private_size = sizeof(Applets::ControllerSupportArgPrivate), - .arg_size = sizeof(Applets::ControllerSupportArgNew), + Frontend::ControllerSupportArgPrivate private_args = { + .arg_private_size = sizeof(Frontend::ControllerSupportArgPrivate), + .arg_size = sizeof(Frontend::ControllerSupportArgNew), .is_home_menu = true, .flag_1 = true, - .mode = Applets::ControllerSupportMode::ShowControllerSupport, - .caller = Applets::ControllerSupportCaller:: + .mode = Frontend::ControllerSupportMode::ShowControllerSupport, + .caller = Frontend::ControllerSupportCaller:: Application, // switchbrew: Always zero except with // ShowControllerFirmwareUpdateForSystem/ShowControllerKeyRemappingForSystem, // which sets this to the input param @@ -103,16 +103,16 @@ void PushInShowCabinetData(Core::System& system, AppletStorageChannel& channel) const CommonArguments arguments{ .arguments_version = CommonArgumentVersion::Version3, .size = CommonArgumentSize::Version3, - .library_version = static_cast(Applets::CabinetAppletVersion::Version1), + .library_version = static_cast(Frontend::CabinetAppletVersion::Version1), .theme_color = ThemeColor::BasicBlack, .play_startup_sound = true, .system_tick = system.CoreTiming().GetClockTicks(), }; - const Applets::StartParamForAmiiboSettings amiibo_settings{ + const Frontend::StartParamForAmiiboSettings amiibo_settings{ .param_1 = 0, - .applet_mode = system.GetAppletManager().GetCabinetMode(), - .flags = Applets::CabinetFlags::None, + .applet_mode = system.GetFrontendAppletHolder().GetCabinetMode(), + .flags = Frontend::CabinetFlags::None, .amiibo_settings_1 = 0, .device_handle = 0, .tag_info{}, @@ -130,16 +130,16 @@ void PushInShowCabinetData(Core::System& system, AppletStorageChannel& channel) void PushInShowMiiEditData(Core::System& system, AppletStorageChannel& channel) { struct MiiEditV3 { - Applets::MiiEditAppletInputCommon common; - Applets::MiiEditAppletInputV3 input; + Frontend::MiiEditAppletInputCommon common; + Frontend::MiiEditAppletInputV3 input; }; static_assert(sizeof(MiiEditV3) == 0x100, "MiiEditV3 has incorrect size."); MiiEditV3 mii_arguments{ .common = { - .version = Applets::MiiEditAppletVersion::Version3, - .applet_mode = Applets::MiiEditAppletMode::ShowMiiEdit, + .version = Frontend::MiiEditAppletVersion::Version3, + .applet_mode = Frontend::MiiEditAppletMode::ShowMiiEdit, }, .input{}, }; @@ -154,7 +154,7 @@ void PushInShowSoftwareKeyboard(Core::System& system, AppletStorageChannel& chan const CommonArguments arguments{ .arguments_version = CommonArgumentVersion::Version3, .size = CommonArgumentSize::Version3, - .library_version = static_cast(Applets::SwkbdAppletVersion::Version524301), + .library_version = static_cast(Frontend::SwkbdAppletVersion::Version524301), .theme_color = ThemeColor::BasicBlack, .play_startup_sound = true, .system_tick = system.CoreTiming().GetClockTicks(), @@ -162,21 +162,21 @@ void PushInShowSoftwareKeyboard(Core::System& system, AppletStorageChannel& chan std::vector initial_string(0); - const Applets::SwkbdConfigCommon swkbd_config{ - .type = Applets::SwkbdType::Qwerty, + const Frontend::SwkbdConfigCommon swkbd_config{ + .type = Frontend::SwkbdType::Qwerty, .ok_text{}, .left_optional_symbol_key{}, .right_optional_symbol_key{}, .use_prediction = false, .key_disable_flags{}, - .initial_cursor_position = Applets::SwkbdInitialCursorPosition::Start, + .initial_cursor_position = Frontend::SwkbdInitialCursorPosition::Start, .header_text{}, .sub_text{}, .guide_text{}, .max_text_length = 500, .min_text_length = 0, - .password_mode = Applets::SwkbdPasswordMode::Disabled, - .text_draw_type = Applets::SwkbdTextDrawType::Box, + .password_mode = Frontend::SwkbdPasswordMode::Disabled, + .text_draw_type = Frontend::SwkbdTextDrawType::Box, .enable_return_button = true, .use_utf8 = false, .use_blur_background = true, @@ -187,7 +187,7 @@ void PushInShowSoftwareKeyboard(Core::System& system, AppletStorageChannel& chan .use_text_check = false, }; - Applets::SwkbdConfigNew swkbd_config_new{}; + Frontend::SwkbdConfigNew swkbd_config_new{}; std::vector argument_data(sizeof(arguments)); std::vector swkbd_data(sizeof(swkbd_config) + sizeof(swkbd_config_new)); @@ -196,7 +196,7 @@ void PushInShowSoftwareKeyboard(Core::System& system, AppletStorageChannel& chan std::memcpy(argument_data.data(), &arguments, sizeof(arguments)); std::memcpy(swkbd_data.data(), &swkbd_config, sizeof(swkbd_config)); std::memcpy(swkbd_data.data() + sizeof(swkbd_config), &swkbd_config_new, - sizeof(Applets::SwkbdConfigNew)); + sizeof(Frontend::SwkbdConfigNew)); std::memcpy(work_buffer.data(), initial_string.data(), swkbd_config.initial_string_length * sizeof(char16_t)); diff --git a/src/core/hle/service/am/applets/applet_cabinet.cpp b/src/core/hle/service/am/frontend/applet_cabinet.cpp similarity index 95% rename from src/core/hle/service/am/applets/applet_cabinet.cpp rename to src/core/hle/service/am/frontend/applet_cabinet.cpp index 1b756fbd7a..f1f49e83b8 100644 --- a/src/core/hle/service/am/applets/applet_cabinet.cpp +++ b/src/core/hle/service/am/frontend/applet_cabinet.cpp @@ -8,18 +8,18 @@ #include "core/hle/kernel/k_event.h" #include "core/hle/kernel/k_readable_event.h" #include "core/hle/service/am/am.h" -#include "core/hle/service/am/applets/applet_cabinet.h" +#include "core/hle/service/am/frontend/applet_cabinet.h" #include "core/hle/service/am/storage.h" #include "core/hle/service/mii/mii_manager.h" #include "core/hle/service/nfc/common/device.h" #include "hid_core/hid_core.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { Cabinet::Cabinet(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::CabinetApplet& frontend_) - : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_}, - service_context{system_, "CabinetApplet"} { + : FrontendApplet{system_, applet_mode_}, frontend{frontend_}, + system{system_}, service_context{system_, "CabinetApplet"} { availability_change_event = service_context.CreateEvent("CabinetApplet:AvailabilityChangeEvent"); @@ -30,7 +30,7 @@ Cabinet::~Cabinet() { }; void Cabinet::Initialize() { - Applet::Initialize(); + FrontendApplet::Initialize(); LOG_INFO(Service_HID, "Initializing Cabinet Applet."); @@ -184,4 +184,4 @@ Result Cabinet::RequestExit() { R_SUCCEED(); } -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_cabinet.h b/src/core/hle/service/am/frontend/applet_cabinet.h similarity index 94% rename from src/core/hle/service/am/applets/applet_cabinet.h rename to src/core/hle/service/am/frontend/applet_cabinet.h index f498796f71..85d25bcb3e 100644 --- a/src/core/hle/service/am/applets/applet_cabinet.h +++ b/src/core/hle/service/am/frontend/applet_cabinet.h @@ -6,7 +6,7 @@ #include #include "core/hle/result.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/kernel_helpers.h" #include "core/hle/service/nfp/nfp_types.h" @@ -23,7 +23,7 @@ namespace Service::NFC { class NfcDevice; } -namespace Service::AM::Applets { +namespace Service::AM::Frontend { enum class CabinetAppletVersion : u32 { Version1 = 0x1, @@ -84,7 +84,7 @@ static_assert(sizeof(ReturnValueForAmiiboSettings) == 0x188, "ReturnValueForAmiiboSettings is an invalid size"); #pragma pack(pop) -class Cabinet final : public Applet { +class Cabinet final : public FrontendApplet { public: explicit Cabinet(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::CabinetApplet& frontend_); @@ -111,4 +111,4 @@ private: StartParamForAmiiboSettings applet_input_common{}; }; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/frontend/applet_controller.cpp similarity index 97% rename from src/core/hle/service/am/applets/applet_controller.cpp rename to src/core/hle/service/am/frontend/applet_controller.cpp index bc8de6b601..b4114f6a3c 100644 --- a/src/core/hle/service/am/applets/applet_controller.cpp +++ b/src/core/hle/service/am/frontend/applet_controller.cpp @@ -11,14 +11,14 @@ #include "core/frontend/applets/controller.h" #include "core/hle/result.h" #include "core/hle/service/am/am.h" -#include "core/hle/service/am/applets/applet_controller.h" +#include "core/hle/service/am/frontend/applet_controller.h" #include "core/hle/service/am/storage.h" #include "hid_core/frontend/emulated_controller.h" #include "hid_core/hid_core.h" #include "hid_core/hid_types.h" #include "hid_core/resources/npad/npad.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { [[maybe_unused]] constexpr Result ResultControllerSupportCanceled{ErrorModule::HID, 3101}; [[maybe_unused]] constexpr Result ResultControllerSupportNotSupportedNpadStyle{ErrorModule::HID, @@ -49,12 +49,12 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters( Controller::Controller(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::ControllerApplet& frontend_) - : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} + : FrontendApplet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} Controller::~Controller() = default; void Controller::Initialize() { - Applet::Initialize(); + FrontendApplet::Initialize(); LOG_INFO(Service_HID, "Initializing Controller Applet."); @@ -270,4 +270,4 @@ Result Controller::RequestExit() { R_SUCCEED(); } -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_controller.h b/src/core/hle/service/am/frontend/applet_controller.h similarity index 96% rename from src/core/hle/service/am/applets/applet_controller.h rename to src/core/hle/service/am/frontend/applet_controller.h index 9f839f3d74..bf2bed332c 100644 --- a/src/core/hle/service/am/applets/applet_controller.h +++ b/src/core/hle/service/am/frontend/applet_controller.h @@ -9,7 +9,7 @@ #include "common/common_funcs.h" #include "common/common_types.h" #include "core/hle/result.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" namespace Core { class System; @@ -19,7 +19,7 @@ namespace Core::HID { enum class NpadStyleSet : u32; } -namespace Service::AM::Applets { +namespace Service::AM::Frontend { using IdentificationColor = std::array; using ExplainText = std::array; @@ -122,7 +122,7 @@ struct ControllerSupportResultInfo { static_assert(sizeof(ControllerSupportResultInfo) == 0xC, "ControllerSupportResultInfo has incorrect size."); -class Controller final : public Applet { +class Controller final : public FrontendApplet { public: explicit Controller(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::ControllerApplet& frontend_); @@ -154,4 +154,4 @@ private: std::vector out_data; }; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_error.cpp b/src/core/hle/service/am/frontend/applet_error.cpp similarity index 96% rename from src/core/hle/service/am/applets/applet_error.cpp rename to src/core/hle/service/am/frontend/applet_error.cpp index 96126832c4..48be77da22 100644 --- a/src/core/hle/service/am/applets/applet_error.cpp +++ b/src/core/hle/service/am/frontend/applet_error.cpp @@ -9,11 +9,11 @@ #include "core/core.h" #include "core/frontend/applets/error.h" #include "core/hle/service/am/am.h" -#include "core/hle/service/am/applets/applet_error.h" +#include "core/hle/service/am/frontend/applet_error.h" #include "core/hle/service/am/storage.h" #include "core/reporter.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { struct ErrorCode { u32 error_category{}; @@ -106,12 +106,12 @@ Result Decode64BitError(u64 error) { Error::Error(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::ErrorApplet& frontend_) - : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} + : FrontendApplet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} Error::~Error() = default; void Error::Initialize() { - Applet::Initialize(); + FrontendApplet::Initialize(); args = std::make_unique(); complete = false; @@ -220,4 +220,4 @@ Result Error::RequestExit() { R_SUCCEED(); } -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_error.h b/src/core/hle/service/am/frontend/applet_error.h similarity index 86% rename from src/core/hle/service/am/applets/applet_error.h rename to src/core/hle/service/am/frontend/applet_error.h index d822a32bbe..639e3c2244 100644 --- a/src/core/hle/service/am/applets/applet_error.h +++ b/src/core/hle/service/am/frontend/applet_error.h @@ -4,13 +4,13 @@ #pragma once #include "core/hle/result.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" namespace Core { class System; } -namespace Service::AM::Applets { +namespace Service::AM::Frontend { enum class ErrorAppletMode : u8 { ShowError = 0, @@ -22,7 +22,7 @@ enum class ErrorAppletMode : u8 { ShowUpdateEula = 8, }; -class Error final : public Applet { +class Error final : public FrontendApplet { public: explicit Error(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::ErrorApplet& frontend_); @@ -50,4 +50,4 @@ private: Core::System& system; }; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_general_backend.cpp b/src/core/hle/service/am/frontend/applet_general.cpp similarity index 93% rename from src/core/hle/service/am/applets/applet_general_backend.cpp rename to src/core/hle/service/am/frontend/applet_general.cpp index c010c78e26..e51171525c 100644 --- a/src/core/hle/service/am/applets/applet_general_backend.cpp +++ b/src/core/hle/service/am/frontend/applet_general.cpp @@ -5,14 +5,14 @@ #include "common/hex_util.h" #include "common/logging/log.h" #include "core/core.h" -#include "core/frontend/applets/general_frontend.h" +#include "core/frontend/applets/general.h" #include "core/hle/result.h" #include "core/hle/service/am/am.h" -#include "core/hle/service/am/applets/applet_general_backend.h" +#include "core/hle/service/am/frontend/applet_general.h" #include "core/hle/service/am/storage.h" #include "core/reporter.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { constexpr Result ERROR_INVALID_PIN{ErrorModule::PCTL, 221}; @@ -36,12 +36,12 @@ static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix) Auth::Auth(Core::System& system_, LibraryAppletMode applet_mode_, Core::Frontend::ParentalControlsApplet& frontend_) - : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} + : FrontendApplet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} Auth::~Auth() = default; void Auth::Initialize() { - Applet::Initialize(); + FrontendApplet::Initialize(); complete = false; const auto storage = broker.PopNormalDataToApplet(); @@ -158,12 +158,12 @@ Result Auth::RequestExit() { PhotoViewer::PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::PhotoViewerApplet& frontend_) - : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} + : FrontendApplet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} PhotoViewer::~PhotoViewer() = default; void PhotoViewer::Initialize() { - Applet::Initialize(); + FrontendApplet::Initialize(); complete = false; const auto storage = broker.PopNormalDataToApplet(); @@ -214,13 +214,13 @@ Result PhotoViewer::RequestExit() { } StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_) - : Applet{system_, applet_mode_}, id{id_}, system{system_} {} + : FrontendApplet{system_, applet_mode_}, id{id_}, system{system_} {} StubApplet::~StubApplet() = default; void StubApplet::Initialize() { LOG_WARNING(Service_AM, "called (STUBBED)"); - Applet::Initialize(); + FrontendApplet::Initialize(); const auto data = broker.PeekDataToAppletForDebug(); system.GetReporter().SaveUnimplementedAppletReport( @@ -266,4 +266,4 @@ Result StubApplet::RequestExit() { R_SUCCEED(); } -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_general_backend.h b/src/core/hle/service/am/frontend/applet_general.h similarity index 89% rename from src/core/hle/service/am/applets/applet_general_backend.h rename to src/core/hle/service/am/frontend/applet_general.h index 34ecaebb91..b39a9a3f11 100644 --- a/src/core/hle/service/am/applets/applet_general_backend.h +++ b/src/core/hle/service/am/frontend/applet_general.h @@ -3,13 +3,13 @@ #pragma once -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" namespace Core { class System; } -namespace Service::AM::Applets { +namespace Service::AM::Frontend { enum class AuthAppletType : u32 { ShowParentalAuthentication, @@ -17,7 +17,7 @@ enum class AuthAppletType : u32 { ChangeParentalPasscode, }; -class Auth final : public Applet { +class Auth final : public FrontendApplet { public: explicit Auth(Core::System& system_, LibraryAppletMode applet_mode_, Core::Frontend::ParentalControlsApplet& frontend_); @@ -49,7 +49,7 @@ enum class PhotoViewerAppletMode : u8 { AllApps = 1, }; -class PhotoViewer final : public Applet { +class PhotoViewer final : public FrontendApplet { public: explicit PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::PhotoViewerApplet& frontend_); @@ -71,7 +71,7 @@ private: Core::System& system; }; -class StubApplet final : public Applet { +class StubApplet final : public FrontendApplet { public: explicit StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_); ~StubApplet() override; @@ -89,4 +89,4 @@ private: Core::System& system; }; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_mii_edit.cpp b/src/core/hle/service/am/frontend/applet_mii_edit.cpp similarity index 96% rename from src/core/hle/service/am/applets/applet_mii_edit.cpp rename to src/core/hle/service/am/frontend/applet_mii_edit.cpp index 1576b45c42..6203ebd2ed 100644 --- a/src/core/hle/service/am/applets/applet_mii_edit.cpp +++ b/src/core/hle/service/am/frontend/applet_mii_edit.cpp @@ -6,17 +6,17 @@ #include "core/core.h" #include "core/frontend/applets/mii_edit.h" #include "core/hle/service/am/am.h" -#include "core/hle/service/am/applets/applet_mii_edit.h" +#include "core/hle/service/am/frontend/applet_mii_edit.h" #include "core/hle/service/am/storage.h" #include "core/hle/service/mii/mii.h" #include "core/hle/service/mii/mii_manager.h" #include "core/hle/service/sm/sm.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { MiiEdit::MiiEdit(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::MiiEditApplet& frontend_) - : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} + : FrontendApplet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} MiiEdit::~MiiEdit() = default; @@ -178,4 +178,4 @@ Result MiiEdit::RequestExit() { R_SUCCEED(); } -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_mii_edit.h b/src/core/hle/service/am/frontend/applet_mii_edit.h similarity index 84% rename from src/core/hle/service/am/applets/applet_mii_edit.h rename to src/core/hle/service/am/frontend/applet_mii_edit.h index 7ff34af494..ebde370287 100644 --- a/src/core/hle/service/am/applets/applet_mii_edit.h +++ b/src/core/hle/service/am/frontend/applet_mii_edit.h @@ -4,8 +4,8 @@ #pragma once #include "core/hle/result.h" -#include "core/hle/service/am/applets/applet_mii_edit_types.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applet_mii_edit_types.h" +#include "core/hle/service/am/frontend/applets.h" namespace Core { class System; @@ -16,9 +16,9 @@ struct DatabaseSessionMetadata; class MiiManager; } // namespace Service::Mii -namespace Service::AM::Applets { +namespace Service::AM::Frontend { -class MiiEdit final : public Applet { +class MiiEdit final : public FrontendApplet { public: explicit MiiEdit(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::MiiEditApplet& frontend_); @@ -49,4 +49,4 @@ private: Mii::DatabaseSessionMetadata metadata{}; }; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_mii_edit_types.h b/src/core/hle/service/am/frontend/applet_mii_edit_types.h similarity index 96% rename from src/core/hle/service/am/applets/applet_mii_edit_types.h rename to src/core/hle/service/am/frontend/applet_mii_edit_types.h index f3d7640732..23d9d7a69b 100644 --- a/src/core/hle/service/am/applets/applet_mii_edit_types.h +++ b/src/core/hle/service/am/frontend/applet_mii_edit_types.h @@ -10,7 +10,7 @@ #include "common/uuid.h" #include "core/hle/service/mii/types/char_info.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { enum class MiiEditAppletVersion : s32 { Version3 = 0x3, // 1.0.0 - 10.1.1 @@ -80,4 +80,4 @@ struct MiiEditAppletOutputForCharInfoEditing { static_assert(sizeof(MiiEditAppletOutputForCharInfoEditing) == 0x80, "MiiEditAppletOutputForCharInfoEditing has incorrect size."); -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/frontend/applet_profile_select.cpp similarity index 93% rename from src/core/hle/service/am/applets/applet_profile_select.cpp rename to src/core/hle/service/am/frontend/applet_profile_select.cpp index f32db68424..5d71f985e6 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/frontend/applet_profile_select.cpp @@ -9,14 +9,14 @@ #include "core/frontend/applets/profile_select.h" #include "core/hle/service/acc/errors.h" #include "core/hle/service/am/am.h" -#include "core/hle/service/am/applets/applet_profile_select.h" +#include "core/hle/service/am/frontend/applet_profile_select.h" #include "core/hle/service/am/storage.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::ProfileSelectApplet& frontend_) - : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} + : FrontendApplet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} ProfileSelect::~ProfileSelect() = default; @@ -25,7 +25,7 @@ void ProfileSelect::Initialize() { status = ResultSuccess; final_data.clear(); - Applet::Initialize(); + FrontendApplet::Initialize(); profile_select_version = ProfileSelectAppletVersion{common_args.library_version}; const auto user_config_storage = broker.PopNormalDataToApplet(); @@ -121,4 +121,4 @@ Result ProfileSelect::RequestExit() { R_SUCCEED(); } -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_profile_select.h b/src/core/hle/service/am/frontend/applet_profile_select.h similarity index 95% rename from src/core/hle/service/am/applets/applet_profile_select.h rename to src/core/hle/service/am/frontend/applet_profile_select.h index 673eed516e..43ec67c8e0 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.h +++ b/src/core/hle/service/am/frontend/applet_profile_select.h @@ -8,13 +8,13 @@ #include "common/common_funcs.h" #include "common/uuid.h" #include "core/hle/result.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" namespace Core { class System; } -namespace Service::AM::Applets { +namespace Service::AM::Frontend { enum class ProfileSelectAppletVersion : u32 { Version1 = 0x1, // 1.0.0+ @@ -111,7 +111,7 @@ struct UiReturnArg { }; static_assert(sizeof(UiReturnArg) == 0x18, "UiReturnArg has incorrect size."); -class ProfileSelect final : public Applet { +class ProfileSelect final : public FrontendApplet { public: explicit ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::ProfileSelectApplet& frontend_); @@ -140,4 +140,4 @@ private: Core::System& system; }; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.cpp b/src/core/hle/service/am/frontend/applet_software_keyboard.cpp similarity index 99% rename from src/core/hle/service/am/applets/applet_software_keyboard.cpp rename to src/core/hle/service/am/frontend/applet_software_keyboard.cpp index a6a07cef3f..7974995cc2 100644 --- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp +++ b/src/core/hle/service/am/frontend/applet_software_keyboard.cpp @@ -5,10 +5,10 @@ #include "core/core.h" #include "core/frontend/applets/software_keyboard.h" #include "core/hle/service/am/am.h" -#include "core/hle/service/am/applets/applet_software_keyboard.h" +#include "core/hle/service/am/frontend/applet_software_keyboard.h" #include "core/hle/service/am/storage.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { namespace { @@ -44,12 +44,12 @@ void SetReplyBase(std::vector& reply, SwkbdState state, SwkbdReplyType reply SoftwareKeyboard::SoftwareKeyboard(Core::System& system_, LibraryAppletMode applet_mode_, Core::Frontend::SoftwareKeyboardApplet& frontend_) - : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} + : FrontendApplet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} SoftwareKeyboard::~SoftwareKeyboard() = default; void SoftwareKeyboard::Initialize() { - Applet::Initialize(); + FrontendApplet::Initialize(); LOG_INFO(Service_AM, "Initializing Software Keyboard Applet with LibraryAppletMode={}", applet_mode); @@ -1274,4 +1274,4 @@ void SoftwareKeyboard::ReplyMovedCursorUtf8V2() { broker.PushInteractiveDataFromApplet(std::make_shared(system, std::move(reply))); } -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.h b/src/core/hle/service/am/frontend/applet_software_keyboard.h similarity index 96% rename from src/core/hle/service/am/applets/applet_software_keyboard.h rename to src/core/hle/service/am/frontend/applet_software_keyboard.h index 2e919811b9..00ad0add35 100644 --- a/src/core/hle/service/am/applets/applet_software_keyboard.h +++ b/src/core/hle/service/am/frontend/applet_software_keyboard.h @@ -5,8 +5,8 @@ #include "common/common_types.h" #include "core/hle/result.h" -#include "core/hle/service/am/applets/applet_software_keyboard_types.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applet_software_keyboard_types.h" +#include "core/hle/service/am/frontend/applets.h" namespace Core { class System; @@ -17,9 +17,9 @@ struct KeyboardInitializeParameters; struct InlineAppearParameters; } // namespace Core::Frontend -namespace Service::AM::Applets { +namespace Service::AM::Frontend { -class SoftwareKeyboard final : public Applet { +class SoftwareKeyboard final : public FrontendApplet { public: explicit SoftwareKeyboard(Core::System& system_, LibraryAppletMode applet_mode_, Core::Frontend::SoftwareKeyboardApplet& frontend_); @@ -184,4 +184,4 @@ private: Result status{ResultSuccess}; }; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_software_keyboard_types.h b/src/core/hle/service/am/frontend/applet_software_keyboard_types.h similarity index 99% rename from src/core/hle/service/am/applets/applet_software_keyboard_types.h rename to src/core/hle/service/am/frontend/applet_software_keyboard_types.h index 1f696900e7..a25ff2a6d2 100644 --- a/src/core/hle/service/am/applets/applet_software_keyboard_types.h +++ b/src/core/hle/service/am/frontend/applet_software_keyboard_types.h @@ -11,7 +11,7 @@ #include "common/swap.h" #include "common/uuid.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { constexpr std::size_t MAX_OK_TEXT_LENGTH = 8; constexpr std::size_t MAX_HEADER_TEXT_LENGTH = 64; @@ -351,4 +351,4 @@ struct SwkbdDecidedEnterArg { }; static_assert(sizeof(SwkbdDecidedEnterArg) == 0x4, "SwkbdDecidedEnterArg has incorrect size."); -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/frontend/applet_web_browser.cpp similarity index 98% rename from src/core/hle/service/am/applets/applet_web_browser.cpp rename to src/core/hle/service/am/frontend/applet_web_browser.cpp index 871737b3eb..28a20c72b0 100644 --- a/src/core/hle/service/am/applets/applet_web_browser.cpp +++ b/src/core/hle/service/am/frontend/applet_web_browser.cpp @@ -19,13 +19,13 @@ #include "core/frontend/applets/web_browser.h" #include "core/hle/result.h" #include "core/hle/service/am/am.h" -#include "core/hle/service/am/applets/applet_web_browser.h" +#include "core/hle/service/am/frontend/applet_web_browser.h" #include "core/hle/service/am/storage.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/ns/iplatform_service_manager.h" #include "core/loader/loader.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { namespace { @@ -226,12 +226,12 @@ void ExtractSharedFonts(Core::System& system) { WebBrowser::WebBrowser(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::WebBrowserApplet& frontend_) - : Applet{system_, applet_mode_}, frontend(frontend_), system{system_} {} + : FrontendApplet{system_, applet_mode_}, frontend(frontend_), system{system_} {} WebBrowser::~WebBrowser() = default; void WebBrowser::Initialize() { - Applet::Initialize(); + FrontendApplet::Initialize(); LOG_INFO(Service_AM, "Initializing Web Browser Applet."); @@ -505,4 +505,4 @@ void WebBrowser::ExecuteLobby() { LOG_WARNING(Service_AM, "(STUBBED) called, Lobby Applet is not implemented"); WebBrowserExit(WebExitReason::EndButtonPressed); } -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_web_browser.h b/src/core/hle/service/am/frontend/applet_web_browser.h similarity index 89% rename from src/core/hle/service/am/applets/applet_web_browser.h rename to src/core/hle/service/am/frontend/applet_web_browser.h index 36adb25107..613d8e9ea1 100644 --- a/src/core/hle/service/am/applets/applet_web_browser.h +++ b/src/core/hle/service/am/frontend/applet_web_browser.h @@ -9,8 +9,8 @@ #include "common/common_types.h" #include "core/file_sys/vfs/vfs_types.h" #include "core/hle/result.h" -#include "core/hle/service/am/applets/applet_web_browser_types.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applet_web_browser_types.h" +#include "core/hle/service/am/frontend/applets.h" namespace Core { class System; @@ -20,9 +20,9 @@ namespace FileSys { enum class ContentRecordType : u8; } -namespace Service::AM::Applets { +namespace Service::AM::Frontend { -class WebBrowser final : public Applet { +class WebBrowser final : public FrontendApplet { public: WebBrowser(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::WebBrowserApplet& frontend_); @@ -84,4 +84,4 @@ private: Core::System& system; }; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applet_web_browser_types.h b/src/core/hle/service/am/frontend/applet_web_browser_types.h similarity index 98% rename from src/core/hle/service/am/applets/applet_web_browser_types.h rename to src/core/hle/service/am/frontend/applet_web_browser_types.h index c522c5c1a5..2f7c05c243 100644 --- a/src/core/hle/service/am/applets/applet_web_browser_types.h +++ b/src/core/hle/service/am/frontend/applet_web_browser_types.h @@ -11,7 +11,7 @@ #include "common/common_types.h" #include "common/swap.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { enum class WebAppletVersion : u32_le { Version0 = 0x0, // Only used by WifiWebAuthApplet @@ -174,4 +174,4 @@ static_assert(sizeof(WebCommonReturnValue) == 0x1010, "WebCommonReturnValue has using WebArgInputTLVMap = std::unordered_map>; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/frontend/applets.cpp similarity index 83% rename from src/core/hle/service/am/applets/applets.cpp rename to src/core/hle/service/am/frontend/applets.cpp index 6a47f4b7a2..4e8f806d7c 100644 --- a/src/core/hle/service/am/applets/applets.cpp +++ b/src/core/hle/service/am/frontend/applets.cpp @@ -8,7 +8,7 @@ #include "core/frontend/applets/cabinet.h" #include "core/frontend/applets/controller.h" #include "core/frontend/applets/error.h" -#include "core/frontend/applets/general_frontend.h" +#include "core/frontend/applets/general.h" #include "core/frontend/applets/mii_edit.h" #include "core/frontend/applets/profile_select.h" #include "core/frontend/applets/software_keyboard.h" @@ -18,19 +18,19 @@ #include "core/hle/service/am/applet_ae.h" #include "core/hle/service/am/applet_message_queue.h" #include "core/hle/service/am/applet_oe.h" -#include "core/hle/service/am/applets/applet_cabinet.h" -#include "core/hle/service/am/applets/applet_controller.h" -#include "core/hle/service/am/applets/applet_error.h" -#include "core/hle/service/am/applets/applet_general_backend.h" -#include "core/hle/service/am/applets/applet_mii_edit.h" -#include "core/hle/service/am/applets/applet_profile_select.h" -#include "core/hle/service/am/applets/applet_software_keyboard.h" -#include "core/hle/service/am/applets/applet_web_browser.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applet_cabinet.h" +#include "core/hle/service/am/frontend/applet_controller.h" +#include "core/hle/service/am/frontend/applet_error.h" +#include "core/hle/service/am/frontend/applet_general.h" +#include "core/hle/service/am/frontend/applet_mii_edit.h" +#include "core/hle/service/am/frontend/applet_profile_select.h" +#include "core/hle/service/am/frontend/applet_software_keyboard.h" +#include "core/hle/service/am/frontend/applet_web_browser.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/am/storage.h" #include "core/hle/service/sm/sm.h" -namespace Service::AM::Applets { +namespace Service::AM::Frontend { AppletDataBroker::AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_) : system{system_}, applet_mode{applet_mode_}, @@ -156,12 +156,12 @@ Kernel::KReadableEvent& AppletDataBroker::GetStateChangedEvent() { return state_changed_event->GetReadableEvent(); } -Applet::Applet(Core::System& system_, LibraryAppletMode applet_mode_) +FrontendApplet::FrontendApplet(Core::System& system_, LibraryAppletMode applet_mode_) : broker{system_, applet_mode_}, applet_mode{applet_mode_} {} -Applet::~Applet() = default; +FrontendApplet::~FrontendApplet() = default; -void Applet::Initialize() { +void FrontendApplet::Initialize() { const auto common = broker.PopNormalDataToApplet(); ASSERT(common != nullptr); @@ -173,9 +173,9 @@ void Applet::Initialize() { initialized = true; } -AppletFrontendSet::AppletFrontendSet() = default; +FrontendAppletSet::FrontendAppletSet() = default; -AppletFrontendSet::AppletFrontendSet(CabinetApplet cabinet_applet, +FrontendAppletSet::FrontendAppletSet(CabinetApplet cabinet_applet, ControllerApplet controller_applet, ErrorApplet error_applet, MiiEdit mii_edit_, ParentalControlsApplet parental_controls_applet, @@ -187,29 +187,29 @@ AppletFrontendSet::AppletFrontendSet(CabinetApplet cabinet_applet, photo_viewer{std::move(photo_viewer_)}, profile_select{std::move(profile_select_)}, software_keyboard{std::move(software_keyboard_)}, web_browser{std::move(web_browser_)} {} -AppletFrontendSet::~AppletFrontendSet() = default; +FrontendAppletSet::~FrontendAppletSet() = default; -AppletFrontendSet::AppletFrontendSet(AppletFrontendSet&&) noexcept = default; +FrontendAppletSet::FrontendAppletSet(FrontendAppletSet&&) noexcept = default; -AppletFrontendSet& AppletFrontendSet::operator=(AppletFrontendSet&&) noexcept = default; +FrontendAppletSet& FrontendAppletSet::operator=(FrontendAppletSet&&) noexcept = default; -AppletManager::AppletManager(Core::System& system_) : system{system_} {} +FrontendAppletHolder::FrontendAppletHolder(Core::System& system_) : system{system_} {} -AppletManager::~AppletManager() = default; +FrontendAppletHolder::~FrontendAppletHolder() = default; -const AppletFrontendSet& AppletManager::GetAppletFrontendSet() const { +const FrontendAppletSet& FrontendAppletHolder::GetFrontendAppletSet() const { return frontend; } -NFP::CabinetMode AppletManager::GetCabinetMode() const { +NFP::CabinetMode FrontendAppletHolder::GetCabinetMode() const { return cabinet_mode; } -AppletId AppletManager::GetCurrentAppletId() const { +AppletId FrontendAppletHolder::GetCurrentAppletId() const { return current_applet_id; } -void AppletManager::SetAppletFrontendSet(AppletFrontendSet set) { +void FrontendAppletHolder::SetFrontendAppletSet(FrontendAppletSet set) { if (set.cabinet != nullptr) { frontend.cabinet = std::move(set.cabinet); } @@ -247,20 +247,20 @@ void AppletManager::SetAppletFrontendSet(AppletFrontendSet set) { } } -void AppletManager::SetCabinetMode(NFP::CabinetMode mode) { +void FrontendAppletHolder::SetCabinetMode(NFP::CabinetMode mode) { cabinet_mode = mode; } -void AppletManager::SetCurrentAppletId(AppletId applet_id) { +void FrontendAppletHolder::SetCurrentAppletId(AppletId applet_id) { current_applet_id = applet_id; } -void AppletManager::SetDefaultAppletFrontendSet() { +void FrontendAppletHolder::SetDefaultAppletFrontendSet() { ClearAll(); SetDefaultAppletsIfMissing(); } -void AppletManager::SetDefaultAppletsIfMissing() { +void FrontendAppletHolder::SetDefaultAppletsIfMissing() { if (frontend.cabinet == nullptr) { frontend.cabinet = std::make_unique(); } @@ -301,11 +301,12 @@ void AppletManager::SetDefaultAppletsIfMissing() { } } -void AppletManager::ClearAll() { +void FrontendAppletHolder::ClearAll() { frontend = {}; } -std::shared_ptr AppletManager::GetApplet(AppletId id, LibraryAppletMode mode) const { +std::shared_ptr FrontendAppletHolder::GetApplet(AppletId id, + LibraryAppletMode mode) const { switch (id) { case AppletId::Auth: return std::make_shared(system, mode, *frontend.parental_controls); @@ -337,4 +338,4 @@ std::shared_ptr AppletManager::GetApplet(AppletId id, LibraryAppletMode } } -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/frontend/applets.h similarity index 63% rename from src/core/hle/service/am/applets/applets.h rename to src/core/hle/service/am/frontend/applets.h index 0bf2598b76..f581479551 100644 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/frontend/applets.h @@ -7,7 +7,7 @@ #include #include "common/swap.h" -#include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/am/applet.h" union Result; @@ -42,90 +42,7 @@ namespace Service::AM { class IStorage; -namespace Applets { - -enum class AppletId : u32 { - None = 0x00, - Application = 0x01, - OverlayDisplay = 0x02, - QLaunch = 0x03, - Starter = 0x04, - Auth = 0x0A, - Cabinet = 0x0B, - Controller = 0x0C, - DataErase = 0x0D, - Error = 0x0E, - NetConnect = 0x0F, - ProfileSelect = 0x10, - SoftwareKeyboard = 0x11, - MiiEdit = 0x12, - Web = 0x13, - Shop = 0x14, - PhotoViewer = 0x15, - Settings = 0x16, - OfflineWeb = 0x17, - LoginShare = 0x18, - WebAuth = 0x19, - MyPage = 0x1A, -}; - -enum class AppletProgramId : u64 { - QLaunch = 0x0100000000001000ull, - Auth = 0x0100000000001001ull, - Cabinet = 0x0100000000001002ull, - Controller = 0x0100000000001003ull, - DataErase = 0x0100000000001004ull, - Error = 0x0100000000001005ull, - NetConnect = 0x0100000000001006ull, - ProfileSelect = 0x0100000000001007ull, - SoftwareKeyboard = 0x0100000000001008ull, - MiiEdit = 0x0100000000001009ull, - Web = 0x010000000000100Aull, - Shop = 0x010000000000100Bull, - OverlayDisplay = 0x010000000000100Cull, - PhotoViewer = 0x010000000000100Dull, - Settings = 0x010000000000100Eull, - OfflineWeb = 0x010000000000100Full, - LoginShare = 0x0100000000001010ull, - WebAuth = 0x0100000000001011ull, - Starter = 0x0100000000001012ull, - MyPage = 0x0100000000001013ull, - MaxProgramId = 0x0100000000001FFFull, -}; - -enum class LibraryAppletMode : u32 { - AllForeground = 0, - Background = 1, - NoUI = 2, - BackgroundIndirectDisplay = 3, - AllForegroundInitiallyHidden = 4, -}; - -enum class CommonArgumentVersion : u32 { - Version0, - Version1, - Version2, - Version3, -}; - -enum class CommonArgumentSize : u32 { - Version3 = 0x20, -}; - -enum class ThemeColor : u32 { - BasicWhite = 0, - BasicBlack = 3, -}; - -struct CommonArguments { - CommonArgumentVersion arguments_version; - CommonArgumentSize size; - u32 library_version; - ThemeColor theme_color; - bool play_startup_sound; - u64_le system_tick; -}; -static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size."); +namespace Frontend { class AppletDataBroker final { public: @@ -187,10 +104,10 @@ private: Kernel::KEvent* pop_interactive_out_data_event; }; -class Applet { +class FrontendApplet { public: - explicit Applet(Core::System& system_, LibraryAppletMode applet_mode_); - virtual ~Applet(); + explicit FrontendApplet(Core::System& system_, LibraryAppletMode applet_mode_); + virtual ~FrontendApplet(); virtual void Initialize(); @@ -223,7 +140,7 @@ protected: bool initialized = false; }; -struct AppletFrontendSet { +struct FrontendAppletSet { using CabinetApplet = std::unique_ptr; using ControllerApplet = std::unique_ptr; using ErrorApplet = std::unique_ptr; @@ -234,19 +151,19 @@ struct AppletFrontendSet { using SoftwareKeyboard = std::unique_ptr; using WebBrowser = std::unique_ptr; - AppletFrontendSet(); - AppletFrontendSet(CabinetApplet cabinet_applet, ControllerApplet controller_applet, + FrontendAppletSet(); + FrontendAppletSet(CabinetApplet cabinet_applet, ControllerApplet controller_applet, ErrorApplet error_applet, MiiEdit mii_edit_, ParentalControlsApplet parental_controls_applet, PhotoViewer photo_viewer_, ProfileSelect profile_select_, SoftwareKeyboard software_keyboard_, WebBrowser web_browser_); - ~AppletFrontendSet(); + ~FrontendAppletSet(); - AppletFrontendSet(const AppletFrontendSet&) = delete; - AppletFrontendSet& operator=(const AppletFrontendSet&) = delete; + FrontendAppletSet(const FrontendAppletSet&) = delete; + FrontendAppletSet& operator=(const FrontendAppletSet&) = delete; - AppletFrontendSet(AppletFrontendSet&&) noexcept; - AppletFrontendSet& operator=(AppletFrontendSet&&) noexcept; + FrontendAppletSet(FrontendAppletSet&&) noexcept; + FrontendAppletSet& operator=(FrontendAppletSet&&) noexcept; CabinetApplet cabinet; ControllerApplet controller; @@ -259,31 +176,31 @@ struct AppletFrontendSet { WebBrowser web_browser; }; -class AppletManager { +class FrontendAppletHolder { public: - explicit AppletManager(Core::System& system_); - ~AppletManager(); + explicit FrontendAppletHolder(Core::System& system_); + ~FrontendAppletHolder(); - const AppletFrontendSet& GetAppletFrontendSet() const; + const FrontendAppletSet& GetFrontendAppletSet() const; NFP::CabinetMode GetCabinetMode() const; AppletId GetCurrentAppletId() const; - void SetAppletFrontendSet(AppletFrontendSet set); + void SetFrontendAppletSet(FrontendAppletSet set); void SetCabinetMode(NFP::CabinetMode mode); void SetCurrentAppletId(AppletId applet_id); void SetDefaultAppletFrontendSet(); void SetDefaultAppletsIfMissing(); void ClearAll(); - std::shared_ptr GetApplet(AppletId id, LibraryAppletMode mode) const; + std::shared_ptr GetApplet(AppletId id, LibraryAppletMode mode) const; private: AppletId current_applet_id{}; NFP::CabinetMode cabinet_mode{}; - AppletFrontendSet frontend; + FrontendAppletSet frontend; Core::System& system; }; -} // namespace Applets +} // namespace Frontend } // namespace Service::AM diff --git a/src/core/hle/service/am/library_applet_accessor.cpp b/src/core/hle/service/am/library_applet_accessor.cpp index 1cccdfcf21..dabbd6dbe7 100644 --- a/src/core/hle/service/am/library_applet_accessor.cpp +++ b/src/core/hle/service/am/library_applet_accessor.cpp @@ -9,7 +9,7 @@ namespace Service::AM { ILibraryAppletAccessor::ILibraryAppletAccessor(Core::System& system_, - std::shared_ptr applet_) + std::shared_ptr applet_) : ServiceFramework{system_, "ILibraryAppletAccessor"}, applet{std::move(applet_)} { // clang-format off static const FunctionInfo functions[] = { diff --git a/src/core/hle/service/am/library_applet_accessor.h b/src/core/hle/service/am/library_applet_accessor.h index 6984672335..77f62906c7 100644 --- a/src/core/hle/service/am/library_applet_accessor.h +++ b/src/core/hle/service/am/library_applet_accessor.h @@ -3,7 +3,7 @@ #pragma once -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/service.h" namespace Service::AM { @@ -11,7 +11,7 @@ namespace Service::AM { class ILibraryAppletAccessor final : public ServiceFramework { public: explicit ILibraryAppletAccessor(Core::System& system_, - std::shared_ptr applet_); + std::shared_ptr applet_); private: void GetAppletStateChangedEvent(HLERequestContext& ctx); @@ -28,7 +28,7 @@ private: void GetPopInteractiveOutDataEvent(HLERequestContext& ctx); void GetIndirectLayerConsumerHandle(HLERequestContext& ctx); - std::shared_ptr applet; + std::shared_ptr applet; }; } // namespace Service::AM diff --git a/src/core/hle/service/am/library_applet_creator.cpp b/src/core/hle/service/am/library_applet_creator.cpp index c33f50a40f..f808875175 100644 --- a/src/core/hle/service/am/library_applet_creator.cpp +++ b/src/core/hle/service/am/library_applet_creator.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/kernel/k_transfer_memory.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/am/library_applet_accessor.h" #include "core/hle/service/am/library_applet_creator.h" #include "core/hle/service/am/storage.h" @@ -28,14 +28,14 @@ ILibraryAppletCreator::~ILibraryAppletCreator() = default; void ILibraryAppletCreator::CreateLibraryApplet(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - const auto applet_id = rp.PopRaw(); - const auto applet_mode = rp.PopRaw(); + const auto applet_id = rp.PopRaw(); + const auto applet_mode = rp.PopRaw(); LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}", applet_id, applet_mode); - const auto& applet_manager{system.GetAppletManager()}; - const auto applet = applet_manager.GetApplet(applet_id, applet_mode); + const auto& holder{system.GetFrontendAppletHolder()}; + const auto applet = holder.GetApplet(applet_id, applet_mode); if (applet == nullptr) { LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); diff --git a/src/core/hle/service/am/library_applet_self_accessor.cpp b/src/core/hle/service/am/library_applet_self_accessor.cpp index 0a12afbbdd..c36f141f49 100644 --- a/src/core/hle/service/am/library_applet_self_accessor.cpp +++ b/src/core/hle/service/am/library_applet_self_accessor.cpp @@ -4,11 +4,11 @@ #include "core/core_timing.h" #include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/am/am_results.h" -#include "core/hle/service/am/applets/applet_cabinet.h" -#include "core/hle/service/am/applets/applet_controller.h" -#include "core/hle/service/am/applets/applet_mii_edit_types.h" -#include "core/hle/service/am/applets/applet_software_keyboard_types.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applet_cabinet.h" +#include "core/hle/service/am/frontend/applet_controller.h" +#include "core/hle/service/am/frontend/applet_mii_edit_types.h" +#include "core/hle/service/am/frontend/applet_software_keyboard_types.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/am/library_applet_self_accessor.h" #include "core/hle/service/am/storage.h" #include "core/hle/service/ipc_helpers.h" @@ -59,20 +59,20 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) // clang-format on RegisterHandlers(functions); - switch (system.GetAppletManager().GetCurrentAppletId()) { - case Applets::AppletId::Cabinet: + switch (system.GetFrontendAppletHolder().GetCurrentAppletId()) { + case AppletId::Cabinet: PushInShowCabinetData(); break; - case Applets::AppletId::MiiEdit: + case AppletId::MiiEdit: PushInShowMiiEditData(); break; - case Applets::AppletId::PhotoViewer: + case AppletId::PhotoViewer: PushInShowAlbum(); break; - case Applets::AppletId::SoftwareKeyboard: + case AppletId::SoftwareKeyboard: PushInShowSoftwareKeyboard(); break; - case Applets::AppletId::Controller: + case AppletId::Controller: PushInShowController(); break; default: @@ -117,15 +117,15 @@ void ILibraryAppletSelfAccessor::ExitProcessAndReturn(HLERequestContext& ctx) { void ILibraryAppletSelfAccessor::GetLibraryAppletInfo(HLERequestContext& ctx) { struct LibraryAppletInfo { - Applets::AppletId applet_id; - Applets::LibraryAppletMode library_applet_mode; + AppletId applet_id; + LibraryAppletMode library_applet_mode; }; LOG_WARNING(Service_AM, "(STUBBED) called"); const LibraryAppletInfo applet_info{ - .applet_id = system.GetAppletManager().GetCurrentAppletId(), - .library_applet_mode = Applets::LibraryAppletMode::AllForeground, + .applet_id = system.GetFrontendAppletHolder().GetCurrentAppletId(), + .library_applet_mode = LibraryAppletMode::AllForeground, }; IPC::ResponseBuilder rb{ctx, 4}; @@ -135,7 +135,7 @@ void ILibraryAppletSelfAccessor::GetLibraryAppletInfo(HLERequestContext& ctx) { void ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo(HLERequestContext& ctx) { struct AppletIdentityInfo { - Applets::AppletId applet_id; + AppletId applet_id; INSERT_PADDING_BYTES(0x4); u64 application_id; }; @@ -144,7 +144,7 @@ void ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo(HLERequestContext& ct LOG_WARNING(Service_AM, "(STUBBED) called"); const AppletIdentityInfo applet_info{ - .applet_id = Applets::AppletId::QLaunch, + .applet_id = AppletId::QLaunch, .application_id = 0x0100000000001000ull, }; @@ -155,7 +155,7 @@ void ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo(HLERequestContext& ct void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& ctx) { struct AppletIdentityInfo { - Applets::AppletId applet_id; + AppletId applet_id; INSERT_PADDING_BYTES(0x4); u64 application_id; }; @@ -163,7 +163,7 @@ void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& LOG_WARNING(Service_AM, "(STUBBED) called"); const AppletIdentityInfo applet_info{ - .applet_id = Applets::AppletId::QLaunch, + .applet_id = AppletId::QLaunch, .application_id = 0x0100000000001000ull, }; @@ -208,11 +208,11 @@ void ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually(HLERequestContext } void ILibraryAppletSelfAccessor::PushInShowAlbum() { - const Applets::CommonArguments arguments{ - .arguments_version = Applets::CommonArgumentVersion::Version3, - .size = Applets::CommonArgumentSize::Version3, + const CommonArguments arguments{ + .arguments_version = CommonArgumentVersion::Version3, + .size = CommonArgumentSize::Version3, .library_version = 1, - .theme_color = Applets::ThemeColor::BasicBlack, + .theme_color = ThemeColor::BasicBlack, .play_startup_sound = true, .system_tick = system.CoreTiming().GetClockTicks(), }; @@ -225,16 +225,16 @@ void ILibraryAppletSelfAccessor::PushInShowAlbum() { } void ILibraryAppletSelfAccessor::PushInShowController() { - const Applets::CommonArguments common_args = { - .arguments_version = Applets::CommonArgumentVersion::Version3, - .size = Applets::CommonArgumentSize::Version3, - .library_version = static_cast(Applets::ControllerAppletVersion::Version8), - .theme_color = Applets::ThemeColor::BasicBlack, + const CommonArguments common_args = { + .arguments_version = CommonArgumentVersion::Version3, + .size = CommonArgumentSize::Version3, + .library_version = static_cast(Frontend::ControllerAppletVersion::Version8), + .theme_color = ThemeColor::BasicBlack, .play_startup_sound = true, .system_tick = system.CoreTiming().GetClockTicks(), }; - Applets::ControllerSupportArgNew user_args = { + Frontend::ControllerSupportArgNew user_args = { .header = {.player_count_min = 1, .player_count_max = 4, .enable_take_over_connection = true, @@ -247,13 +247,13 @@ void ILibraryAppletSelfAccessor::PushInShowController() { .explain_text = {}, }; - Applets::ControllerSupportArgPrivate private_args = { - .arg_private_size = sizeof(Applets::ControllerSupportArgPrivate), - .arg_size = sizeof(Applets::ControllerSupportArgNew), + Frontend::ControllerSupportArgPrivate private_args = { + .arg_private_size = sizeof(Frontend::ControllerSupportArgPrivate), + .arg_size = sizeof(Frontend::ControllerSupportArgNew), .is_home_menu = true, .flag_1 = true, - .mode = Applets::ControllerSupportMode::ShowControllerSupport, - .caller = Applets::ControllerSupportCaller:: + .mode = Frontend::ControllerSupportMode::ShowControllerSupport, + .caller = Frontend::ControllerSupportCaller:: Application, // switchbrew: Always zero except with // ShowControllerFirmwareUpdateForSystem/ShowControllerKeyRemappingForSystem, // which sets this to the input param @@ -274,19 +274,19 @@ void ILibraryAppletSelfAccessor::PushInShowController() { } void ILibraryAppletSelfAccessor::PushInShowCabinetData() { - const Applets::CommonArguments arguments{ - .arguments_version = Applets::CommonArgumentVersion::Version3, - .size = Applets::CommonArgumentSize::Version3, - .library_version = static_cast(Applets::CabinetAppletVersion::Version1), - .theme_color = Applets::ThemeColor::BasicBlack, + const CommonArguments arguments{ + .arguments_version = CommonArgumentVersion::Version3, + .size = CommonArgumentSize::Version3, + .library_version = static_cast(Frontend::CabinetAppletVersion::Version1), + .theme_color = ThemeColor::BasicBlack, .play_startup_sound = true, .system_tick = system.CoreTiming().GetClockTicks(), }; - const Applets::StartParamForAmiiboSettings amiibo_settings{ + const Frontend::StartParamForAmiiboSettings amiibo_settings{ .param_1 = 0, - .applet_mode = system.GetAppletManager().GetCabinetMode(), - .flags = Applets::CabinetFlags::None, + .applet_mode = system.GetFrontendAppletHolder().GetCabinetMode(), + .flags = Frontend::CabinetFlags::None, .amiibo_settings_1 = 0, .device_handle = 0, .tag_info{}, @@ -304,16 +304,16 @@ void ILibraryAppletSelfAccessor::PushInShowCabinetData() { void ILibraryAppletSelfAccessor::PushInShowMiiEditData() { struct MiiEditV3 { - Applets::MiiEditAppletInputCommon common; - Applets::MiiEditAppletInputV3 input; + Frontend::MiiEditAppletInputCommon common; + Frontend::MiiEditAppletInputV3 input; }; static_assert(sizeof(MiiEditV3) == 0x100, "MiiEditV3 has incorrect size."); MiiEditV3 mii_arguments{ .common = { - .version = Applets::MiiEditAppletVersion::Version3, - .applet_mode = Applets::MiiEditAppletMode::ShowMiiEdit, + .version = Frontend::MiiEditAppletVersion::Version3, + .applet_mode = Frontend::MiiEditAppletMode::ShowMiiEdit, }, .input{}, }; @@ -325,32 +325,32 @@ void ILibraryAppletSelfAccessor::PushInShowMiiEditData() { } void ILibraryAppletSelfAccessor::PushInShowSoftwareKeyboard() { - const Applets::CommonArguments arguments{ - .arguments_version = Applets::CommonArgumentVersion::Version3, - .size = Applets::CommonArgumentSize::Version3, - .library_version = static_cast(Applets::SwkbdAppletVersion::Version524301), - .theme_color = Applets::ThemeColor::BasicBlack, + const CommonArguments arguments{ + .arguments_version = CommonArgumentVersion::Version3, + .size = CommonArgumentSize::Version3, + .library_version = static_cast(Frontend::SwkbdAppletVersion::Version524301), + .theme_color = ThemeColor::BasicBlack, .play_startup_sound = true, .system_tick = system.CoreTiming().GetClockTicks(), }; std::vector initial_string(0); - const Applets::SwkbdConfigCommon swkbd_config{ - .type = Applets::SwkbdType::Qwerty, + const Frontend::SwkbdConfigCommon swkbd_config{ + .type = Frontend::SwkbdType::Qwerty, .ok_text{}, .left_optional_symbol_key{}, .right_optional_symbol_key{}, .use_prediction = false, .key_disable_flags{}, - .initial_cursor_position = Applets::SwkbdInitialCursorPosition::Start, + .initial_cursor_position = Frontend::SwkbdInitialCursorPosition::Start, .header_text{}, .sub_text{}, .guide_text{}, .max_text_length = 500, .min_text_length = 0, - .password_mode = Applets::SwkbdPasswordMode::Disabled, - .text_draw_type = Applets::SwkbdTextDrawType::Box, + .password_mode = Frontend::SwkbdPasswordMode::Disabled, + .text_draw_type = Frontend::SwkbdTextDrawType::Box, .enable_return_button = true, .use_utf8 = false, .use_blur_background = true, @@ -361,7 +361,7 @@ void ILibraryAppletSelfAccessor::PushInShowSoftwareKeyboard() { .use_text_check = false, }; - Applets::SwkbdConfigNew swkbd_config_new{}; + Frontend::SwkbdConfigNew swkbd_config_new{}; std::vector argument_data(sizeof(arguments)); std::vector swkbd_data(sizeof(swkbd_config) + sizeof(swkbd_config_new)); @@ -370,7 +370,7 @@ void ILibraryAppletSelfAccessor::PushInShowSoftwareKeyboard() { std::memcpy(argument_data.data(), &arguments, sizeof(arguments)); std::memcpy(swkbd_data.data(), &swkbd_config, sizeof(swkbd_config)); std::memcpy(swkbd_data.data() + sizeof(swkbd_config), &swkbd_config_new, - sizeof(Applets::SwkbdConfigNew)); + sizeof(Frontend::SwkbdConfigNew)); std::memcpy(work_buffer.data(), initial_string.data(), swkbd_config.initial_string_length * sizeof(char16_t)); diff --git a/src/core/hle/service/am/process_winding_controller.cpp b/src/core/hle/service/am/process_winding_controller.cpp index 7b3ab157f7..7954abd7ae 100644 --- a/src/core/hle/service/am/process_winding_controller.cpp +++ b/src/core/hle/service/am/process_winding_controller.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/am/library_applet_accessor.h" #include "core/hle/service/am/process_winding_controller.h" #include "core/hle/service/ipc_helpers.h" @@ -48,14 +48,14 @@ void IProcessWindingController::GetLaunchReason(HLERequestContext& ctx) { } void IProcessWindingController::OpenCallingLibraryApplet(HLERequestContext& ctx) { - const auto applet_id = system.GetAppletManager().GetCurrentAppletId(); - const auto applet_mode = Applets::LibraryAppletMode::AllForeground; + const auto applet_id = system.GetFrontendAppletHolder().GetCurrentAppletId(); + const auto applet_mode = LibraryAppletMode::AllForeground; LOG_WARNING(Service_AM, "(STUBBED) called with applet_id={:08X}, applet_mode={:08X}", applet_id, applet_mode); - const auto& applet_manager{system.GetAppletManager()}; - const auto applet = applet_manager.GetApplet(applet_id, applet_mode); + const auto& holder{system.GetFrontendAppletHolder()}; + const auto applet = holder.GetApplet(applet_id, applet_mode); if (applet == nullptr) { LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); diff --git a/src/core/hle/service/am/self_controller.cpp b/src/core/hle/service/am/self_controller.cpp index 0f495c8711..d5de1bb2fb 100644 --- a/src/core/hle/service/am/self_controller.cpp +++ b/src/core/hle/service/am/self_controller.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/am/self_controller.h" #include "core/hle/service/caps/caps_su.h" #include "core/hle/service/ipc_helpers.h" @@ -271,7 +271,7 @@ Result ISelfController::EnsureBufferSharingEnabled(Kernel::KProcess* process) { return ResultSuccess; } - if (system.GetAppletManager().GetCurrentAppletId() <= Applets::AppletId::Application) { + if (system.GetFrontendAppletHolder().GetCurrentAppletId() <= AppletId::Application) { return VI::ResultOperationFailed; } diff --git a/src/yuzu/applets/qt_profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp index 79162a4916..66edd6acde 100644 --- a/src/yuzu/applets/qt_profile_select.cpp +++ b/src/yuzu/applets/qt_profile_select.cpp @@ -162,7 +162,7 @@ void QtProfileSelectionDialog::SelectUser(const QModelIndex& index) { void QtProfileSelectionDialog::SetWindowTitle( const Core::Frontend::ProfileSelectParameters& parameters) { - using Service::AM::Applets::UiMode; + using Service::AM::Frontend::UiMode; switch (parameters.mode) { case UiMode::UserCreator: case UiMode::UserCreatorForStarter: @@ -193,7 +193,7 @@ void QtProfileSelectionDialog::SetWindowTitle( void QtProfileSelectionDialog::SetDialogPurpose( const Core::Frontend::ProfileSelectParameters& parameters) { - using Service::AM::Applets::UserSelectionPurpose; + using Service::AM::Frontend::UserSelectionPurpose; switch (parameters.purpose) { case UserSelectionPurpose::GameCardRegistration: diff --git a/src/yuzu/applets/qt_software_keyboard.cpp b/src/yuzu/applets/qt_software_keyboard.cpp index ac81ace9e1..2749e6ed31 100644 --- a/src/yuzu/applets/qt_software_keyboard.cpp +++ b/src/yuzu/applets/qt_software_keyboard.cpp @@ -20,7 +20,7 @@ namespace { -using namespace Service::AM::Applets; +using namespace Service::AM::Frontend; constexpr float BASE_HEADER_FONT_SIZE = 23.0f; constexpr float BASE_SUB_FONT_SIZE = 17.0f; @@ -389,7 +389,7 @@ void QtSoftwareKeyboardDialog::ShowNormalKeyboard(QPoint pos, QSize size) { } void QtSoftwareKeyboardDialog::ShowTextCheckDialog( - Service::AM::Applets::SwkbdTextCheckResult text_check_result, + Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) { switch (text_check_result) { case SwkbdTextCheckResult::Success: @@ -1612,7 +1612,7 @@ void QtSoftwareKeyboard::ShowNormalKeyboard() const { } void QtSoftwareKeyboard::ShowTextCheckDialog( - Service::AM::Applets::SwkbdTextCheckResult text_check_result, + Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const { emit MainWindowShowTextCheckDialog(text_check_result, std::move(text_check_message)); } @@ -1662,12 +1662,12 @@ void QtSoftwareKeyboard::ExitKeyboard() const { emit MainWindowExitKeyboard(); } -void QtSoftwareKeyboard::SubmitNormalText(Service::AM::Applets::SwkbdResult result, +void QtSoftwareKeyboard::SubmitNormalText(Service::AM::Frontend::SwkbdResult result, std::u16string submitted_text, bool confirmed) const { submit_normal_callback(result, submitted_text, confirmed); } -void QtSoftwareKeyboard::SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type, +void QtSoftwareKeyboard::SubmitInlineText(Service::AM::Frontend::SwkbdReplyType reply_type, std::u16string submitted_text, s32 cursor_position) const { submit_inline_callback(reply_type, submitted_text, cursor_position); diff --git a/src/yuzu/applets/qt_software_keyboard.h b/src/yuzu/applets/qt_software_keyboard.h index ac23ce0472..7e2fdf09ea 100644 --- a/src/yuzu/applets/qt_software_keyboard.h +++ b/src/yuzu/applets/qt_software_keyboard.h @@ -39,7 +39,7 @@ public: void ShowNormalKeyboard(QPoint pos, QSize size); - void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result, + void ShowTextCheckDialog(Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message); void ShowInlineKeyboard(Core::Frontend::InlineAppearParameters appear_parameters, QPoint pos, @@ -52,10 +52,10 @@ public: void ExitKeyboard(); signals: - void SubmitNormalText(Service::AM::Applets::SwkbdResult result, std::u16string submitted_text, + void SubmitNormalText(Service::AM::Frontend::SwkbdResult result, std::u16string submitted_text, bool confirmed = false) const; - void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type, + void SubmitInlineText(Service::AM::Frontend::SwkbdReplyType reply_type, std::u16string submitted_text, s32 cursor_position) const; public slots: @@ -244,7 +244,7 @@ public: void ShowNormalKeyboard() const override; - void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result, + void ShowTextCheckDialog(Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const override; void ShowInlineKeyboard( @@ -262,8 +262,9 @@ signals: void MainWindowShowNormalKeyboard() const; - void MainWindowShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result, - std::u16string text_check_message) const; + void MainWindowShowTextCheckDialog( + Service::AM::Frontend::SwkbdTextCheckResult text_check_result, + std::u16string text_check_message) const; void MainWindowShowInlineKeyboard( Core::Frontend::InlineAppearParameters appear_parameters) const; @@ -275,10 +276,10 @@ signals: void MainWindowExitKeyboard() const; private: - void SubmitNormalText(Service::AM::Applets::SwkbdResult result, std::u16string submitted_text, + void SubmitNormalText(Service::AM::Frontend::SwkbdResult result, std::u16string submitted_text, bool confirmed) const; - void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type, + void SubmitInlineText(Service::AM::Frontend::SwkbdReplyType reply_type, std::u16string submitted_text, s32 cursor_position) const; mutable SubmitNormalCallback submit_normal_callback; diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index 34c5fd3be0..cce9b2efb2 100644 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp @@ -96,7 +96,7 @@ QtNXWebEngineView::QtNXWebEngineView(QWidget* parent, Core::System& system, [this] { if (page()->url() == url_interceptor->GetRequestedURL()) { SetFinished(true); - SetExitReason(Service::AM::Applets::WebExitReason::WindowClosed); + SetExitReason(Service::AM::Frontend::WebExitReason::WindowClosed); } }, Qt::QueuedConnection); @@ -115,7 +115,7 @@ void QtNXWebEngineView::LoadLocalWebPage(const std::string& main_url, FocusFirstLinkElement(); SetUserAgent(UserAgent::WebApplet); SetFinished(false); - SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); + SetExitReason(Service::AM::Frontend::WebExitReason::EndButtonPressed); SetLastURL("http://localhost/"); StartInputThread(); @@ -130,7 +130,7 @@ void QtNXWebEngineView::LoadExternalWebPage(const std::string& main_url, FocusFirstLinkElement(); SetUserAgent(UserAgent::WebApplet); SetFinished(false); - SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); + SetExitReason(Service::AM::Frontend::WebExitReason::EndButtonPressed); SetLastURL("http://localhost/"); StartInputThread(); @@ -170,11 +170,11 @@ void QtNXWebEngineView::SetFinished(bool finished_) { finished = finished_; } -Service::AM::Applets::WebExitReason QtNXWebEngineView::GetExitReason() const { +Service::AM::Frontend::WebExitReason QtNXWebEngineView::GetExitReason() const { return exit_reason; } -void QtNXWebEngineView::SetExitReason(Service::AM::Applets::WebExitReason exit_reason_) { +void QtNXWebEngineView::SetExitReason(Service::AM::Frontend::WebExitReason exit_reason_) { exit_reason = exit_reason_; } @@ -441,7 +441,7 @@ void QtWebBrowser::MainWindowExtractOfflineRomFS() { extract_romfs_callback(); } -void QtWebBrowser::MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, +void QtWebBrowser::MainWindowWebBrowserClosed(Service::AM::Frontend::WebExitReason exit_reason, std::string last_url) { if (callback) { callback(exit_reason, last_url); diff --git a/src/yuzu/applets/qt_web_browser.h b/src/yuzu/applets/qt_web_browser.h index 1234108ae2..e8a0b6931b 100644 --- a/src/yuzu/applets/qt_web_browser.h +++ b/src/yuzu/applets/qt_web_browser.h @@ -85,8 +85,8 @@ public: [[nodiscard]] bool IsFinished() const; void SetFinished(bool finished_); - [[nodiscard]] Service::AM::Applets::WebExitReason GetExitReason() const; - void SetExitReason(Service::AM::Applets::WebExitReason exit_reason_); + [[nodiscard]] Service::AM::Frontend::WebExitReason GetExitReason() const; + void SetExitReason(Service::AM::Frontend::WebExitReason exit_reason_); [[nodiscard]] const std::string& GetLastURL() const; void SetLastURL(std::string last_url_); @@ -176,8 +176,8 @@ private: std::atomic finished{}; - Service::AM::Applets::WebExitReason exit_reason{ - Service::AM::Applets::WebExitReason::EndButtonPressed}; + Service::AM::Frontend::WebExitReason exit_reason{ + Service::AM::Frontend::WebExitReason::EndButtonPressed}; std::string last_url{"http://localhost/"}; @@ -212,7 +212,7 @@ signals: private: void MainWindowExtractOfflineRomFS(); - void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, + void MainWindowWebBrowserClosed(Service::AM::Frontend::WebExitReason exit_reason, std::string last_url); mutable ExtractROMFSCallback extract_romfs_callback; diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f51fd3fa35..90ddecbfc9 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -39,14 +39,14 @@ #include "core/file_sys/vfs/vfs_real.h" #include "core/frontend/applets/cabinet.h" #include "core/frontend/applets/controller.h" -#include "core/frontend/applets/general_frontend.h" +#include "core/frontend/applets/general.h" #include "core/frontend/applets/mii_edit.h" #include "core/frontend/applets/software_keyboard.h" #include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/am/applet_ae.h" #include "core/hle/service/am/applet_message_queue.h" #include "core/hle/service/am/applet_oe.h" -#include "core/hle/service/am/applets/applets.h" +#include "core/hle/service/am/frontend/applets.h" #include "core/hle/service/set/system_settings_server.h" #include "frontend_common/content_manager.h" #include "hid_core/frontend/emulated_controller.h" @@ -631,13 +631,14 @@ void GMainWindow::RegisterMetaTypes() { qRegisterMetaType( "Core::Frontend::InlineAppearParameters"); qRegisterMetaType("Core::Frontend::InlineTextParameters"); - qRegisterMetaType("Service::AM::Applets::SwkbdResult"); - qRegisterMetaType( - "Service::AM::Applets::SwkbdTextCheckResult"); - qRegisterMetaType("Service::AM::Applets::SwkbdReplyType"); + qRegisterMetaType("Service::AM::Frontend::SwkbdResult"); + qRegisterMetaType( + "Service::AM::Frontend::SwkbdTextCheckResult"); + qRegisterMetaType( + "Service::AM::Frontend::SwkbdReplyType"); // Web Browser Applet - qRegisterMetaType("Service::AM::Applets::WebExitReason"); + qRegisterMetaType("Service::AM::Frontend::WebExitReason"); // Register loader types qRegisterMetaType("Core::SystemResultStatus"); @@ -747,7 +748,7 @@ void GMainWindow::SoftwareKeyboardInitialize( if (is_inline) { connect( software_keyboard, &QtSoftwareKeyboardDialog::SubmitInlineText, this, - [this](Service::AM::Applets::SwkbdReplyType reply_type, std::u16string submitted_text, + [this](Service::AM::Frontend::SwkbdReplyType reply_type, std::u16string submitted_text, s32 cursor_position) { emit SoftwareKeyboardSubmitInlineText(reply_type, submitted_text, cursor_position); }, @@ -755,7 +756,7 @@ void GMainWindow::SoftwareKeyboardInitialize( } else { connect( software_keyboard, &QtSoftwareKeyboardDialog::SubmitNormalText, this, - [this](Service::AM::Applets::SwkbdResult result, std::u16string submitted_text, + [this](Service::AM::Frontend::SwkbdResult result, std::u16string submitted_text, bool confirmed) { emit SoftwareKeyboardSubmitNormalText(result, submitted_text, confirmed); }, @@ -782,7 +783,7 @@ void GMainWindow::SoftwareKeyboardShowNormal() { } void GMainWindow::SoftwareKeyboardShowTextCheck( - Service::AM::Applets::SwkbdTextCheckResult text_check_result, + Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) { if (!software_keyboard) { LOG_ERROR(Frontend, "The software keyboard is not initialized!"); @@ -853,7 +854,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, // Raw input breaks with the web applet, Disable web applets if enabled if (UISettings::values.disable_web_applet || Settings::values.enable_raw_input) { - emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, + emit WebBrowserClosed(Service::AM::Frontend::WebExitReason::WindowClosed, "http://localhost/"); return; } @@ -941,7 +942,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, if (variant.toBool()) { web_applet->SetFinished(true); web_applet->SetExitReason( - Service::AM::Applets::WebExitReason::EndButtonPressed); + Service::AM::Frontend::WebExitReason::EndButtonPressed); } }); @@ -951,7 +952,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, if (web_applet->GetCurrentURL().contains(QStringLiteral("localhost"))) { if (!web_applet->IsFinished()) { web_applet->SetFinished(true); - web_applet->SetExitReason(Service::AM::Applets::WebExitReason::CallbackURL); + web_applet->SetExitReason(Service::AM::Frontend::WebExitReason::CallbackURL); } web_applet->SetLastURL(web_applet->GetCurrentURL().toStdString()); @@ -984,7 +985,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, #else // Utilize the same fallback as the default web browser applet. - emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); + emit WebBrowserClosed(Service::AM::Frontend::WebExitReason::WindowClosed, "http://localhost/"); #endif } @@ -992,7 +993,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, void GMainWindow::WebBrowserRequestExit() { #ifdef YUZU_USE_QT_WEB_ENGINE if (web_applet) { - web_applet->SetExitReason(Service::AM::Applets::WebExitReason::ExitRequested); + web_applet->SetExitReason(Service::AM::Frontend::WebExitReason::ExitRequested); web_applet->SetFinished(true); } #endif @@ -1778,7 +1779,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p system->GetUserChannel().clear(); } - system->SetAppletFrontendSet({ + system->SetFrontendAppletSet({ std::make_unique(*this), // Amiibo Settings (UISettings::values.controller_applet_disabled.GetValue() == true) ? nullptr @@ -1921,7 +1922,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t LOG_INFO(Frontend, "yuzu starting..."); if (program_id == 0 || - program_id > static_cast(Service::AM::Applets::AppletProgramId::MaxProgramId)) { + program_id > static_cast(Service::AM::AppletProgramId::MaxProgramId)) { StoreRecentFile(filename); // Put the filename on top of the list } @@ -1955,10 +1956,10 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t if (UISettings::values.select_user_on_boot && !user_flag_cmd_line) { const Core::Frontend::ProfileSelectParameters parameters{ - .mode = Service::AM::Applets::UiMode::UserSelector, + .mode = Service::AM::Frontend::UiMode::UserSelector, .invalid_uid_list = {}, .display_options = {}, - .purpose = Service::AM::Applets::UserSelectionPurpose::General, + .purpose = Service::AM::Frontend::UserSelectionPurpose::General, }; if (SelectAndSetCurrentUser(parameters) == false) { return; @@ -2161,7 +2162,7 @@ void GMainWindow::OnEmulationStopped() { OnTasStateChanged(); render_window->FinalizeCamera(); - system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::None); + system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::None); // Enable all controllers system->HIDCore().SetSupportedStyleTag({Core::HID::NpadStyleSet::All}); @@ -2281,10 +2282,10 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target // User save data const auto select_profile = [this] { const Core::Frontend::ProfileSelectParameters parameters{ - .mode = Service::AM::Applets::UiMode::UserSelector, + .mode = Service::AM::Frontend::UiMode::UserSelector, .invalid_uid_list = {}, .display_options = {}, - .purpose = Service::AM::Applets::UserSelectionPurpose::General, + .purpose = Service::AM::Frontend::UserSelectionPurpose::General, }; QtProfileSelectionDialog dialog(*system, this, parameters); dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | @@ -4154,7 +4155,7 @@ void GMainWindow::OnToggleStatusBar() { } void GMainWindow::OnAlbum() { - constexpr u64 AlbumId = static_cast(Service::AM::Applets::AppletProgramId::PhotoViewer); + constexpr u64 AlbumId = static_cast(Service::AM::AppletProgramId::PhotoViewer); auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); if (!bis_system) { QMessageBox::warning(this, tr("No firmware available"), @@ -4169,7 +4170,7 @@ void GMainWindow::OnAlbum() { return; } - system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::PhotoViewer); + system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::PhotoViewer); const auto filename = QString::fromStdString(album_nca->GetFullPath()); UISettings::values.roms_path = QFileInfo(filename).path().toStdString(); @@ -4177,7 +4178,7 @@ void GMainWindow::OnAlbum() { } void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { - constexpr u64 CabinetId = static_cast(Service::AM::Applets::AppletProgramId::Cabinet); + constexpr u64 CabinetId = static_cast(Service::AM::AppletProgramId::Cabinet); auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); if (!bis_system) { QMessageBox::warning(this, tr("No firmware available"), @@ -4192,8 +4193,8 @@ void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { return; } - system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::Cabinet); - system->GetAppletManager().SetCabinetMode(mode); + system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Cabinet); + system->GetFrontendAppletHolder().SetCabinetMode(mode); const auto filename = QString::fromStdString(cabinet_nca->GetFullPath()); UISettings::values.roms_path = QFileInfo(filename).path().toStdString(); @@ -4201,7 +4202,7 @@ void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { } void GMainWindow::OnMiiEdit() { - constexpr u64 MiiEditId = static_cast(Service::AM::Applets::AppletProgramId::MiiEdit); + constexpr u64 MiiEditId = static_cast(Service::AM::AppletProgramId::MiiEdit); auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); if (!bis_system) { QMessageBox::warning(this, tr("No firmware available"), @@ -4216,7 +4217,7 @@ void GMainWindow::OnMiiEdit() { return; } - system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::MiiEdit); + system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::MiiEdit); const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath())); UISettings::values.roms_path = QFileInfo(filename).path().toStdString(); @@ -4224,8 +4225,7 @@ void GMainWindow::OnMiiEdit() { } void GMainWindow::OnOpenControllerMenu() { - constexpr u64 ControllerAppletId = - static_cast(Service::AM::Applets::AppletProgramId::Controller); + constexpr u64 ControllerAppletId = static_cast(Service::AM::AppletProgramId::Controller); auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); if (!bis_system) { QMessageBox::warning(this, tr("No firmware available"), @@ -4241,7 +4241,7 @@ void GMainWindow::OnOpenControllerMenu() { return; } - system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::Controller); + system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Controller); const auto filename = QString::fromStdString((controller_applet_nca->GetFullPath())); UISettings::values.roms_path = QFileInfo(filename).path().toStdString(); @@ -4565,7 +4565,7 @@ void GMainWindow::OnCheckFirmwareDecryption() { } bool GMainWindow::CheckFirmwarePresence() { - constexpr u64 MiiEditId = static_cast(Service::AM::Applets::AppletProgramId::MiiEdit); + constexpr u64 MiiEditId = static_cast(Service::AM::AppletProgramId::MiiEdit); auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); if (!bis_system) { diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 6b72094ff8..c079baffa0 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -101,12 +101,12 @@ namespace InputCommon { class InputSubsystem; } -namespace Service::AM::Applets { +namespace Service::AM::Frontend { enum class SwkbdResult : u32; enum class SwkbdTextCheckResult : u32; enum class SwkbdReplyType : u32; enum class WebExitReason : u32; -} // namespace Service::AM::Applets +} // namespace Service::AM::Frontend namespace Service::NFC { class NfcDevice; @@ -204,13 +204,13 @@ signals: void ProfileSelectorFinishedSelection(std::optional uuid); - void SoftwareKeyboardSubmitNormalText(Service::AM::Applets::SwkbdResult result, + void SoftwareKeyboardSubmitNormalText(Service::AM::Frontend::SwkbdResult result, std::u16string submitted_text, bool confirmed); - void SoftwareKeyboardSubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type, + void SoftwareKeyboardSubmitInlineText(Service::AM::Frontend::SwkbdReplyType reply_type, std::u16string submitted_text, s32 cursor_position); void WebBrowserExtractOfflineRomFS(); - void WebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, std::string last_url); + void WebBrowserClosed(Service::AM::Frontend::WebExitReason exit_reason, std::string last_url); void SigInterrupt(); @@ -228,8 +228,9 @@ public slots: void SoftwareKeyboardInitialize( bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters); void SoftwareKeyboardShowNormal(); - void SoftwareKeyboardShowTextCheck(Service::AM::Applets::SwkbdTextCheckResult text_check_result, - std::u16string text_check_message); + void SoftwareKeyboardShowTextCheck( + Service::AM::Frontend::SwkbdTextCheckResult text_check_result, + std::u16string text_check_message); void SoftwareKeyboardShowInline(Core::Frontend::InlineAppearParameters appear_parameters); void SoftwareKeyboardHideInline(); void SoftwareKeyboardInlineTextChanged(Core::Frontend::InlineTextParameters text_parameters);