From 76e3cb0721f3beffe6ee0ea2307e2a0e78e8dc87 Mon Sep 17 00:00:00 2001 From: suloku Date: Thu, 1 Oct 2015 17:19:13 +0200 Subject: [PATCH] Implement APT_GetProgramID --- libctru/source/services/apt.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libctru/source/services/apt.c b/libctru/source/services/apt.c index 1d01d4d..2b3c97b 100644 --- a/libctru/source/services/apt.c +++ b/libctru/source/services/apt.c @@ -833,6 +833,28 @@ Result APT_GetAppletProgramInfo(Handle* handle, u32 id, u32 flags, u16 *titlever return cmdbuf[1]; } +Result APT_GetProgramID(Handle* handle, u64* pProgramID) +{ + if(!handle)handle=&aptuHandle; + + u32* cmdbuf=getThreadCommandBuffer(); + cmdbuf[0] = 0x00580002; //request header code + cmdbuf[1] = 0x20; + + Result ret=0; + if((ret=svcSendSyncRequest(*handle)))return ret; + + if(ret==0)ret = cmdbuf[1]; + + if(pProgramID) + { + *pProgramID = 0; + if(ret==0) *pProgramID=((u64)cmdbuf[3]<<32)|cmdbuf[2]; + } + + return ret; +} + Result APT_IsRegistered(Handle* handle, NS_APPID appID, u8* out) { if(!handle)handle=&aptuHandle;