Exemplo n.º 1
0
Result CAMU_SetReceiving(Handle* event, void* dst, u32 port, u32 imageSize, s16 transferUnit) {
	Result ret = 0;
	u32* cmdbuf = getThreadCommandBuffer();
	cmdbuf[0] = IPC_MakeHeader(0x7,4,2); // 0x70102
	cmdbuf[1] = (u32) dst;
	cmdbuf[2] = port;
	cmdbuf[3] = imageSize;
	cmdbuf[4] = transferUnit;
	cmdbuf[5] = IPC_Desc_SharedHandles(1);
	cmdbuf[6] = CUR_PROCESS_HANDLE;

	if (R_FAILED(ret = svcSendSyncRequest(camHandle))) return ret;
	*event = cmdbuf[3];
	return cmdbuf[1];
}
Exemplo n.º 2
0
Result GSPGPU_InvalidateDataCache(const void* adr, u32 size)
{
	u32 *cmdbuf = getThreadCommandBuffer();

	cmdbuf[0] = IPC_MakeHeader(0x9,2,2); // 0x90082
	cmdbuf[1] = (u32)adr;
	cmdbuf[2] = size;
	cmdbuf[3] = IPC_Desc_SharedHandles(1);
	cmdbuf[4] = CUR_PROCESS_HANDLE;

	Result ret=0;
	if(R_FAILED(ret=svcSendSyncRequest(gspGpuHandle)))return ret;

	return cmdbuf[1];
}
Exemplo n.º 3
0
Result CFGNOR_Shutdown()
{
	Result ret = 0;
	u32 *cmdbuf = getThreadCommandBuffer();

	cmdbuf[0] = 0x00020000;

	if((ret = svcSendSyncRequest(CFGNOR_handle))!=0)return ret;
	ret = (Result)cmdbuf[1];

	svcCloseHandle(CFGNOR_handle);
	CFGNOR_handle = 0;

	return ret;
}
Exemplo n.º 4
0
/*! Set attributes for an open file
 *
 *  @param[in] handle     Open file handle
 *  @param[in] attributes Attributes to set
 *
 *  @returns error
 *
 *  @internal
 *
 *  #### Request
 *
 *  Index Word | Description
 *  -----------|-------------------------
 *  0          | Header code [0x08070040]
 *  1          | Attributes
 *
 *  #### Response
 *
 *  Index Word | Description
 *  -----------|-------------------------
 *  0          | Header code
 *  1          | Result code
 */
