1 #ifndef _MDB_H 2 #define _MDB_H 3 4 struct ocpfilehandle_t; 5 6 struct __attribute__((packed)) moduleinfostruct 7 { 8 #define MDB_USED 1 9 #define MDB_DIRTY 2 10 #define MDB_BLOCKTYPE 12 11 #define MDB_VIRTUAL 16 12 #define MDB_BIGMODULE 32 13 #define MDB_RESERVED 64 /* used to be MDB_PLAYLIST */ 14 uint8_t flags1; /* 0 */ 15 #define MDB_GENERAL 0 16 /* sorry dudes, but I upgraded the references to 32 bit */ 17 uint8_t modtype; /* 1 */ 18 uint32_t comref; /* 5 */ 19 uint32_t compref; /* 9 */ 20 uint32_t futref; /* 13 */ 21 char name[12]; /* 25 */ 22 uint32_t size; /* 29 */ 23 char modname[32]; /* 61 */ 24 uint32_t date; /* 65 */ 25 uint16_t playtime; /* 67 */ 26 uint8_t channels; /* 68 */ 27 uint8_t moduleflags; /* 69 => 70 */ 28 29 uint8_t flags2; /* 0 */ 30 #define MDB_COMPOSER 4 31 char composer[32]; /* 1 */ 32 char style[31]; /* 33 => 65 */ 33 34 uint8_t flags3; /* 0 */ 35 char unusedfill1[6]; /* 1 */ 36 #define MDB_COMMENT 8 37 char comment[63]; /* 7 => 70 */ 38 39 uint8_t flags4; /* 0 */ 40 char unusedfill2[6]; /* 1 */ 41 #define MDB_FUTURE 12 42 char dum[63]; /* 7 => 70 */ 43 }; 44 45 enum 46 { 47 mtMOD=0, mtMODd=1, mtMODt=2, mtM31=3, mtM15=6, mtM15t=7, mtWOW=8, 48 mtS3M=9, mtXM=10, mtMTM=11, mt669=12, mtULT=13, mtDMF=14, mtOKT=15, 49 mtMID=16, mtCDA=17, mtMIDd=18, mtPTM=19, mtMED=20, mtMDL=21, mtAMS=22, 50 mtINP=23, /* These three now uses a common mtDEVv instead mtDEVp=24, mtDEVs=25, mtDEVw=26, */ mtIT=27, mtWAV=28, mtVOC=29, 51 mtMPx=30, mtSID=31, mtMXM=32, mtMODf=33, mtWMA=34, mtOGG=35, mtOPL=36, 52 mtAY=37, mtFLAC=38, mtYM=39, mtSTM=40, mtHVL=41, 53 /* These two no longer makes it into the mdb mtPLS=128, mtM3U=129, */ mtANI=130, 54 55 mtDEVv=0xfe, mtUnRead=0xFF 56 }; 57 58 enum 59 { 60 mdbEvInit, mdbEvDone 61 }; 62 63 struct mdbreadinforegstruct /* this is to test a file, and give it a tag..*/ 64 { 65 int (*ReadMemInfo)(struct moduleinfostruct *m, const char *buf, size_t len); 66 int (*ReadInfo)(struct moduleinfostruct *m, struct ocpfilehandle_t *f, const char *buf, size_t len); 67 void (*Event)(int mdbEv); 68 struct mdbreadinforegstruct *next; 69 }; 70 71 #define MDBREADINFOREGSTRUCT_TAIL ,0 72 73 struct ocpfile_t; 74 75 extern const char *mdbGetModTypeString(unsigned char type); 76 extern int mdbGetModuleType(uint32_t fileref); 77 extern uint8_t mdbReadModType(const char *str); 78 extern int mdbInfoRead(uint32_t fileref); 79 extern int mdbReadMemInfo(struct moduleinfostruct *m, const char *buf, int len); 80 extern int mdbReadInfo(struct moduleinfostruct *m, struct ocpfilehandle_t *f); 81 extern int mdbWriteModuleInfo(uint32_t fileref, struct moduleinfostruct *m); 82 void mdbScan(struct ocpfile_t *file, uint32_t mdb_ref); 83 extern int mdbInit(void); 84 extern void mdbUpdate(void); 85 extern void mdbClose(void); 86 extern uint32_t mdbGetModuleReference2(const uint32_t dirdb_ref, uint32_t size); 87 extern int mdbGetModuleInfo(struct moduleinfostruct *m, uint32_t fileref); 88 89 extern void mdbRegisterReadInfo(struct mdbreadinforegstruct *r); 90 extern void mdbUnregisterReadInfo(struct mdbreadinforegstruct *r); 91 92 extern const char mdbsigv1[60]; 93 94 #endif 95