static gboolean bios_load_ipl( cdrom_disc_t disc, cdrom_track_t track, const char *program_name, unsigned char *buffer, gboolean unscramble ) { gboolean rv = TRUE; IsoImageFilesystem *iso = iso_filesystem_new_from_track( disc, track, NULL ); if( iso == NULL ) { ERROR( "Disc is not bootable (invalid ISO9660 filesystem)" ); return FALSE; } IsoFileSource *file = NULL; int status = iso->get_by_path(iso, program_name, &file ); if( status != 1 ) { ERROR( "Disc is not bootable (initial program '%s' not found)", program_name ); iso_filesystem_unref(iso); return FALSE; } struct stat st; if( iso_file_source_stat(file, &st) == 1 ) { if( st.st_size > (0x8D000000 - BINARY_LOAD_ADDR) ) { ERROR( "Disc is not bootable (Initial program is too large to fit into memory)" ); rv = FALSE; } else if( iso_file_source_open(file) == 1 ) { size_t len; if( unscramble ) { char *tmp = g_malloc(st.st_size); len = iso_file_source_read(file, tmp, st.st_size); bootprogram_unscramble(buffer, tmp, st.st_size); g_free(tmp); } else { len = iso_file_source_read(file, buffer, st.st_size); } if( len != st.st_size ) { ERROR( "Disc is not bootable (Unable to read initial program '%s')", program_name ); rv = FALSE; } iso_file_source_close(file); } } else { ERROR( "Disc is not bootable (Unable to get size of initial program '%s')", program_name ); rv = FALSE; } iso_file_source_unref(file); iso_filesystem_unref(iso); return rv; }
GtkTreeStore * read_cd ( char *dev,int block ) { TrackData *cd_data=main_app->cd_data; int result; IsoImageFilesystem *fs; IsoDataSource *src; IsoFileSource *root; IsoReadOpts *ropts; iso_init(); iso_set_msgs_severities ( "NEVER", "ALL", "" ); result = iso_data_source_new_from_file ( dev, &src ); if ( result < 0 ) { printf ( "Error creating data source\n" ); show_error("Error creating data source "); return NULL; } result = iso_read_opts_new ( &ropts, 0 ); iso_read_opts_set_start_block ( ropts,cd_data[ block].track_start ); if ( result < 0 ) { fprintf ( stderr, "Error creating read options\n" ); show_error("Error creating read options "); return NULL; } result = iso_image_filesystem_new ( src, ropts, 1, &fs ); iso_read_opts_free ( ropts ); if ( result < 0 ) { printf ( "Error creating filesystem\n" ); show_error("Error creating filesystem"); return NULL; } GtkListStore *store; GtkTreeIter iter; GString *string=g_string_new(""); store = gtk_list_store_new ( 2, G_TYPE_STRING ,G_TYPE_STRING ); g_string_printf(string,"%ld * 2kB",cd_data[ block].track_start); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Track Start",1,string->str,-1 ); g_string_printf(string,"%ld * 2kB",cd_data[ block].track_end); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Track End",1,string->str,-1 ); g_string_printf(string,"%ld * 2kB",cd_data[ block].track_size); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Track Size",1,string->str,-1 ); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Vol. id: ",1,iso_image_fs_get_volume_id ( fs ),-1 ); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Publisher ",1,iso_image_fs_get_publisher_id ( fs ),-1 ); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Data preparer ",1,iso_image_fs_get_data_preparer_id ( fs ),-1 ); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "System ",1,iso_image_fs_get_system_id ( fs ),-1 ); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Application ",1,iso_image_fs_get_application_id ( fs ),-1 ); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Copyright ",1,iso_image_fs_get_copyright_file_id ( fs ),-1 ); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Abstract ",1,iso_image_fs_get_abstract_file_id ( fs ),-1 ); gtk_list_store_append ( store, &iter ); gtk_list_store_set ( store, &iter, 0, "Biblio ",1,iso_image_fs_get_biblio_file_id ( fs ),-1 ); cd_data[ block].track_info=store; result = fs->get_root ( fs, &root ); if ( result < 0 ) { printf ( "Can't get root %d\n", result ); show_error("Can't get root "); return NULL; } GtkTreeIter root_iter; GtkTreeStore * tree_store ; tree_store = gtk_tree_store_new ( 1,G_TYPE_STRING ); root_iter.stamp=0; create_tree ( root, tree_store,root_iter ); iso_file_source_unref ( root ); fs->close ( fs ); iso_filesystem_unref ( ( IsoFilesystem* ) fs ); iso_data_source_unref ( src ); iso_finish(); return tree_store; }