//------------------------------------------------------------------------------ // File: cdread.c // Description: CD-ROM related routines // Copyright (C) 1997 Sony Computer Entertainment Inc., // All Rights Reserved //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // I N C L U D E S //------------------------------------------------------------------------------ #include #include "cdread.h" #include "gfx.h" //------------------------------------------------------------------------------ // S T R U C T U R E S //------------------------------------------------------------------------------ // CD file reading typedef struct cd_read_type { char *fname; // name of file to read void *addr; // pointer to nothing CdlFILE finfo; // ISO-9660 file descriptor }file_info; //------------------------------------------------------------------------------ // G L O B A L S //------------------------------------------------------------------------------ // 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}, }; //------------------------------------------------------------------------------ // Function: DataFileSearch() // Description: Retrieve file on CD-ROM // Parameters: none // Returns: void // Notes: N/A //------------------------------------------------------------------------------ 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 //------------------------------------------------------------------------------ // Function: DataFileRead() // Description: CD-ROM file reading // Parameters: none // Returns: void // Notes: N/A //------------------------------------------------------------------------------ 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 //-----------------------------------EOF----------------------------------------