yuzu-emu
/
yuzu
Archived
1
0
Fork 0

am: rewrite IGlobalStateController, add ICradleFirmwareUpdater

This commit is contained in:
Liam 2024-02-11 19:48:13 -05:00
parent 77b7e1e682
commit 17460def8e
9 changed files with 187 additions and 54 deletions

View File

@ -425,8 +425,6 @@ add_library(core STATIC
hle/service/am/applet_message_queue.h
hle/service/am/application_creator.cpp
hle/service/am/application_creator.h
hle/service/am/global_state_controller.cpp
hle/service/am/global_state_controller.h
hle/service/am/hid_registration.cpp
hle/service/am/hid_registration.h
hle/service/am/home_menu_functions.cpp
@ -467,10 +465,14 @@ add_library(core STATIC
hle/service/am/service/audio_controller.h
hle/service/am/service/common_state_getter.cpp
hle/service/am/service/common_state_getter.h
hle/service/am/service/cradle_firmware_updater.cpp
hle/service/am/service/cradle_firmware_updater.h
hle/service/am/service/debug_functions.cpp
hle/service/am/service/debug_functions.h
hle/service/am/service/display_controller.cpp
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/library_applet_proxy.cpp
hle/service/am/service/library_applet_proxy.h
hle/service/am/service/system_applet_proxy.cpp

View File

@ -1,34 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/am/global_state_controller.h"
#include "core/hle/service/ipc_helpers.h"
namespace Service::AM {
IGlobalStateController::IGlobalStateController(Core::System& system_)
: ServiceFramework{system_, "IGlobalStateController"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "RequestToEnterSleep"},
{1, nullptr, "EnterSleep"},
{2, nullptr, "StartSleepSequence"},
{3, nullptr, "StartShutdownSequence"},
{4, nullptr, "StartRebootSequence"},
{9, nullptr, "IsAutoPowerDownRequested"},
{10, nullptr, "LoadAndApplyIdlePolicySettings"},
{11, nullptr, "NotifyCecSettingsChanged"},
{12, nullptr, "SetDefaultHomeButtonLongPressTime"},
{13, nullptr, "UpdateDefaultDisplayResolution"},
{14, nullptr, "ShouldSleepOnBoot"},
{15, nullptr, "GetHdcpAuthenticationFailedEvent"},
{30, nullptr, "OpenCradleFirmwareUpdater"},
};
// clang-format on
RegisterHandlers(functions);
}
IGlobalStateController::~IGlobalStateController() = default;
} // namespace Service::AM

View File

@ -1,16 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "core/hle/service/service.h"
namespace Service::AM {
class IGlobalStateController final : public ServiceFramework<IGlobalStateController> {
public:
explicit IGlobalStateController(Core::System& system_);
~IGlobalStateController() override;
};
} // namespace Service::AM

View File

@ -0,0 +1,52 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/am/service/cradle_firmware_updater.h"
#include "core/hle/service/cmif_serialization.h"
namespace Service::AM {
ICradleFirmwareUpdater::ICradleFirmwareUpdater(Core::System& system_)
: ServiceFramework{system_, "ICradleFirmwareUpdater"},
m_context{system, "ICradleFirmwareUpdater"}, m_cradle_device_info_event{m_context} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&ICradleFirmwareUpdater::StartUpdate>, "StartUpdate"},
{1, D<&ICradleFirmwareUpdater::FinishUpdate>, "FinishUpdate"},
{2, D<&ICradleFirmwareUpdater::GetCradleDeviceInfo>, "GetCradleDeviceInfo"},
{3, D<&ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent>, "GetCradleDeviceInfoChangeEvent"},
{4, nullptr, "GetUpdateProgressInfo"},
{5, nullptr, "GetLastInternalResult"},
};
// clang-format on
RegisterHandlers(functions);
}
ICradleFirmwareUpdater::~ICradleFirmwareUpdater() = default;
Result ICradleFirmwareUpdater::StartUpdate() {
LOG_WARNING(Service_AM, "(STUBBED) called");
R_SUCCEED();
}
Result ICradleFirmwareUpdater::FinishUpdate() {
LOG_WARNING(Service_AM, "(STUBBED) called");
R_SUCCEED();
}
Result ICradleFirmwareUpdater::GetCradleDeviceInfo(Out<CradleDeviceInfo> out_cradle_device_info) {
LOG_WARNING(Service_AM, "(STUBBED) called");
*out_cradle_device_info = {};
R_SUCCEED();
}
Result ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_WARNING(Service_AM, "(STUBBED) called");
*out_event = m_cradle_device_info_event.GetHandle();
R_SUCCEED();
}
} // namespace Service::AM

