* These values correspond with the number of wifi bars displayed by Home Menu.
*/
u8 osGetWifiStrength(void);
+
+/**
+ * @brief Configures the New 3DS speedup.
+ * @param enable Specifies whether to enable or disable the speedup.
+ */
+void osSetSpeedupEnable(bool enable);
/// Exits PTM.
Result ptmExit(void);
+/// Initializes ptm:sysm.
+Result ptmSysmInit(void);
+
+/// Exits ptm:sysm.
+Result ptmSysmExit(void);
+
/**
* @brief Gets the system's current shell state.
* @param servhandle Optional pointer to the handle to use.
* @param steps Pointer to write the total step count to.
*/
Result PTMU_GetTotalStepCount(Handle* servhandle, u32 *steps);
+
+/**
+ * @brief Configures the New 3DS' CPU clock speed and L2 cache.
+ * @param value Bit0: enable higher clock, Bit1: enable L2 cache.
+ */
+Result PTMSYSM_ConfigureNew3DSCPU(u8 value);
#include <3ds/types.h>
#include <3ds/os.h>
#include <3ds/svc.h>
+#include <3ds/services/ptm.h>
#include <sys/time.h>
#include <reent.h>
static volatile datetime_t* __datetime1 =
(datetime_t*) 0x1FF81040;
+__attribute__((weak)) bool __ctru_speedup = false;
//---------------------------------------------------------------------------------
u32 osConvertVirtToPhys(u32 vaddr) {
//---------------------------------------------------------------------------------
return *((u8*)0x1FF81066);
}
+
+void __ctru_speedup_config(void)
+{
+ if (ptmSysmInit()==0)
+ {
+ PTMSYSM_ConfigureNew3DSCPU(__ctru_speedup ? 3 : 0);
+ ptmSysmExit();
+ }
+}
+
+void osSetSpeedupEnable(bool enable)
+{
+ __ctru_speedup = enable;
+ __ctru_speedup_config();
+}
{
}
+void __ctru_speedup_config(void);
+
static void aptAppStarted(void);
static bool aptIsReinit(void)
aptSetStatus(APP_APPLETCLOSED);
return true;
case 0xB: // Just returned from menu.
- if (aptStatusMutex)
+ if (aptGetStatus() != APP_NOTINITIALIZED)
{
GSPGPU_AcquireRight(0x0);
GSPGPU_RestoreVramSysArea();
svcCreateEvent(&aptStatusEvent, 0);
svcCreateEvent(&aptSleepSync, 0);
+ svcCreateMutex(&aptStatusMutex, false);
+ aptStatus=0;
if(!aptIsCrippled())
{
{
u8 buf1[4], buf2[4];
- svcCreateMutex(&aptStatusMutex, true);
- aptStatus=0;
- svcReleaseMutex(aptStatusMutex);
-
aptSetStatus(APP_RUNNING);
if(!aptIsCrippled())
//if(prevstatus != APP_NOTINITIALIZED)
//{
+ if(status == APP_RUNNING)
+ __ctru_speedup_config();
if(status == APP_RUNNING || status == APP_EXITING || status == APP_APPLETSTARTED || status == APP_APPLETCLOSED)
svcSignalEvent(aptStatusEvent);
//}
#include <3ds/ipc.h>
-static Handle ptmHandle;
+static Handle ptmHandle, ptmSysmHandle;
Result ptmInit(void)
{
- return srvGetServiceHandle(&ptmHandle, "ptm:u");
+ return srvGetServiceHandle(&ptmHandle, "ptm:u");
}
Result ptmExit(void)
return svcCloseHandle(ptmHandle);
}
+Result ptmSysmInit(void)
+{
+ return srvGetServiceHandle(&ptmSysmHandle, "ptm:sysm");
+}
+
+Result ptmSysmExit(void)
+{
+ return svcCloseHandle(ptmSysmHandle);
+}
+
Result PTMU_GetShellState(Handle* servhandle, u8 *out)
{
if(!servhandle)servhandle=&ptmHandle;
return (Result)cmdbuf[1];
}
+
+Result PTMSYSM_ConfigureNew3DSCPU(u8 value)
+{
+ Result ret;
+ u32 *cmdbuf = getThreadCommandBuffer();
+
+ cmdbuf[0] = IPC_MakeHeader(0x818,1,0); // 0x08180040
+ cmdbuf[1] = value;
+
+ if((ret = svcSendSyncRequest(ptmSysmHandle))!=0)return ret;
+
+ return (Result)cmdbuf[1];
+}