diff options
| author | 2024-02-11 19:51:14 -0500 | |
|---|---|---|
| committer | 2024-02-12 09:16:02 -0500 | |
| commit | 2c49ebbeead0d1269aefca832d284bd3a1be5a01 (patch) | |
| tree | 417a5a975cfe524e757d1a71c5feb4753f914515 /src/core/hle/service/am | |
| parent | am: rewrite IGlobalStateController, add ICradleFirmwareUpdater (diff) | |
| download | yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.tar.gz yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.tar.xz yuzu-2c49ebbeead0d1269aefca832d284bd3a1be5a01.zip | |
am: rewrite IHomeMenuFunctions
Diffstat (limited to 'src/core/hle/service/am')
6 files changed, 112 insertions, 86 deletions
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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "core/hle/service/am/home_menu_functions.h" | ||
| 5 | #include "core/hle/service/ipc_helpers.h" | ||
| 6 | |||
| 7 | namespace Service::AM { | ||
| 8 | |||
| 9 | IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) | ||
| 10 | : ServiceFramework{system_, "IHomeMenuFunctions"}, service_context{system, | ||
| 11 | "IHomeMenuFunctions"} { | ||
| 12 | // clang-format off | ||
| 13 | static const FunctionInfo functions[] = { | ||
| 14 | {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, | ||
| 15 | {11, nullptr, "LockForeground"}, | ||
| 16 | {12, nullptr, "UnlockForeground"}, | ||
| 17 | {20, nullptr, "PopFromGeneralChannel"}, | ||
| 18 | {21, &IHomeMenuFunctions::GetPopFromGeneralChannelEvent, "GetPopFromGeneralChannelEvent"}, | ||
| 19 | {30, nullptr, "GetHomeButtonWriterLockAccessor"}, | ||
| 20 | {31, nullptr, "GetWriterLockAccessorEx"}, | ||
| 21 | {40, nullptr, "IsSleepEnabled"}, | ||
| 22 | {41, nullptr, "IsRebootEnabled"}, | ||
| 23 | {50, nullptr, "LaunchSystemApplet"}, | ||
| 24 | {51, nullptr, "LaunchStarter"}, | ||
| 25 | {100, nullptr, "PopRequestLaunchApplicationForDebug"}, | ||
| 26 | {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"}, | ||
| 27 | {200, nullptr, "LaunchDevMenu"}, | ||
| 28 | {1000, nullptr, "SetLastApplicationExitReason"}, | ||
| 29 | }; | ||
| 30 | // clang-format on | ||
| 31 | |||
| 32 | RegisterHandlers(functions); | ||
| 33 | |||
| 34 | pop_from_general_channel_event = | ||
| 35 | service_context.CreateEvent("IHomeMenuFunctions:PopFromGeneralChannelEvent"); | ||
| 36 | } | ||
| 37 | |||
| 38 | IHomeMenuFunctions::~IHomeMenuFunctions() { | ||
| 39 | service_context.CloseEvent(pop_from_general_channel_event); | ||
| 40 | } | ||
| 41 | |||
| 42 | void IHomeMenuFunctions::RequestToGetForeground(HLERequestContext& ctx) { | ||
| 43 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 44 | |||
| 45 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 46 | rb.Push(ResultSuccess); | ||
| 47 | } | ||
| 48 | |||
| 49 | void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(HLERequestContext& ctx) { | ||
| 50 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 51 | |||
| 52 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 53 | rb.Push(ResultSuccess); | ||
| 54 | rb.PushCopyObjects(pop_from_general_channel_event->GetReadableEvent()); | ||
| 55 | } | ||
| 56 | |||
| 57 | } // 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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/kernel_helpers.h" | ||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Service::AM { | ||
| 10 | |||
| 11 | class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { | ||
| 12 | public: | ||
| 13 | explicit IHomeMenuFunctions(Core::System& system_); | ||
| 14 | ~IHomeMenuFunctions() override; | ||
| 15 | |||
| 16 | private: | ||
| 17 | void RequestToGetForeground(HLERequestContext& ctx); | ||
| 18 | void GetPopFromGeneralChannelEvent(HLERequestContext& ctx); | ||
| 19 | |||
| 20 | KernelHelpers::ServiceContext service_context; | ||
| 21 | |||
| 22 | Kernel::KEvent* pop_from_general_channel_event; | ||
| 23 | }; | ||
| 24 | |||
| 25 | } // 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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "core/hle/result.h" | ||
| 5 | #include "core/hle/service/am/applet_manager.h" | ||
| 6 | #include "core/hle/service/am/service/home_menu_functions.h" | ||
| 7 | #include "core/hle/service/cmif_serialization.h" | ||
| 8 | |||
| 9 | namespace Service::AM { | ||
| 10 | |||
| 11 | IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr<Applet> applet) | ||
| 12 | : ServiceFramework{system_, "IHomeMenuFunctions"}, m_applet{std::move(applet)}, | ||
| 13 | m_context{system, "IHomeMenuFunctions"}, m_pop_from_general_channel_event{m_context} { | ||
| 14 | // clang-format off | ||
| 15 | static const FunctionInfo functions[] = { | ||
| 16 | {10, D<&IHomeMenuFunctions::RequestToGetForeground>, "RequestToGetForeground"}, | ||
| 17 | {11, D<&IHomeMenuFunctions::LockForeground>, "LockForeground"}, | ||
| 18 | {12, D<&IHomeMenuFunctions::UnlockForeground>, "UnlockForeground"}, | ||
| 19 | {20, nullptr, "PopFromGeneralChannel"}, | ||
| 20 | {21, D<&IHomeMenuFunctions::GetPopFromGeneralChannelEvent>, "GetPopFromGeneralChannelEvent"}, | ||
| 21 | {30, nullptr, "GetHomeButtonWriterLockAccessor"}, | ||
| 22 | {31, nullptr, "GetWriterLockAccessorEx"}, | ||
| 23 | {40, nullptr, "IsSleepEnabled"}, | ||
| 24 | {41, D<&IHomeMenuFunctions::IsRebootEnabled>, "IsRebootEnabled"}, | ||
| 25 | {50, nullptr, "LaunchSystemApplet"}, | ||
| 26 | {51, nullptr, "LaunchStarter"}, | ||
| 27 | {100, nullptr, "PopRequestLaunchApplicationForDebug"}, | ||
| 28 | {110, D<&IHomeMenuFunctions::IsForceTerminateApplicationDisabledForDebug>, "IsForceTerminateApplicationDisabledForDebug"}, | ||
| 29 | {200, nullptr, "LaunchDevMenu"}, | ||
| 30 | {1000, nullptr, "SetLastApplicationExitReason"}, | ||
| 31 | }; | ||
| 32 | // clang-format on | ||
| 33 | |||
| 34 | RegisterHandlers(functions); | ||
| 35 | } | ||
| 36 | |||
| 37 | IHomeMenuFunctions::~IHomeMenuFunctions() = default; | ||
| 38 | |||
| 39 | Result IHomeMenuFunctions::RequestToGetForeground() { | ||
| 40 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 41 | R_SUCCEED(); | ||
| 42 | } | ||
| 43 | |||
| 44 | Result IHomeMenuFunctions::LockForeground() { | ||
| 45 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 46 | R_SUCCEED(); | ||
| 47 | } | ||
| 48 | |||
| 49 | Result IHomeMenuFunctions::UnlockForeground() { | ||
| 50 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 51 | R_SUCCEED(); | ||
| 52 | } | ||
| 53 | |||
| 54 | Result IHomeMenuFunctions::GetPopFromGeneralChannelEvent( | ||
| 55 | OutCopyHandle<Kernel::KReadableEvent> out_event) { | ||
| 56 | LOG_INFO(Service_AM, "called"); | ||
| 57 | *out_event = m_pop_from_general_channel_event.GetHandle(); | ||
| 58 | R_SUCCEED(); | ||
| 59 | } | ||
| 60 | |||
| 61 | Result IHomeMenuFunctions::IsRebootEnabled(Out<bool> out_is_reboot_enbaled) { | ||
| 62 | LOG_INFO(Service_AM, "called"); | ||
| 63 | *out_is_reboot_enbaled = true; | ||
| 64 | R_SUCCEED(); | ||
| 65 | } | ||
| 66 | |||
| 67 | Result IHomeMenuFunctions::IsForceTerminateApplicationDisabledForDebug( | ||
| 68 | Out<bool> out_is_force_terminate_application_disabled_for_debug) { | ||
| 69 | LOG_INFO(Service_AM, "called"); | ||
| 70 | *out_is_force_terminate_application_disabled_for_debug = false; | ||
| 71 | R_SUCCEED(); | ||
| 72 | } | ||
| 73 | |||
| 74 | } // 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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 7 | #include "core/hle/service/kernel_helpers.h" | ||
| 8 | #include "core/hle/service/os/event.h" | ||
| 9 | #include "core/hle/service/service.h" | ||
| 10 | |||
| 11 | namespace Service::AM { | ||
| 12 | |||
| 13 | struct Applet; | ||
| 14 | |||
| 15 | class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { | ||
| 16 | public: | ||
| 17 | explicit IHomeMenuFunctions(Core::System& system_, std::shared_ptr<Applet> applet); | ||
| 18 | ~IHomeMenuFunctions() override; | ||
| 19 | |||
| 20 | private: | ||
| 21 | Result RequestToGetForeground(); | ||
| 22 | Result LockForeground(); | ||
| 23 | Result UnlockForeground(); | ||
| 24 | Result GetPopFromGeneralChannelEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); | ||
| 25 | Result IsRebootEnabled(Out<bool> out_is_reboot_enbaled); | ||
| 26 | Result IsForceTerminateApplicationDisabledForDebug( | ||
| 27 | Out<bool> out_is_force_terminate_application_disabled_for_debug); | ||
| 28 | |||
| 29 | const std::shared_ptr<Applet> m_applet; | ||
| 30 | KernelHelpers::ServiceContext m_context; | ||
| 31 | Event m_pop_from_general_channel_event; | ||
| 32 | }; | ||
| 33 | |||
| 34 | } // 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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/am/home_menu_functions.h" | ||
| 5 | #include "core/hle/service/am/library_applet_creator.h" | 4 | #include "core/hle/service/am/library_applet_creator.h" |
| 6 | #include "core/hle/service/am/library_applet_self_accessor.h" | 5 | #include "core/hle/service/am/library_applet_self_accessor.h" |
| 7 | #include "core/hle/service/am/process_winding_controller.h" | 6 | #include "core/hle/service/am/process_winding_controller.h" |
| @@ -12,6 +11,7 @@ | |||
| 12 | #include "core/hle/service/am/service/debug_functions.h" | 11 | #include "core/hle/service/am/service/debug_functions.h" |
| 13 | #include "core/hle/service/am/service/display_controller.h" | 12 | #include "core/hle/service/am/service/display_controller.h" |
| 14 | #include "core/hle/service/am/service/global_state_controller.h" | 13 | #include "core/hle/service/am/service/global_state_controller.h" |
| 14 | #include "core/hle/service/am/service/home_menu_functions.h" | ||
| 15 | #include "core/hle/service/am/service/library_applet_proxy.h" | 15 | #include "core/hle/service/am/service/library_applet_proxy.h" |
| 16 | #include "core/hle/service/am/window_controller.h" | 16 | #include "core/hle/service/am/window_controller.h" |
| 17 | #include "core/hle/service/cmif_serialization.h" | 17 | #include "core/hle/service/cmif_serialization.h" |
| @@ -119,7 +119,7 @@ Result ILibraryAppletProxy::GetAppletCommonFunctions( | |||
| 119 | Result ILibraryAppletProxy::GetHomeMenuFunctions( | 119 | Result ILibraryAppletProxy::GetHomeMenuFunctions( |
| 120 | Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) { | 120 | Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) { |
| 121 | LOG_DEBUG(Service_AM, "called"); | 121 | LOG_DEBUG(Service_AM, "called"); |
| 122 | *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system); | 122 | *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system, m_applet); |
| 123 | R_SUCCEED(); | 123 | R_SUCCEED(); |
| 124 | } | 124 | } |
| 125 | 125 | ||
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 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/am/application_creator.h" | 4 | #include "core/hle/service/am/application_creator.h" |
| 5 | #include "core/hle/service/am/home_menu_functions.h" | ||
| 6 | #include "core/hle/service/am/library_applet_creator.h" | 5 | #include "core/hle/service/am/library_applet_creator.h" |
| 7 | #include "core/hle/service/am/library_applet_self_accessor.h" | 6 | #include "core/hle/service/am/library_applet_self_accessor.h" |
| 8 | #include "core/hle/service/am/process_winding_controller.h" | 7 | #include "core/hle/service/am/process_winding_controller.h" |
| @@ -13,6 +12,7 @@ | |||
| 13 | #include "core/hle/service/am/service/debug_functions.h" | 12 | #include "core/hle/service/am/service/debug_functions.h" |
| 14 | #include "core/hle/service/am/service/display_controller.h" | 13 | #include "core/hle/service/am/service/display_controller.h" |
| 15 | #include "core/hle/service/am/service/global_state_controller.h" | 14 | #include "core/hle/service/am/service/global_state_controller.h" |
| 15 | #include "core/hle/service/am/service/home_menu_functions.h" | ||
| 16 | #include "core/hle/service/am/service/system_applet_proxy.h" | 16 | #include "core/hle/service/am/service/system_applet_proxy.h" |
| 17 | #include "core/hle/service/am/window_controller.h" | 17 | #include "core/hle/service/am/window_controller.h" |
| 18 | #include "core/hle/service/cmif_serialization.h" | 18 | #include "core/hle/service/cmif_serialization.h" |
| @@ -118,7 +118,7 @@ Result ISystemAppletProxy::GetAppletCommonFunctions( | |||
| 118 | Result ISystemAppletProxy::GetHomeMenuFunctions( | 118 | Result ISystemAppletProxy::GetHomeMenuFunctions( |
| 119 | Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) { | 119 | Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) { |
| 120 | LOG_DEBUG(Service_AM, "called"); | 120 | LOG_DEBUG(Service_AM, "called"); |
| 121 | *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system); | 121 | *out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system, m_applet); |
| 122 | R_SUCCEED(); | 122 | R_SUCCEED(); |
| 123 | } | 123 | } |
| 124 | 124 | ||