diff --git a/libctru/source/services/mvd.c b/libctru/source/services/mvd.c index e85317b..fdad9c1 100644 --- a/libctru/source/services/mvd.c +++ b/libctru/source/services/mvd.c @@ -10,6 +10,7 @@ #include <3ds/os.h> #include <3ds/linear.h> #include <3ds/services/mvd.h> +#include <3ds/ipc.h> Handle mvdstdHandle; static u32 mvdstdInitialized = 0; @@ -22,10 +23,10 @@ static size_t mvdstd_workbufsize = 0; static Result mvdstdipc_Initialize(u32 *buf, u32 bufsize, Handle kprocess) { u32* cmdbuf = getThreadCommandBuffer(); - cmdbuf[0] = 0x00010082; //request header code + cmdbuf[0] = IPC_MakeHeader(0x1,2,2); // 0x10082 cmdbuf[1] = (u32)buf; cmdbuf[2] = bufsize; - cmdbuf[3] = 0; + cmdbuf[3] = IPC_Desc_SharedHandles(1); cmdbuf[4] = kprocess; Result ret=0; @@ -37,7 +38,7 @@ static Result mvdstdipc_Initialize(u32 *buf, u32 bufsize, Handle kprocess) static Result mvdstdipc_Shutdown(void) { u32* cmdbuf = getThreadCommandBuffer(); - cmdbuf[0] = 0x00020000; //request header code + cmdbuf[0] = IPC_MakeHeader(0x2,0,0); // 0x20000 Result ret=0; if((ret = svcSendSyncRequest(mvdstdHandle)))return ret; @@ -48,7 +49,7 @@ static Result mvdstdipc_Shutdown(void) static Result mvdstdipc_cmd18(void) { u32* cmdbuf = getThreadCommandBuffer(); - cmdbuf[0] = 0x00180000; //request header code + cmdbuf[0] = IPC_MakeHeader(0x18,0,0); // 0x180000 Result ret=0; if((ret=svcSendSyncRequest(mvdstdHandle)))return ret; @@ -59,7 +60,7 @@ static Result mvdstdipc_cmd18(void) static Result mvdstdipc_cmd19(void) { u32* cmdbuf = getThreadCommandBuffer(); - cmdbuf[0] = 0x00190000; //request header code + cmdbuf[0] = IPC_MakeHeader(0x19,0,0); // 0x190000 Result ret=0; if((ret=svcSendSyncRequest(mvdstdHandle)))return ret; @@ -70,7 +71,7 @@ static Result mvdstdipc_cmd19(void) static Result mvdstdipc_cmd1a(void) { u32* cmdbuf = getThreadCommandBuffer(); - cmdbuf[0] = 0x001A0000; //request header code + cmdbuf[0] = IPC_MakeHeader(0x1A,0,0); // 0x1A0000 Result ret=0; if((ret=svcSendSyncRequest(mvdstdHandle)))return ret; @@ -81,11 +82,11 @@ static Result mvdstdipc_cmd1a(void) Result mvdstdSetConfig(mvdstdConfig *config) { u32* cmdbuf = getThreadCommandBuffer(); - cmdbuf[0] = 0x001E0044; //request header code + cmdbuf[0] = IPC_MakeHeader(0x1E,1,4); // 0x1E0044 cmdbuf[1] = sizeof(mvdstdConfig); - cmdbuf[2] = 0; + cmdbuf[2] = IPC_Desc_SharedHandles(1); cmdbuf[3] = CUR_PROCESS_HANDLE; - cmdbuf[4] = (sizeof(mvdstdConfig)<<4) | 10; + cmdbuf[4] = IPC_Desc_Buffer(sizeof(mvdstdConfig),IPC_BUFFER_R); cmdbuf[5] = (u32)config; Result ret=0;