Example #1
0
void exitspawn_kernel( const char* fileName, SceSize args, void * argp){
   thread_active = 0;
   struct SceKernelLoadExecVSHParam game_param;

   memset(&game_param,0,sizeof(game_param));

   game_param.size = sizeof(game_param);
   game_param.args = args;
   game_param.argp = argp;
   game_param.key  = "game";
   game_param.vshmain_args_size = 0;
   game_param.vshmain_args = NULL;
   game_param.configfile = 0;
   game_param.unk4 = 0;
   game_param.unk5 = 0x10000;

   pspSdkSetK1(0);
   sceKernelSuspendAllUserThreads();
   sceKernelLoadExecVSHMs2(fileName, &game_param);
}
Example #2
0
void psplinkReset(void)
{
#if _PSP_FW_VERSION >= 200
	{
		struct SceKernelLoadExecVSHParam param; 
		const char *rebootkey = NULL;
		char argp[256];
		int  args;

		args = 0;
		strcpy(argp, g_context.bootfile);
		args += strlen(g_context.bootfile)+1;
		strcpy(&argp[args], g_context.currdir);
		args += strlen(g_context.currdir)+1;
		
		memset(&param, 0, sizeof(param)); 
		param.size = sizeof(param); 
		param.args = args;
		param.argp = argp;
		switch(g_context.rebootkey)
		{
			case REBOOT_MODE_GAME: rebootkey = "game";
								   break;
			case REBOOT_MODE_VSH : rebootkey = "vsh";
								   break;
			case REBOOT_MODE_UPDATER : rebootkey = "updater";
									   break;
			default: rebootkey = NULL;
					 break;

		};
		param.key = rebootkey; 
		param.vshmain_args_size = 0; 
		param.vshmain_args = NULL; 

		debugDisableHW();
		psplinkSetK1(0);
		SHELL_PRINT("Resetting psplink\n");
		psplinkStop();

		sceKernelSuspendAllUserThreads();

		sceKernelLoadExecVSHMs2(g_context.bootfile, &param);
	}
#else
	{
		struct SceKernelLoadExecParam le;
		struct SavedContext *save = (struct SavedContext *) SAVED_ADDR;
		const char *rebootkey = NULL;

		save->magic = SAVED_MAGIC;
		strcpy(save->currdir, g_context.currdir);
		save->rebootkey = g_context.rebootkey;

		debugDisableHW();
		psplinkSetK1(0);
		SHELL_PRINT("Resetting psplink\n");
		psplinkStop();

		le.size = sizeof(le);
		le.args = strlen(g_context.bootfile) + 1;
		le.argp = (char *) g_context.bootfile;
		switch(g_context.rebootkey)
		{
			case REBOOT_MODE_GAME: rebootkey = "game";
								   break;
			case REBOOT_MODE_VSH : rebootkey = "vsh";
								   break;
			case REBOOT_MODE_UPDATER : rebootkey = "updater";
									   break;
			default: rebootkey = NULL;
					 break;

		};
		le.key = rebootkey;

		sceKernelSuspendAllUserThreads();

		sceKernelLoadExec(g_context.bootfile, &le);
	}
#endif
}