Merge branch 'master' into devop_socket

Conflicts:
	libctru/source/services/soc/soc_ioctl.c
This commit is contained in:
Dave Murphy 2015-02-12 15:52:15 +00:00
commit 71a59a1da3
7 changed files with 33 additions and 32 deletions

View File

@ -39,7 +39,7 @@ typedef volatile s64 vs64;
typedef u32 Handle; typedef u32 Handle;
typedef s32 Result; typedef s32 Result;
typedef void (*ThreadFunc)(u32); typedef void (*ThreadFunc)(void *);
#define BIT(n) (1U<<(n)) #define BIT(n) (1U<<(n))

View File

@ -565,6 +565,7 @@ sdmc_stat(struct _reent *r,
st->st_uid = 1; st->st_uid = 1;
st->st_gid = 2; st->st_gid = 2;
st->st_mode = S_IFDIR | S_IWUSR | S_IWGRP | S_IWOTH | S_IRUSR | S_IRGRP | S_IROTH; st->st_mode = S_IFDIR | S_IWUSR | S_IWGRP | S_IWOTH | S_IRUSR | S_IRGRP | S_IROTH;
FSFILE_Close(fd);
return 0; return 0;
} }

View File

@ -380,7 +380,7 @@ static bool __handle_incoming_parameter() {
return true; return true;
} }
void aptEventHandler(u32 arg) void aptEventHandler(void *arg)
{ {
bool runThread = true; bool runThread = true;

View File

@ -410,7 +410,7 @@ Result csndPlaySound(int chn, u32 flags, u32 sampleRate, void* data0, void* data
if (data0) paddr0 = osConvertVirtToPhys((u32)data0); if (data0) paddr0 = osConvertVirtToPhys((u32)data0);
if (data1) paddr1 = osConvertVirtToPhys((u32)data1); if (data1) paddr1 = osConvertVirtToPhys((u32)data1);
if (encoding == CSND_ENCODING_ADPCM) if (data0 && encoding == CSND_ENCODING_ADPCM)
{ {
int adpcmSample = ((s16*)data0)[-2]; int adpcmSample = ((s16*)data0)[-2];
int adpcmIndex = ((u8*)data0)[-2]; int adpcmIndex = ((u8*)data0)[-2];

View File

@ -21,7 +21,7 @@ Handle gspEventThread;
static Handle gspEvent; static Handle gspEvent;
static vu8* gspEventData; static vu8* gspEventData;
static void gspEventThreadMain(u32 arg); static void gspEventThreadMain(void *arg);
Result gspInit() Result gspInit()
@ -82,7 +82,7 @@ void gspWaitForEvent(GSP_Event id, bool nextEvent)
svcClearEvent(gspEvents[id]); svcClearEvent(gspEvents[id]);
} }
void gspEventThreadMain(u32 arg) void gspEventThreadMain(void *arg)
{ {
while (gspRunEvents) while (gspRunEvents)
{ {
@ -114,7 +114,7 @@ void gspEventThreadMain(u32 arg)
Result GSPGPU_WriteHWRegs(Handle* handle, u32 regAddr, u32* data, u8 size) Result GSPGPU_WriteHWRegs(Handle* handle, u32 regAddr, u32* data, u8 size)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
if(size>0x80 || !data)return -1; if(size>0x80 || !data)return -1;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
@ -133,7 +133,7 @@ Result GSPGPU_WriteHWRegs(Handle* handle, u32 regAddr, u32* data, u8 size)
Result GSPGPU_WriteHWRegsWithMask(Handle* handle, u32 regAddr, u32* data, u8 datasize, u32* maskdata, u8 masksize) Result GSPGPU_WriteHWRegsWithMask(Handle* handle, u32 regAddr, u32* data, u8 datasize, u32* maskdata, u8 masksize)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
if(datasize>0x80 || !data)return -1; if(datasize>0x80 || !data)return -1;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
@ -154,7 +154,7 @@ Result GSPGPU_WriteHWRegsWithMask(Handle* handle, u32 regAddr, u32* data, u8 dat
Result GSPGPU_ReadHWRegs(Handle* handle, u32 regAddr, u32* data, u8 size) Result GSPGPU_ReadHWRegs(Handle* handle, u32 regAddr, u32* data, u8 size)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
if(size>0x80 || !data)return -1; if(size>0x80 || !data)return -1;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
@ -180,7 +180,7 @@ Result GSPGPU_SetBufferSwap(Handle* handle, u32 screenid, GSP_FramebufferInfo *f
cmdbuf[0] = 0x00050200; cmdbuf[0] = 0x00050200;
cmdbuf[1] = screenid; cmdbuf[1] = screenid;
memcpy(&cmdbuf[2], framebufinfo, sizeof(GSP_FramebufferInfo)); memcpy(&cmdbuf[2], framebufinfo, sizeof(GSP_FramebufferInfo));
if((ret=svcSendSyncRequest(*handle)))return ret; if((ret=svcSendSyncRequest(*handle)))return ret;
return cmdbuf[1]; return cmdbuf[1];
@ -189,7 +189,7 @@ Result GSPGPU_SetBufferSwap(Handle* handle, u32 screenid, GSP_FramebufferInfo *f
Result GSPGPU_FlushDataCache(Handle* handle, u8* adr, u32 size) Result GSPGPU_FlushDataCache(Handle* handle, u8* adr, u32 size)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x00080082; //request header code cmdbuf[0]=0x00080082; //request header code
cmdbuf[1]=(u32)adr; cmdbuf[1]=(u32)adr;
@ -224,7 +224,7 @@ Result GSPGPU_InvalidateDataCache(Handle* handle, u8* adr, u32 size)
Result GSPGPU_SetLcdForceBlack(Handle* handle, u8 flags) Result GSPGPU_SetLcdForceBlack(Handle* handle, u8 flags)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x000B0040; //request header code cmdbuf[0]=0x000B0040; //request header code
cmdbuf[1]=flags; cmdbuf[1]=flags;
@ -238,7 +238,7 @@ Result GSPGPU_SetLcdForceBlack(Handle* handle, u8 flags)
Result GSPGPU_TriggerCmdReqQueue(Handle* handle) Result GSPGPU_TriggerCmdReqQueue(Handle* handle)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x000C0000; //request header code cmdbuf[0]=0x000C0000; //request header code
@ -251,7 +251,7 @@ Result GSPGPU_TriggerCmdReqQueue(Handle* handle)
Result GSPGPU_RegisterInterruptRelayQueue(Handle* handle, Handle eventHandle, u32 flags, Handle* outMemHandle, u8* threadID) Result GSPGPU_RegisterInterruptRelayQueue(Handle* handle, Handle eventHandle, u32 flags, Handle* outMemHandle, u8* threadID)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x00130042; //request header code cmdbuf[0]=0x00130042; //request header code
cmdbuf[1]=flags; cmdbuf[1]=flags;
@ -263,27 +263,27 @@ Result GSPGPU_RegisterInterruptRelayQueue(Handle* handle, Handle eventHandle, u3
if(threadID)*threadID=cmdbuf[2]; if(threadID)*threadID=cmdbuf[2];
if(outMemHandle)*outMemHandle=cmdbuf[4]; if(outMemHandle)*outMemHandle=cmdbuf[4];
return cmdbuf[1]; return cmdbuf[1];
} }
Result GSPGPU_UnregisterInterruptRelayQueue(Handle* handle) Result GSPGPU_UnregisterInterruptRelayQueue(Handle* handle)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x00140000; //request header code cmdbuf[0]=0x00140000; //request header code
Result ret=0; Result ret=0;
if((ret=svcSendSyncRequest(*handle)))return ret; if((ret=svcSendSyncRequest(*handle)))return ret;
return cmdbuf[1]; return cmdbuf[1];
} }
Result GSPGPU_AcquireRight(Handle* handle, u8 flags) Result GSPGPU_AcquireRight(Handle* handle, u8 flags)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x160042; //request header code cmdbuf[0]=0x160042; //request header code
cmdbuf[1]=flags; cmdbuf[1]=flags;
@ -299,7 +299,7 @@ Result GSPGPU_AcquireRight(Handle* handle, u8 flags)
Result GSPGPU_ReleaseRight(Handle* handle) Result GSPGPU_ReleaseRight(Handle* handle)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x170000; //request header code cmdbuf[0]=0x170000; //request header code
@ -312,7 +312,7 @@ Result GSPGPU_ReleaseRight(Handle* handle)
Result GSPGPU_ImportDisplayCaptureInfo(Handle* handle, GSP_CaptureInfo *captureinfo) Result GSPGPU_ImportDisplayCaptureInfo(Handle* handle, GSP_CaptureInfo *captureinfo)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x00180000; //request header code cmdbuf[0]=0x00180000; //request header code
@ -332,7 +332,7 @@ Result GSPGPU_ImportDisplayCaptureInfo(Handle* handle, GSP_CaptureInfo *capturei
Result GSPGPU_SaveVramSysArea(Handle* handle) Result GSPGPU_SaveVramSysArea(Handle* handle)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x00190000; //request header code cmdbuf[0]=0x00190000; //request header code
@ -345,7 +345,7 @@ Result GSPGPU_SaveVramSysArea(Handle* handle)
Result GSPGPU_RestoreVramSysArea(Handle* handle) Result GSPGPU_RestoreVramSysArea(Handle* handle)
{ {
if(!handle)handle=&gspGpuHandle; if(!handle)handle=&gspGpuHandle;
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x001A0000; //request header code cmdbuf[0]=0x001A0000; //request header code
@ -361,7 +361,7 @@ Result GSPGPU_RestoreVramSysArea(Handle* handle)
Result GSPGPU_SubmitGxCommand(u32* sharedGspCmdBuf, u32 gxCommand[0x8], Handle* handle) Result GSPGPU_SubmitGxCommand(u32* sharedGspCmdBuf, u32 gxCommand[0x8], Handle* handle)
{ {
if(!sharedGspCmdBuf || !gxCommand)return -1; if(!sharedGspCmdBuf || !gxCommand)return -1;
u32 cmdBufHeader; u32 cmdBufHeader;
__asm__ __volatile__ ("ldrex %[result], [%[adr]]" : [result] "=r" (cmdBufHeader) : [adr] "r" (sharedGspCmdBuf)); __asm__ __volatile__ ("ldrex %[result], [%[adr]]" : [result] "=r" (cmdBufHeader) : [adr] "r" (sharedGspCmdBuf));

View File

@ -43,8 +43,8 @@ Result httpcOpenContext(httpcContext *context, char* url, u32 use_defaultproxy)
ret = HTTPC_InitializeConnectionSession(context->servhandle, context->httphandle); ret = HTTPC_InitializeConnectionSession(context->servhandle, context->httphandle);
if(ret!=0) { if(ret!=0) {
HTTPC_CloseContext(__httpc_servhandle, context->httphandle);
svcCloseHandle(context->servhandle); svcCloseHandle(context->servhandle);
HTTPC_CloseContext(__httpc_servhandle, context->httphandle);
return ret; return ret;
} }
@ -52,8 +52,8 @@ Result httpcOpenContext(httpcContext *context, char* url, u32 use_defaultproxy)
ret = HTTPC_SetProxyDefault(context->servhandle, context->httphandle); ret = HTTPC_SetProxyDefault(context->servhandle, context->httphandle);
if(ret!=0) { if(ret!=0) {
HTTPC_CloseContext(__httpc_servhandle, context->httphandle);
svcCloseHandle(context->servhandle); svcCloseHandle(context->servhandle);
HTTPC_CloseContext(__httpc_servhandle, context->httphandle);
return ret; return ret;
} }
@ -64,8 +64,8 @@ Result httpcCloseContext(httpcContext *context)
{ {
Result ret=0; Result ret=0;
ret = HTTPC_CloseContext(context->servhandle, context->httphandle);
svcCloseHandle(context->servhandle); svcCloseHandle(context->servhandle);
ret = HTTPC_CloseContext(__httpc_servhandle, context->httphandle);
return ret; return ret;
} }
@ -216,16 +216,16 @@ Result HTTPC_AddRequestHeaderField(Handle handle, Handle contextHandle, char* na
{ {
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();
int l1=strlen(name)+1; int name_len=strlen(name)+1;
int l2=strlen(value)+1; int value_len=strlen(value)+1;
cmdbuf[0]=0x1100c4; //request header code cmdbuf[0]=0x1100c4; //request header code
cmdbuf[1]=contextHandle; cmdbuf[1]=contextHandle;
cmdbuf[2]=l1; cmdbuf[2]=name_len;
cmdbuf[3]=l2; cmdbuf[3]=value_len;
cmdbuf[4]=(l1<<14)|0xC02; cmdbuf[4]=(name_len<<14)|0xC02;
cmdbuf[5]=(u32)name; cmdbuf[5]=(u32)name;
cmdbuf[6]=(l1<<4)|0xA; cmdbuf[6]=(value_len<<4)|0xA;
cmdbuf[7]=(u32)value; cmdbuf[7]=(u32)value;
Result ret=0; Result ret=0;

View File

@ -25,7 +25,7 @@ int ioctl(int sockfd, int request, ...)
if(value == NULL) { if(value == NULL) {
errno = EFAULT; errno = EFAULT;
ret = -1; return -1;
} }
flags = fcntl(sockfd, F_GETFL, 0); flags = fcntl(sockfd, F_GETFL, 0);