#include <3ds.h>

#include <stdio.h>

int main ( int argc , char ** argv )

{

gfxInitDefault ( ) ;

consoleInit ( GFX_TOP , NULL ) ;

osSetSpeedupEnable ( true ) ;

Result res ;

printf ( "Slowerhax

" ) ; //slower version of slowhax

//POC - probably won't work and I don't have two weeks to find out

res = nsInit ( ) ;

printf ( "nsinit: %08X



" , ( int ) res ) ;

u64 titleid = 0x0004001000024000 ; //promo video, US old3ds. your mileage may vary. it's good to experiment as not all title relaunch spamming works well or at all.

//titleid=0x000400102002D500;

u32 procid ; //we assume nintendo is using an s32 for this hopefully

u32 launch_flags = 0 ; //this doesn't seem to affect anything

//u32 target=0x100;

u32 target = 0x7FFFFFFF - 1 ; //(s32 max - 1)

//This is the PID cut-off. After exiting this app and going to hbmenu, the next app should launch with cut-off + 2 based on tests with lower target PIDs.

//This, in theory(aka internet lore), should launch 3ds_dsiwarehax_installer with an s32 wrap-around at PID 0, giving it full svc access.

//This is estimated to take all of two weeks to reach the cut-off! Who has the time to actually test this?

//Note: this doesn't seems to work on new3ds very well. Relaunching system apps leads to the pid not advancing or memory crashes.

for ( u32 i = 0 ; i < 0x80000000 ; i ++ ) {

NS_LaunchTitle ( titleid , launch_flags , & procid ) ; //loop until pid is right up next to the s32 wrap-around.

printf ( "%08X

" , ( int ) procid ) ;

NS_TerminateProcessTID ( titleid ) ;

if ( procid >= target ) break ;

}

nsExit ( ) ;

printf ( "

%08X Current PID

" , ( int ) procid ) ;

printf ( "%08X Target PID

" , ( int ) procid + 2 ) ;

printf ( "Start to exit, then run 3ds_dsiwarehax_installer" ) ; //need to launch 3ds_dsiwarehax_installer with an xml to takeover some other app or pid will be download play (too low)

while ( aptMainLoop ( ) )

{

hidScanInput ( ) ;

u32 kDown = hidKeysDown ( ) ;

if ( kDown & KEY_START ) break ;

if ( kDown & KEY_A ) {

}

gfxFlushBuffers ( ) ;

gfxSwapBuffers ( ) ;

gspWaitForVBlank ( ) ;

}

gfxExit ( ) ;

return 0 ;