00001 // 00002 // Copyright 2002 Sony Corporation 00003 // 00004 // Permission to use, copy, modify, and redistribute this software for 00005 // non-commercial use is hereby granted. 00006 // 00007 // This software is provided "as is" without warranty of any kind, 00008 // either expressed or implied, including but not limited to the 00009 // implied warranties of fitness for a particular purpose. 00010 // 00011 00012 #ifndef ODA_h_DEFINED 00013 #define ODA_h_DEFINED 00014 00015 #include <Types.h> 00016 00017 typedef longword ODAMagic; 00018 const ODAMagic ODA_MAGIC_UNDEF = 0xffffffff; // UNDEFINED 00019 const ODAMagic ODA_MAGIC_OSND = 0x444e534f; // 'OSND' 00020 const ODAMagic ODA_MAGIC_ODAR = 0x5241444f; // 'ODAR' 00021 const ODAMagic ODA_MAGIC_OMTN = 0x4e544d4f; // 'OMTN' 00022 const ODAMagic ODA_MAGIC_WAVE = 0x45564157; // 'WAVE' 00023 const ODAMagic ODA_MAGIC_MIDI = 0x4944494d; // 'MIDI' 00024 const ODAMagic ODA_MAGIC_LED = 0x0044454c; // 'LED ' 00025 const ODAMagic ODA_MAGIC_SYN = 0x004e5953; // 'SYN ' 00026 00027 struct ODAInfo { // 64 bytes (total) 00028 ODAMagic magic; // 4 bytes 00029 longword version; // 4 bytes 00030 longword numFiles; // 4 bytes 00031 longword entrySize; // 4 bytes 00032 byte reserved[48]; // 48 bytes 00033 }; 00034 00035 struct ODAEntry { // 144 bytes (total) 00036 ODAMagic magic; // 4 bytes 00037 char name[128]; // 128 bytes 00038 longword offset; // 4 bytes 00039 longword size; // 4 bytes 00040 byte reserved[4]; // 4 bytes 00041 }; 00042 00043 struct ODATOC { 00044 ODAInfo info; 00045 ODAEntry entry[1]; 00046 }; 00047 00048 class ODA { 00049 public: 00050 ODA(); 00051 ODA(byte* oda); 00052 ~ODA() {} 00053 00054 void Set(byte* oda); 00055 00056 int Find(char* name) const; 00057 int Find(ODAMagic magic, char* name) const; 00058 int GetNumFiles() const; 00059 00060 ODAMagic GetMagic (int index) const; 00061 char* GetName (int index) const; 00062 int GetSize (int index) const; 00063 byte* GetData (int index) const; 00064 int GetOffset(int index) const; 00065 00066 private: 00067 ODATOC* toc; 00068 }; 00069 00070 #endif // ODA_h_DEFINED