diff --git a/libctru/include/3ds/services/ptmu.h b/libctru/include/3ds/services/ptmu.h index a5822ce..1ba4e97 100644 --- a/libctru/include/3ds/services/ptmu.h +++ b/libctru/include/3ds/services/ptmu.h @@ -40,3 +40,8 @@ Result PTMU_GetPedometerState(u8 *out); */ 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); diff --git a/libctru/include/3ds/svc.h b/libctru/include/3ds/svc.h index baed48a..e1e2ced 100644 --- a/libctru/include/3ds/svc.h +++ b/libctru/include/3ds/svc.h @@ -776,6 +776,28 @@ Result svcGetResourceLimitLimitValues(s64* values, Handle resourceLimit, u32* na */ 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. * @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); +/** + * @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. * @param type Type of state to set (the other parameters depend on it). diff --git a/libctru/include/3ds/synchronization.h b/libctru/include/3ds/synchronization.h index f23594b..d09bc7f 100644 --- a/libctru/include/3ds/synchronization.h +++ b/libctru/include/3ds/synchronization.h @@ -4,6 +4,7 @@ */ #pragma once #include +#include <3ds/svc.h> /// A light lock. typedef _LOCK_T LightLock; diff --git a/libctru/source/services/ptmu.c b/libctru/source/services/ptmu.c index e302e63..8db305d 100644 --- a/libctru/source/services/ptmu.c +++ b/libctru/source/services/ptmu.c @@ -94,3 +94,16 @@ Result PTMU_GetTotalStepCount(u32 *steps) 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]; +} diff --git a/libctru/source/svc.s b/libctru/source/svc.s index 7932ddd..059bd29 100644 --- a/libctru/source/svc.s +++ b/libctru/source/svc.s @@ -502,6 +502,16 @@ SVC_BEGIN svcGetDmaState bx lr SVC_END +SVC_BEGIN svcSetGpuProt + svc 0x59 + bx lr +SVC_END + +SVC_BEGIN svcSetWifiEnabled + svc 0x5A + bx lr +SVC_END + SVC_BEGIN svcDebugActiveProcess push {r0} svc 0x60 @@ -637,6 +647,24 @@ SVC_BEGIN svcTerminateProcess bx lr 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 0x7B bx lr