aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
authornotaz2011-07-13 01:34:01 +0300
committernotaz2011-07-15 00:12:49 +0300
commit056d67598872b0bac092878972633d6c10aa0ad6 (patch)
treee3c0f42cd57e005f418300da2064c28e778cb70e /libpcsxcore
parentebe6ff2b3de3b1cd41ba685764340a1e305bc3fa (diff)
downloadpcsx_rearmed-056d67598872b0bac092878972633d6c10aa0ad6.tar.gz
pcsx_rearmed-056d67598872b0bac092878972633d6c10aa0ad6.tar.bz2
pcsx_rearmed-056d67598872b0bac092878972633d6c10aa0ad6.zip
cdrom: partially implement attenuation
based on pcsrx code.
Diffstat (limited to 'libpcsxcore')
-rw-r--r--libpcsxcore/cdrom.c33
-rw-r--r--libpcsxcore/cdrom.h3
2 files changed, 30 insertions, 6 deletions
diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c
index cc377b9..839e89e 100644
--- a/libpcsxcore/cdrom.c
+++ b/libpcsxcore/cdrom.c
@@ -1329,6 +1329,23 @@ void cdrReadInterrupt() {
int ret = xa_decode_sector(&cdr.Xa, cdr.Transfer+4, cdr.FirstSector);
if (!ret) {
+ // only handle attenuator basic channel switch for now
+ if (cdr.Xa.stereo) {
+ int i;
+ if ((cdr.AttenuatorLeft[0] | cdr.AttenuatorLeft[1])
+ && !(cdr.AttenuatorRight[0] | cdr.AttenuatorRight[1]))
+ {
+ for (i = 0; i < cdr.Xa.nsamples; i++)
+ cdr.Xa.pcm[i*2 + 1] = cdr.Xa.pcm[i*2];
+ }
+ else if (!(cdr.AttenuatorLeft[0] | cdr.AttenuatorLeft[1])
+ && (cdr.AttenuatorRight[0] | cdr.AttenuatorRight[1]))
+ {
+ for (i = 0; i < cdr.Xa.nsamples; i++)
+ cdr.Xa.pcm[i*2] = cdr.Xa.pcm[i*2 + 1];
+ }
+ }
+
SPU_playADPCMchannel(&cdr.Xa);
cdr.FirstSector = 0;
@@ -1465,7 +1482,7 @@ void cdrWrite1(unsigned char rt) {
// Tekken: CDXA fade-out
if( (cdr.Ctrl & 3) == 3 ) {
- //cdr.AttenuatorRight[0] = rt;
+ cdr.AttenuatorRight[0] = rt;
}
@@ -1817,10 +1834,10 @@ void cdrWrite2(unsigned char rt) {
// Tekken: CDXA fade-out
if( (cdr.Ctrl & 3) == 2 ) {
- //cdr.AttenuatorLeft[0] = rt;
+ cdr.AttenuatorLeft[0] = rt;
}
else if( (cdr.Ctrl & 3) == 3 ) {
- //cdr.AttenuatorRight[1] = rt;
+ cdr.AttenuatorRight[1] = rt;
}
@@ -1862,7 +1879,7 @@ void cdrWrite3(unsigned char rt) {
#ifdef CDR_LOG
CDR_LOG("cdrWrite3() Log: CD3 write: %x\n", rt);
#endif
-/*
+
// Tekken: CDXA fade-out
if( (cdr.Ctrl & 3) == 2 ) {
cdr.AttenuatorLeft[1] = rt;
@@ -1874,7 +1891,7 @@ void cdrWrite3(unsigned char rt) {
cdr.AttenuatorRight[0], cdr.AttenuatorRight[1] );
#endif
}
-*/
+
// GameShark CDX CD Player: Irq timing mania
if( rt == 0 &&
@@ -2028,6 +2045,12 @@ void cdrReset() {
cdr.CurTrack = 1;
cdr.File = 1;
cdr.Channel = 1;
+
+ // BIOS player - default values
+ cdr.AttenuatorLeft[0] = 0x80;
+ cdr.AttenuatorLeft[1] = 0x00;
+ cdr.AttenuatorRight[0] = 0x80;
+ cdr.AttenuatorRight[1] = 0x00;
}
int cdrFreeze(gzFile f, int Mode) {
diff --git a/libpcsxcore/cdrom.h b/libpcsxcore/cdrom.h
index 1f70ff3..772e3ca 100644
--- a/libpcsxcore/cdrom.h
+++ b/libpcsxcore/cdrom.h
@@ -94,7 +94,8 @@ typedef struct {
u8 FastBackward;
u8 pad;
- u32 LeftVol, RightVol;
+ u8 AttenuatorLeft[2], AttenuatorRight[2];
+ u32 pad2;
} cdrStruct;
extern cdrStruct cdr;