Ejemplo n.º 1
0
int main()
{

	pspDebugScreenInit();
	
	pspDebugScreenSetBackColor(0xFF0000);
	pspDebugScreenSetTextColor(0x00FFFF);
	pspDebugScreenClear();

	printf("Recovery Mode by Dark_Alex, in-eboot by BlackSith\n\n\n\n");
	printf("Press start to activate USB Mass.\n");
	printf("Press triangle to flash ms0:/index.dat to flash0.\n");
	printf("Press cross to start the program under ms0:/PSP/GAME/UPDATE/EBOOT.PBP\n");
	printf("Press home to exit.\n\n\n\n");

	sceIoUnassign("flash0:");
	sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);

	while (1)
	{
		SceCtrlData pad;

		int keyprocessed = 0;

		sceCtrlReadBufferPositive(&pad, 1);

		if (pad.Buttons & PSP_CTRL_START)
		{
			start_usb();
			printf("Usb started.\n");
			keyprocessed = 1;
		}
		else if (pad.Buttons & PSP_CTRL_TRIANGLE)
		{
			if (copy_file("ms0:/index.dat", "flash0:/vsh/etc/index.dat") < 0)
				printf("Cannot copy file. (file missing?).\n");
			else
				printf("File copied succesfully.\n");

			keyprocessed = 1;
		}
		else if (pad.Buttons & PSP_CTRL_CROSS)
		{
			struct SceKernelLoadExecParam param;

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

			param.size = sizeof(param);
			param.args = strlen(PROGRAM)+1;
			param.argp = PROGRAM;
			param.key = "updater";

			printf("Starting program...\n");
			sceKernelLoadExec(PROGRAM, &param);

			keyprocessed = 1;
		}
		else if (pad.Buttons & PSP_CTRL_HOME)
		{
			break;
		}

		sceKernelDelayThread((keyprocessed) ? 200000 : 50000);
	}

	sceKernelExitGame();

	return 0;
}
Ejemplo n.º 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
}