home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2003 March / VPR0303A.ISO / AIBO / MoNet / common / include / ODA.h < prev   
C/C++ Source or Header  |  2002-12-19  |  2KB  |  71 lines

  1. //
  2. // Copyright 2002 Sony Corporation 
  3. //
  4. // Permission to use, copy, modify, and redistribute this software for
  5. // non-commercial use is hereby granted.
  6. //
  7. // This software is provided "as is" without warranty of any kind,
  8. // either expressed or implied, including but not limited to the
  9. // implied warranties of fitness for a particular purpose.
  10. //
  11.  
  12. #ifndef ODA_h_DEFINED
  13. #define ODA_h_DEFINED
  14.  
  15. #include <Types.h>
  16.  
  17. typedef longword ODAMagic;
  18. const ODAMagic ODA_MAGIC_UNDEF = 0xffffffff; // UNDEFINED
  19. const ODAMagic ODA_MAGIC_OSND  = 0x444e534f; // 'OSND' 
  20. const ODAMagic ODA_MAGIC_ODAR  = 0x5241444f; // 'ODAR' 
  21. const ODAMagic ODA_MAGIC_OMTN  = 0x4e544d4f; // 'OMTN'
  22. const ODAMagic ODA_MAGIC_WAVE  = 0x45564157; // 'WAVE'
  23. const ODAMagic ODA_MAGIC_MIDI  = 0x4944494d; // 'MIDI'
  24. const ODAMagic ODA_MAGIC_LED   = 0x0044454c; // 'LED '
  25. const ODAMagic ODA_MAGIC_SYN   = 0x004e5953; // 'SYN ' 
  26.  
  27. struct ODAInfo {            // 64 bytes (total)
  28.     ODAMagic  magic;        //  4 bytes
  29.     longword  version;        //  4 bytes
  30.     longword  numFiles;     //  4 bytes
  31.     longword  entrySize;    //  4 bytes
  32.     byte      reserved[48]; // 48 bytes
  33. };
  34.  
  35. struct ODAEntry {           // 144 bytes (total)
  36.     ODAMagic  magic;        //   4 bytes
  37.     char      name[128];    // 128 bytes
  38.     longword  offset;        //   4 bytes
  39.     longword  size;         //   4 bytes
  40.     byte      reserved[4];    //   4 bytes
  41. };
  42.  
  43. struct ODATOC {
  44.     ODAInfo   info;
  45.     ODAEntry  entry[1];
  46. };
  47.  
  48. class ODA {
  49. public:
  50.     ODA();
  51.     ODA(byte* oda);
  52.     ~ODA() {}
  53.  
  54.     void Set(byte* oda);
  55.  
  56.     int Find(char* name) const;
  57.     int Find(ODAMagic magic, char* name) const;
  58.     int GetNumFiles() const;
  59.  
  60.     ODAMagic GetMagic (int index) const;
  61.     char*    GetName  (int index) const;
  62.     int      GetSize  (int index) const;
  63.     byte*    GetData  (int index) const;
  64.     int      GetOffset(int index) const;
  65.  
  66. private:
  67.     ODATOC* toc;
  68. };
  69.  
  70. #endif // ODA_h_DEFINED
  71.