mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
add capssc 1201-1203 debug calls (#408)
This commit is contained in:
parent
8cbac97466
commit
8e245a0ba8
@ -35,6 +35,33 @@ Service* capsscGetServiceSession(void);
|
||||
*/
|
||||
Result capsscCaptureRawImageWithTimeout(void* buf, size_t size, ViLayerStack layer_stack, u64 width, u64 height, s64 buffer_count, s64 buffer_index, s64 timeout);
|
||||
|
||||
/**
|
||||
* @brief This takes a raw screenshot, with the screenshot being held until \ref capsscCloseRawScreenShotReadStream is called.
|
||||
* @note Only available on [3.0.0+]. Requires debug mode.
|
||||
* @param out_size Pointer to write the size of the captured raw image to. Always 0x384000(1280*720*4).
|
||||
* @param out_width Pointer to write the width of the captured raw image to. Always 1280.
|
||||
* @param out_height Pointer to write the height of the captured raw image to. Always 720.
|
||||
* @param layer_stack \ref ViLayerStack
|
||||
* @param timeout Timeout in nanoseconds.
|
||||
*/
|
||||
Result capsscOpenRawScreenShotReadStream(u64 *out_size, u64 *out_width, u64 *out_height, ViLayerStack layer_stack, s64 timeout);
|
||||
|
||||
/**
|
||||
* @brief Discards a stream opened by \ref capsscOpenRawScreenShotReadStream.
|
||||
* @note Only available on [3.0.0+]. Requires debug mode.
|
||||
*/
|
||||
Result capsscCloseRawScreenShotReadStream(void);
|
||||
|
||||
/**
|
||||
* @brief Reads from a stream opened by \ref capsscOpenRawScreenShotReadStream.
|
||||
* @note Only available on [3.0.0+]. Requires debug mode.
|
||||
* @param bytes_read Pointer to write the amounts of bytes written to buffer.
|
||||
* @param buf Output buffer containing the RGBA8 image.
|
||||
* @param size Size of buf.
|
||||
* @param offset Offset in image where read should start.
|
||||
*/
|
||||
Result capsscReadRawScreenShotReadStream(u64 *bytes_read, void* buf, size_t size, u64 offset);
|
||||
|
||||
/**
|
||||
* @brief This takes a screenshot, with the screenshot being written as jpeg into the output buffer.
|
||||
* @note Only available on [9.0.0+]. Requires debug mode before [10.0.0].
|
||||
|
@ -43,6 +43,49 @@ Result capsscCaptureRawImageWithTimeout(void* buf, size_t size, ViLayerStack lay
|
||||
);
|
||||
}
|
||||
|
||||
Result capsscOpenRawScreenShotReadStream(u64 *out_size, u64 *out_width, u64 *out_height, ViLayerStack layer_stack, s64 timeout) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
const struct {
|
||||
s32 layer_stack;
|
||||
u32 pad;
|
||||
u64 timeout;
|
||||
} in = {layer_stack, 0, timeout};
|
||||
|
||||
struct {
|
||||
u64 size;
|
||||
u64 width;
|
||||
u64 height;
|
||||
} out;
|
||||
|
||||
Result rc = serviceDispatchInOut(&g_capsscSrv, 1201, in, out);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (out_size) *out_size = out.size;
|
||||
if (out_width) *out_width = out.width;
|
||||
if (out_height) *out_height = out.height;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result capsscCloseRawScreenShotReadStream(void) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return serviceDispatch(&g_capsscSrv, 1202);
|
||||
}
|
||||
|
||||
Result capsscReadRawScreenShotReadStream(u64 *bytes_read, void* buf, size_t size, u64 offset) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return serviceDispatchInOut(&g_capsscSrv, 1203, offset, *bytes_read,
|
||||
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcMapAlias },
|
||||
.buffers = { { buf, size } },
|
||||
);
|
||||
}
|
||||
|
||||
Result capsscCaptureJpegScreenShot(u64* out_jpeg_size, void* jpeg_buf, size_t jpeg_buf_size, ViLayerStack layer_stack, s64 timeout) {
|
||||
if (hosversionBefore(9,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
Loading…
Reference in New Issue
Block a user