X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fdfsound%2Fregisters.c;h=adc9c3a5466c6ba15672cbe6f0f5596a65693b2f;hb=4d66d894c6563cbfb78fe8ccc0b374809fc44b0d;hp=bb64658d7f96f4a68ed426bebc8ad969f0046b3d;hpb=210476c77ec6d0160e66ab6e9a45ad64fe5e50ce;p=pcsx_rearmed.git diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c index bb64658d..adc9c3a5 100644 --- a/plugins/dfsound/registers.c +++ b/plugins/dfsound/registers.c @@ -22,6 +22,7 @@ #include "externals.h" #include "registers.h" #include "spu_config.h" +#include "spu.h" static void SoundOn(int start,int end,unsigned short val); static void SoundOff(int start,int end,unsigned short val); @@ -112,6 +113,7 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val, //------------------------------------------------// case 14: // loop? spu.s_chan[ch].pLoop=spu.spuMemC+((val&~1)<<3); + spu.s_chan[ch].bIgnoreLoop = 1; goto upd_irq; //------------------------------------------------// } @@ -126,7 +128,7 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val, break; //-------------------------------------------------// case H_SPUdata: - *(unsigned short *)(spu.spuMemC + spu.spuAddr) = val; + *(unsigned short *)(spu.spuMemC + spu.spuAddr) = HTOLE16(val); spu.spuAddr += 2; spu.spuAddr &= 0x7fffe; break; @@ -148,6 +150,8 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val, goto rvbd; //-------------------------------------------------// case H_SPUirqAddr: + //if (val & 1) + // log_unhandled("w irq with lsb: %08lx %04x\n", reg, val); spu.pSpuIrq=spu.spuMemC+(((unsigned long) val<<3)&~0xf); goto upd_irq; //-------------------------------------------------// @@ -160,6 +164,17 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val, break; //-------------------------------------------------// + case H_SPUmvolL: + case H_SPUmvolR: + if (val & 0x8000) + log_unhandled("w master sweep: %08lx %04x\n", reg, val); + break; + + case 0x0dac: + if (val != 4) + log_unhandled("1f801dac %04x\n", val); + break; + /* case H_ExtLeft: //auxprintf("EL %d\n",val); @@ -203,12 +218,12 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val, break; //-------------------------------------------------// case H_CDLeft: - spu.iLeftXAVol=val & 0x7fff; - if(spu.cddavCallback) spu.cddavCallback(0,val); + spu.iLeftXAVol=(int16_t)val; + if(spu.cddavCallback) spu.cddavCallback(0,(int16_t)val); break; case H_CDRight: - spu.iRightXAVol=val & 0x7fff; - if(spu.cddavCallback) spu.cddavCallback(1,val); + spu.iRightXAVol=(int16_t)val; + if(spu.cddavCallback) spu.cddavCallback(1,(int16_t)val); break; //-------------------------------------------------// case H_FMod1: @@ -295,7 +310,7 @@ unsigned short CALLBACK SPUreadRegister(unsigned long reg) { const int ch=(r>>4)-0xc0; if(spu.dwNewChannel&(1<>16); @@ -315,14 +330,14 @@ unsigned short CALLBACK SPUreadRegister(unsigned long reg) return spu.spuCtrl; case H_SPUstat: - return spu.spuStat; + return (spu.spuStat & ~0x3F) | (spu.spuCtrl & 0x3F); case H_SPUaddr: return (unsigned short)(spu.spuAddr>>3); case H_SPUdata: { - unsigned short s = *(unsigned short *)(spu.spuMemC + spu.spuAddr); + unsigned short s = LE16TOH(*(unsigned short *)(spu.spuMemC + spu.spuAddr)); spu.spuAddr += 2; spu.spuAddr &= 0x7fffe; return s; @@ -334,6 +349,10 @@ unsigned short CALLBACK SPUreadRegister(unsigned long reg) //case H_SPUIsOn2: // return IsSoundOn(16,24); + case H_SPUMute1: + case H_SPUMute2: + log_unhandled("r isOn: %08lx\n", reg); + break; } return spu.regArea[(r-0xc00)>>1]; @@ -349,10 +368,9 @@ static void SoundOn(int start,int end,unsigned short val) for(ch=start;ch>=1) // loop channels { - if((val&1) && regAreaGet(ch,6)) // mmm... start has to be set before key on !?! + if((val&1) && regAreaGetCh(ch, 6)) // mmm... start has to be set before key on !?! { - spu.s_chan[ch].pCurr=spu.spuMemC+((regAreaGet(ch,6)&~1)<<3); // must be block aligned - if (spu_config.idiablofix == 0) spu.s_chan[ch].pLoop=spu.spuMemC+((regAreaGet(ch,14)&~1)<<3); + spu.s_chan[ch].bIgnoreLoop = 0; spu.dwNewChannel|=(1< sweep up? + log_unhandled("ch%d sweepl %04x\n", ch, vol); if(vol&0x2000) sInc=-1; // -> or down? if(vol&0x1000) vol^=0xffff; // -> mmm... phase inverted? have to investigate this vol=((vol&0x7f)+1)/2; // -> sweep: 0..127 -> 0..64 @@ -457,6 +476,7 @@ static void SetVolumeR(unsigned char ch,short vol) // RIGHT VOLUME if(vol&0x8000) // comments... see above :) { short sInc=1; + log_unhandled("ch%d sweepr %04x\n", ch, vol); if(vol&0x2000) sInc=-1; if(vol&0x1000) vol^=0xffff; vol=((vol&0x7f)+1)/2; @@ -484,11 +504,12 @@ static void SetPitch(int ch,unsigned short val) // SET PITCH if(val>0x3fff) NP=0x3fff; // get pitch val else NP=val; - spu.s_chan[ch].iRawPitch=NP; - spu.s_chan[ch].sinc=(NP<<4)|8; - spu.s_chan[ch].sinc_inv=0; - if (spu_config.iUseInterpolation == 1) - spu.SB[ch * SB_SIZE + 32] = 1; // -> freq change in simple interpolation mode: set flag + spu.s_chan[ch].iRawPitch = NP; + spu.s_chan[ch].sinc = NP << 4; + spu.s_chan[ch].sinc_inv = 0; + spu.s_chan[ch].bNewPitch = 1; + + // don't mess spu.dwChannelsAudible as adsr runs independently } ////////////////////////////////////////////////////////////////////////