This commit is contained in:
HiddenRambler 2017-07-10 18:19:08 +01:00
commit cb4e2ee0c5
5 changed files with 81 additions and 0 deletions

View File

@ -40,3 +40,8 @@ Result PTMU_GetPedometerState(u8 *out);
*/ */
Result PTMU_GetTotalStepCount(u32 *steps); Result PTMU_GetTotalStepCount(u32 *steps);
/**
* @brief Gets whether the adapter is plugged in or not
* @param out Pointer to write the adapter state to.
*/
Result PTMU_GetAdapterState(bool *out);

View File

@ -776,6 +776,28 @@ Result svcGetResourceLimitLimitValues(s64* values, Handle resourceLimit, u32* na
*/ */
Result svcGetResourceLimitCurrentValues(s64* values, Handle resourceLimit, u32* names, s32 nameCount); Result svcGetResourceLimitCurrentValues(s64* values, Handle resourceLimit, u32* names, s32 nameCount);
/**
* @brief Sets the resource limit set of a process.
* @param process Process to set the resource limit set to.
* @param resourceLimit Resource limit set handle.
*/
Result svcSetProcessResourceLimits(Handle process, Handle resourceLimit);
/**
* @brief Creates a resource limit set.
* @param[out] resourceLimit Pointer to output the resource limit set handle to.
*/
Result svcCreateResourceLimit(Handle* resourceLimit);
/**
* @brief Sets the value limits of a resource limit set.
* @param resourceLimit Resource limit set to use.
* @param names Resource limit names to set the limits of.
* @param values Value limits to set.
* @param nameCount Number of resource limit names.
*/
Result svcSetResourceLimitValues(Handle resourceLimit, const u32* names, const s64* values, s32 nameCount);
/** /**
* @brief Gets the process ID of a thread. * @brief Gets the process ID of a thread.
* @param[out] out Pointer to output the process ID of the thread @p handle to. * @param[out] out Pointer to output the process ID of the thread @p handle to.
@ -1007,6 +1029,18 @@ Result svcGetHandleInfo(s64* out, Handle handle, u32 param);
*/ */
Result svcGetSystemInfo(s64* out, u32 type, s32 param); Result svcGetSystemInfo(s64* out, u32 type, s32 param);
/**
* @brief Sets the GPU protection register to restrict the range of the GPU DMA. 11.3+ only.
* @param useApplicationRestriction Whether to use the register value used for APPLICATION titles.
*/
Result svcSetGpuProt(bool useApplicationRestriction);
/**
* @brief Enables or disables Wi-Fi. 11.4+ only.
* @param enabled Whether to enable or disable Wi-Fi.
*/
Result svcSetWifiEnabled(bool enabled);
/** /**
* @brief Sets the current kernel state. * @brief Sets the current kernel state.
* @param type Type of state to set (the other parameters depend on it). * @param type Type of state to set (the other parameters depend on it).

View File

@ -4,6 +4,7 @@
*/ */
#pragma once #pragma once
#include <sys/lock.h> #include <sys/lock.h>
#include <3ds/svc.h>
/// A light lock. /// A light lock.
typedef _LOCK_T LightLock; typedef _LOCK_T LightLock;

View File

@ -94,3 +94,16 @@ Result PTMU_GetTotalStepCount(u32 *steps)
return (Result)cmdbuf[1]; return (Result)cmdbuf[1];
} }
Result PTMU_GetAdapterState(bool *out)
{
Result ret=0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x5,0,0); // 0x50000
if(R_FAILED(ret = svcSendSyncRequest(ptmuHandle)))return ret;
*out = cmdbuf[2] & 0xFF;
return (Result)cmdbuf[1];
}

View File

@ -502,6 +502,16 @@ SVC_BEGIN svcGetDmaState
bx lr bx lr
SVC_END SVC_END
SVC_BEGIN svcSetGpuProt
svc 0x59
bx lr
SVC_END
SVC_BEGIN svcSetWifiEnabled
svc 0x5A
bx lr
SVC_END
SVC_BEGIN svcDebugActiveProcess SVC_BEGIN svcDebugActiveProcess
push {r0} push {r0}
svc 0x60 svc 0x60
@ -637,6 +647,24 @@ SVC_BEGIN svcTerminateProcess
bx lr bx lr
SVC_END SVC_END
SVC_BEGIN svcSetProcessResourceLimits
svc 0x77
bx lr
SVC_END
SVC_BEGIN svcCreateResourceLimits
push {r0}
svc 0x78
pop {r2}
str r1, [r2]
bx lr
SVC_END
SVC_BEGIN svcSetResourceLimitValues
svc 0x79
bx lr
SVC_END
SVC_BEGIN svcBackdoor SVC_BEGIN svcBackdoor
svc 0x7B svc 0x7B
bx lr bx lr