Create Xref-Html Frames                    Remove All Frames
file:/home/jivera/wd/pcsx/Dreamcast/PlugCD.h        (Tue Nov 25 22:46:14 2003 )


   1: #ifndef _PLUGCD_H_
   2: #define _PLUGCD_H_
   3: 
   4: #include <stdio.h>
   5: 
   6: #define CHAR_LEN 256
   7: 
   8: // 2352 is a sector size, so cache is 50 sectors
   9: #define BUFFER_SECTORS 50
  10: #define BUFFER_SIZE BUFFER_SECTORS*2352
  11: #define BZIP_BUFFER_SECTORS 10
  12: 
  13: //  74 minutes * 60 sex/min * 75 frames/sec * 96 bytes needed per frame
  14: #define TOTAL_CD_LENGTH 74*60*75
  15: #define BYTES_PER_SUBCHANNEL_FRAME 96
  16: #define MAX_SUBCHANNEL_DATA TOTAL_CD_LENGTH*BYTES_PER_SUBCHANNEL_FRAME
  17: 
  18: typedef struct {
  19:         char    dn[128];
  20:         char    fn[128];
  21: } cd_conf;
  22: 
  23: cd_conf CDConfiguration;
  24: 
  25: int rc;
  26: 
  27: enum TrackType
  28: {
  29:    unknown, Mode1, Mode2, Audio, Pregap = 0x80
  30: };
  31: 
  32: enum CDType
  33: {
  34:    unk, Bin, Cue, Rar, IndexBZ, IndexZ, SBI, M3S
  35: };
  36: 
  37: typedef struct
  38: {
  39:    enum TrackType type;
  40:    char num;
  41:    unsigned char start[3];
  42:    unsigned char end[3];
  43: } Track;
  44: 
  45: struct
  46: {   
  47:    FILE* cd;
  48:    FILE* cdda;
  49:    int numtracks;
  50:    long bufferPos;
  51:    long sector;
  52:    Track* tl;
  53:    unsigned char buffer[BUFFER_SIZE];
  54:    enum CDType type;
  55: } CD;
  56: 
  57: void CDDAclose(void);
  58: 
  59: // function headers for cdreader.c
  60: void openCue(const char* filename);
  61: void openBin(const char* filename);
  62: void openIso(const char* filename);
  63: char getNumTracks();
  64: void seekSector(const unsigned char m, const unsigned char s, const unsigned char f);
  65: unsigned char* getSector();
  66: void newCD(const char * filename);
  67: void readit(const unsigned char m, const unsigned char s, const unsigned char f);
  68: 
  69: 
  70: // subtracts two times in integer format (non-BCD) ->  l - r = a
  71: #define sub(l, r, a)\
  72:    a[1] = 0;\
  73:    a[0] = 0;\
  74:    a[2] = l[2] - r[2];\
  75:    if ((char)a[2] < 0)\
  76:    {\
  77:       a[2] += 75;\
  78:       a[1] -= 1;\
  79:    }\
  80:    a[1] += l[1] - r[1];\
  81:    if ((char)a[1] < 0)\
  82:    {\
  83:       a[1] += 60;\
  84:       a[0] -= 1;\
  85:    }\
  86:    a[0] += l[0] - r[0];\
  87: 
  88: // converts a time like 17:61:00  to 18:01:00
  89: #define normalizeTime(c)\
  90:    while(c[2] > 75)\
  91:    {\
  92:       c[2] -= 75;\
  93:       c[1] += 1;\
  94:    }\
  95:    while(c[1] > 60)\
  96:    {\
  97:       c[1] -= 60;\
  98:       c[0] += 1;\
  99:    }
 100: 
 101: // converts uchar in c to BCD character
 102: #define intToBCD(c) (unsigned char)((c%10) | ((c/10)<<4))
 103: 
 104: // converts BCD number in c to uchar
 105: #define BCDToInt(c) (unsigned char)((c & 0x0F) + 10 * ((c & 0xF0) >> 4))
 106: 
 107: #endif
 108: 
 109: /* arch-tag: Matthew Dempsky Wed Oct 15 10:34:19 CST 2003 (Dreamcast/PlugCD.h)
 110:  */
 111: 








































Html form generated by Xrefactory version 1.6.4 on Fri Dec 12 20:52:56 2003
Trial version.