From: notaz Date: Wed, 21 Sep 2011 01:03:48 +0000 (+0300) Subject: spu: get rid of pCurr -1, pass right chans to silent handler X-Git-Tag: r10~38 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=174c454a98a71475b72958c9f76293af7d6fb502;p=pcsx_rearmed.git spu: get rid of pCurr -1, pass right chans to silent handler pCurr -1 would work weird with savestates and could screw things up in general.. --- diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index b60c1cdf..57b94222 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -81,8 +81,9 @@ static void print_cpu_usage(void) // draw 192x8 status of 24 sound channels static __attribute__((noinline)) void draw_active_chans(void) { - extern void spu_get_debug_info(int *chans_out, int *fmod_chans_out, int *noise_chans_out); // hack - int live_chans, fmod_chans, noise_chans; + extern void spu_get_debug_info(int *chans_out, int *run_chans, + int *fmod_chans_out, int *noise_chans_out); // hack + int live_chans, run_chans, fmod_chans, noise_chans; static const unsigned short colors[2] = { 0x1fe3, 0x0700 }; unsigned short *dest = (unsigned short *)pl_vout_buf + @@ -93,11 +94,11 @@ static __attribute__((noinline)) void draw_active_chans(void) if (pl_vout_bpp != 16) return; - spu_get_debug_info(&live_chans, &fmod_chans, &noise_chans); + spu_get_debug_info(&live_chans, &run_chans, &fmod_chans, &noise_chans); for (c = 0; c < 24; c++) { d = dest + c * 8; - p = !(live_chans & (1<s_chan[i],i); @@ -341,6 +342,7 @@ void LoadStateUnknown(SPUFreeze_t * pF) dwNewChannel=0; dwChannelOn=0; + dwChannelDead=0; pSpuIrq=0; for(i=0;i<0xc0;i++) diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c index 83b9e438..f6c30588 100644 --- a/plugins/dfsound/registers.c +++ b/plugins/dfsound/registers.c @@ -169,6 +169,7 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val) s_chan[ch].pLoop=spuMemC+((unsigned long)((val<<3)&~0xf)); //s_chan[ch].bIgnoreLoop=1; //ReleaseMutex(s_chan[ch].hMutex); // -> oki, on with the thread + dwChannelDead&=~(1< turn everything off dwPendingChanOff&=~(1< and done for this channel } //////////////////////////////////////////// irq check @@ -495,8 +494,11 @@ static int decode_block(int ch) start = s_chan[ch].pLoop; } - if (start - spuMemC >= 0x80000) - start = (unsigned char*)-1; + if (start - spuMemC >= 0x80000) { + // most likely wrong + start = spuMemC; + printf("ch%d oflow\n", ch); + } s_chan[ch].pCurr = start; // store values for next cycle @@ -697,7 +699,7 @@ static void *MAINThread(void *arg) { int volmult = iVolume; int ns,ns_from,ns_to; - int ch,d; + int ch,d,silentch; int bIRQReturn=0; while(!bEndThread) // until we are shutting down @@ -737,6 +739,8 @@ static void *MAINThread(void *arg) ch=lastch; ns_from=lastns; lastch=-1; // -> setup all kind of vars to continue } + silentch=~(dwChannelOn|dwNewChannel); + //--------------------------------------------------// //- main channel loop -// //--------------------------------------------------// @@ -782,9 +786,8 @@ static void *MAINThread(void *arg) if(!bIRQReturn && (spuCtrl&CTRL_IRQ)) for(ch=0;ch pSpuIrq && s_chan[ch].pLoop > pSpuIrq) continue; @@ -801,7 +804,7 @@ static void *MAINThread(void *arg) if(start == s_chan[ch].pCurr) { // looping on self - s_chan[ch].pCurr=(unsigned char *)-1; + dwChannelDead|=1<