From 502ea36eb42c455c063ce30a5ee93ddd75f839e6 Mon Sep 17 00:00:00 2001 From: gameblabla Date: Mon, 16 Aug 2021 21:03:52 +0000 Subject: [PATCH] Fixed Linked List DMA end marker. (#183) Taken from PCSX Redux project. https://github.com/grumpycoders/pcsx-redux/pull/396/commits/a6401da3a4e7b4860b0f7a7f679cf9a93e739caa --- libpcsxcore/psxdma.c | 3 ++- plugins/dfxvideo/gpu.c | 4 ++-- plugins/gpu-gles/gpuPlugin.c | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libpcsxcore/psxdma.c b/libpcsxcore/psxdma.c index 03ee5639..cb84fbcc 100644 --- a/libpcsxcore/psxdma.c +++ b/libpcsxcore/psxdma.c @@ -122,7 +122,8 @@ static u32 gpuDmaChainSize(u32 addr) { // next 32-bit pointer addr = psxMu32( addr & ~0x3 ) & 0xffffff; size += 1; - } while (addr != 0xffffff); + } while (!(addr & 0x800000)); // contrary to some documentation, the end-of-linked-list marker is not actually 0xFF'FFFF + // any pointer with bit 23 set will do. return size; } diff --git a/plugins/dfxvideo/gpu.c b/plugins/dfxvideo/gpu.c index 3d20dfa4..649cb429 100644 --- a/plugins/dfxvideo/gpu.c +++ b/plugins/dfxvideo/gpu.c @@ -1060,8 +1060,8 @@ long CALLBACK GPUdmaChain(uint32_t * baseAddrL, uint32_t addr) if(count>0) GPUwriteDataMem(&baseAddrL[dmaMem>>2],count); addr = GETLE32(&baseAddrL[addr>>2])&0xffffff; - } - while (addr != 0xffffff); + } while (!(addr & 0x800000)); // contrary to some documentation, the end-of-linked-list marker is not actually 0xFF'FFFF + // any pointer with bit 23 set will do. GPUIsIdle; diff --git a/plugins/gpu-gles/gpuPlugin.c b/plugins/gpu-gles/gpuPlugin.c index 60570ace..6d3ca14c 100644 --- a/plugins/gpu-gles/gpuPlugin.c +++ b/plugins/gpu-gles/gpuPlugin.c @@ -2205,9 +2205,8 @@ do if(count>0) GPUwriteDataMem(&baseAddrL[dmaMem>>2],count); addr = baseAddrL[addr>>2]&0xffffff; - } -while (addr != 0xffffff); - + } while (!(addr & 0x800000)); // contrary to some documentation, the end-of-linked-list marker is not actually 0xFF'FFFF + // any pointer with bit 23 set will do. GPUIsIdle; return 0; -- 2.39.5