int add_obj_scene(t_scene *scene, t_obj *obj, int n_line, t_obj *father) { if (obj->type == O_NULL && !obj->content) { warn("Object will be ignored because type is missing", n_line); delete_obj(obj); } else if (father && father->type != O_NULL) { warn("Complex object will be ignored because father have a type.", n_line); delete_obj(obj); } else if (obj->type == O_EYE && (scene->camera || father)) { warn("Eye redefined", n_line); delete_obj(obj); } else if (obj->type == O_LIGHT && father) { warn("Light will be ignored", n_line); delete_obj(obj); } else return (0); return (1); }
void destroy_hash_table(struct hash_table *tbl, void (*delete_obj)(void *)) { struct list_link *head, *next, *tmp; struct hash_entry *entry; int i; for (i = 0; i < tbl->ht_size; i++) { head = &tbl->ht_lists[i]; next = head->next; while (next != head) { tmp = next->next; entry = list_entry(next, struct hash_entry, he_list); if (delete_obj) delete_obj(entry->he_obj); free(entry); next = tmp; } } free(tbl); }
/** * Specially treats exceptions in test object destructor; * if test itself failed, exceptions in destructor * are ignored; if test was successful and destructor failed, * warning exception throwed. */ void release() { try { if (delete_obj() == false) { throw warning("destructor of test object raised" " an SEH exception"); } } catch (const std::exception& ex) { if (permit_throw_in_dtor) { std::string msg = "destructor of test object raised" " exception: "; msg += ex.what(); throw warning(msg); } } catch( ... ) { if (permit_throw_in_dtor) { throw warning("destructor of test object raised an" " exception"); } } }
/*========================================================= * destroy_array -- Delete array (releasing all elements) *=======================================================*/ void destroy_array (ARRAY array) { int i; for (i=0; i<ASize(array); ++i) { OBJECT obj = (OBJECT)AData(array)[i]; delete_obj(obj); } stdfree(AData(array)); AData(array) = 0; stdfree(array); }
void fatal_msgbox(const char* m, ...) { delete_obj(); ShowCursor(TRUE); MSG msg; while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } char st[1024]; va_list marker; va_start(marker, m); vsprintf(st, m, marker); va_end(marker); msgbox("Error::Error: %s\n", st); MessageBox(NULL, st, "Error", MB_ICONEXCLAMATION); exit(1); }
/*================================================= * clear_generic -- free any memory held *===============================================*/ void clear_generic (GENERIC *gen) { switch(gen->selector) { case GENERIC_NULL: break; case GENERIC_INT: break; case GENERIC_FLOAT: stdfree(gen->data.fval); gen->data.fval = 0; case GENERIC_STRING: stdfree(gen->data.sval); gen->data.sval = 0; break; case GENERIC_STRING_SHARED: break; case GENERIC_VPTR: break; case GENERIC_OBJECT: delete_obj(gen->data.oval); break; /* don't need to free any others */ } gen->selector = GENERIC_NULL; gen->data.oval = 0; }
/* Start a visual effect and move the party to the target. */ void TimedPartyMove::change_location() { EffectManager *effect_mgr = Game::get_game()->get_effect_manager(); SDL_Surface *mapwindow_capture = NULL; if(wait_for_effect != 1) { bool is_moongate = moongate != NULL; if(moongate&&moongate->obj_n==OBJ_U6_RED_GATE) // leave blue moongates { // get image before deleting moongate mapwindow_capture = map_window->get_sdl_surface(); // must delete moongate here because dest may be the same as target... // remove moongate before moving so the tempobj cleanup doesn't bite us Game::get_game()->get_obj_manager()->remove_obj_from_map(moongate); delete_obj(moongate); } if(is_moongate) Game::get_game()->get_player()->move(target->x, target->y, target->z, true); else party->move(target->x, target->y, target->z); party->show(); // unhide everyone Game::get_game()->get_view_manager()->update(); // we do this to update party view sun moon display if visible. if(mapwindow_capture) // could check this or moongate again { // start fade-to effect_mgr->watch_effect(this, /* call me */ new FadeEffect(FADE_PIXELATED, FADE_OUT, mapwindow_capture)); SDL_FreeSurface(mapwindow_capture); Game::get_game()->pause_anims(); wait_for_effect = 1; } } }
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; }