1
0

iPodSD.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #pragma once
  2. #include <bfc/platform/types.h>
  3. #include "iPodDB.h"
  4. /* iPod shuffle Shadow Database code */
  5. // iTunesSD (iPod Shuffle) Database Classes
  6. class iTunesSD_Song;
  7. class iTunesSD2_Song;
  8. class iTunesSD1
  9. {
  10. public:
  11. iTunesSD1();
  12. ~iTunesSD1();
  13. long write(const iPod_mhlt::mhit_map_t *mhit, unsigned char * data, const unsigned long datasize);
  14. };
  15. class iTunesSD2
  16. {
  17. public:
  18. long write(const iPod_mhlt *mhit, const iPod_mhlp *playlists, unsigned char * data, const unsigned long datasize);
  19. };
  20. #define SDSONG_FILENAME_LEN 260
  21. class iTunesSD_Song
  22. {
  23. public:
  24. iTunesSD_Song(const iPod_mhit *mhit);
  25. enum FileType
  26. {
  27. MP3 = 0x01,
  28. AAC = 0x02,
  29. WAV = 0x04
  30. };
  31. enum PlayFlags
  32. {
  33. UNKNOWN = 0x000001, // Might do something special, but nothing has been observed so far
  34. BOOKMARKABLE = 0x000100, // Any song that has flag is bookmarked
  35. SHUFFLE = 0x010000 // Only songs that have this flag are available in shuffle playback mode
  36. };
  37. long write(unsigned char * data, const unsigned long datasize);
  38. void SetFilename(const wchar_t *filename);
  39. void SetStartTime(const double milliseconds) { starttime = (unsigned int)(milliseconds / 256.0); }
  40. void SetStopTime(const double milliseconds) { stoptime = (unsigned int)(milliseconds / 256.0); }
  41. void SetVolume(const int percent);
  42. // These are also only 3 byte values
  43. uint32_t size_total;
  44. uint32_t starttime;
  45. uint32_t stoptime;
  46. uint32_t volume; // -100% = 0x0, 0% = 0x64 (100), 100% = 0xc8 (200)
  47. uint32_t filetype; // 0x01 = MP3, 0x02 = AAC, 0x04 = WAV
  48. wchar_t filename[SDSONG_FILENAME_LEN + 1]; // Equal to Windows' MAX_PATH, plus the trailing NULL (261 wide chars = 522 bytes)
  49. unsigned int playflags;
  50. };
  51. class iTunesSD2_Song
  52. {
  53. public:
  54. static long write(const iPod_mhit *mhit, unsigned char * data, const unsigned long datasize);
  55. static uint32_t header_size;
  56. };
  57. class iTunesSD2_Playlist
  58. {
  59. public:
  60. static long write(const iPod_mhyp *master_playlist, const iPod_mhyp *playlist, unsigned char * data, const unsigned long datasize);
  61. };