// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/am/applet_common_functions.h" #include "core/hle/service/am/common_state_getter.h" #include "core/hle/service/am/debug_functions.h" #include "core/hle/service/am/display_controller.h" #include "core/hle/service/am/global_state_controller.h" #include "core/hle/service/am/home_menu_functions.h" #include "core/hle/service/am/library_applet_creator.h" #include "core/hle/service/am/library_applet_self_accessor.h" #include "core/hle/service/am/process_winding_controller.h" #include "core/hle/service/am/self_controller.h" #include "core/hle/service/am/service/audio_controller.h" #include "core/hle/service/am/service/library_applet_proxy.h" #include "core/hle/service/am/window_controller.h" #include "core/hle/service/cmif_serialization.h" namespace Service::AM { ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr applet, Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger) : ServiceFramework{system_, "ILibraryAppletProxy"}, m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} { // clang-format off static const FunctionInfo functions[] = { {0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, {1, D<&ILibraryAppletProxy::GetSelfController>, "GetSelfController"}, {2, D<&ILibraryAppletProxy::GetWindowController>, "GetWindowController"}, {3, D<&ILibraryAppletProxy::GetAudioController>, "GetAudioController"}, {4, D<&ILibraryAppletProxy::GetDisplayController>, "GetDisplayController"}, {10, D<&ILibraryAppletProxy::GetProcessWindingController>, "GetProcessWindingController"}, {11, D<&ILibraryAppletProxy::GetLibraryAppletCreator>, "GetLibraryAppletCreator"}, {20, D<&ILibraryAppletProxy::OpenLibraryAppletSelfAccessor>, "OpenLibraryAppletSelfAccessor"}, {21, D<&ILibraryAppletProxy::GetAppletCommonFunctions>, "GetAppletCommonFunctions"}, {22, D<&ILibraryAppletProxy::GetHomeMenuFunctions>, "GetHomeMenuFunctions"}, {23, D<&ILibraryAppletProxy::GetGlobalStateController>, "GetGlobalStateController"}, {1000, D<&ILibraryAppletProxy::GetDebugFunctions>, "GetDebugFunctions"}, }; // clang-format on RegisterHandlers(functions); } ILibraryAppletProxy::~ILibraryAppletProxy() = default; Result ILibraryAppletProxy::GetAudioController( Out> out_audio_controller) { LOG_DEBUG(Service_AM, "called"); *out_audio_controller = std::make_shared(system); R_SUCCEED(); } Result ILibraryAppletProxy::GetDisplayController( Out> out_display_controller) { LOG_DEBUG(Service_AM, "called"); *out_display_controller = std::make_shared(system, m_applet); R_SUCCEED(); } Result ILibraryAppletProxy::GetProcessWindingController( Out> out_process_winding_controller) { LOG_DEBUG(Service_AM, "called"); *out_process_winding_controller = std::make_shared(system, m_applet); R_SUCCEED(); } Result ILibraryAppletProxy::GetDebugFunctions( Out> out_debug_functions) { LOG_DEBUG(Service_AM, "called"); *out_debug_functions = std::make_shared(system); R_SUCCEED(); } Result ILibraryAppletProxy::GetWindowController( Out> out_window_controller) { LOG_DEBUG(Service_AM, "called"); *out_window_controller = std::make_shared(system, m_applet); R_SUCCEED(); } Result ILibraryAppletProxy::GetSelfController( Out> out_self_controller) { LOG_DEBUG(Service_AM, "called"); *out_self_controller = std::make_shared(system, m_applet, m_nvnflinger); R_SUCCEED(); } Result ILibraryAppletProxy::GetCommonStateGetter( Out> out_common_state_getter) { LOG_DEBUG(Service_AM, "called"); *out_common_state_getter = std::make_shared(system, m_applet); R_SUCCEED(); } Result ILibraryAppletProxy::GetLibraryAppletCreator( Out> out_library_applet_creator) { LOG_DEBUG(Service_AM, "called"); *out_library_applet_creator = std::make_shared(system, m_applet); R_SUCCEED(); } Result ILibraryAppletProxy::OpenLibraryAppletSelfAccessor( Out> out_library_applet_self_accessor) { LOG_DEBUG(Service_AM, "called"); *out_library_applet_self_accessor = std::make_shared(system, m_applet); R_SUCCEED(); } Result ILibraryAppletProxy::GetAppletCommonFunctions( Out> out_applet_common_functions) { LOG_DEBUG(Service_AM, "called"); *out_applet_common_functions = std::make_shared(system, m_applet); R_SUCCEED(); } Result ILibraryAppletProxy::GetHomeMenuFunctions( Out> out_home_menu_functions) { LOG_DEBUG(Service_AM, "called"); *out_home_menu_functions = std::make_shared(system); R_SUCCEED(); } Result ILibraryAppletProxy::GetGlobalStateController( Out> out_global_state_controller) { LOG_DEBUG(Service_AM, "called"); *out_global_state_controller = std::make_shared(system); R_SUCCEED(); } } // namespace Service::AM