Result
FSFILE_SetAttributes(Handle handle,
                     u32    attributes)
{
	u32 *cmdbuf = getThreadCommandBuffer();

	cmdbuf[0] = 0x08070040;
	cmdbuf[1] = attributes;

	Result ret = 0;
	if((ret = svcSendSyncRequest(handle)))
		return ret;

	return cmdbuf[1];
}
Exemplo n.º 5
0
Result APT_GetAppletProgramInfo(Handle* handle, u32 id, u32 flags, u16 *titleversion)
{
	if(!handle)handle=&aptuHandle;
	u32* cmdbuf=getThreadCommandBuffer();
	cmdbuf[0]=0x004D0080; //request header code
	cmdbuf[1]=id;
	cmdbuf[2]=flags;

	Result ret=0;
	if((ret=svcSendSyncRequest(*handle)))return ret;

	if(titleversion)*titleversion=cmdbuf[2];

	return cmdbuf[1];
}
Exemplo n.º 6
0
Result APT_JumpToApplication(Handle* handle, u32 a, u32 b, u32 c)
{
	if(!handle)handle=&aptuHandle;
	u32* cmdbuf=getThreadCommandBuffer();
	cmdbuf[0]=0x240044; //request header code
	cmdbuf[1]=a;
	cmdbuf[2]=b;
	cmdbuf[3]=c;
	cmdbuf[4]=(b<<14)|2;
	
	Result ret=0;
	if((ret=svcSendSyncRequest(*handle)))return ret;
	
	return cmdbuf[1];
}
Exemplo n.º 7
0
Result Y2RU_SetReceiving(void* dst_buf, u32 image_size, u16 transfer_unit, u16 transfer_gap)
{
	Result ret = 0;
	u32* cmdbuf = getThreadCommandBuffer();
	cmdbuf[0] = 0x00180102;
	cmdbuf[1] = (u32)dst_buf;
	cmdbuf[2] = image_size;
	cmdbuf[3] = transfer_unit;
	cmdbuf[4] = transfer_gap;
	cmdbuf[5] = 0;
	cmdbuf[6] = 0xFFFF8001;

	if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
	return cmdbuf[1];
}
Exemplo n.º 8
0
Result APT_GetAppCpuTimeLimit(Handle* handle, u32 *percent)
{
	if(!handle)handle=&aptuHandle;

	u32* cmdbuf=getThreadCommandBuffer();
	cmdbuf[0]=0x500040;
	cmdbuf[1]=1;
	
	Result ret=0;
	if((ret=svcSendSyncRequest(*handle)))return ret;

	if(percent)*percent=cmdbuf[2];

	return cmdbuf[1];
}
Exemplo n.º 9
0
Result HTTPC_ReceiveData(Handle handle, Handle contextHandle, u8* buffer, u32 size)
{
	u32* cmdbuf=getThreadCommandBuffer();

	cmdbuf[0]=0xB0082; //request header code
	cmdbuf[1]=contextHandle;
	cmdbuf[2]=size;
	cmdbuf[3]=(size<<4)|12;
	cmdbuf[4]=(u32)buffer;
	
	Result ret=0;
	if((ret=svcSendSyncRequest(handle)))return ret;

	return cmdbuf[1];
}
Exemplo n.º 10
0
static Result sslcipc_ContextSetValue(sslcContext *context, u32 type, u32 value)
{
	u32* cmdbuf=getThreadCommandBuffer();

	if(type >= 4)return -1;

	cmdbuf[0]=IPC_MakeHeader(0x18 + type,2,0); // 0x180080
	cmdbuf[1]=context->sslchandle;
	cmdbuf[2]=value;

	Result ret=0;
	if(R_FAILED(ret=svcSendSyncRequest(context->servhandle)))return ret;

	return cmdbuf[1];
}
Exemplo n.º 11
0
Result
srvSysUnregisterService(const char *name)
{
    Result rc = 0;
    u32 *cmdbuf = getThreadCommandBuffer();

    cmdbuf[0] = IPC_MakeHeader(0x4, 3, 0); // 0x400C0
    strncpy((char *)&cmdbuf[1], name, 8);
    cmdbuf[3] = strlen(name);

    if (R_FAILED(rc = svcSendSyncRequest(srvHandle)))
        return rc;

    return cmdbuf[1];
}
Exemplo n.º 12
0
Result HTTPC_Initialize(Handle handle)
{
	u32* cmdbuf=getThreadCommandBuffer();

	cmdbuf[0]=0x10044; //request header code
	cmdbuf[1]=0x1000; //unk
	cmdbuf[2]=0x20;//processID header, following word is set to processID by the arm11kernel.
	cmdbuf[4]=0;
	cmdbuf[5]=0;//Some sort of handle.
	
	Result ret=0;
	if((ret=svcSendSyncRequest(handle)))return ret;

	return cmdbuf[1];
}
Exemplo n.º 13
0
static Result SOCU_Shutdown(void)
{
	Result ret = 0;
	u32 *cmdbuf = getThreadCommandBuffer();

	cmdbuf[0] = IPC_MakeHeader(0x19,0,0); // 0x190000

	ret = svcSendSyncRequest(SOCU_handle);
	if(ret != 0) {
		errno = SYNC_ERROR;
		return ret;
	}

	return cmdbuf[1];
}
Exemplo n.º 14
0
Result Y2RU_SetReceiving(void* dst_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap)
{
	Result ret = 0;
	u32* cmdbuf = getThreadCommandBuffer();
	cmdbuf[0] = IPC_MakeHeader(0x18,4,2); // 0x180102
	cmdbuf[1] = (u32)dst_buf;
	cmdbuf[2] = image_size;
	cmdbuf[3] = transfer_unit;
	cmdbuf[4] = transfer_gap;
	cmdbuf[5] = IPC_Desc_SharedHandles(1);
	cmdbuf[6] = CUR_PROCESS_HANDLE;

	if (R_FAILED(ret = svcSendSyncRequest(y2rHandle))) return ret;
	return cmdbuf[1];
}
Exemplo n.º 15
0
Arquivo: ir.c Projeto: Almamu/ctrulib
Result irucmd_StartSendTransfer(u8 *buf, u32 size)
{
	Result ret = 0;
	u32 *cmdbuf = getThreadCommandBuffer();

	cmdbuf[0] = 0x00030042;
	cmdbuf[1] = size;
	cmdbuf[2] = (size<<4) | 10;
	cmdbuf[3] = (u32)buf;

	if((ret = svcSendSyncRequest(iru_handle))!=0)return ret;
	ret = (Result)cmdbuf[1];

	return ret;
}
Exemplo n.º 16
0
Result LOADER_RegisterProgram(u64* programHandle, const FS_ProgramInfo *programInfo, const FS_ProgramInfo *programInfoUpdate)
{
	Result ret = 0;
	u32 *cmdbuf = getThreadCommandBuffer();

	cmdbuf[0] = IPC_MakeHeader(2, 8, 0); // 0x20200
	memcpy(&cmdbuf[1], programInfo, sizeof(FS_ProgramInfo));
	memcpy(&cmdbuf[5], programInfoUpdate, sizeof(FS_ProgramInfo));

	if(R_FAILED(ret = svcSendSyncRequest(loaderHandle))) return ret;

	*programHandle = ((u64)cmdbuf[3] << 32) | cmdbuf[2];

	return (Result)cmdbuf[1];
}
Exemplo n.º 17
0
Result HTTPC_GetDownloadSizeState(Handle handle, Handle contextHandle, u32* downloadedsize, u32* contentsize)
{
	u32* cmdbuf=getThreadCommandBuffer();

	cmdbuf[0]=0x60040; //request header code
	cmdbuf[1]=contextHandle;
	
	Result ret=0;
	if((ret=svcSendSyncRequest(handle)))return ret;

	if(downloadedsize)*downloadedsize = cmdbuf[2];
	if(contentsize)*contentsize = cmdbuf[3];

	return cmdbuf[1];
}
Exemplo n.º 18
0
Result sslcOpenDefaultClientCertContext(SSLC_DefaultClientCert certID, u32 *ClientCert_contexthandle)
{
	u32* cmdbuf=getThreadCommandBuffer();

	cmdbuf[0]=IPC_MakeHeader(0xE,1,0); // 0xE0040
	cmdbuf[1]=certID;

	Result ret=0;
	if(R_FAILED(ret=svcSendSyncRequest(__sslc_servhandle)))return ret;
	ret = cmdbuf[1];

	if(R_SUCCEEDED(ret))*ClientCert_contexthandle = cmdbuf[2];

	return ret;
}
Exemplo n.º 19
0
Result LOADER_LoadProcess(Handle* process, u64 programHandle)
{
	Result ret = 0;
	u32 *cmdbuf = getThreadCommandBuffer();

	cmdbuf[0] = IPC_MakeHeader(1, 2, 0); // 0x10080
	cmdbuf[1] = (u32)programHandle;
	cmdbuf[2] = (u32)(programHandle >> 32);

	if(R_FAILED(ret = svcSendSyncRequest(loaderHandle))) return ret;

	*process = cmdbuf[3];

	return (Result)cmdbuf[1];
}
Exemplo n.º 20
0
int socBind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
{
    Result ret = 0;
    socklen_t tmp_addrlen = 0;
    u32 *cmdbuf = getThreadCommandBuffer();
    u8 tmpaddr[0x1c];

    memset(tmpaddr, 0, 0x1c);

    if(addr->sa_family == AF_INET)
        tmp_addrlen = 8;
    else
        tmp_addrlen = 0x1c;

    if(addrlen < tmp_addrlen)
    {
        //errno = EINVAL;
        return -1;
    }

    tmpaddr[0] = tmp_addrlen;
    tmpaddr[1] = addr->sa_family;
    memcpy(&tmpaddr[2], &addr->sa_data, tmp_addrlen-2);

    cmdbuf[0] = IPC_MakeHeader(0x5,2,4); // 0x50084
    cmdbuf[1] = (u32)sockfd;
    cmdbuf[2] = (u32)tmp_addrlen;
    cmdbuf[3] = IPC_Desc_CurProcessHandle();
    cmdbuf[5] = IPC_Desc_StaticBuffer(tmp_addrlen,0);
    cmdbuf[6] = (u32)tmpaddr;

    ret = svcSendSyncRequest(SOCU_handle);
    if(ret != 0) {
        //errno = SYNC_ERROR;
        return ret;
    }

    ret = (int)cmdbuf[1];
    if(ret == 0)
        ret = _net_convert_error(cmdbuf[2]);

    if(ret < 0) {
        //errno = -ret;
        return -1;
    }

    return ret;
}
Exemplo n.º 21
0
static Result udsipc_BeginHostingNetwork(const udsNetworkStruct *network, const void *passphrase, size_t passphrase_size)
{
	u32* cmdbuf=getThreadCommandBuffer();

	cmdbuf[0]=IPC_MakeHeader(0x1D,1,4); // 0x1D0044
	cmdbuf[1]=passphrase_size;
	cmdbuf[2]=IPC_Desc_StaticBuffer(sizeof(udsNetworkStruct), 1);
	cmdbuf[3]=(u32)network;
	cmdbuf[4]=IPC_Desc_StaticBuffer(passphrase_size, 0);
	cmdbuf[5]=(u32)passphrase;

	Result ret=0;
	if(R_FAILED(ret=svcSendSyncRequest(__uds_servhandle)))return ret;

	return cmdbuf[1];
}
Exemplo n.º 22
0
Result srvGetPort(Handle* out, const char* name)
{
	Result rc = 0;
	u32* cmdbuf = getThreadCommandBuffer();

	cmdbuf[0] = IPC_MakeHeader(0x8,4,0); // 0x80100
	strncpy((char*) &cmdbuf[1], name,8);
	cmdbuf[3] = strlen(name);
	cmdbuf[4] = 0x0;

	if(R_FAILED(rc = svcSendSyncRequest(srvHandle)))return rc;

	if(out) *out = cmdbuf[3];

	return cmdbuf[1];
}
Exemplo n.º 23
0
Result srvRegisterService(Handle* out, const char* name, int maxSessions)
{
	Result rc = 0;
	u32* cmdbuf = getThreadCommandBuffer();

	cmdbuf[0] = IPC_MakeHeader(0x3,4,0); // 0x30100
	strncpy((char*) &cmdbuf[1], name,8);
	cmdbuf[3] = strlen(name);
	cmdbuf[4] = maxSessions;

	if(R_FAILED(rc = svcSendSyncRequest(srvHandle)))return rc;

	if(out) *out = cmdbuf[3];

	return cmdbuf[1];
}
Exemplo n.º 24
0
Result APT_StartSystemApplet(NS_APPID appID, u32 bufSize, Handle applHandle, u8 *buf)
{
	u32* cmdbuf=getThreadCommandBuffer();
	cmdbuf[0] = IPC_MakeHeader(0x1F,2,4); // 0x001F0084
	cmdbuf[1] = appID;
	cmdbuf[2] = bufSize;
	cmdbuf[3] = IPC_Desc_SharedHandles(1);
	cmdbuf[4] = applHandle;
	cmdbuf[5] = IPC_Desc_StaticBuffer(bufSize,0);
	cmdbuf[6] = (u32)buf;
	
	Result ret=0;
	if(R_FAILED(ret=svcSendSyncRequest(aptuHandle)))return ret;

	return cmdbuf[1];
}
Exemplo n.º 25
0
Result APT_GetAppletManInfo(u8 inval, u8 *outval8, u32 *outval32, NS_APPID *menu_appid, NS_APPID *active_appid)
{
	u32* cmdbuf=getThreadCommandBuffer();
	cmdbuf[0]=IPC_MakeHeader(0x5,1,0); // 0x50040
	cmdbuf[1]=inval;
	
	Result ret=0;
	if(R_FAILED(ret=svcSendSyncRequest(aptuHandle)))return ret;

	if(outval8)*outval8=cmdbuf[2];
	if(outval32)*outval32=cmdbuf[3];
	if(menu_appid)*menu_appid=cmdbuf[4];
	if(active_appid)*active_appid=cmdbuf[5];
	
	return cmdbuf[1];
}
Exemplo n.º 26
0
Result APT_StartLibraryApplet(NS_APPID appID, Handle inhandle, u32 *parambuf, u32 parambufsize)
{
	u32* cmdbuf=getThreadCommandBuffer();
	cmdbuf[0]=IPC_MakeHeader(0x1E,2,4); // 0x1E0084
	cmdbuf[1]=appID;
	cmdbuf[2]=parambufsize;
	cmdbuf[3]=IPC_Desc_SharedHandles(1);
	cmdbuf[4]=inhandle;
	cmdbuf[5]=IPC_Desc_StaticBuffer(parambufsize,0);
	cmdbuf[6]=(u32)parambuf;
	
	Result ret=0;
	if(R_FAILED(ret=svcSendSyncRequest(aptuHandle)))return ret;

	return cmdbuf[1];
}
Exemplo n.º 27
0
Result APT_DoAppJump(u32 NSbuf0Size, u32 NSbuf1Size, u8 *NSbuf0Ptr, u8 *NSbuf1Ptr)
{
	u32* cmdbuf=getThreadCommandBuffer();
	cmdbuf[0]=IPC_MakeHeader(0x32,2,4); // 0x320084
	cmdbuf[1]=NSbuf0Size;
	cmdbuf[2]=NSbuf1Size;
	cmdbuf[3]=IPC_Desc_StaticBuffer(NSbuf0Size,0);
	cmdbuf[4]=(u32)NSbuf0Ptr;
	cmdbuf[5]=IPC_Desc_StaticBuffer(NSbuf1Size,2);
	cmdbuf[6]=(u32)NSbuf1Ptr;
	
	Result ret=0;
	if(R_FAILED(ret=svcSendSyncRequest(aptuHandle)))return ret;

	return cmdbuf[1];
}
Exemplo n.º 28
0
Result AM_GetCiaFileInfo(u8 mediatype, AM_TitleEntry *titleEntry, Handle fileHandle)
{
	Result ret = 0;
	u32 *cmdbuf = getThreadCommandBuffer();
	
	cmdbuf[0] = IPC_MakeHeader(0x408,1,2); // 0x04080042
	cmdbuf[1] = mediatype;
	cmdbuf[2] = IPC_Desc_SharedHandles(1);
	cmdbuf[3] = fileHandle;

	if(R_FAILED(ret = svcSendSyncRequest(amHandle))) return ret;

	if(titleEntry) memcpy(titleEntry, &cmdbuf[2], sizeof(AM_TitleEntry));

	return (Result)cmdbuf[1];
}
Exemplo n.º 29
0
Result APT_Initialize(Handle* handle, NS_APPID appId, Handle* eventHandle1, Handle* eventHandle2)
{
	if(!handle)handle=&aptuHandle;
	u32* cmdbuf=getThreadCommandBuffer();
	cmdbuf[0]=0x20080; //request header code
	cmdbuf[1]=appId;
	cmdbuf[2]=0x0;
	
	Result ret=0;
	if((ret=svcSendSyncRequest(*handle)))return ret;
	
	if(eventHandle1)*eventHandle1=cmdbuf[3]; //return to menu event ?
	if(eventHandle2)*eventHandle2=cmdbuf[4];

	return cmdbuf[1];
}
Exemplo n.º 30
0
Result APT_PrepareToDoAppJump(Handle* handle, u8 flags, u64 programID, u8 mediatype)
{
	if(!handle)handle=&aptuHandle;

	u32* cmdbuf=getThreadCommandBuffer();
	cmdbuf[0]=0x310100; //request header code
	cmdbuf[1]=flags;
	cmdbuf[2]=(u32)programID;
	cmdbuf[3]=(u32)(programID>>32);
	cmdbuf[4]=mediatype;
	
	Result ret=0;
	if((ret=svcSendSyncRequest(*handle)))return ret;

	return cmdbuf[1];
}