Exemplo n.º 1
0
void ResumeInterprets(void) {
	// Master script only affected on restore game, not restore scene
	if (!TinselV2 && (rsd == &sgData)) {
		g_scheduler->killMatchingProcess(PID_MASTER_SCR, -1);
		FreeMasterInterpretContext();
	}

	for (int i = 0; i < NUM_INTERPRET; i++) {
		switch (rsd->SavedICInfo[i].GSort) {
		case GS_NONE:
			break;

		case GS_INVENTORY:
			if (rsd->SavedICInfo[i].event != POINTED) {
				RestoreProcess(&rsd->SavedICInfo[i]);
			}
			break;

		case GS_MASTER:
			// Master script only affected on restore game, not restore scene
			if (rsd == &sgData)
				RestoreMasterProcess(&rsd->SavedICInfo[i]);
			break;

		case GS_PROCESS:
			// Tinsel 2 process
			RestoreSceneProcess(&rsd->SavedICInfo[i]);
			break;

		case GS_GPROCESS:
			// Tinsel 2 Global processes only affected on restore game, not restore scene
			if (rsd == &sgData)
				RestoreGlobalProcess(&rsd->SavedICInfo[i]);
			break;

		case GS_ACTOR:
			if (TinselV2)
				RestoreProcess(&rsd->SavedICInfo[i]);
			else
				RestoreActorProcess(rsd->SavedICInfo[i].idActor, &rsd->SavedICInfo[i]);
			break;

		case GS_POLYGON:
		case GS_SCENE:
			RestoreProcess(&rsd->SavedICInfo[i]);
			break;

		default:
			warning("Unhandled GSort in ResumeInterprets");
		}
	}
}
Exemplo n.º 2
0
int main()
{
	int iRet = -1;
	int errnum = 0;
	int totalsize = 0;
	char Cmdline[1024] = {0};
	/*add by sandy on 2008-3-27, no need renice this process, because when it works, zplayer will not work.*/
	/*reduce the usb restore priority to 19*/
	/*pid_t pid;*
	*pid = getpid();*	
	*setpriority(PRIO_PROCESS, pid, 19);*/
	
	UsbInfo UsbInformation;
	InitUsbInfo(&UsbInformation);
	
	iRet = GetStorageMessage(&UsbInformation);
	if(iRet != 0){
		sendResponseErr(iRet);
		
		sprintf(Cmdline, "umount %s", UsbInformation.mountpoint);
		OpenPipe(Cmdline);
		
		return iRet;
	}
	//register_signals();
	
	ReportStatus("preparing", 0 , 0, 0);

	totalsize = PrepareRestore(&UsbInformation);
	if(totalsize < 0 ){
		sendResponseErr(totalsize);	
		
		sprintf(Cmdline, "umount %s", UsbInformation.mountpoint);
		OpenPipe(Cmdline);
		return iRet;	
	}
	
	/*because the size unit is M, if the totalsize < 1M it will be zero, so we should continue to restore*/
	if(totalsize >= 0){
		sendResponseState();
	
		iRet = RestoreProcess(UsbInformation.mountpoint, BACKUP_FILE_NAME, totalsize);
	
	}
	
	if(iRet < 0 ){
		errnum = -7;
		sendResponseErr(errnum);
	
		sprintf(Cmdline, "umount %s", UsbInformation.mountpoint);
		OpenPipe(Cmdline);
		
		return 1;	
	}
	
	sync();
	
	sprintf(Cmdline, "umount %s", UsbInformation.mountpoint);
	OpenPipe(Cmdline);
	
	ReportFinishEvt();
	
	return 0;
}