View File

@ -0,0 +1,37 @@
// 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 CradleDeviceInfo {
bool unknown0;
bool unknown1;
bool unknown2;
u64 unknown3;
};
static_assert(sizeof(CradleDeviceInfo) == 0x10, "CradleDeviceInfo has incorrect size");
class ICradleFirmwareUpdater final : public ServiceFramework<ICradleFirmwareUpdater> {
public:
explicit ICradleFirmwareUpdater(Core::System& system_);
~ICradleFirmwareUpdater() override;
private:
Result StartUpdate();
Result FinishUpdate();
Result GetCradleDeviceInfo(Out<CradleDeviceInfo> out_cradle_device_info);
Result GetCradleDeviceInfoChangeEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
private:
KernelHelpers::ServiceContext m_context;
Event m_cradle_device_info_event;
};
} // namespace Service::AM

View File

@ -0,0 +1,61 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/am/service/cradle_firmware_updater.h"
#include "core/hle/service/am/service/global_state_controller.h"
#include "core/hle/service/cmif_serialization.h"
namespace Service::AM {
IGlobalStateController::IGlobalStateController(Core::System& system_)
: ServiceFramework{system_, "IGlobalStateController"},
m_context{system_, "IGlobalStateController"}, m_hdcp_authentication_failed_event{m_context} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "RequestToEnterSleep"},
{1, nullptr, "EnterSleep"},
{2, nullptr, "StartSleepSequence"},
{3, nullptr, "StartShutdownSequence"},
{4, nullptr, "StartRebootSequence"},
{9, nullptr, "IsAutoPowerDownRequested"},
{10, D<&IGlobalStateController::LoadAndApplyIdlePolicySettings>, "LoadAndApplyIdlePolicySettings"},
{11, nullptr, "NotifyCecSettingsChanged"},
{12, nullptr, "SetDefaultHomeButtonLongPressTime"},
{13, nullptr, "UpdateDefaultDisplayResolution"},
{14, D<&IGlobalStateController::ShouldSleepOnBoot>, "ShouldSleepOnBoot"},
{15, D<&IGlobalStateController::GetHdcpAuthenticationFailedEvent>, "GetHdcpAuthenticationFailedEvent"},
{30, D<&IGlobalStateController::OpenCradleFirmwareUpdater>, "OpenCradleFirmwareUpdater"},
};
// clang-format on
RegisterHandlers(functions);
}
IGlobalStateController::~IGlobalStateController() = default;
Result IGlobalStateController::LoadAndApplyIdlePolicySettings() {
LOG_WARNING(Service_AM, "(STUBBED) called");
R_SUCCEED();
}
Result IGlobalStateController::ShouldSleepOnBoot(Out<bool> out_should_sleep_on_boot) {
LOG_INFO(Service_AM, "called");
*out_should_sleep_on_boot = false;
R_SUCCEED();
}
Result IGlobalStateController::GetHdcpAuthenticationFailedEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_INFO(Service_AM, "called");
*out_event = m_hdcp_authentication_failed_event.GetHandle();
R_SUCCEED();
}
Result IGlobalStateController::OpenCradleFirmwareUpdater(
Out<SharedPointer<ICradleFirmwareUpdater>> out_cradle_firmware_updater) {
LOG_INFO(Service_AM, "called");
*out_cradle_firmware_updater = std::make_shared<ICradleFirmwareUpdater>(system);
R_SUCCEED();
}
} // namespace Service::AM

View File

@ -0,0 +1,31 @@
// 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 {
class ICradleFirmwareUpdater;
class IGlobalStateController final : public ServiceFramework<IGlobalStateController> {
public:
explicit IGlobalStateController(Core::System& system_);
~IGlobalStateController() override;
private:
Result LoadAndApplyIdlePolicySettings();
Result ShouldSleepOnBoot(Out<bool> out_should_sleep_on_boot);
Result GetHdcpAuthenticationFailedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result OpenCradleFirmwareUpdater(
Out<SharedPointer<ICradleFirmwareUpdater>> out_cradle_firmware_updater);
KernelHelpers::ServiceContext m_context;
Event m_hdcp_authentication_failed_event;
};
} // namespace Service::AM

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#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"
@ -12,6 +11,7 @@
#include "core/hle/service/am/service/common_state_getter.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/global_state_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"

View File

@ -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/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"
@ -13,6 +12,7 @@
#include "core/hle/service/am/service/common_state_getter.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/global_state_controller.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"