00001 00011 /* Copyright (C) 1998-2003 Benjamin Gerard */ 00012 00013 #ifndef _FILE68_H_ 00014 #define _FILE68_H_ 00015 00016 #include "file68/istream68.h" 00017 00018 #ifdef __cplusplus 00019 extern "C" { 00020 #endif 00021 00025 #define SC68_IDSTR "SC68 Music-file / (c) (BeN)jamin Gerard / SasHipA-Dev " 00026 00027 #define SC68_NOFILENAME "???" 00028 #define SC68_LOADADDR 0x8000 00029 #define SC68_MAX_TRACK 99 00035 #define SC68_YM 1 00036 #define SC68_STE 2 00037 #define SC68_AMIGA 4 00038 #define SC68_STECHOICE 8 00043 typedef struct 00044 { 00045 char id[4]; 00046 char size[4]; 00047 } chunk68_t; 00048 00049 00054 #define CH68_CHUNK "SC" 00056 #define CH68_BASE "68" 00057 #define CH68_FNAME "FN" 00058 #define CH68_DEFAULT "DF" 00060 #define CH68_MUSIC "MU" 00061 #define CH68_MNAME "MN" 00062 #define CH68_ANAME "AN" 00063 #define CH68_CNAME "CN" 00064 #define CH68_D0 "D0" 00065 #define CH68_AT "AT" 00066 #define CH68_TIME "TI" 00067 #define CH68_FRAME "FR" 00068 #define CH68_FRQ "FQ" 00070 #define CH68_TYP "TY" 00071 #define CH68_IMG "IM" 00072 #define CH68_REPLAY "RE" 00074 #define CH68_MDATA "DA" 00076 #define CH68_EOF "EF" 00082 typedef struct 00083 { 00084 00088 unsigned d0; 00089 unsigned a0; 00090 unsigned frq; 00091 unsigned start_ms; 00092 unsigned time_ms; 00093 unsigned frames; 00096 struct { 00097 unsigned ym:1; 00098 unsigned ste:1; 00099 unsigned amiga:1; 00100 unsigned stechoice:1; 00101 } flags; 00107 char * name; 00108 char * author; 00109 char * composer; 00110 char * replay; 00116 unsigned datasz; 00117 char *data; 00120 } music68_t; 00121 00122 00133 typedef struct 00134 { 00138 int default_six; 00139 int nb_six; 00140 unsigned time_ms; 00141 int flags; 00142 char *name; 00148 music68_t mus[SC68_MAX_TRACK]; 00149 char data[1]; 00152 } disk68_t; 00153 00158 extern const char SC68file_idstr[]; 00159 00160 00181 int SC68file_verify(istream_t * is); 00182 00187 int SC68file_verify_file(const char * fname); 00188 00194 int SC68file_verify_mem(const void * buffer, int len); 00195 00216 int SC68file_diskname(istream_t * is, char * dest, int max); 00217 00241 disk68_t * SC68file_load(istream_t * is); 00242 00247 disk68_t * SC68file_load_file(const char * fname); 00248 00254 disk68_t * SC68file_load_mem(const void * buffer, int len); 00255 00276 int SC68file_save(istream_t * os, const disk68_t * mb); 00277 00283 int SC68file_save_file(const char * fname, const disk68_t * mb); 00284 00291 int SC68file_save_mem(const char * buffer, int len, const disk68_t * mb); 00292 00295 #ifdef __cplusplus 00296 } 00297 #endif 00298 00299 #endif /* #ifndef _FILE68_H_ */