예제 #1
0
int checkUpdate(const char* TITLE_ID, int env_choose){
	if((TITLE_ID[0]=='N' && TITLE_ID[1]=='P') ||
	   (TITLE_ID[0]=='B' && TITLE_ID[1]=='L') ||
	   (TITLE_ID[0]=='B' && TITLE_ID[1]=='C') ||
	   (TITLE_ID[0]=='X' && TITLE_ID[1]=='C') ||
	   (TITLE_ID[0]=='U' && TITLE_ID[1]=='L') ||
	   (TITLE_ID[0]=='M' && TITLE_ID[1]=='R')){

		const char *env[3] = {"np","sp-int","prod-qa"};
		int size = strlen(TITLE_ID)*2+49+strlen(env[env_choose])*2;
		char *xml_url = (char*) malloc(size);

		snprintf(xml_url,size,"https://a0.ww.%s.dl.playstation.net/tpl/%s/%s/%s-ver.xml",env[env_choose],env[env_choose],TITLE_ID,TITLE_ID);
		download_game_update(xml_url,CACHE_PATH2"/game-update.xml", progress, NULL);
		free((void*)xml_url);
	
		size = get_size(CACHE_PATH2"/game-update.xml");
		if(size == 16 || size == 241 || size == 0){ //Update not found
			file_delete(CACHE_PATH2"/game-update.xml");
			return 0;
		}
	
		if(get_download_status()==DOWNLOAD_FAILED){
			file_delete(CACHE_PATH2"/game-update.xml");
			return 0;
		}
		file_delete(CACHE_PATH2"/game-update.xml");
		return 1;
	}else 
		return 0;
}
예제 #2
0
int main(int argc, char *argv[]){
	/*
	 * Here i need to get the TV resolution
	 */
	ecore_psl1ght_optimal_screen_resolution_get(&REAL_WIDTH, &REAL_HEIGHT);
	
	if(REAL_HEIGHT > 720){
		REAL_WIDTH  = 1280;
		REAL_HEIGHT = 720;
	}
	
	init_core(&core, REAL_WIDTH, REAL_HEIGHT, "Playstation Channel");
	edje_start();
	init_core_file();
	
	Cursor_Y[0] = 0.25972*REAL_HEIGHT;
	Cursor_Y[1] = 0.5445 *REAL_HEIGHT;
	
	Cursor_X[0] = 0.1*REAL_WIDTH;		// APPS      (APP 1) || MEDIA     (APP 4)
	Cursor_X[1] = 0.37421875*REAL_WIDTH;	// BMANAGERS (APP 2) || RETRO     (APP 5)
	Cursor_X[2] = 0.65*REAL_WIDTH;		// GAMES     (APP 3) || OPTIONS   (APP 6)


	
	load_edj_from_file(&core, &info, PSC_INFO_SCREEN_PATH, "information", REAL_WIDTH, REAL_HEIGHT);
	load_edj_from_file(&core, &menu[0], PSC_OPTION_MENU_PATH, "menu", REAL_WIDTH, REAL_HEIGHT); //OPTIONS
	load_edj_from_file(&core, &menu[1], PSC_SUB_MENU_PATH, "menu", REAL_WIDTH, REAL_HEIGHT);    //SUB MENU

	main_layer = evas_object_rectangle_add(get_main_object(&core));
	evas_object_resize(main_layer, REAL_WIDTH, REAL_HEIGHT);
	evas_object_color_set(main_layer, 0, 0, 0, 0);
	evas_object_show(main_layer);

	ecore_evas_object_associate(core.ee_core, main_layer, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
	override_text(&info, "information_download", " ");
	draw_edj(&info, 0, 0);

//-----------------------------------------------------------------------------------------------------

	dir_make(CACHE_PATH);
	if(file_exist(CACHE_PATH"/files.zip"))
		file_delete(CACHE_PATH"/files.zip");

	{
		char url[20];
		sprintf(url,"%s",MAINURL);
//		if(!ecore_file_download(url,CACHE_PATH"/files.zip", download_main_is_finished, download_main_func, NULL, NULL))
		download_file(url,CACHE_PATH"/files.zip", download_main_func_curl, download_main_is_finished);
		if(get_download_status()==DOWNLOAD_FAILED)
			goto end;
	}
	LoadStrings(PSC_MAIN_MENU_LANG_PATH, Categories_Names, 6);
	{
		string XML_files[5];
		LoadMainStringsFromXML(CACHE_PATH"/files.xml",XML_files);
		for(int i=0;i<5;i++){
			char tmp_char[250];
			sprintf(tmp_char,"%s/%s",CACHE_PATH,XML_files[i].c_str());
			LoadStringsFromXML(tmp_char,&Apps[i]);
			Applications[i].Image = new EFL_Image [Apps[i].n_elem];
			Applications[i].x = new int [Apps[i].n_elem];
			Applications[i].y = new int [Apps[i].n_elem];
			for(int j=0, k=0, h=0;j<Apps[i].n_elem;j++,(k>1) ? h=!h : h=h,(k>1) ? k=0 : k++ ){
				sprintf(tmp_char,"%s/%s",CACHE_PATH,Apps[i].img_file[j].c_str());
				create_image_obj(&core, &Applications[i].Image[j], tmp_char, REAL_WIDTH*0.25, REAL_HEIGHT*0.246);
				Applications[i].x[j] = Cursor_X[k];
				Applications[i].y[j] = Cursor_Y[h];
				draw_image(&Applications[i].Image[j], Applications[i].x[j], Applications[i].y[j]);
				hide_obj(Applications[i].Image[j].obj);
			}
		}
	}
//-----------------------------------------------------------------------------------------------------
	load_edj_from_file(&core, &menu[2], PSC_MAIN_MENU_PATH, "menu", REAL_WIDTH, REAL_HEIGHT);                                 //MAIN MENU
	load_edj_from_file(&core, &bar, PSC_MAIN_MENU_BAR_PATH, "main_menu_bar", REAL_WIDTH*0.25, REAL_HEIGHT*0.246);             //(Main/Sub) Menu bar
	load_edj_from_file(&core, &download, PSC_DOWNLOAD_MASK_PATH, "download_mask", REAL_WIDTH*0.3125, REAL_HEIGHT*0.3055);     //DOWNLOAD MENU

	override_text(&menu[2], "error_text", "");

	down = evas_object_rectangle_add(get_main_object(&core));
	evas_object_move(down, (REAL_WIDTH-(REAL_WIDTH*0.3125))/2 +REAL_WIDTH*0.03125,REAL_HEIGHT*0.08861 +(REAL_HEIGHT-(REAL_HEIGHT*0.3055))/2);
	Bar_X_Val = REAL_WIDTH*0.25;
	Bar_Y_Val = REAL_HEIGHT*0.058;
	evas_object_resize(down, 1, Bar_Y_Val);
	evas_object_color_set(down, 0, 0, 255, 255); //blue
	hide_obj(down);
	load_edj_from_file(&core, &download_perc, PSC_DOWNLOADPERC_MASK_PATH, "download_perc", REAL_WIDTH*0.3125, REAL_HEIGHT*0.3055);    //DOWNLOAD MENU
	load_edj_from_file(&core, &download_ask, PSC_DOWNLOAD_MASK_PATH, "download_mask_ask", REAL_WIDTH*0.3125, REAL_HEIGHT*0.3055);     //DOWNLOAD MENU ASK XMB

	ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, on_exit_handler, NULL);
	information_timer = ecore_timer_add(PSC_INFO_SCREEN_TIMER, delete_info, NULL);
	enable_callback(&core, main_layer, EVAS_CALLBACK_KEY_DOWN , user_menu_handler);
	
	override_text(&menu[0], "ps3_version_edit", get_ps3_version());
	char space [100];

	if(get_ps3_free_space()>1000000000)
		sprintf(space,"%ld/%ld Gigabytes",get_ps3_free_space()/1000000000,get_ps3_total_space()/1000000000);
	else if(get_ps3_free_space()>1000000)
		sprintf(space,"%ld/%ld Megabytes",get_ps3_free_space()/1000000,get_ps3_total_space()/1000000);
	else if(get_ps3_free_space()>1000)
		sprintf(space,"%ld/%ld Kilobytes",get_ps3_free_space()/1000,get_ps3_total_space()/1000);
	else
		sprintf(space,"%ld/%ld Bytes",get_ps3_free_space(),get_ps3_total_space());

	override_text(&menu[0], "ps3_hdd_free_space_edit", space);
#ifdef PSCHANNEL_VERSION
	sprintf(space,"%f",PSCHANNEL_VERSION);
	override_text(&menu[0], "software_version", space);
#else
	override_text(&menu[0], "software_version", " ");
#endif
	if(sysModuleIsLoaded(SYSMODULE_NET))
		override_text(&menu[2], "error_text", "SYSMODULE_NET NOT LOADED!!");



	start_core_loop();
	disable_callback(main_layer,EVAS_CALLBACK_KEY_DOWN, user_menu_handler);
	
end:
	dir_recursive_delete(CACHE_PATH);

	for(int i=0;i<3;i++)
		delete_edj(&menu[i]);
	for(int i=0;i<5;i++)
		for(int j=0;j<Apps[i].n_elem;j++)
			delete_obj(Applications[i].Image[j].obj);
	delete_edj(&bar);
	delete_edj(&download);
	delete_edj(&download_perc);
	delete_obj(down);


	edje_stop();
	stop_core_file();
	ecore_psl1ght_shutdown();
//	stop_core(&core);  not needed on ps3.

	if(pkg_is_installed)
		reboot_sys();
	

	return 0;
}
예제 #3
0
static void user_menu_handler(void *data, Evas *e, Evas_Object *obj, void *event){
	Evas_Event_Key_Down *ev = (Evas_Event_Key_Down*) event;

//	if (strcmp (ev->keyname, "f") == 0)
//		ecore_evas_fullscreen_set (core.ee_core, !ecore_evas_fullscreen_get (core.ee_core));
//	else


	if (strcmp (ev->keyname, "Start") == 0){
		if(!is_download && !is_downloading && get_download_status()!=IS_DOWNLOADING)
			ecore_main_loop_quit();
	}else if (strcmp (ev->keyname, "Circle") == 0){
		if(is_main_menu);
		else if(is_asking_exit_to_xmb){
			is_asking_exit_to_xmb = false;
			is_abort = false;
			hide_edj(&download_ask);
		}else if(is_download){
			is_download = false;
			hide_obj(down);
			hide_edj(&download_perc);
			hide_edj(&download);
		}else if(is_downloading){
			is_abort = true;
	//		ecore_file_download_abort_all();
		}else if(!is_downloading && get_download_status()!=IS_DOWNLOADING){
			for(int i=0;i<Apps[category].n_elem && category !=5;i++)
				hide_obj(Applications[category].Image[i].obj);
			is_main_menu = true;
			is_drawn = category = x = y = 0;
			show_edj(&menu[0]);
			show_edj(&menu[1]);
			show_edj(&menu[2]);
			show_edj(&bar);
			app=0;
			override_text(&bar, "app_type_text", "");
			override_text(&bar, "app_version_text", "");
		}else{
			is_downloading = false;
			is_download = false;
			evas_object_resize(down, 1, Bar_Y_Val);
		}
	}else if (strcmp (ev->keyname, "Left") == 0 && !is_download) 
		x--;
	else if (strcmp (ev->keyname, "Right") == 0 && !is_download)
		x++;
	else if (strcmp (ev->keyname, "Up") == 0 && !is_download){
		if(!y)
			app-=6;
		y=!y;
	}else if (strcmp (ev->keyname, "Down") == 0 && !is_download){
		if(y)
			app+=6;
		y=!y;
	}else if (strcmp (ev->keyname, "Cross") == 0 && !is_download){
		if(is_main_menu){
			category = y*3+x;
			app = x = y = 0;
			is_drawn = 2;
			hide_edj(&menu[2]); //main menu
			if(category==5)
				hide_edj(&menu[1]); // sub menu
		}else if(is_asking_exit_to_xmb){
			is_asking_exit_to_xmb = false;
			ecore_main_loop_quit();
		}else if(app+(y*3+x) < Apps[category].n_elem){
			override_text(&download, "d_name_text", Apps[category].name[app+(y*3+x)].c_str());
			override_text(&download_perc, "d_perc_text", " ");
/*
		// uncomment this only if you have in the xml the file size (you need to edit also application.h and .cpp
			char dst[100];
			if(Apps[category].file_size[app+(y*3+x)]>1000000000)
				sprintf(dst,"%.2f Gb",1.*Apps[category].file_size[app+(y*3+x)]/1000000000);
			else if(Apps[category].file_size[app+(y*3+x)]>1000000)
				sprintf(dst,"%.2f Mb",1.*Apps[category].file_size[app+(y*3+x)]/1000000);
			else if(Apps[category].file_size[app+(y*3+x)]>1000)
				sprintf(dst,"%.2f Kb",1.*Apps[category].file_size[app+(y*3+x)]/1000);
			else
				sprintf(dst,"%d Bytes",1.*Apps[category].file_size[app+(y*3+x)]);
			override_text(&download_perc, "d_perc_text", dst);

*/
			show_edj(&download);
			show_edj(&download_perc);
			show_obj(down);
			is_download = true;
		}
		is_main_menu = false;
	}else if (strcmp (ev->keyname, "Cross") == 0 && is_download && !is_downloading){
		override_text(&download, "d_name_text", Apps[category].name[app+(y*3+x)].c_str());
		int ret = 7;
		show_obj(down);
		show_edj(&download);
		show_edj(&download_perc);
		download_status = 0;
		char dst[100];
		sprintf(dst,"%s/%s",CACHE_PATH,Apps[category].pkg_file[app+(y*3+x)].c_str());
		if(file_exist(dst))
			file_delete(dst);
		download_file(Apps[category].link[app+(y*3+x)].c_str(), dst, download_func_curl, download_is_finished);
//		ecore_file_download(Apps[category].link[app+(y*3+x)].c_str(), dst, download_is_finished, download_func, NULL, NULL);
	 	
	}
	
	if(x<0)
		x = 2;
	else if(x>2)
		x = 0;
	if(app<0)
		app=0;

	if(category != 5){
		if(is_main_menu)
			override_text(&bar, "menu_text", Categories_Names[y*3+x].c_str());
		else{
			if(app > Apps[category].n_elem-1)
				app -=6;
			override_text(&bar, "menu_text", (app+(y*3+x) < Apps[category].n_elem) ? (Apps[category].name[app+(y*3+x)].c_str()) : "" );
			override_text(&bar, "app_version_text", (app+(y*3+x) < Apps[category].n_elem) ? (Apps[category].version[app+(y*3+x)].c_str()) : "" );
			char page[20];
			sprintf(page,"%d/%d",app+(y*3+x)+1,Apps[category].n_elem);
			override_text(&menu[1], "page_of", page);
			switch(Apps[category].type_file[app+(y*3+x)]){
			 		case PSC_PACKAGE:
						override_text(&bar, "app_type_text", "Package");
			 			break;
			 		case PSC_THEME:
						override_text(&bar, "app_type_text", "Theme");
			 			break;
			 		case PSC_IMAGE:
						override_text(&bar, "app_type_text", "Image");
			 			break;
			 		case PSC_VIDEO:
						override_text(&bar, "app_type_text", "Video");
			 			break;
			 		case PSC_NO_TYPE:
						override_text(&bar, "app_type_text", " ");
			 			break;
			 		default:
						override_text(&bar, "app_type_text", " ");
			 			break;
			}
			for(int i=0;i<Apps[category].n_elem;i++)
				hide_obj(Applications[category].Image[i].obj);
			for(int i=0;i<6 && i+app < Apps[category].n_elem;i++)
				show_obj(Applications[category].Image[app+i].obj);
		}
		move_edj(&bar, Cursor_X[x], Cursor_Y[y]);
	}else{
		hide_edj(&bar);
	}
}
예제 #4
0
int updateFinder(const char* TITLE_ID, int env_choose, PSN_Update* game){
	const char *env[3] = {"np","sp-int","prod-qa"};
	int size = strlen(TITLE_ID)*2+49+strlen(env[env_choose])*2;
	char *xml_url = (char*) malloc(size);

	snprintf(xml_url,size,"https://a0.ww.%s.dl.playstation.net/tpl/%s/%s/%s-ver.xml",env[env_choose],env[env_choose],TITLE_ID,TITLE_ID);
	download_game_update(xml_url,CACHE_PATH2"/game-update.xml", progress, NULL);
	free((void*)xml_url);
	
	size = get_size(CACHE_PATH2"/game-update.xml");
	if(size == 16 || size == 241 || size == 0){ //Update not found
		file_delete(CACHE_PATH2"/game-update.xml");
		return 0;
	}
	
	if(get_download_status()==DOWNLOAD_FAILED){
		file_delete(CACHE_PATH2"/game-update.xml");
		return 0;
	}
	
	
	IrrXMLReader* xml = createIrrXMLReader(CACHE_PATH2"/game-update.xml");
	int i=-1;
	PSN_Update game_tmp;
	game_tmp.version = new string  [10];
	game_tmp.link    = new string  [10];
	game_tmp.size    = new uint32_t[10];
	game_tmp.min_ver = new float   [10];
	game_tmp.pkgs	 = 0;
	while(xml && xml->read() && i<10){
		//printf("debug: %s\n", xml->getNodeData());
 		switch(xml->getNodeType())
		{
			case EXN_NONE:
				break;
			case EXN_ELEMENT:
			{
				if (!strcmp("package", xml->getNodeName())){
					++i;
					char tmp[10];
					game_tmp.version[i] = xml->getAttributeValue("version");
					game_tmp.size[i]    = xml->getAttributeValueAsInt("size");
					game_tmp.link[i]    = xml->getAttributeValue("url");
					game_tmp.min_ver[i] = xml->getAttributeValueAsFloat("ps3_system_ver");
					game_tmp.pkgs++;
					break;
				}else if (!strcmp("TITLE", xml->getNodeName())){
					xml->read();
					game_tmp.name = xml->getNodeData();
					break;
				}
			}
			case EXN_ELEMENT_END:
				break;
			case EXN_TEXT:
				break;
			case EXN_COMMENT:
				break;
			case EXN_CDATA:
				break;
			case EXN_UNKNOWN:
				break;
		}
	}
	delete xml;
	game->name    = game_tmp.name.c_str();
	game->version = new string  [game_tmp.pkgs];
	game->link    = new string  [game_tmp.pkgs];
	game->size    = new uint32_t[game_tmp.pkgs];
	game->min_ver = new float   [game_tmp.pkgs];
	game->pkgs    = game_tmp.pkgs;
	for(u8 j=0; j<game_tmp.pkgs; ++j){
		game->version[j] = game_tmp.version[j];
		game->link[j]    = game_tmp.link[j];
		game->size[j]    = game_tmp.size[j];
		game->min_ver[j] = game_tmp.min_ver[j];
	}
	
	delete [] game_tmp.version;
	delete [] game_tmp.link;
	delete [] game_tmp.size;
	
	file_delete(CACHE_PATH2"/game-update.xml");
	return 1;
}