various fixes
This commit is contained in:
parent
bb5d5b290f
commit
4e3c18863b
@ -4,4 +4,3 @@
|
|||||||
u32 osConvertVirtToPhys(u32 vaddr);
|
u32 osConvertVirtToPhys(u32 vaddr);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -20,9 +20,12 @@ typedef enum {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
MEMPERM_READ =1,
|
MEMPERM_READ =1,
|
||||||
MEMPERM_WRITE =2,
|
MEMPERM_WRITE =2,
|
||||||
MEMPERM_EXECUTE=4
|
MEMPERM_EXECUTE=4,
|
||||||
|
MEMPERM_MAX =0xFFFFFFFF //force 4-byte
|
||||||
} MemPerm;
|
} MemPerm;
|
||||||
|
|
||||||
|
u32* getThreadCommandBuffer(void);
|
||||||
|
|
||||||
s32 svcControlMemory(u32* addr_out, u32 addr0, u32 addr1, u32 size, MemOp op, MemPerm perm);
|
s32 svcControlMemory(u32* addr_out, u32 addr0, u32 addr1, u32 size, MemOp op, MemPerm perm);
|
||||||
void svcExitProcess();
|
void svcExitProcess();
|
||||||
s32 svcCreateThread(Handle* thread, ThreadFunc entrypoint, u32 arg, u32* stack_top, s32 thread_priority, s32 processor_id);
|
s32 svcCreateThread(Handle* thread, ThreadFunc entrypoint, u32 arg, u32* stack_top, s32 thread_priority, s32 processor_id);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/srv.h>
|
#include <3ds/srv.h>
|
||||||
#include <3ds/APT.h>
|
#include <3ds/APT.h>
|
||||||
@ -68,7 +69,7 @@ void aptInitCaptureInfo(u32 *ns_capinfo)
|
|||||||
|
|
||||||
void aptWaitStatusEvent()
|
void aptWaitStatusEvent()
|
||||||
{
|
{
|
||||||
svcWaitSynchronization1(aptStatusEvent, U64_MAX);
|
svcWaitSynchronization(aptStatusEvent, U64_MAX);
|
||||||
svcClearEvent(aptStatusEvent);
|
svcClearEvent(aptStatusEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +378,7 @@ void aptSetupEventHandler()
|
|||||||
APP_STATUS aptGetStatus()
|
APP_STATUS aptGetStatus()
|
||||||
{
|
{
|
||||||
APP_STATUS ret;
|
APP_STATUS ret;
|
||||||
svcWaitSynchronization1(aptStatusMutex, U64_MAX);
|
svcWaitSynchronization(aptStatusMutex, U64_MAX);
|
||||||
ret=aptStatus;
|
ret=aptStatus;
|
||||||
svcReleaseMutex(aptStatusMutex);
|
svcReleaseMutex(aptStatusMutex);
|
||||||
return ret;
|
return ret;
|
||||||
@ -387,7 +388,7 @@ void aptSetStatus(APP_STATUS status)
|
|||||||
{
|
{
|
||||||
u32 prevstatus;
|
u32 prevstatus;
|
||||||
|
|
||||||
svcWaitSynchronization1(aptStatusMutex, U64_MAX);
|
svcWaitSynchronization(aptStatusMutex, U64_MAX);
|
||||||
|
|
||||||
prevstatus = status;
|
prevstatus = status;
|
||||||
aptStatus = status;
|
aptStatus = status;
|
||||||
@ -404,7 +405,7 @@ void aptSetStatus(APP_STATUS status)
|
|||||||
u32 aptGetStatusPower()
|
u32 aptGetStatusPower()
|
||||||
{
|
{
|
||||||
u32 ret;
|
u32 ret;
|
||||||
svcWaitSynchronization1(aptStatusMutex, U64_MAX);
|
svcWaitSynchronization(aptStatusMutex, U64_MAX);
|
||||||
ret=aptStatusPower;
|
ret=aptStatusPower;
|
||||||
svcReleaseMutex(aptStatusMutex);
|
svcReleaseMutex(aptStatusMutex);
|
||||||
return ret;
|
return ret;
|
||||||
@ -412,14 +413,14 @@ u32 aptGetStatusPower()
|
|||||||
|
|
||||||
void aptSetStatusPower(u32 status)
|
void aptSetStatusPower(u32 status)
|
||||||
{
|
{
|
||||||
svcWaitSynchronization1(aptStatusMutex, U64_MAX);
|
svcWaitSynchronization(aptStatusMutex, U64_MAX);
|
||||||
aptStatusPower = status;
|
aptStatusPower = status;
|
||||||
svcReleaseMutex(aptStatusMutex);
|
svcReleaseMutex(aptStatusMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void aptOpenSession()
|
void aptOpenSession()
|
||||||
{
|
{
|
||||||
svcWaitSynchronization1(aptLockHandle, U64_MAX);
|
svcWaitSynchronization(aptLockHandle, U64_MAX);
|
||||||
srvGetServiceHandle(&aptuHandle, "APT:U");
|
srvGetServiceHandle(&aptuHandle, "APT:U");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/os.h>
|
#include <3ds/os.h>
|
||||||
#include <3ds/svc.h>
|
#include <3ds/svc.h>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/FS.h>
|
#include <3ds/FS.h>
|
||||||
#include <3ds/svc.h>
|
#include <3ds/svc.h>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/GSP.h>
|
#include <3ds/GSP.h>
|
||||||
#include <3ds/GX.h>
|
#include <3ds/GX.h>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/GSP.h>
|
#include <3ds/GSP.h>
|
||||||
#include <3ds/svc.h>
|
#include <3ds/svc.h>
|
||||||
|
@ -36,10 +36,10 @@ Result GX_SetMemoryFill(u32* gxbuf, u32* buf0a, u32 buf0v, u32* buf0e, u16 width
|
|||||||
gxCommand[0]=0x01000102; //CommandID
|
gxCommand[0]=0x01000102; //CommandID
|
||||||
gxCommand[1]=(u32)buf0a; //buf0 address
|
gxCommand[1]=(u32)buf0a; //buf0 address
|
||||||
gxCommand[2]=buf0v; //buf0 value
|
gxCommand[2]=buf0v; //buf0 value
|
||||||
gxCommand[3]=(u32*)buf0e; //buf0 end addr
|
gxCommand[3]=(u32)buf0e; //buf0 end addr
|
||||||
gxCommand[4]=(u32)buf1a; //buf1 address
|
gxCommand[4]=(u32)buf1a; //buf1 address
|
||||||
gxCommand[5]=buf1v; //buf1 value
|
gxCommand[5]=buf1v; //buf1 value
|
||||||
gxCommand[6]=(u32*)buf1e; //buf1 end addr
|
gxCommand[6]=(u32)buf1e; //buf1 end addr
|
||||||
gxCommand[7]=(width0)|(width1<<16);
|
gxCommand[7]=(width0)|(width1<<16);
|
||||||
|
|
||||||
return GSPGPU_submitGxCommand(gxbuf, gxCommand, NULL);
|
return GSPGPU_submitGxCommand(gxbuf, gxCommand, NULL);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/HID.h>
|
#include <3ds/HID.h>
|
||||||
#include <3ds/srv.h>
|
#include <3ds/srv.h>
|
||||||
@ -18,7 +19,7 @@ Result hidInit(u32* sharedMem)
|
|||||||
|
|
||||||
if((ret=HIDUSER_GetInfo(NULL, &hidMemHandle)))return ret;
|
if((ret=HIDUSER_GetInfo(NULL, &hidMemHandle)))return ret;
|
||||||
hidSharedMem=sharedMem;
|
hidSharedMem=sharedMem;
|
||||||
svcMapMemoryBlock(hidMemHandle, (u32)hidSharedMem, 0x1, 0x10000000);
|
svcMapMemoryBlock(hidMemHandle, (u32)hidSharedMem, MEMPERM_READ, 0x10000000);
|
||||||
|
|
||||||
if((ret=HIDUSER_EnableAccelerometer(NULL)))return ret;
|
if((ret=HIDUSER_EnableAccelerometer(NULL)))return ret;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/GSP.h>
|
#include <3ds/GSP.h>
|
||||||
#include <3ds/GX.h>
|
#include <3ds/GX.h>
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
Handle SOCU_handle = 0;
|
Handle SOCU_handle = 0;
|
||||||
static int SOCU_errno = 0;
|
static int SOCU_errno = 0;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
srv.c _ Service manager.
|
srv.c _ Service manager.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include <3ds/types.h>
|
#include <3ds/types.h>
|
||||||
#include <3ds/srv.h>
|
#include <3ds/srv.h>
|
||||||
#include <3ds/svc.h>
|
#include <3ds/svc.h>
|
||||||
@ -68,10 +69,9 @@ Result srvInit()
|
|||||||
{
|
{
|
||||||
Result rc = 0;
|
Result rc = 0;
|
||||||
|
|
||||||
if(rc = svcConnectToPort(&g_srv_handle, "srv:"))
|
if((rc = svcConnectToPort(&g_srv_handle, "srv:")))return rc;
|
||||||
return rc;
|
|
||||||
|
|
||||||
if(rc = srvRegisterClient()) {
|
if((rc = srvRegisterClient())) {
|
||||||
svcCloseHandle(g_srv_handle);
|
svcCloseHandle(g_srv_handle);
|
||||||
g_srv_handle = 0;
|
g_srv_handle = 0;
|
||||||
}
|
}
|
||||||
@ -81,8 +81,7 @@ Result srvInit()
|
|||||||
|
|
||||||
Result srvExit()
|
Result srvExit()
|
||||||
{
|
{
|
||||||
if(g_srv_handle != 0)
|
if(g_srv_handle != 0)svcCloseHandle(g_srv_handle);
|
||||||
svcCloseHandle(g_srv_handle);
|
|
||||||
|
|
||||||
g_srv_handle = 0;
|
g_srv_handle = 0;
|
||||||
return 0;
|
return 0;
|
||||||
@ -95,8 +94,7 @@ Result srvRegisterClient()
|
|||||||
cmdbuf[1] = 0x20;
|
cmdbuf[1] = 0x20;
|
||||||
|
|
||||||
Result rc;
|
Result rc;
|
||||||
if(rc = svcSendSyncRequest(g_srv_handle))
|
if((rc = svcSendSyncRequest(g_srv_handle)))return rc;
|
||||||
return rc;
|
|
||||||
|
|
||||||
return cmdbuf[1];
|
return cmdbuf[1];
|
||||||
}
|
}
|
||||||
@ -121,8 +119,7 @@ Result srvGetServiceHandle(Handle* out, char* name)
|
|||||||
cmdbuf[4] = 0x0;
|
cmdbuf[4] = 0x0;
|
||||||
|
|
||||||
Result rc;
|
Result rc;
|
||||||
if(rc = svcSendSyncRequest(g_srv_handle))
|
if((rc = svcSendSyncRequest(g_srv_handle)))return rc;
|
||||||
return rc;
|
|
||||||
|
|
||||||
*out = cmdbuf[3];
|
*out = cmdbuf[3];
|
||||||
return cmdbuf[1];
|
return cmdbuf[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user