diff --git a/src/main.rs b/src/main.rs index b7c2ccd..a37326f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,9 +33,6 @@ struct DataSet { #[derive(Archive, Deserialize, Serialize, Debug, PartialEq)] #[rkyv(compare(PartialEq), derive(Debug))] struct AlbumItem { - chunk_type: [u8; 4], - end_of_chunk: u32, - total_length: u32, number_of_strings: u32, unknown: u16, album_id_for_track: u16, @@ -43,6 +40,81 @@ struct AlbumItem { unknown1: u32 } +#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)] +#[rkyv(compare(PartialEq), derive(Debug))] +struct TrackItem { + number_of_strings: u32, + unique_id: u32, + visible: u32, + filetype: u32, + type1: u8, + type2: u8, + compilation_flag: u8, + stars: u8, + last_modified_time: u32, + size: u32, + length: u32, + track_number: u32, + total_tracks: u32, + year: u32, + bitrate: u32, + sample_rate: u32, + volume: u32, + start_time: u32, + stop_time: u32, + soundcheck: u32, + play_count: u32, + play_count2: u32, + last_played_time: u32, + disc_number: u32, + total_discs: u32, + userid: u32, + date_added: u32, + bookmark_time: u32, + dbid: u64, + checked: u8, + application_rating: u8, + bpm: u16, + artwork_count: u16, + unk9: u16, + artwork_size: u32, + unk11: u32, + sample_rate2: u32, + date_released: u32, + unk14: u32, + unk15: u32, + unk16: u32, + skip_count: u32, + last_skipped: u32, + has_artwork: u8, + skip_when_shuffling: u8, + remember_playback_position: u8, + flag4: u8, + dbid2: u64, + lyrics_flag: u8, + movie_file_flag: u8, + played_mark: u8, + unk17: u8, + unk21: u32, + pregap: u32, + sample_count: u64, + unk25: u32, + postgap: u32, + unk27: u32, + media_type: u32, + season_number: u32, + episode_number: u32, + unk31: [u8; 28], + gapless_data: u32, + unk38: u32, + gapless_track_flag: u16, + gapless_album_flag: u16, + unk39_hash: [u8; 20], + unk40: [u8; 18], + album_id: u16, + mhii_link: u32 +} + enum ChunkState { Header, Data @@ -56,7 +128,7 @@ fn db(data: &[u8]) { state = match state { ChunkState::Header => { chunk_header = Some(rkyv::access::(&data[i..i+12]).unwrap()); - info!("header: {:?}", chunk_header); + //info!("header: {:?}", chunk_header); i += 12; ChunkState::Data }, @@ -70,10 +142,16 @@ fn db(data: &[u8]) { info!("val: {:?}", rkyv::access::(&data[i..i+4]).unwrap()); }, [109, 104, 105, 97] => { // mhla - + info!("AlbumList"); }, [109, 104, 108, 97] => { // mhia - info!("val: {:?}", rkyv::access::(&data[i..i+32]).unwrap()); + info!("val: {:?}", rkyv::access::(&data[i..i+20]).unwrap()); + }, + [109, 104, 108, 116] => { // mhlt + info!("TrackList"); + }, + [109, 104, 105, 116] => { // mhit + info!("val: {:?}", rkyv::access::(&data[i..]).unwrap()); } _ => return }