Merge pull request #7 from profi200/refactor

refactor
This commit is contained in:
fincs 2014-09-01 20:21:55 +02:00
commit 38a442ae10
3 changed files with 39 additions and 0 deletions

View File

@ -6,3 +6,8 @@ library for writing user mode arm11 code for the 3DS (CTR)
the goal with this is to create a very straightforward interface with the 3DS's OS. the goal with this is to create a very straightforward interface with the 3DS's OS.
it is not meant to provide higher level functions; to put things in perspective, the purpose of ctrulib would be to sit between the OS and a possible port of SDL rather than replace it. it is not meant to provide higher level functions; to put things in perspective, the purpose of ctrulib would be to sit between the OS and a possible port of SDL rather than replace it.
license
=======
you may do whatever the hell you want with ctrulib as long as you give proper credit to its authors. that includes making commercial games/apps that use ctrulib. i'd personally rather you didn't sell ctrulib itself, because that would not be nice of you, but i'm not a lawyer and it's not like i'm going to sue you.

View File

@ -67,3 +67,5 @@ Result APT_ReplySleepQuery(Handle* handle, NS_APPID appID, u32 a);
Result APT_ReplySleepNotificationComplete(Handle* handle, NS_APPID appID); Result APT_ReplySleepNotificationComplete(Handle* handle, NS_APPID appID);
Result APT_PrepareToCloseApplication(Handle* handle, u8 a); Result APT_PrepareToCloseApplication(Handle* handle, u8 a);
Result APT_CloseApplication(Handle* handle, u32 a, u32 b, u32 c); Result APT_CloseApplication(Handle* handle, u32 a, u32 b, u32 c);
Result APT_SetAppCpuTimeLimit(Handle* handle, u32 percent);
Result APT_GetAppCpuTimeLimit(Handle* handle, u32 *percent);

View File

@ -743,3 +743,35 @@ Result APT_CloseApplication(Handle* handle, u32 a, u32 b, u32 c)
return cmdbuf[1]; return cmdbuf[1];
} }
//See http://3dbrew.org/APT:SetApplicationCpuTimeLimit
Result APT_SetAppCpuTimeLimit(Handle* handle, u32 percent)
{
if(!handle)handle=&aptuHandle;
u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=0x4F0080;
cmdbuf[1]=1;
cmdbuf[2]=percent;
Result ret=0;
if((ret=svcSendSyncRequest(*handle)))return ret;
return cmdbuf[1];
}
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];
}