mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
am: rewrite IHomeMenuFunctions
This commit is contained in:
parent
17460def8e
commit
2c49ebbeea
7 changed files with 114 additions and 88 deletions
|
@ -427,8 +427,6 @@ add_library(core STATIC
|
||||||
hle/service/am/application_creator.h
|
hle/service/am/application_creator.h
|
||||||
hle/service/am/hid_registration.cpp
|
hle/service/am/hid_registration.cpp
|
||||||
hle/service/am/hid_registration.h
|
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.cpp
|
||||||
hle/service/am/idle.h
|
hle/service/am/idle.h
|
||||||
hle/service/am/library_applet_accessor.cpp
|
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/display_controller.h
|
||||||
hle/service/am/service/global_state_controller.cpp
|
hle/service/am/service/global_state_controller.cpp
|
||||||
hle/service/am/service/global_state_controller.h
|
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.cpp
|
||||||
hle/service/am/service/library_applet_proxy.h
|
hle/service/am/service/library_applet_proxy.h
|
||||||
hle/service/am/service/system_applet_proxy.cpp
|
hle/service/am/service/system_applet_proxy.cpp
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
74
src/core/hle/service/am/service/home_menu_functions.cpp
Normal file
74
src/core/hle/service/am/service/home_menu_functions.cpp
Normal file
|
@ -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
|
34
src/core/hle/service/am/service/home_menu_functions.h
Normal file
34
src/core/hle/service/am/service/home_menu_functions.h
Normal file
|
@ -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
|
|
@ -1,7 +1,6 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// 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_creator.h"
|
||||||
#include "core/hle/service/am/library_applet_self_accessor.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/process_winding_controller.h"
|
||||||
|
@ -12,6 +11,7 @@
|
||||||
#include "core/hle/service/am/service/debug_functions.h"
|
#include "core/hle/service/am/service/debug_functions.h"
|
||||||
#include "core/hle/service/am/service/display_controller.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/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/service/library_applet_proxy.h"
|
||||||
#include "core/hle/service/am/window_controller.h"
|
#include "core/hle/service/am/window_controller.h"
|
||||||
#include "core/hle/service/cmif_serialization.h"
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
@ -119,7 +119,7 @@ Result ILibraryAppletProxy::GetAppletCommonFunctions(
|
||||||
Result ILibraryAppletProxy::GetHomeMenuFunctions(
|
Result ILibraryAppletProxy::GetHomeMenuFunctions(
|
||||||
Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) {
|
Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) {
|
||||||
LOG_DEBUG(Service_AM, "called");
|
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();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/am/application_creator.h"
|
#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_creator.h"
|
||||||
#include "core/hle/service/am/library_applet_self_accessor.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/process_winding_controller.h"
|
||||||
|
@ -13,6 +12,7 @@
|
||||||
#include "core/hle/service/am/service/debug_functions.h"
|
#include "core/hle/service/am/service/debug_functions.h"
|
||||||
#include "core/hle/service/am/service/display_controller.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/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/service/system_applet_proxy.h"
|
||||||
#include "core/hle/service/am/window_controller.h"
|
#include "core/hle/service/am/window_controller.h"
|
||||||
#include "core/hle/service/cmif_serialization.h"
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
@ -118,7 +118,7 @@ Result ISystemAppletProxy::GetAppletCommonFunctions(
|
||||||
Result ISystemAppletProxy::GetHomeMenuFunctions(
|
Result ISystemAppletProxy::GetHomeMenuFunctions(
|
||||||
Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) {
|
Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) {
|
||||||
LOG_DEBUG(Service_AM, "called");
|
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();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue