mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Added nvQueryEvent().
This commit is contained in:
parent
61ff5bd9a1
commit
42fbabe9d1
@ -12,4 +12,5 @@ void nvExit(void);
|
||||
Result nvOpen(u32 *fd, const char *devicepath);
|
||||
Result nvIoctl(u32 fd, u32 request, void* argp);
|
||||
Result nvClose(u32 fd);
|
||||
Result nvQueryEvent(u32 fd, u32 event_id, Handle *handle_out);
|
||||
|
||||
|
@ -297,3 +297,40 @@ Result nvClose(u32 fd) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result nvQueryEvent(u32 fd, u32 event_id, Handle *handle_out) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u32 fd;
|
||||
u32 event_id;
|
||||
} *raw;
|
||||
|
||||
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 4;
|
||||
raw->fd = fd;
|
||||
raw->event_id = event_id;
|
||||
|
||||
Result rc = ipcDispatch(g_nvServiceSession);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcCommandResponse r;
|
||||
ipcParseResponse(&r);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
u32 error;
|
||||
} *resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
if (R_SUCCEEDED(rc)) rc = resp->error;
|
||||
if (R_SUCCEEDED(rc)) *handle_out = r.Handles[0];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user