drc: add a timing hack for Internal Section
[pcsx_rearmed.git] / libpcsxcore / cdrom.h
index fde7f21..2ec1054 100644 (file)
@@ -34,6 +34,10 @@ extern "C" {
 #define btoi(b)     ((b) / 16 * 10 + (b) % 16) /* BCD to u_char */
 #define itob(i)     ((i) / 10 * 16 + (i) % 10) /* u_char to BCD */
 
+#define ABS_CD(x) ((x >= 0) ? x : -x)
+#define MIN_VALUE(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
+#define MAX_VALUE(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
+
 #define MSF2SECT(m, s, f)              (((m) * 60 + (s) - 2) * 75 + (f))
 
 #define CD_FRAMESIZE_RAW               2352
@@ -51,8 +55,17 @@ typedef struct {
 
        unsigned char StatP;
 
-       unsigned char Transfer[CD_FRAMESIZE_RAW];
-       unsigned int  pad1;
+       unsigned char Transfer[DATA_SIZE];
+       struct {
+               unsigned char Track;
+               unsigned char Index;
+               unsigned char Relative[3];
+               unsigned char Absolute[3];
+       } subq;
+       unsigned char TrackChanged;
+       boolean m_locationChanged;
+       unsigned char pad1[2];
+       unsigned int  freeze_ver;
 
        unsigned char Prev[4];
        unsigned char Param[8];
@@ -65,44 +78,48 @@ typedef struct {
        unsigned char ResultReady;
        unsigned char Cmd;
        unsigned char Readed;
+       unsigned char SetlocPending;
        u32 Reading;
 
        unsigned char ResultTN[6];
        unsigned char ResultTD[4];
-       unsigned char SetSector[4];
-       unsigned char SetSectorSeek[4];
        unsigned char SetSectorPlay[4];
+       unsigned char SetSectorEnd[4];
+       unsigned char SetSector[4];
        unsigned char Track;
        boolean Play, Muted;
        int CurTrack;
        int Mode, File, Channel;
        int Reset;
-       int RErr;
+       int NoErr;
        int FirstSector;
 
        xa_decode_t Xa;
 
        int Init;
 
-       unsigned char Irq;
+       u16 Irq;
+       u8 IrqRepeated;
        u32 eCycle;
 
-       boolean Seeked;
+       u8 Seeked;
 
-       u8 LidCheck;
+       u8 DriveState;
        u8 FastForward;
        u8 FastBackward;
        u8 pad;
 
-       u8 AttenuatorLeft[2], AttenuatorRight[2];
-       u32 pad2;
+       u8 AttenuatorLeftToLeft, AttenuatorLeftToRight;
+       u8 AttenuatorRightToRight, AttenuatorRightToLeft;
+       u8 AttenuatorLeftToLeftT, AttenuatorLeftToRightT;
+       u8 AttenuatorRightToRightT, AttenuatorRightToLeftT;
 } cdrStruct;
 
 extern cdrStruct cdr;
 
-void cdrDecodedBufferInterrupt();
-
 void cdrReset();
+void cdrAttenuate(s16 *buf, int samples, int stereo);
+
 void cdrInterrupt();
 void cdrReadInterrupt();
 void cdrRepplayInterrupt();
@@ -118,7 +135,7 @@ void cdrWrite0(unsigned char rt);
 void cdrWrite1(unsigned char rt);
 void cdrWrite2(unsigned char rt);
 void cdrWrite3(unsigned char rt);
-int cdrFreeze(gzFile f, int Mode);
+int cdrFreeze(void *f, int Mode);
 
 #ifdef __cplusplus
 }