#include #include #define ARTISTLEN 32 #define ALBUMLEN 68 #define SONGLEN 92 #define GENRELEN 20 #define FILELEN 212 #define SONGARRAYLEN 48 #define ALBUMARRAYLEN 38 #define BE32(_x_) (((_x_ & 0xff000000) >> 24) | \ ((_x_ & 0x00ff0000) >> 8) | \ ((_x_ & 0x0000ff00) << 8) | \ ((_x_ & 0x000000ff) << 24)) #define BE16(_x_) ( ((_x_&0xff00) >> 8) | ((_x_&0xff)<<8)) struct header { int version; int artiststart; int albumstart; int songstart; int filestart; int artistcount; int albumcount; int songcount; int filecount; int artistlen; int albumlen; int songlen; int genrelen; int filelen; int songarraylen; int albumarraylen; int rundbdirty; } header; struct FileEntry { char name[FILELEN]; int hash; int tagoffset; int rundboffset; } FileEntry; struct SongEntry { char name[SONGLEN]; int artist; int album; int file; char genre[GENRELEN]; short bitrate; short year; } SongEntry; struct ArtistEntry { char name[ARTISTLEN]; int album[ALBUMARRAYLEN]; } ArtistEntry; struct AlbumEntry { char name[ALBUMLEN]; int artist; int song[SONGARRAYLEN]; } AlbumEntry; FILE *fp; void showsong(int offset) { fseek(fp,offset,SEEK_SET); fread(&SongEntry,sizeof(struct SongEntry),1,fp); SongEntry.artist=BE32(SongEntry.artist); SongEntry.album=BE32(SongEntry.album); SongEntry.file=BE32(SongEntry.file); SongEntry.year=BE16(SongEntry.year); SongEntry.bitrate=BE16(SongEntry.bitrate); printf("Offset: 0x%x\nName: %s\nArtist: 0x%x\nAlbum: 0x%x\nFile: 0x%x\nGenre: %s\nBitrate: %d\nYear: %d\n\n",offset,SongEntry.name,SongEntry.artist,SongEntry.album,SongEntry.file,SongEntry.genre,SongEntry.bitrate,SongEntry.year); } void showalbum(int offset) { int i; fseek(fp,offset,SEEK_SET); fread(&AlbumEntry,sizeof(struct AlbumEntry),1,fp); AlbumEntry.artist=BE32(AlbumEntry.artist); printf("Offset: 0x%x\nAlbum: %s\nArtist: 0x%x\n",offset,AlbumEntry.name,AlbumEntry.artist); for(i=0;i