X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fdfsound%2Fdma.c;h=ada007f01d9ded25d2fc9f12732a40523ec0fe61;hb=3c7a8977ddbdbfb4a8840a487fadade29bd939d6;hp=eb85a7316d31b8eb55c0e3b272aa4e32c263a5f3;hpb=4d66d894c6563cbfb78fe8ccc0b374809fc44b0d;p=pcsx_rearmed.git diff --git a/plugins/dfsound/dma.c b/plugins/dfsound/dma.c index eb85a731..ada007f0 100644 --- a/plugins/dfsound/dma.c +++ b/plugins/dfsound/dma.c @@ -22,18 +22,13 @@ #include "externals.h" #include "registers.h" -//////////////////////////////////////////////////////////////////////// -// READ DMA (one value) -//////////////////////////////////////////////////////////////////////// - -unsigned short CALLBACK SPUreadDMA(void) +static void set_dma_end(int iSize, unsigned int cycles) { - unsigned short s = *(unsigned short *)(spu.spuMemC + spu.spuAddr); - check_irq_io(spu.spuAddr); - spu.spuAddr += 2; - spu.spuAddr &= 0x7fffe; - - return s; + // this must be > psxdma.c dma irq + // Road Rash also wants a considerable delay, maybe because of fifo? + cycles += iSize * 20; // maybe + cycles |= 1; // indicates dma is active + spu.cycles_dma_end = cycles; } //////////////////////////////////////////////////////////////////////// @@ -58,24 +53,7 @@ void CALLBACK SPUreadDMAMem(unsigned short *pusPSXMem, int iSize, if (irq && (spu.spuCtrl & CTRL_IRQ)) log_unhandled("rdma spu irq: %x/%x+%x\n", irq_addr, spu.spuAddr, iSize * 2); spu.spuAddr = addr; -} - -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////// -// WRITE DMA (one value) -//////////////////////////////////////////////////////////////////////// - -void CALLBACK SPUwriteDMA(unsigned short val) -{ - *(unsigned short *)(spu.spuMemC + spu.spuAddr) = val; - - check_irq_io(spu.spuAddr); - spu.spuAddr += 2; - spu.spuAddr &= 0x7fffe; - spu.bMemDirty = 1; + set_dma_end(iSize, cycles); } //////////////////////////////////////////////////////////////////////// @@ -110,6 +88,7 @@ void CALLBACK SPUwriteDMAMem(unsigned short *pusPSXMem, int iSize, if (irq && (spu.spuCtrl & CTRL_IRQ)) // unhandled because need to implement delay log_unhandled("wdma spu irq: %x/%x+%x\n", irq_addr, spu.spuAddr, iSize * 2); spu.spuAddr = addr; + set_dma_end(iSize, cycles); } ////////////////////////////////////////////////////////////////////////