Stub application copyright image AM calls

These are used on HOS to control the screenshot overlay image for
developer copyrights.
This commit is contained in:
Billy Laws 2021-05-27 22:26:46 +01:00
parent 6f9189e8f9
commit 22c83006a3
2 changed files with 67 additions and 1 deletions

View File

@ -62,6 +62,47 @@ namespace skyline::service::am {
return {};
}
Result IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
i32 width{request.Pop<i32>()};
i32 height{request.Pop<i32>()};
u64 transferMemorySize{request.Pop<u64>()};
constexpr i32 MaximumFbWidth{1280};
constexpr i32 MaximumFbHeight{720};
constexpr u64 RequiredFbAlignment{0x40000};
if (width > MaximumFbWidth || height > MaximumFbHeight || !util::IsAligned(transferMemorySize, RequiredFbAlignment))
return result::InvalidParameters;
state.logger->Debug("Dimensions: ({}, {}) Transfer Memory Size: {}", width, height, transferMemorySize);
return {};
}
Result IApplicationFunctions::SetApplicationCopyrightImage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
i32 x{request.Pop<i32>()};
i32 y{request.Pop<i32>()};
i32 width{request.Pop<i32>()};
i32 height{request.Pop<i32>()};
enum class WindowOriginMode : i32 {
LowerLeft,
UpperLeft
} originMode = request.Pop<WindowOriginMode>();
if (y < 0 || x < 0 || width < 1 || height < 1)
return result::InvalidParameters;
state.logger->Debug("Position: ({}, {}) Dimensions: ({}, {}) Origin mode: {}", x, y, width, height, static_cast<i32>(originMode));
return {};
}
Result IApplicationFunctions::SetApplicationCopyrightVisibility(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
u8 visiblity{request.Pop<u8>()};
state.logger->Debug("Visiblity: {}", visiblity);
return {};
}
Result 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);

View File

@ -7,6 +7,10 @@
#include <services/serviceman.h>
namespace skyline::service::am {
namespace result {
constexpr Result InvalidParameters(128, 506);
}
/**
* @brief This is used to notify an application about its own state
* @url https://switchbrew.org/wiki/Applet_Manager_services#IApplicationFunctions
@ -60,6 +64,24 @@ namespace skyline::service::am {
*/
Result SetGamePlayRecordingState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief Uses the given transfer memory to setup memory for the screenshot copyright image
* @url https://switchbrew.org/wiki/Applet_Manager_services#InitializeApplicationCopyrightFrameBuffer
*/
Result InitializeApplicationCopyrightFrameBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief Sets the copyright image for screenshots using the buffer from InitializeApplicationCopyrightFrameBuffer
* @url https://switchbrew.org/wiki/Applet_Manager_services#SetApplicationCopyrightImage
*/
Result SetApplicationCopyrightImage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief Controls the visibility of the screenshot copyright image
* @url https://switchbrew.org/wiki/Applet_Manager_services#SetApplicationCopyrightVisibility
*/
Result SetApplicationCopyrightVisibility(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief Obtains a handle to the system GPU error KEvent
* @url https://switchbrew.org/wiki/Applet_Manager_services#GetGpuErrorDetectedSystemEvent
@ -74,8 +96,11 @@ namespace skyline::service::am {
SFUNC(0x32, IApplicationFunctions, GetPseudoDeviceId),
SFUNC(0x42, IApplicationFunctions, InitializeGamePlayRecording),
SFUNC(0x43, IApplicationFunctions, SetGamePlayRecordingState),
SFUNC(0x64, IApplicationFunctions, SetGamePlayRecordingState),
SFUNC(0x64, IApplicationFunctions, InitializeApplicationCopyrightFrameBuffer),
SFUNC(0x65, IApplicationFunctions, SetApplicationCopyrightImage),
SFUNC(0x66, IApplicationFunctions, SetApplicationCopyrightVisibility),
SFUNC(0x82, IApplicationFunctions, GetGpuErrorDetectedSystemEvent)
)
};
}