/*********************************** Sandstorm CDREAD.C ************************************/ /**** INCLUDES ****/ #include #include "main.h" #include "graphics.h" #include "pad.h" #include "control.h" #include "debug.h" #include "sprite.h" #include "collide.h" #include "fire.h" #include "ai.h" #include "cdread.h" #include "sound.h" /**** NOTE ****/ // Source taken from George Bain's Starfighter game // See www.netyaroze-europe.com/~gbain for more info /**** STRUCTURES ****/ typedef struct cd_read_type { char *fname; //file name to read void *addr; //pointer to nothing CdlFILE finfo; //ISO-9660 file descriptor } file_info; /**** GLOBALS ****/// array to hold standard sound source data files and SEQ file file_info dfile[DFILE] = { {"\\DATA\\SOUND\\STD0.VH;1", (void *)VH_ADDR, 0}, {"\\DATA\\SOUND\\STD0.VB;1", (void *)VB_ADDR, 0}, }; /**** DATAFILESEARCH ****/ //retrieve file from CD-ROM void DataFileSearch( void ) { int count, count1; // loop vars for ( count= 0; count< DFILE; count++ ) { for ( count1= 0; count1< 10; count1++ ) // retry loop { if ( CdSearchFile( &(dfile[count].finfo), dfile[count].fname ) != 0) break; // file found else printf("ERROR: File %s not found.\n", dfile[count].fname); }// end count1 }// end count }// end DataFileSearch /**** DATAFILEREAD ****/ //CD-ROM file reading void DataFileRead( void ) { int count, count1, count2= 0; // loop vars for ( count= 0; count< DFILE; count++ ) { for ( count1= 0; count1< 10; count1++ ) // retry loop { CdReadFile(dfile[count].fname, dfile[count].addr, dfile[count].finfo.size); while ( (count2 = CdReadSync(1,0)) > 0 ) VSync(0); // wait for vertical sync for time adjustment if ( count2 ==0 ) break; // retry loop interruption on normal termination }// end count1 }// end count }// end DataFileRead