spu: simplify irq and flag handling
[pcsx_rearmed.git] / plugins / dfsound / registers.c
index 19a0a46..ac495d6 100644 (file)
@@ -168,7 +168,7 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val)
      case 14:                                          // loop?\r
        //WaitForSingleObject(s_chan[ch].hMutex,2000);        // -> no multithread fuckups\r
        s_chan[ch].pLoop=spuMemC+((unsigned long)((val<<3)&~0xf));\r
-       s_chan[ch].bIgnoreLoop=1;\r
+       //s_chan[ch].bIgnoreLoop=1;\r
        //ReleaseMutex(s_chan[ch].hMutex);                    // -> oki, on with the thread\r
        break;\r
      //------------------------------------------------//\r
@@ -191,6 +191,8 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val)
       break;\r
     //-------------------------------------------------//\r
     case H_SPUctrl:\r
+      if(!(spuCtrl & CTRL_IRQ))\r
+        spuStat&=~STAT_IRQ;\r
       spuCtrl=val;\r
       break;\r
     //-------------------------------------------------//\r
@@ -214,7 +216,7 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val)
     //-------------------------------------------------//\r
     case H_SPUirqAddr:\r
       spuIrq = val;\r
-      pSpuIrq=spuMemC+((unsigned long) val<<3);\r
+      pSpuIrq=spuMemC+(((unsigned long) val<<3)&~0xf);\r
       break;\r
     //-------------------------------------------------//\r
     case H_SPUrvolL:\r
@@ -376,7 +378,6 @@ unsigned short CALLBACK SPUreadRegister(unsigned long reg)
      case 14:                                          // get loop address\r
       {\r
        const int ch=(r>>4)-0xc0;\r
-       if(s_chan[ch].pLoop==NULL) return 0;\r
        return (unsigned short)((s_chan[ch].pLoop-spuMemC)>>3);\r
       }\r
     }\r