Service: am: enhance UnpopInData, GetHdcpAuthenticationState and GetHdcpAuthenticationStateChangeEvent

Thanks to Sudachi and Torzu for some help and referance.
This commit is contained in:
JPikachu 2025-04-13 22:42:28 +01:00 committed by swurl
parent 2149362378
commit d6eff706f2
7 changed files with 33 additions and 4 deletions

View file

@ -9,7 +9,7 @@ namespace Service::AM {
LifecycleManager::LifecycleManager(Core::System& system, KernelHelpers::ServiceContext& context, LifecycleManager::LifecycleManager(Core::System& system, KernelHelpers::ServiceContext& context,
bool is_application) bool is_application)
: m_system_event(context), m_operation_mode_changed_system_event(context), : m_system_event(context), m_operation_mode_changed_system_event(context),
m_is_application(is_application) {} m_hdcp_state_changed_event(context), m_is_application(is_application) {}
LifecycleManager::~LifecycleManager() = default; LifecycleManager::~LifecycleManager() = default;
@ -21,6 +21,10 @@ Event& LifecycleManager::GetOperationModeChangedSystemEvent() {
return m_operation_mode_changed_system_event; return m_operation_mode_changed_system_event;
} }
Event& LifecycleManager::GetHDCPStateChangedEvent() {
return m_hdcp_state_changed_event;
}
void LifecycleManager::PushUnorderedMessage(AppletMessage message) { void LifecycleManager::PushUnorderedMessage(AppletMessage message) {
m_unordered_messages.push_back(message); m_unordered_messages.push_back(message);
this->SignalSystemEventIfNeeded(); this->SignalSystemEventIfNeeded();

View file

@ -42,6 +42,7 @@ public:
public: public:
Event& GetSystemEvent(); Event& GetSystemEvent();
Event& GetOperationModeChangedSystemEvent(); Event& GetOperationModeChangedSystemEvent();
Event& GetHDCPStateChangedEvent();
public: public:
bool IsApplication() { bool IsApplication() {
@ -145,12 +146,14 @@ private:
private: private:
Event m_system_event; Event m_system_event;
Event m_operation_mode_changed_system_event; Event m_operation_mode_changed_system_event;
Event m_hdcp_state_changed_event;
std::list<AppletMessage> m_unordered_messages{}; std::list<AppletMessage> m_unordered_messages{};
bool m_is_application{}; bool m_is_application{};
bool m_focus_state_changed_notification_enabled{true}; bool m_focus_state_changed_notification_enabled{true};
bool m_operation_mode_changed_notification_enabled{true}; bool m_operation_mode_changed_notification_enabled{true};
bool m_hdcp_state_changed_notification_enabled{true};
bool m_performance_mode_changed_notification_enabled{true}; bool m_performance_mode_changed_notification_enabled{true};
bool m_resume_notification_enabled{}; bool m_resume_notification_enabled{};

View file

@ -106,6 +106,7 @@ std::unique_ptr<Process> CreateApplicationProcess(std::vector<u8>& out_control,
out_control = nacp.GetRawBytes(); out_control = nacp.GetRawBytes();
} else { } else {
out_control.resize(sizeof(FileSys::RawNACP)); out_control.resize(sizeof(FileSys::RawNACP));
std::fill(out_control.begin(), out_control.end(), 0);
} }
auto& storage = system.GetContentProviderUnion(); auto& storage = system.GetContentProviderUnion();

View file

@ -48,8 +48,8 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Ap
{59, nullptr, "SetVrPositionForDebug"}, {59, nullptr, "SetVrPositionForDebug"},
{60, D<&ICommonStateGetter::GetDefaultDisplayResolution>, "GetDefaultDisplayResolution"}, {60, D<&ICommonStateGetter::GetDefaultDisplayResolution>, "GetDefaultDisplayResolution"},
{61, D<&ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent>, "GetDefaultDisplayResolutionChangeEvent"}, {61, D<&ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent>, "GetDefaultDisplayResolutionChangeEvent"},
{62, nullptr, "GetHdcpAuthenticationState"}, {62, D<&ICommonStateGetter::GetHdcpAuthenticationState>, "GetHdcpAuthenticationState"},
{63, nullptr, "GetHdcpAuthenticationStateChangeEvent"}, {63, D<&ICommonStateGetter::GetHdcpAuthenticationStateChangeEvent>, "GetHdcpAuthenticationStateChangeEvent"},
{64, nullptr, "SetTvPowerStateMatchingMode"}, {64, nullptr, "SetTvPowerStateMatchingMode"},
{65, nullptr, "GetApplicationIdByContentActionName"}, {65, nullptr, "GetApplicationIdByContentActionName"},
{66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"}, {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"},
@ -140,6 +140,19 @@ Result ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(
R_SUCCEED(); R_SUCCEED();
} }
Result ICommonStateGetter::GetHdcpAuthenticationState(Out<s32> out_state) {
LOG_DEBUG(Service_AM, "called");
*out_state = 1;
R_SUCCEED();
}
Result ICommonStateGetter::GetHdcpAuthenticationStateChangeEvent(
OutCopyHandle<Kernel::KReadableEvent> out_event) {
LOG_DEBUG(Service_AM, "called");
*out_event = m_applet->lifecycle_manager.GetHDCPStateChangedEvent().GetHandle();
R_SUCCEED();
}
Result ICommonStateGetter::GetOperationMode(Out<OperationMode> out_operation_mode) { Result ICommonStateGetter::GetOperationMode(Out<OperationMode> out_operation_mode) {
const bool use_docked_mode{Settings::IsDockedMode()}; const bool use_docked_mode{Settings::IsDockedMode()};
LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode);

View file

@ -35,6 +35,8 @@ private:
Result GetWriterLockAccessorEx(Out<SharedPointer<ILockAccessor>> out_lock_accessor, Result GetWriterLockAccessorEx(Out<SharedPointer<ILockAccessor>> out_lock_accessor,
u32 button_type); u32 button_type);
Result GetDefaultDisplayResolutionChangeEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); Result GetDefaultDisplayResolutionChangeEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result GetHdcpAuthenticationState(Out<s32> out_state);
Result GetHdcpAuthenticationStateChangeEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result GetOperationMode(Out<OperationMode> out_operation_mode); Result GetOperationMode(Out<OperationMode> out_operation_mode);
Result GetPerformanceMode(Out<APM::PerformanceMode> out_performance_mode); Result GetPerformanceMode(Out<APM::PerformanceMode> out_performance_mode);
Result GetCradleFwVersion(OutArray<uint32_t, 4> out_version); Result GetCradleFwVersion(OutArray<uint32_t, 4> out_version);

View file

@ -63,7 +63,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_,
{19, D<&ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout>, "GetDesirableKeyboardLayout"}, {19, D<&ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout>, "GetDesirableKeyboardLayout"},
{20, nullptr, "PopExtraStorage"}, {20, nullptr, "PopExtraStorage"},
{25, nullptr, "GetPopExtraStorageEvent"}, {25, nullptr, "GetPopExtraStorageEvent"},
{30, nullptr, "UnpopInData"}, {30, D<&ILibraryAppletSelfAccessor::UnpopInData>, "UnpopInData"},
{31, nullptr, "UnpopExtraStorage"}, {31, nullptr, "UnpopExtraStorage"},
{40, nullptr, "GetIndirectLayerProducerHandle"}, {40, nullptr, "GetIndirectLayerProducerHandle"},
{50, D<&ILibraryAppletSelfAccessor::ReportVisibleError>, "ReportVisibleError"}, {50, D<&ILibraryAppletSelfAccessor::ReportVisibleError>, "ReportVisibleError"},
@ -223,6 +223,11 @@ Result ILibraryAppletSelfAccessor::ReportVisibleErrorWithErrorContext(
R_SUCCEED(); R_SUCCEED();
} }
Result ILibraryAppletSelfAccessor::UnpopInData() {
LOG_WARNING(Service_AM, "(STUBBED) called");
R_SUCCEED();
}
Result ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage( Result ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage(
Out<u64> out_desired_language) { Out<u64> out_desired_language) {
// FIXME: this is copied from IApplicationFunctions::GetDesiredLanguage // FIXME: this is copied from IApplicationFunctions::GetDesiredLanguage

View file

@ -69,6 +69,7 @@ private:
Result ReportVisibleError(ErrorCode error_code); Result ReportVisibleError(ErrorCode error_code);
Result ReportVisibleErrorWithErrorContext( Result ReportVisibleErrorWithErrorContext(
ErrorCode error_code, InLargeData<ErrorContext, BufferAttr_HipcMapAlias> error_context); ErrorCode error_code, InLargeData<ErrorContext, BufferAttr_HipcMapAlias> error_context);
Result UnpopInData();
Result GetMainAppletApplicationDesiredLanguage(Out<u64> out_desired_language); Result GetMainAppletApplicationDesiredLanguage(Out<u64> out_desired_language);
Result GetCurrentApplicationId(Out<u64> out_application_id); Result GetCurrentApplicationId(Out<u64> out_application_id);
Result GetMainAppletAvailableUsers(Out<bool> out_can_select_any_user, Out<s32> out_users_count, Result GetMainAppletAvailableUsers(Out<bool> out_can_select_any_user, Out<s32> out_users_count,