diff options
author | Liam <byteslice@airmail.cc> | 2024-02-12 01:51:14 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-12 15:16:02 +0100 |
commit | 2c49ebbeead0d1269aefca832d284bd3a1be5a01 (patch) | |
tree | 417a5a975cfe524e757d1a71c5feb4753f914515 | |
parent | am: rewrite IGlobalStateController, add ICradleFirmwareUpdater (diff) | |
download | yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.tar yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.tar.gz yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.tar.bz2 yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.tar.lz yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.tar.xz yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.tar.zst yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.zip |
-rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/core/hle/service/am/home_menu_functions.cpp | 57 | ||||
-rw-r--r-- | src/core/hle/service/am/home_menu_functions.h | 25 | ||||
-rw-r--r-- | src/core/hle/service/am/service/home_menu_functions.cpp | 74 | ||||
-rw-r--r-- | src/core/hle/service/am/service/home_menu_functions.h | 34 | ||||
-rw-r--r-- | src/core/hle/service/am/service/library_applet_proxy.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/service/am/service/system_applet_proxy.cpp | 4 |
7 files changed, 114 insertions, 88 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 724ed989d..ae2fe0b68 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -427,8 +427,6 @@ add_library(core STATIC hle/service/am/application_creator.h hle/service/am/hid_registration.cpp hle/service/am/hid_registration.h - hle/service/am/home_menu_functions.cpp - hle/service/am/home_menu_functions.h hle/service/am/idle.cpp hle/service/am/idle.h hle/service/am/library_applet_accessor.cpp @@ -473,6 +471,8 @@ add_library(core STATIC hle/service/am/service/display_controller.h hle/service/am/service/global_state_controller.cpp hle/service/am/service/global_state_controller.h + hle/service/am/service/home_menu_functions.cpp + hle/service/am/service/home_menu_functions.h hle/service/am/service/library_applet_proxy.cpp hle/service/am/service/library_applet_proxy.h hle/service/am/service/system_applet_proxy.cpp diff --git a/src/core/hle/service/am/home_menu_functions.cpp b/src/core/hle/service/am/home_menu_functions.cpp deleted file mode 100644 index 640e9fbb7..000000000 --- a/src/core/hle/service/am/home_menu_functions.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/am/home_menu_functions.h" -#include "core/hle/service/ipc_helpers.h" - -namespace Service::AM { - -IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) - : ServiceFramework{system_, "IHomeMenuFunctions"}, service_context{system, - "IHomeMenuFunctions"} { - // clang-format off - static const FunctionInfo functions[] = { - {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, - {11, nullptr, "LockForeground"}, - {12, nullptr, "UnlockForeground"}, - {20, nullptr, "PopFromGeneralChannel"}, - {21, &IHomeMenuFunctions::GetPopFromGeneralChannelEvent, "GetPopFromGeneralChannelEvent"}, - {30, nullptr, "GetHomeButtonWriterLockAccessor"}, - {31, nullptr, "GetWriterLockAccessorEx"}, - {40, nullptr, "IsSleepEnabled"}, - {41, nullptr, "IsRebootEnabled"}, - {50, nullptr, "LaunchSystemApplet"}, - {51, nullptr, "LaunchStarter"}, - {100, nullptr, "PopRequestLaunchApplicationForDebug"}, - {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"}, - {200, nullptr, "LaunchDevMenu"}, - {1000, nullptr, "SetLastApplicationExitReason"}, - }; - // clang-format on - - RegisterHandlers(functions); - - pop_from_general_channel_event = - service_context.CreateEvent("IHomeMenuFunctions:PopFromGeneralChannelEvent"); -} - -IHomeMenuFunctions::~IHomeMenuFunctions() { - service_context.CloseEvent(pop_from_general_channel_event); -} - -void IHomeMenuFunctions::RequestToGetForeground(HLERequestContext& ctx) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(HLERequestContext& ctx) { - LOG_WARNING(Service_AM, "(STUBBED) called"); - - IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.Push(ResultSuccess); - rb.PushCopyObjects(pop_from_general_channel_event->GetReadableEvent()); -} - -} // namespace Service::AM diff --git a/src/core/hle/service/am/home_menu_functions.h b/src/core/hle/service/am/home_menu_functions.h deleted file mode 100644 index e082d5d73..000000000 --- a/src/core/hle/service/am/home_menu_functions.h +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/kernel_helpers.h" -#include "core/hle/service/service.h" - -namespace Service::AM { - -class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { -public: - explicit IHomeMenuFunctions(Core::System& system_); - ~IHomeMenuFunctions() override; - -private: - void RequestToGetForeground(HLERequestContext& ctx); - void GetPopFromGeneralChannelEvent(HLERequestContext& ctx); - - KernelHelpers::ServiceContext service_context; - - Kernel::KEvent* pop_from_general_channel_event; -}; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/service/home_menu_functions.cpp b/src/core/hle/service/am/service/home_menu_functions.cpp new file mode 100644 index 000000000..0c4d24b58 --- /dev/null +++ b/src/core/hle/service/am/service/home_menu_functions.cpp @@ -0,0 +1,74 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/hle/result.h" +#include "core/hle/service/am/applet_manager.h" +#include "core/hle/service/am/service/home_menu_functions.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::AM { + +IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr<Applet> applet) + : ServiceFramework{system_, "IHomeMenuFunctions"}, m_applet{std::move(applet)}, + m_context{system, "IHomeMenuFunctions"}, m_pop_from_general_channel_event{m_context} { + // clang-format off + static const FunctionInfo functions[] = { + {10, D<&IHomeMenuFunctions::RequestToGetForeground>, "RequestToGetForeground"}, + {11, D<&IHomeMenuFunctions::LockForeground>, "LockForeground"}, + {12, D<&IHomeMenuFunctions::UnlockForeground>, "UnlockForeground"}, + {20, nullptr, "PopFromGeneralChannel"}, + {21, D<&IHomeMenuFunctions::GetPopFromGeneralChannelEvent>, "GetPopFromGeneralChannelEvent"}, + {30, nullptr, "GetHomeButtonWriterLockAccessor"}, + {31, nullptr, "GetWriterLockAccessorEx"}, + {40, nullptr, "IsSleepEnabled"}, + {41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, + {50, nullptr, "LaunchSystemApplet"}, + {51, nullptr, "LaunchStarter"}, + {100, nullptr, "PopRequestLaunchApplicationForDebug"}, + {110, D<&IHomeMenuFunctions::IsForceTerminateApplicationDisabledForDebug>, "IsForceTerminateApplicationDisabledForDebug"}, + {200, nullptr, "LaunchDevMenu"}, + {1000, nullptr, "SetLastApplicationExitReason"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IHomeMenuFunctions::~IHomeMenuFunctions() = default; + +Result IHomeMenuFunctions::RequestToGetForeground() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IHomeMenuFunctions::LockForeground() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IHomeMenuFunctions::UnlockForeground() { + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); +} + +Result IHomeMenuFunctions::GetPopFromGeneralChannelEvent( + OutCopyHandle<Kernel::KReadableEvent> out_event) { + LOG_INFO(Service_AM, "called"); + *out_event = m_pop_from_general_channel_event.GetHandle(); + R_SUCCEED(); +} + +Result IHomeMenuFunctions::IsRebootEnabled(Out<bool> out_is_reboot_enbaled) { + LOG_INFO(Service_AM, "called"); + *out_is_reboot_enbaled = true; + R_SUCCEED(); +} + +Result IHomeMenuFunctions::IsForceTerminateApplicationDisabledForDebug( + Out<bool> out_is_force_terminate_application_disabled_for_debug) { + LOG_INFO(Service_AM, "called"); + *out_is_force_terminate_application_disabled_for_debug = false; + R_SUCCEED(); +} + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/home_menu_functions.h b/src/core/hle/service/am/service/home_menu_functions.h new file mode 100644 index 000000000..caf6fbaab --- /dev/null +++ b/src/core/hle/service/am/service/home_menu_functions.h @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/os/event.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +struct Applet; + +class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { +public: + explicit IHomeMenuFunctions(Core::System& system_, std::shared_ptr<Applet> applet); + ~IHomeMenuFunctions() override; + +private: + Result RequestToGetForeground(); + Result LockForeground(); + Result UnlockForeground(); + Result GetPopFromGeneralChannelEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); + Result IsRebootEnabled(Out<bool> out_is_reboot_enbaled); + Result IsForceTerminateApplicationDisabledForDebug( + Out<bool> out_is_force_terminate_application_disabled_for_debug); + + const std::shared_ptr<Applet> m_applet; + KernelHelpers::ServiceContext m_context; + Event m_pop_from_general_channel_event; +}; + +} // namespace Service::AM diff --git a/src/core/hle/service/am/service/library_applet_proxy.cpp b/src/core/hle/service/am/service/library_applet_proxy.cpp index 7b5e9717d..cf1a34db2 100644 --- a/src/core/hle/service/am/service/library_applet_proxy.cpp +++ b/src/core/hle/service/am/service/library_applet_proxy.cpp @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#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" @@ -12,6 +11,7 @@ #include "core/hle/service/am/service/debug_functions.h" #include "core/hle/service/am/service/display_controller.h" #include "core/hle/service/am/service/global_state_controller.h" +#include "core/hle/service/am/service/home_menu_functions.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" @@ -119,7 +119,7 @@ Result ILibraryAppletProxy::GetAppletCommonFunctions( Result ILibraryAppletProxy::GetHomeMenuFunctions( Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) { LOG_DEBUG(Service_AM, "called"); - *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system); + *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system, m_applet); R_SUCCEED(); } diff --git a/src/core/hle/service/am/service/system_applet_proxy.cpp b/src/core/hle/service/am/service/system_applet_proxy.cpp index 077f6eea7..8fa852cfa 100644 --- a/src/core/hle/service/am/service/system_applet_proxy.cpp +++ b/src/core/hle/service/am/service/system_applet_proxy.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/am/application_creator.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" @@ -13,6 +12,7 @@ #include "core/hle/service/am/service/debug_functions.h" #include "core/hle/service/am/service/display_controller.h" #include "core/hle/service/am/service/global_state_controller.h" +#include "core/hle/service/am/service/home_menu_functions.h" #include "core/hle/service/am/service/system_applet_proxy.h" #include "core/hle/service/am/window_controller.h" #include "core/hle/service/cmif_serialization.h" @@ -118,7 +118,7 @@ Result ISystemAppletProxy::GetAppletCommonFunctions( Result ISystemAppletProxy::GetHomeMenuFunctions( Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) { LOG_DEBUG(Service_AM, "called"); - *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system); + *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system, m_applet); R_SUCCEED(); } |