Add some IApplicationFunctions calls used by newer games

This commit is contained in:
Billy Laws 2020-08-09 14:51:57 +01:00 committed by ◱ PixelyIon
parent 9e39cbaf7b
commit 6c9e0a943c
2 changed files with 30 additions and 1 deletions

View File

@ -1,18 +1,22 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include <kernel/types/KProcess.h>
#include <services/account/IAccountServiceForApplication.h>
#include <services/am/storage/IStorage.h>
#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<type::KEvent>(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<u8>(1);
}
void IApplicationFunctions::GetPseudoDeviceId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
response.Push<u64>(0L);
response.Push<u64>(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);
}
}

View File

@ -3,6 +3,7 @@
#pragma once
#include <kernel/types/KEvent.h>
#include <services/base_service.h>
#include <services/serviceman.h>
@ -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<type::KEvent> 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);
};
}