mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-14 17:16:36 +00:00
cs: fix screenshot packet semantics
This commit is contained in:
parent
a4da7cc8bf
commit
a5e761ceca
2 changed files with 18 additions and 8 deletions
|
@ -18,17 +18,21 @@
|
||||||
|
|
||||||
namespace ams::scs {
|
namespace ams::scs {
|
||||||
|
|
||||||
struct CommandHeader {
|
struct alignas(alignof(u32)) CommandHeader {
|
||||||
u64 id;
|
u64 id __attribute__((packed));
|
||||||
u32 command;
|
u32 command;
|
||||||
u32 body_size;
|
u32 body_size;
|
||||||
};
|
};
|
||||||
|
static_assert(sizeof(CommandHeader) == 0x10);
|
||||||
|
static_assert(alignof(CommandHeader) == alignof(u32));
|
||||||
|
|
||||||
struct ResponseHeader {
|
struct alignas(alignof(u32)) ResponseHeader {
|
||||||
u64 id;
|
u64 id __attribute__((packed));
|
||||||
u32 response;
|
u32 response;
|
||||||
u32 body_size;
|
u32 body_size;
|
||||||
};
|
};
|
||||||
|
static_assert(sizeof(ResponseHeader) == 0x10);
|
||||||
|
static_assert(alignof(ResponseHeader) == alignof(u32));
|
||||||
|
|
||||||
class CommandProcessor {
|
class CommandProcessor {
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -109,11 +109,17 @@ namespace ams::cs {
|
||||||
.buffer_size = sizeof(g_data),
|
.buffer_size = sizeof(g_data),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Acquire the send lock. */
|
|
||||||
auto lk = MakeSendGuardBlock();
|
|
||||||
|
|
||||||
/* Take the screenshot. */
|
/* Take the screenshot. */
|
||||||
const Result result = DoTakeScreenShotCommand(params);
|
Result result;
|
||||||
|
{
|
||||||
|
/* Acquire the send lock. */
|
||||||
|
auto lk = MakeSendGuardBlock();
|
||||||
|
|
||||||
|
/* Perform the command. */
|
||||||
|
result = DoTakeScreenShotCommand(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handle the error case. */
|
||||||
if (R_FAILED(result)) {
|
if (R_FAILED(result)) {
|
||||||
SendErrorResult(socket, header, result);
|
SendErrorResult(socket, header, result);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue