X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fdfsound%2Ffreeze.c;h=51e9fd77582436cf78c92db10aecc3d853f41160;hb=1d5d35bc9d0d3d84873cd1d31870d09248ddc05b;hp=5b4267bfad8b9ecd62bfc4ce58454078dda61a7d;hpb=de4a0279efefdd2e4595c8fc27f1564f4bff9341;p=pcsx_rearmed.git diff --git a/plugins/dfsound/freeze.c b/plugins/dfsound/freeze.c index 5b4267bf..51e9fd77 100644 --- a/plugins/dfsound/freeze.c +++ b/plugins/dfsound/freeze.c @@ -119,6 +119,7 @@ typedef struct typedef struct { unsigned short spuIrq; + unsigned short decode_pos; uint32_t pSpuIrq; uint32_t spuAddr; uint32_t dummy1; @@ -144,10 +145,10 @@ static void save_channel(SPUCHAN_orig *d, const SPUCHAN *s, int ch) d->spos = s->spos; d->sinc = s->sinc; memcpy(d->SB, spu.SB + ch * SB_SIZE, sizeof(d->SB[0]) * SB_SIZE); - d->iStart = (regAreaGet(ch,6)&~1)<<3; + d->iStart = (regAreaGetCh(ch, 6) & ~1) << 3; d->iCurr = 0; // set by the caller d->iLoop = 0; // set by the caller - d->bOn = !!(spu.dwChannelOn & (1<bOn = !!(spu.dwChannelsAudible & (1<bStop = s->ADSRX.State == ADSR_RELEASE; d->bReverb = s->bReverb; d->iActFreq = 1; @@ -186,8 +187,8 @@ static void load_channel(SPUCHAN *d, const SPUCHAN_orig *s, int ch) d->sinc = s->sinc; d->sinc_inv = 0; memcpy(spu.SB + ch * SB_SIZE, s->SB, sizeof(spu.SB[0]) * SB_SIZE); - d->pCurr = (void *)((long)s->iCurr & 0x7fff0); - d->pLoop = (void *)((long)s->iLoop & 0x7fff0); + d->pCurr = (void *)((uintptr_t)s->iCurr & 0x7fff0); + d->pLoop = (void *)((uintptr_t)s->iLoop & 0x7fff0); d->bReverb = s->bReverb; d->iLeftVolume = s->iLeftVolume; d->iRightVolume = s->iRightVolume; @@ -208,7 +209,7 @@ static void load_channel(SPUCHAN *d, const SPUCHAN_orig *s, int ch) d->ADSRX.ReleaseModeExp = s->ADSRX.ReleaseModeExp; d->ADSRX.ReleaseRate = s->ADSRX.ReleaseRate; d->ADSRX.EnvelopeVol = s->ADSRX.EnvelopeVol; - if (s->bOn) spu.dwChannelOn |= 1<bOn) spu.dwChannelsAudible |= 1<ADSRX.EnvelopeVol = 0; } @@ -231,6 +232,8 @@ long CALLBACK SPUfreeze(uint32_t ulFreezeMode, SPUFreeze_t * pF, if(!pF) return 0; // first check + do_samples(cycles, 1); + if(ulFreezeMode) // info or save? {//--------------------------------------------------// if(ulFreezeMode==1) @@ -242,8 +245,6 @@ long CALLBACK SPUfreeze(uint32_t ulFreezeMode, SPUFreeze_t * pF, if(ulFreezeMode==2) return 1; // info mode? ok, bye // save mode: - do_samples(cycles, 1); - memcpy(pF->cSPURam,spu.spuMem,0x80000); // copy common infos memcpy(pF->cSPUPort,spu.regArea,0x200); @@ -257,10 +258,11 @@ long CALLBACK SPUfreeze(uint32_t ulFreezeMode, SPUFreeze_t * pF, pFO=(SPUOSSFreeze_t *)(pF+1); // store special stuff pFO->spuIrq = spu.regArea[(H_SPUirqAddr - 0x0c00) / 2]; - if(spu.pSpuIrq) pFO->pSpuIrq = (unsigned long)spu.pSpuIrq-(unsigned long)spu.spuMemC; + if(spu.pSpuIrq) pFO->pSpuIrq = spu.pSpuIrq - spu.spuMemC; pFO->spuAddr=spu.spuAddr; if(pFO->spuAddr==0) pFO->spuAddr=0xbaadf00d; + pFO->decode_pos = spu.decode_pos; for(i=0;icSPURam,0x80000); // get ram memcpy(spu.regArea,pF->cSPUPort,0x200); + spu.bMemDirty = 1; if(pF->xaS.nsamples<=4032) // start xa again - SPUplayADPCMchannel(&pF->xaS); + SPUplayADPCMchannel(&pF->xaS, spu.cycles_played, 0); spu.xapGlobal=0; @@ -328,16 +331,17 @@ void LoadStateV5(SPUFreeze_t * pF) if (pFO->spuAddr == 0xbaadf00d) spu.spuAddr = 0; else spu.spuAddr = pFO->spuAddr & 0x7fffe; } + spu.decode_pos = pFO->decode_pos & 0x1ff; spu.dwNewChannel=0; - spu.dwChannelOn=0; + spu.dwChannelsAudible=0; spu.dwChannelDead=0; for(i=0;is_chan[i],i); - spu.s_chan[i].pCurr+=(unsigned long)spu.spuMemC; - spu.s_chan[i].pLoop+=(unsigned long)spu.spuMemC; + spu.s_chan[i].pCurr+=(uintptr_t)spu.spuMemC; + spu.s_chan[i].pLoop+=(uintptr_t)spu.spuMemC; } } @@ -353,7 +357,7 @@ void LoadStateUnknown(SPUFreeze_t * pF, uint32_t cycles) } spu.dwNewChannel=0; - spu.dwChannelOn=0; + spu.dwChannelsAudible=0; spu.dwChannelDead=0; spu.pSpuIrq=spu.spuMemC;