diff options
| author | Zephyron <zephyron@citron-emu.org> | 2025-01-27 00:45:27 +1000 | 
|---|---|---|
| committer | Zephyron <zephyron@citron-emu.org> | 2025-01-27 00:45:27 +1000 | 
| commit | b7e11d3724a262da718d1eff3d6e8c2c57f18637 (patch) | |
| tree | 6466d8c69b02d92a48d4b5d3d1c94c08a5957a0a | |
| parent | be191f740a477290f6dae570fa615aaf0d24bdd4 (diff) | |
service: Implement GPU error handling IPC commands for AM
Implements several IPC commands in IApplicationFunctions related to GPU error
handling and system events:
- EnableApplicationAllThreadDumpOnCrash (cmd 124)
- SetDelayTimeToAbortOnGpuError (cmd 131)
- TryPopFromNotificationStorageChannel (cmd 151)
- SetHdcpAuthenticationActivated (cmd 170)
- GetLaunchRequiredVersion (cmd 180)
- UpgradeLaunchRequiredVersion (cmd 181)
Also adds the LaunchRequiredVersion struct definition to the header file.
These are currently stubbed implementations that log warnings when called.
REFS: switchbrew.org/wiki/Applet_Manager_services#GetGpuErrorDetectedSystemEvent
| -rw-r--r-- | src/core/hle/service/am/service/application_functions.cpp | 45 | ||||
| -rw-r--r-- | src/core/hle/service/am/service/application_functions.h | 13 | ||||
| -rw-r--r-- | src/core/hle/service/sm/sm.cpp | 2 | 
3 files changed, 53 insertions, 7 deletions
diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp index 30c2715a6..70b8df409 100644 --- a/src/core/hle/service/am/service/application_functions.cpp +++ b/src/core/hle/service/am/service/application_functions.cpp @@ -72,17 +72,17 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_          {121, D<&IApplicationFunctions::ClearUserChannel>, "ClearUserChannel"},          {122, D<&IApplicationFunctions::UnpopToUserChannel>, "UnpopToUserChannel"},          {123, D<&IApplicationFunctions::GetPreviousProgramIndex>, "GetPreviousProgramIndex"}, -        {124, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, +        {124, D<&IApplicationFunctions::EnableApplicationAllThreadDumpOnCrash>, "EnableApplicationAllThreadDumpOnCrash"},          {130, D<&IApplicationFunctions::GetGpuErrorDetectedSystemEvent>, "GetGpuErrorDetectedSystemEvent"}, -        {131, nullptr, "SetDelayTimeToAbortOnGpuError"}, +        {131, D<&IApplicationFunctions::SetDelayTimeToAbortOnGpuError>, "SetDelayTimeToAbortOnGpuError"},          {140, D<&IApplicationFunctions::GetFriendInvitationStorageChannelEvent>, "GetFriendInvitationStorageChannelEvent"},          {141, D<&IApplicationFunctions::TryPopFromFriendInvitationStorageChannel>, "TryPopFromFriendInvitationStorageChannel"},          {150, D<&IApplicationFunctions::GetNotificationStorageChannelEvent>, "GetNotificationStorageChannelEvent"}, -        {151, nullptr, "TryPopFromNotificationStorageChannel"}, +        {151, D<&IApplicationFunctions::TryPopFromNotificationStorageChannel>, "TryPopFromNotificationStorageChannel"},          {160, D<&IApplicationFunctions::GetHealthWarningDisappearedSystemEvent>, "GetHealthWarningDisappearedSystemEvent"}, -        {170, nullptr, "SetHdcpAuthenticationActivated"}, -        {180, nullptr, "GetLaunchRequiredVersion"}, -        {181, nullptr, "UpgradeLaunchRequiredVersion"}, +        {170, D<&IApplicationFunctions::SetHdcpAuthenticationActivated>, "SetHdcpAuthenticationActivated"}, +        {180, D<&IApplicationFunctions::GetLaunchRequiredVersion>, "GetLaunchRequiredVersion"}, +        {181, D<&IApplicationFunctions::UpgradeLaunchRequiredVersion>, "UpgradeLaunchRequiredVersion"},          {190, nullptr, "SendServerMaintenanceOverlayNotification"},          {200, nullptr, "GetLastApplicationExitReason"},          {500, nullptr, "StartContinuousRecordingFlushForDebug"}, @@ -500,4 +500,37 @@ Result IApplicationFunctions::PrepareForJit() {      R_SUCCEED();  } +Result IApplicationFunctions::EnableApplicationAllThreadDumpOnCrash() { +    LOG_WARNING(Service_AM, "(STUBBED) called"); +    return ResultSuccess; +} + +Result IApplicationFunctions::SetDelayTimeToAbortOnGpuError(u64 delay_time_ns) { +    LOG_WARNING(Service_AM, "(STUBBED) called, delay_time_ns={}", delay_time_ns); +    return ResultSuccess; +} + +Result IApplicationFunctions::TryPopFromNotificationStorageChannel(Out<bool> out_success, +                                                                OutBuffer<BufferAttr_HipcMapAlias> out_buffer) { +    LOG_WARNING(Service_AM, "(STUBBED) called"); +    *out_success = false; +    return ResultSuccess; +} + +Result IApplicationFunctions::SetHdcpAuthenticationActivated(bool activated) { +    LOG_WARNING(Service_AM, "(STUBBED) called, activated={}", activated); +    return ResultSuccess; +} + +Result IApplicationFunctions::GetLaunchRequiredVersion(Out<LaunchRequiredVersion> out_version) { +    LOG_WARNING(Service_AM, "(STUBBED) called"); +    *out_version = {}; // Zero-initialize the struct +    return ResultSuccess; +} + +Result IApplicationFunctions::UpgradeLaunchRequiredVersion(const LaunchRequiredVersion& version) { +    LOG_WARNING(Service_AM, "(STUBBED) called"); +    return ResultSuccess; +} +  } // namespace Service::AM diff --git a/src/core/hle/service/am/service/application_functions.h b/src/core/hle/service/am/service/application_functions.h index 10025a152..85bf8640d 100644 --- a/src/core/hle/service/am/service/application_functions.h +++ b/src/core/hle/service/am/service/application_functions.h @@ -21,6 +21,12 @@ namespace Service::AM {  struct Applet;  class IStorage; +struct LaunchRequiredVersion { +    u32 version; +    INSERT_PADDING_WORDS(3); // Padding for IPC alignment +}; +static_assert(sizeof(LaunchRequiredVersion) == 0x10); +  class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {  public:      explicit IApplicationFunctions(Core::System& system_, std::shared_ptr<Applet> applet); @@ -77,6 +83,13 @@ private:      Result GetNotificationStorageChannelEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);      Result GetHealthWarningDisappearedSystemEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);      Result PrepareForJit(); +    Result EnableApplicationAllThreadDumpOnCrash(); +    Result SetDelayTimeToAbortOnGpuError(u64 delay_time_ns); +    Result TryPopFromNotificationStorageChannel(Out<bool> out_success, +                                              OutBuffer<BufferAttr_HipcMapAlias> out_buffer); +    Result SetHdcpAuthenticationActivated(bool activated); +    Result GetLaunchRequiredVersion(Out<LaunchRequiredVersion> out_version); +    Result UpgradeLaunchRequiredVersion(const LaunchRequiredVersion& version);      const std::shared_ptr<Applet> m_applet;  }; diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index 14e0a03c8..8a92d9146 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -22,7 +22,7 @@ constexpr Result ResultInvalidClient(ErrorModule::SM, 2);  constexpr Result ResultAlreadyRegistered(ErrorModule::SM, 4);  constexpr Result ResultInvalidServiceName(ErrorModule::SM, 6);  constexpr Result ResultNotRegistered(ErrorModule::SM, 7); -constexpr Result ResultNotAllowed(ErrorModule::SM, 1); +[[maybe_unused]] constexpr Result ResultNotAllowed(ErrorModule::SM, 1);  ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} {      controller_interface = std::make_unique<Controller>(kernel.System());  | 
