diff --git a/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.cpp b/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.cpp index 001652bf..f97e8bb4 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.cpp +++ b/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.cpp @@ -1,18 +1,22 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) +#include #include #include #include "IApplicationFunctions.h" namespace skyline::service::am { - IApplicationFunctions::IApplicationFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IApplicationFunctions, "am:IApplicationFunctions", { + IApplicationFunctions::IApplicationFunctions(const DeviceState &state, ServiceManager &manager) : gpuErrorEvent(std::make_shared(state)), BaseService(state, manager, Service::am_IApplicationFunctions, "am:IApplicationFunctions", { {0x1, SFUNC(IApplicationFunctions::PopLaunchParameter)}, {0x14, SFUNC(IApplicationFunctions::EnsureSaveData)}, {0x15, SFUNC(IApplicationFunctions::GetDesiredLanguage)}, {0x28, SFUNC(IApplicationFunctions::NotifyRunning)}, + {0x32, SFUNC(IApplicationFunctions::GetPseudoDeviceId)}, {0x42, SFUNC(IApplicationFunctions::InitializeGamePlayRecording)}, {0x43, SFUNC(IApplicationFunctions::SetGamePlayRecordingState)}, + {0x64, SFUNC(IApplicationFunctions::SetGamePlayRecordingState)}, + {0x82, SFUNC(IApplicationFunctions::GetGpuErrorDetectedSystemEvent)}, }) {} void IApplicationFunctions::PopLaunchParameter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { @@ -40,7 +44,18 @@ namespace skyline::service::am { response.Push(1); } + void IApplicationFunctions::GetPseudoDeviceId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + response.Push(0L); + response.Push(0L); + } + void IApplicationFunctions::InitializeGamePlayRecording(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {} void IApplicationFunctions::SetGamePlayRecordingState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {} + + void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + auto handle = state.process->InsertItem(gpuErrorEvent); + state.logger->Debug("GPU Error Event Handle: 0x{:X}", handle); + response.copyHandles.push_back(handle); + } } diff --git a/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.h b/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.h index 12843eab..994849c2 100644 --- a/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.h +++ b/app/src/main/cpp/skyline/services/am/controller/IApplicationFunctions.h @@ -3,6 +3,7 @@ #pragma once +#include #include #include @@ -11,6 +12,9 @@ namespace skyline::service::am { * @brief This has functions that are used to notify an application about it's state (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationFunctions) */ class IApplicationFunctions : public BaseService { + private: + std::shared_ptr gpuErrorEvent; //!< The event signalled on GPU errors + public: IApplicationFunctions(const DeviceState &state, ServiceManager &manager); @@ -34,6 +38,11 @@ namespace skyline::service::am { */ void NotifyRunning(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + /** + * @brief This returns a UUID, however what it refers to is currently unknown (https://switchbrew.org/wiki/Applet_Manager_services#GetPseudoDeviceId) + */ + void GetPseudoDeviceId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + /** * @brief This initializes gameplay recording (https://switchbrew.org/wiki/Applet_Manager_services#InitializeGamePlayRecording) */ @@ -43,5 +52,10 @@ namespace skyline::service::am { * @brief This controls the gameplay recording state (https://switchbrew.org/wiki/Applet_Manager_services#SetGamePlayRecordingState) */ void SetGamePlayRecordingState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + /** + * @brief This obtains a handle to the system GPU error KEvent (https://switchbrew.org/wiki/Applet_Manager_services#GetGpuErrorDetectedSystemEvent) + */ + void GetGpuErrorDetectedSystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); }; }