blargg_err_t track_info_( track_info_t* out, int ) const { get_vgm_length( h, out ); if ( gd3.size() ) parse_gd3( gd3.begin(), gd3.end(), out ); return 0; }
blargg_err_t load_( Data_Reader& in ) { int file_size = in.remain(); if ( file_size <= h.size_min ) return blargg_err_file_type; RETURN_ERR( in.read( &h, h.size_min ) ); if ( !h.valid_tag() ) return blargg_err_file_type; if ( h.size() > h.size_min ) RETURN_ERR( in.read( &h.rf5c68_rate, h.size() - h.size_min ) ); h.cleanup(); int data_offset = get_le32( h.data_offset ) + offsetof( Vgm_Core::header_t, data_offset ); int data_size = file_size - offsetof( Vgm_Core::header_t, data_offset ) - data_offset; int gd3_offset = get_le32( h.gd3_offset ); if ( gd3_offset > 0 ) gd3_offset += offsetof( Vgm_Core::header_t, gd3_offset ); int amount_to_skip = gd3_offset - h.size(); if ( gd3_offset > 0 && gd3_offset > data_offset ) { data_size = gd3_offset - data_offset; amount_to_skip = 0; RETURN_ERR( data.resize( data_size ) ); RETURN_ERR( in.skip( data_offset - h.size() ) ); RETURN_ERR( in.read( data.begin(), data_size ) ); } int remain = file_size - gd3_offset; byte gd3_h [gd3_header_size]; if ( gd3_offset > 0 && remain >= gd3_header_size ) { RETURN_ERR( in.skip( amount_to_skip ) ); RETURN_ERR( in.read( gd3_h, sizeof gd3_h ) ); int gd3_size = check_gd3_header( gd3_h, remain ); if ( gd3_size ) { RETURN_ERR( gd3.resize( gd3_size ) ); RETURN_ERR( in.read( gd3.begin(), gd3.size() ) ); } if ( data_offset > gd3_offset ) { RETURN_ERR( data.resize( data_size ) ); RETURN_ERR( in.skip( data_offset - gd3_offset - sizeof gd3_h - gd3.size() ) ); RETURN_ERR( in.read( data.begin(), data.end() - data.begin() ) ); } } return (blargg_err_t)blargg_ok; }
blargg_err_t load_( Data_Reader& in ) { int file_size = in.remain(); if ( file_size < Sfm_Emu::sfm_min_file_size ) return blargg_err_file_type; RETURN_ERR( data.resize( file_size ) ); RETURN_ERR( in.read( data.begin(), data.end() - data.begin() ) ); RETURN_ERR( check_sfm_header( data.begin() ) ); int metadata_size = get_le32( data.begin() + 4 ); byte temp = data[ 8 + metadata_size ]; data[ 8 + metadata_size ] = '\0'; metadata.parseDocument( (const char *)data.begin() + 8 ); data[ 8 + metadata_size ] = temp; return blargg_ok; }
blargg_err_t hash_( Hash_Function& out ) const { hash_vgm_file( h, data.begin(), data.end() - data.begin(), out ); return (blargg_err_t)blargg_ok; }
blargg_err_t hash_( Hash_Function& out ) const { hash_sfm_file( data.begin(), data.end() - data.begin(), out ); return blargg_ok; }