In APT_CheckNew3DS_*, properly load+check the retval from the cmdbuf when svcSendSyncRequest was successful. In APT_CheckNew3DS(), added code to check for out nullptr, and code to clear out.

This commit is contained in:
yellows8 2015-05-29 17:15:55 -04:00
parent f631036063
commit 0ec23dc90a

View File

@ -1101,13 +1101,15 @@ Result APT_CheckNew3DS_Application(Handle* handle, u8 *out)
Result ret=0; Result ret=0;
if((ret=svcSendSyncRequest(*handle)))return ret; if((ret=svcSendSyncRequest(*handle)))return ret;
if(ret==0)ret = cmdbuf[1];
if(out) if(out)
{ {
*out = 0; *out = 0;
if(ret==0)*out=cmdbuf[2]; if(ret==0)*out=cmdbuf[2];
} }
return cmdbuf[1]; return ret;
} }
Result APT_CheckNew3DS_System(Handle* handle, u8 *out) Result APT_CheckNew3DS_System(Handle* handle, u8 *out)
@ -1120,19 +1122,25 @@ Result APT_CheckNew3DS_System(Handle* handle, u8 *out)
Result ret=0; Result ret=0;
if((ret=svcSendSyncRequest(*handle)))return ret; if((ret=svcSendSyncRequest(*handle)))return ret;
if(ret==0)ret = cmdbuf[1];
if(out) if(out)
{ {
*out = 0; *out = 0;
if(ret==0)*out=cmdbuf[2]; if(ret==0)*out=cmdbuf[2];
} }
return cmdbuf[1]; return ret;
} }
Result APT_CheckNew3DS(Handle* handle, u8 *out) Result APT_CheckNew3DS(Handle* handle, u8 *out)
{ {
Result ret=0; Result ret=0;
if(out==NULL)return -1;
*out = 0;
if(__apt_new3dsflag_initialized) if(__apt_new3dsflag_initialized)
{ {
*out = __apt_new3dsflag; *out = __apt_new3dsflag;